RE: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-13 Thread David Laight
From: David Laight > Sent: 12 June 2019 15:18 > From: Oleg Nesterov > > Sent: 12 June 2019 14:46 > > On 06/11, David Laight wrote: > > > > > > If I have an application that has a loop with a pselect call that > > > enables SIGINT (without a handler) and, for whatever reason, > > > one of the fd is

Re: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-13 Thread Oleg Nesterov
On 06/13, David Laight wrote: > > I tested NetBSD last night. > pselect() always calls the signal handlers even when an fd is ready. > I'm beginning to suspect that this is the 'standards conforming' behaviour. May be. May be not. I have no idea. > > The ToG page for pselect() > > http://pubs.op

RE: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-13 Thread David Laight
From: Oleg Nesterov > Sent: 13 June 2019 10:43 > On 06/13, David Laight wrote: > > > > I tested NetBSD last night. > > pselect() always calls the signal handlers even when an fd is ready. > > I'm beginning to suspect that this is the 'standards conforming' behaviour. > > May be. May be not. I have

Re: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-13 Thread Oleg Nesterov
On 06/13, David Laight wrote: > > > And you interpret this as if a pending signal should be delivered in any > > case, > > even if pselect succeeds. Again, perhaps you are right, but to me this is > > simply > > undocumented. > > This text (from > http://pubs.opengroup.org/onlinepubs/9699919799/

Re: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-12 Thread Oleg Nesterov
On 06/12, Eric W. Biederman wrote: > David Laight writes: > > > From: Oleg Nesterov > >> Sent: 12 June 2019 14:46 > >> On 06/11, David Laight wrote: > >> > > >> > If I have an application that has a loop with a pselect call that > >> > enables SIGINT (without a handler) and, for whatever reason, >

Re: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-12 Thread Eric W. Biederman
David Laight writes: > From: Oleg Nesterov >> Sent: 12 June 2019 14:46 >> On 06/11, David Laight wrote: >> > >> > If I have an application that has a loop with a pselect call that >> > enables SIGINT (without a handler) and, for whatever reason, >> > one of the fd is always 'ready' then I'd expec

RE: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-12 Thread David Laight
From: Oleg Nesterov > Sent: 12 June 2019 14:46 > On 06/11, David Laight wrote: > > > > If I have an application that has a loop with a pselect call that > > enables SIGINT (without a handler) and, for whatever reason, > > one of the fd is always 'ready' then I'd expect a SIGINT > > (from ^C) to ter

Re: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-12 Thread Oleg Nesterov
On 06/11, David Laight wrote: > > If I have an application that has a loop with a pselect call that > enables SIGINT (without a handler) and, for whatever reason, > one of the fd is always 'ready' then I'd expect a SIGINT > (from ^C) to terminate the program. This was never true. Before Eric's pa

RE: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-12 Thread David Laight
From: Oleg Nesterov > Sent: 12 June 2019 14:35 > On 06/12, David Laight wrote: > > > > > > If I add a signal handler for SIGINT it is called when pselect() > > > > returns regardless of the return value. > > > > > > That is odd. Is this with Oleg's fix applied? > > > > No it is a 5.1.0-rc5 kernel

Re: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-12 Thread Oleg Nesterov
On 06/12, David Laight wrote: > > > > If I add a signal handler for SIGINT it is called when pselect() > > > returns regardless of the return value. > > > > That is odd. Is this with Oleg's fix applied? > > No it is a 5.1.0-rc5 kernel with no related local patches. > So it is the 'historic' behavi

RE: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-12 Thread David Laight
From: Eric W. Biederman > Sent: 12 June 2019 13:56 > David Laight writes: > > > From: David Laight > >> Sent: 11 June 2019 10:52 > > ... > >> If I have an application that has a loop with a pselect call that > >> enables SIGINT (without a handler) and, for whatever reason, > >> one of the fd is a

Re: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-12 Thread Eric W. Biederman
David Laight writes: > From: Oleg Nesterov [mailto:o...@redhat.com] >> Sent: 11 June 2019 19:56 >> On 06/10, Eric W. Biederman wrote: >> > >> > Personally I don't think anyone sane would intentionally depend on this >> > and I don't think there is a sufficiently reliable way to depend on this >>

Re: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-12 Thread Eric W. Biederman
David Laight writes: > From: David Laight >> Sent: 11 June 2019 10:52 > ... >> If I have an application that has a loop with a pselect call that >> enables SIGINT (without a handler) and, for whatever reason, >> one of the fd is always 'ready' then I'd expect a SIGINT >> (from ^C) to terminate th

Re: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-12 Thread Eric W. Biederman
David Laight writes: > From: David Laight >> Sent: 11 June 2019 10:52 > ... >> FWIW is ERESTARTNOHAND actually sane here? >> If I've used setitimer() to get SIGALARM generated every second I'd >> expect select() to return EINTR every second even if I don't >> have a SIGALARM handler? > > Actually

RE: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-12 Thread David Laight
From: Oleg Nesterov [mailto:o...@redhat.com] > Sent: 11 June 2019 19:56 > On 06/10, Eric W. Biederman wrote: > > > > Personally I don't think anyone sane would intentionally depend on this > > and I don't think there is a sufficiently reliable way to depend on this > > by accident that people would

Re: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-11 Thread Eric W. Biederman
Oleg Nesterov writes: > On 06/10, Eric W. Biederman wrote: >> >> Personally I don't think anyone sane would intentionally depend on this >> and I don't think there is a sufficiently reliable way to depend on this >> by accident that people would actually be depending on it. > > Agreed. > > As I s

Re: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-11 Thread Oleg Nesterov
On 06/10, Eric W. Biederman wrote: > > Personally I don't think anyone sane would intentionally depend on this > and I don't think there is a sufficiently reliable way to depend on this > by accident that people would actually be depending on it. Agreed. As I said I like these changes and I see n

RE: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-11 Thread David Laight
From: David Laight > Sent: 11 June 2019 10:52 ... > FWIW is ERESTARTNOHAND actually sane here? > If I've used setitimer() to get SIGALARM generated every second I'd > expect select() to return EINTR every second even if I don't > have a SIGALARM handler? Actually no - after sigset(SIGALRM, SIG_IGN

RE: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-11 Thread David Laight
From: David Laight > Sent: 11 June 2019 10:52 ... > If I have an application that has a loop with a pselect call that > enables SIGINT (without a handler) and, for whatever reason, > one of the fd is always 'ready' then I'd expect a SIGINT > (from ^C) to terminate the program. > > A quick test pro

RE: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-11 Thread David Laight
From: Eric W. Biederman > Sent: 10 June 2019 22:21 ... > > > > As for "remove saved_sigmask" I have some concerns... At least this > > means a user-visible change iiuc. Say, pselect unblocks a fatal signal. > > Say, SIGINT without a handler. Suppose SIGINT comes after set_sigmask(). > > > > Before

Re: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-10 Thread Eric W. Biederman
Oleg Nesterov writes: > On 06/07, Eric W. Biederman wrote: >> >> +static int set_sigmask(sigset_t *kmask) >> +{ >> +set_restore_sigmask(); >> +current->saved_sigmask = current->blocked; >> +set_current_blocked(kmask); >> + >> +return 0; >> +} > > I was going to do the same change

Re: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-10 Thread Oleg Nesterov
On 06/07, Eric W. Biederman wrote: > > +static int set_sigmask(sigset_t *kmask) > +{ > + set_restore_sigmask(); > + current->saved_sigmask = current->blocked; > + set_current_blocked(kmask); > + > + return 0; > +} I was going to do the same change except my version returns void ;)

Re: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-07 Thread Linus Torvalds
On Fri, Jun 7, 2019 at 2:41 PM Eric W. Biederman wrote: > > The sigsuspend system call overrides the signal mask just > like all of the other users of set_user_sigmask, so convert > it to use the same helpers. Me likey. Whole series looks good to me, but that's just from looking at the patches.

[RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask

2019-06-07 Thread Eric W. Biederman
The sigsuspend system call overrides the signal mask just like all of the other users of set_user_sigmask, so convert it to use the same helpers. Signed-off-by: "Eric W. Biederman" --- kernel/signal.c | 43 +++ 1 file changed, 19 insertions(+), 24 deleti