Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-07 Thread Jeff Dike
On Thu, Jun 07, 2007 at 01:29:23PM +1000, Benjamin Herrenschmidt wrote: > But you use ptrace and don't steal signals with dequeue_signal() on a > live other task, which is ok. True. However, with an SMP UML running a threaded app (which is also threads on the host), if the thread on one CPU gets

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-07 Thread Jeff Dike
On Thu, Jun 07, 2007 at 01:29:23PM +1000, Benjamin Herrenschmidt wrote: But you use ptrace and don't steal signals with dequeue_signal() on a live other task, which is ok. True. However, with an SMP UML running a threaded app (which is also threads on the host), if the thread on one CPU gets a

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-06 Thread Benjamin Herrenschmidt
On Wed, 2007-06-06 at 22:20 -0400, Jeff Dike wrote: > On Thu, Jun 07, 2007 at 08:43:42AM +1000, Paul Mackerras wrote: > > What Ben was talking about was stealing a synchronous SEGV from a task > > without stopping it, and as Ben says that makes no sense. > > Intercepting a signal and stopping the

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-06 Thread Benjamin Herrenschmidt
On Wed, 2007-06-06 at 08:52 -0400, Jeff Dike wrote: > On Wed, Jun 06, 2007 at 12:50:04PM +1000, Benjamin Herrenschmidt wrote: > > Yeah, synchronous signals should probably never be delivered to another > > process, even via signalfd. There's no point delivering a SEGV to > > somebody else :-) > >

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-06 Thread Jeff Dike
On Thu, Jun 07, 2007 at 08:43:42AM +1000, Paul Mackerras wrote: > What Ben was talking about was stealing a synchronous SEGV from a task > without stopping it, and as Ben says that makes no sense. > Intercepting a signal and stopping the task is reasonable, and that is > what ptrace does, and I

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-06 Thread Paul Mackerras
Jeff Dike writes: > On Wed, Jun 06, 2007 at 12:50:04PM +1000, Benjamin Herrenschmidt wrote: > > Yeah, synchronous signals should probably never be delivered to another > > process, even via signalfd. There's no point delivering a SEGV to > > somebody else :-) > > Sure there is. UML does exactly

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-06 Thread Davide Libenzi
On Wed, 6 Jun 2007, Benjamin Herrenschmidt wrote: > On Tue, 2007-06-05 at 20:37 -0700, Linus Torvalds wrote: > > > I agree that it would be a limitation, but it would be a sane one. > > > > How about we try to live with that limitation, if only to avoid the issue > > of having the private

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-06 Thread Jeff Dike
On Wed, Jun 06, 2007 at 12:50:04PM +1000, Benjamin Herrenschmidt wrote: > Yeah, synchronous signals should probably never be delivered to another > process, even via signalfd. There's no point delivering a SEGV to > somebody else :-) Sure there is. UML does exactly that - intercepting child

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-06 Thread Benjamin Herrenschmidt
On Tue, 2007-06-05 at 20:37 -0700, Linus Torvalds wrote: > I agree that it would be a limitation, but it would be a sane one. > > How about we try to live with that limitation, if only to avoid the issue > of having the private signals being stolen by anybody else. If we actually > find a

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-06 Thread Benjamin Herrenschmidt
On Tue, 2007-06-05 at 20:37 -0700, Linus Torvalds wrote: I agree that it would be a limitation, but it would be a sane one. How about we try to live with that limitation, if only to avoid the issue of having the private signals being stolen by anybody else. If we actually find a real-live

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-06 Thread Jeff Dike
On Wed, Jun 06, 2007 at 12:50:04PM +1000, Benjamin Herrenschmidt wrote: Yeah, synchronous signals should probably never be delivered to another process, even via signalfd. There's no point delivering a SEGV to somebody else :-) Sure there is. UML does exactly that - intercepting child signals

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-06 Thread Davide Libenzi
On Wed, 6 Jun 2007, Benjamin Herrenschmidt wrote: On Tue, 2007-06-05 at 20:37 -0700, Linus Torvalds wrote: I agree that it would be a limitation, but it would be a sane one. How about we try to live with that limitation, if only to avoid the issue of having the private signals being

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-06 Thread Paul Mackerras
Jeff Dike writes: On Wed, Jun 06, 2007 at 12:50:04PM +1000, Benjamin Herrenschmidt wrote: Yeah, synchronous signals should probably never be delivered to another process, even via signalfd. There's no point delivering a SEGV to somebody else :-) Sure there is. UML does exactly that -

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-06 Thread Jeff Dike
On Thu, Jun 07, 2007 at 08:43:42AM +1000, Paul Mackerras wrote: What Ben was talking about was stealing a synchronous SEGV from a task without stopping it, and as Ben says that makes no sense. Intercepting a signal and stopping the task is reasonable, and that is what ptrace does, and I assume

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-06 Thread Benjamin Herrenschmidt
On Wed, 2007-06-06 at 08:52 -0400, Jeff Dike wrote: On Wed, Jun 06, 2007 at 12:50:04PM +1000, Benjamin Herrenschmidt wrote: Yeah, synchronous signals should probably never be delivered to another process, even via signalfd. There's no point delivering a SEGV to somebody else :-) Sure

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-06 Thread Benjamin Herrenschmidt
On Wed, 2007-06-06 at 22:20 -0400, Jeff Dike wrote: On Thu, Jun 07, 2007 at 08:43:42AM +1000, Paul Mackerras wrote: What Ben was talking about was stealing a synchronous SEGV from a task without stopping it, and as Ben says that makes no sense. Intercepting a signal and stopping the task is

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-05 Thread Davide Libenzi
On Tue, 5 Jun 2007, Linus Torvalds wrote: > On Tue, 5 Jun 2007, Davide Libenzi wrote: > > On Wed, 6 Jun 2007, Benjamin Herrenschmidt wrote: > > > > > > Yeah, synchronous signals should probably never be delivered to another > > > process, even via signalfd. There's no point delivering a SEGV to

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-05 Thread Benjamin Herrenschmidt
> a) Process-global signals can be read by any thread (inside or outside > of the process receiving the signal). > > Rationale: > This should always work, so there's no reason to limit it. I agree, with an appropriate fix to recalc_sigpending_tsk() to only clear TIF_SIGPENDING if tsk ==

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-05 Thread Nicholas Miell
On Tue, 2007-06-05 at 20:37 -0700, Linus Torvalds wrote: > > On Tue, 5 Jun 2007, Davide Libenzi wrote: > > On Wed, 6 Jun 2007, Benjamin Herrenschmidt wrote: > > > > > > Yeah, synchronous signals should probably never be delivered to another > > > process, even via signalfd. There's no point

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-05 Thread Benjamin Herrenschmidt
> That'd be a limitation. Like you can choose to not handle SEGV, you can > choose to have a signalfd listening to it. Of course, not with the > intention to *handle* the signal, but with a notification intent. Hrm.. either you handle it or you are dead ... I fail to see how signalfd can sneak

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-05 Thread Linus Torvalds
On Tue, 5 Jun 2007, Davide Libenzi wrote: > On Wed, 6 Jun 2007, Benjamin Herrenschmidt wrote: > > > > Yeah, synchronous signals should probably never be delivered to another > > process, even via signalfd. There's no point delivering a SEGV to > > somebody else :-) > > That'd be a limitation.

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-05 Thread Davide Libenzi
On Wed, 6 Jun 2007, Benjamin Herrenschmidt wrote: > On Tue, 2007-06-05 at 17:58 -0700, Nicholas Miell wrote: > > > > "At the time of generation, a determination shall be made whether the > > signal has been generated for the process or for a specific thread > > within the process. Signals which

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-05 Thread Benjamin Herrenschmidt
On Tue, 2007-06-05 at 17:58 -0700, Nicholas Miell wrote: > > "At the time of generation, a determination shall be made whether the > signal has been generated for the process or for a specific thread > within the process. Signals which are generated by some action > attributable to a particular

signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-05 Thread Nicholas Miell
On Tue, 2007-06-05 at 17:37 -0700, Davide Libenzi wrote: > On Tue, 5 Jun 2007, Nicholas Miell wrote: > > > On Tue, 2007-06-05 at 17:11 -0700, Davide Libenzi wrote: > > > On Tue, 5 Jun 2007, Nicholas Miell wrote: > > > > > > > Yes, that's certainly wrong, but that's an implementation issue. I was

signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-05 Thread Nicholas Miell
On Tue, 2007-06-05 at 17:37 -0700, Davide Libenzi wrote: On Tue, 5 Jun 2007, Nicholas Miell wrote: On Tue, 2007-06-05 at 17:11 -0700, Davide Libenzi wrote: On Tue, 5 Jun 2007, Nicholas Miell wrote: Yes, that's certainly wrong, but that's an implementation issue. I was more

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-05 Thread Benjamin Herrenschmidt
On Tue, 2007-06-05 at 17:58 -0700, Nicholas Miell wrote: At the time of generation, a determination shall be made whether the signal has been generated for the process or for a specific thread within the process. Signals which are generated by some action attributable to a particular thread,

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-05 Thread Davide Libenzi
On Wed, 6 Jun 2007, Benjamin Herrenschmidt wrote: On Tue, 2007-06-05 at 17:58 -0700, Nicholas Miell wrote: At the time of generation, a determination shall be made whether the signal has been generated for the process or for a specific thread within the process. Signals which are

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-05 Thread Linus Torvalds
On Tue, 5 Jun 2007, Davide Libenzi wrote: On Wed, 6 Jun 2007, Benjamin Herrenschmidt wrote: Yeah, synchronous signals should probably never be delivered to another process, even via signalfd. There's no point delivering a SEGV to somebody else :-) That'd be a limitation. Like you

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-05 Thread Benjamin Herrenschmidt
That'd be a limitation. Like you can choose to not handle SEGV, you can choose to have a signalfd listening to it. Of course, not with the intention to *handle* the signal, but with a notification intent. Hrm.. either you handle it or you are dead ... I fail to see how signalfd can sneak in

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-05 Thread Nicholas Miell
On Tue, 2007-06-05 at 20:37 -0700, Linus Torvalds wrote: On Tue, 5 Jun 2007, Davide Libenzi wrote: On Wed, 6 Jun 2007, Benjamin Herrenschmidt wrote: Yeah, synchronous signals should probably never be delivered to another process, even via signalfd. There's no point delivering a SEGV

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-05 Thread Benjamin Herrenschmidt
a) Process-global signals can be read by any thread (inside or outside of the process receiving the signal). Rationale: This should always work, so there's no reason to limit it. I agree, with an appropriate fix to recalc_sigpending_tsk() to only clear TIF_SIGPENDING if tsk ==

Re: signalfd API issues (was Re: [PATCH/RFC] signal races/bugs, losing TIF_SIGPENDING and other woes)

2007-06-05 Thread Davide Libenzi
On Tue, 5 Jun 2007, Linus Torvalds wrote: On Tue, 5 Jun 2007, Davide Libenzi wrote: On Wed, 6 Jun 2007, Benjamin Herrenschmidt wrote: Yeah, synchronous signals should probably never be delivered to another process, even via signalfd. There's no point delivering a SEGV to somebody