Bug 1352124 - segfault when using timer_create with SIGEV_THREAD and a low timer interval
Summary: segfault when using timer_create with SIGEV_THREAD and a low timer interval
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: glibc team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-01 16:53 UTC by Cristian Morales Vega
Modified: 2017-07-26 08:46 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-07-26 08:46:13 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Sourceware 20340 0 None None None 2019-01-11 21:07:47 UTC

Description Cristian Morales Vega 2016-07-01 16:53:28 UTC
Running this program results in a segfault.

---------------------------------
#include <signal.h>
#include <time.h>
#include <limits.h>
#include <unistd.h>
#include <stdio.h>

static void sigev_notify(union sigval arg) {}

int main() {
	timer_t timerid;
	static struct sigevent sevp = {
		.sigev_notify = SIGEV_THREAD,
		.sigev_notify_function = sigev_notify
	};

	timer_create(CLOCK_MONOTONIC, &sevp, &timerid);

	static const struct itimerspec new_value = {
		.it_interval = {
			.tv_sec = 0,
			.tv_nsec = 1000
		},
		.it_value = {
			.tv_sec = 0,
			.tv_nsec = 1000
		}
	};

	timer_settime(&timerid, 0, &new_value, NULL);

	sleep(UINT_MAX);
}
---------------------------------

The problem happens when SIGEV_THREAD is used with a too low timer interval. Seems to be related to the new thread stack allocation, but I didn't check in detail.

Maybe the problem can be reproduced without using timers, just using pthread_create() in a for loop in a pair of threads, but I have not tried.

Comment 1 Carlos O'Donell 2016-07-08 21:01:34 UTC
If you slow down the application even slightly with strace it works. Similarly with gdb when you slow it down to send thread creation events it works.

Filed upstream:
https://sourceware.org/bugzilla/show_bug.cgi?id=20340

This needs deeper investigation by the community.

Comment 2 Fedora End Of Life 2017-07-25 21:29:43 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 3 Cristian Morales Vega 2017-07-26 06:12:17 UTC
I'm actually unable to reproduce this in Fedora 26 (glibc 2.25).


Note You need to log in before you can comment on or make changes to this bug.