public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: george anzinger <george@mvista.com>
To: Andrew Morton <akpm@digeo.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	chandra.smurthy@wipro.com
Subject: Re: [BUG] problem with timer_create(2) for SIGEV_NONE ??
Date: Wed, 07 May 2003 08:21:08 -0700	[thread overview]
Message-ID: <3EB92464.3050306@mvista.com> (raw)
In-Reply-To: <E935C89216CC5D4AB77D89B253ADED2A92257F@blr-m2-msg.wipro.com>

[-- Attachment #1: Type: text/plain, Size: 1114 bytes --]

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



[-- Attachment #2: hrtimers-fix-signone-2.5.69-1.0.patch --]
[-- Type: text/plain, Size: 507 bytes --]

--- 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;
 }
 



      parent reply	other threads:[~2003-05-07 15:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-05 13:13 [BUG] problem with timer_create(2) for SIGEV_NONE ?? Aniruddha M Marathe
2003-05-05 23:35 ` george anzinger
2003-05-07 15:21 ` george anzinger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3EB92464.3050306@mvista.com \
    --to=george@mvista.com \
    --cc=akpm@digeo.com \
    --cc=chandra.smurthy@wipro.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox