lkml.org 
[lkml]   [2004]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Periodic posix timer support broke between 2.6.9-rc1 and 2.6.9-rc1-bk17
From
Date
> I ran some test programs and discovered that the periodic timer support
> is broken. The timer is triggered once and then never again. Single shot
> timers work fine. 2.6.9-rc1 is fine. The first kernel that I tested where
> I noticed the breakage was 2.6.9-rc1-bk17. 2.6.9-rc2 and following all
> cannot do periodic timer signals.
>
> I looked through the changelog but I cannot see anything that would cause
> the problem. Roland's patch surely could not have done this.
>
> Will try to track this down further, time permitting...

I took a bit of a look at this, and it looks like some things changed
with the introduction of the flexible mmap in 2.6.9-rc1-bk1.

If you run the program below it will work, doing as expected. Now
comment out the the line "memset(&sa, 0, sizeof(struct sigaction));"
and program won't run as expected.

Now do "echo -n 1 > /proc/sys/vm/legacy_va_layout" and run the same
program again (the one with memset commented out).

Turning on signal debugging tells us that with legacy_va_layout=0
"SIG deliver (a.out:415): sp=bffff6c0 pc=08048434 ra=00000000"
where ra is the 8-byte instruction that's supposed to get us back to
sys_sigreturn().

Me thinks someone somewhere is using some of the bits that we
"accidently" pass via sa.sa_flags by not setting it to 0, the regular
flags don't seem to show this behaviour, and I couldn't see any real
checking of the passed value of sa.sa_flags.

---------------------------------------------------------

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/time.h>

void sighandler(int signal)
{
printf("hihi\n");
}

int main()
{
struct itimerval timeval;
struct sigaction sa;

memset(&timeval, 0, sizeof(struct timeval));
memset(&sa, 0, sizeof(struct sigaction));

sa.sa_handler = &sighandler;
sigfillset(&sa.sa_mask);

sigaction(SIGALRM, &sa, NULL);

timeval.it_interval.tv_sec = 2;
timeval.it_interval.tv_usec = 0;

timeval.it_value.tv_sec = 2;
timeval.it_value.tv_usec = 0;

if (setitimer(ITIMER_REAL, &timeval, NULL))
printf("Nooo!\n");

for(;;)
;

return 0;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:07    [W:0.129 / U:1.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site