Re: [BUG] problem with timer_create(2) for SIGEV_NONE ??

From: george anzinger (george@mvista.com)
Date: Wed May 07 2003 - 10:21:08 EST


Attached is a fix.

Change log:

Fix the sig_notify filtering code for the timer_create system call to
properly check for the signal number being small enought, but only if
SIG_NONE is not specified.

Eliminate useless test of sig_notify.

george

Aniruddha M Marathe wrote:
> George,
>
> timer_create(2) fails in the case where sigev_notify parameter of
> sigevent structure is SIGEV_NONE. I believe this should not happen.
>
    ~snip~

>
> Line 377:
> SIGEV_NONE & ~(SIGEV_SIGNAL | SIGEV_THREAD_ID)
> = 001 & ~(000 | 100)
> = 001 & ~(100)
> = 001 & 011
> = 001
> therefore the if condition is true
> therefore the function returns NULL from line 378.
>
> Now in sys_timer_create() at line number 462
> Process = NULL
>
> Now at line 489
> if (!process) becomes TRUE
> and function returns with EINVAL
>
> Is my analysis right? If so can you comment on this behaviour?
>
Looks like a bug :( I feel a patch coming on...

-- 
George Anzinger   george@mvista.com
High-res-timers:  http://sourceforge.net/projects/high-res-timers/
Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml

--- linux-2.5.69-org/kernel/posix-timers.c 2003-05-05 15:34:09.000000000 -0700 +++ linux/kernel/posix-timers.c 2003-05-06 00:24:21.000000000 -0700 @@ -357,13 +357,10 @@ rtn->tgid != current->tgid)) return NULL; - if ((event->sigev_notify & SIGEV_SIGNAL & MIPS_SIGEV) && + if ((event->sigev_notify & ~SIGEV_NONE & MIPS_SIGEV) && ((unsigned) (event->sigev_signo > SIGRTMAX))) return NULL; - if (event->sigev_notify & ~(SIGEV_SIGNAL | SIGEV_THREAD_ID)) - return NULL; - return rtn; }

- 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/



This archive was generated by hypermail 2b29 : Wed May 07 2003 - 22:00:31 EST