Re: pselect/etc semantics

2019-05-30 Thread Eric Wong
"Eric W. Biederman" wrote: > Frankly the only reason this appears to be worth touching is that we > have a userspace regression. Otherwise I would call the current > behavior more correct and desirable than ignoring the signal longer. > > If I am reading sitaution properly I suggest we go back

Re: pselect/etc semantics (Was: [PATCH v2] signal: Adjust error codes according to restore_user_sigmask())

2019-05-30 Thread Arnd Bergmann
On Thu, May 30, 2019 at 4:41 PM Oleg Nesterov wrote: > On 05/30, Arnd Bergmann wrote: > Plus every file touched by this patch asks for more cleanups. Say, do_poll() > should return -ERESTARTNOHAND, not -EINTR, after that we can remove the ugly > EINTR->ERESTARTNOHAND in its callers. And more. > >

Re: pselect/etc semantics

2019-05-30 Thread Arnd Bergmann
On Thu, May 30, 2019 at 3:54 AM Eric W. Biederman wrote: > Arnd Bergmann writes: > > On Wed, May 29, 2019 at 6:12 PM Oleg Nesterov wrote: > > > > Not sure about the order of the cleanups, but probably something like > > this would work: > > > > 1. fix the race (to be backported) > > 2. unify

Re: pselect/etc semantics

2019-05-30 Thread Eric W. Biederman
Oleg Nesterov writes: > On 05/30, Eric W. Biederman wrote: >> >> ebied...@xmission.com (Eric W. Biederman) writes: >> >> > Which means I believe we have a semantically valid change in behavior >> > that is causing a regression. >> >> I haven't made a survey of all of the functions yet but >>

Re: pselect/etc semantics

2019-05-30 Thread Deepa Dinamani
behavior > >> that is causing a regression. > > > > I haven't made a survey of all of the functions yet but > > fucntions return -ENORESTARTNOHAND will never return -EINTR and are > > immune from this problem. > > > > AKA pselect is fine. While epoll_pwait ca

RE: pselect/etc semantics

2019-05-30 Thread David Laight
From: Eric W. Biederman > Sent: 30 May 2019 16:38 > ebied...@xmission.com (Eric W. Biederman) writes: > > > Which means I believe we have a semantically valid change in behavior > > that is causing a regression. > > I haven't made a survey of all of the functions yet but > fucntions return

Re: pselect/etc semantics

2019-05-30 Thread Oleg Nesterov
On 05/30, David Laight wrote: > > 4) As an optimisation a signal that arrives after the timer >expires, but before the mask is restored can be 'deemed' >to have happened before the timeout expired and EINTR >returned. This is what pselect/ppoll already does. Oleg.

Re: pselect/etc semantics

2019-05-30 Thread Oleg Nesterov
On 05/30, Eric W. Biederman wrote: > > ebied...@xmission.com (Eric W. Biederman) writes: > > > Which means I believe we have a semantically valid change in behavior > > that is causing a regression. > > I haven't made a survey of all of the functions yet but > fucntions return -ENORESTARTNOHAND

Re: pselect/etc semantics

2019-05-30 Thread Oleg Nesterov
results in a return value of 0, 0 or success > and a signal > delivered, where previously that did not happen. Yes. And to me this doesn't look right. OK, OK, probably this is because I never read the docs, only the source code in fs/select.c. But to me pselect() should either return succes

Re: pselect/etc semantics

2019-05-30 Thread Deepa Dinamani
ons yet but > fucntions return -ENORESTARTNOHAND will never return -EINTR and are > immune from this problem. > > AKA pselect is fine. While epoll_pwait can be affected. This was my understanding as well. > Has anyone contacted Omar Kilani to see if that is his issue? > ht

Re: pselect/etc semantics

2019-05-30 Thread Eric W. Biederman
e from this problem. AKA pselect is fine. While epoll_pwait can be affected. Has anyone contacted Omar Kilani to see if that is his issue? https://lore.kernel.org/lkml/CA+8F9hicnF=kvjXPZFQy=pa2hjus3js+g9vswfhnqqynpmh...@mail.gmail.com/ So far the only regression report I am seeing is from Eric Won

RE: pselect/etc semantics

2019-05-30 Thread David Laight
ask changing system call > can be defined. The naive way and by reading posix. I will pick > on pselect. > > The naive way: > int pselect(int nfds, fd_set *readfds, fd_set *writefds, > fd_set *exceptfds, const struct timespec *timeout, >

Re: pselect/etc semantics (Was: [PATCH v2] signal: Adjust error codes according to restore_user_sigmask())

2019-05-30 Thread Oleg Nesterov
On 05/30, Arnd Bergmann wrote: > > I think this is a nice simplification, but it would help not to mix up the > minimal regression fix with the rewrite of those functions. Yes, yes, agreed. Plus every file touched by this patch asks for more cleanups. Say, do_poll() should return

Re: pselect/etc semantics

2019-05-30 Thread Eric W. Biederman
Eric Wong writes: > Agreed... I believe cmogstored has always had a bug in the way > it uses epoll_pwait because it failed to check interrupts if: > > a) an FD is ready + interrupt > b) epoll_pwait returns 0 on interrupt > > The bug remains in userspace for a), which I will fix by adding > an

Re: pselect/etc semantics

2019-05-30 Thread Eric W. Biederman
this thread correctly the core issue is that ther is a program that used to work and that fails now. The question is why. There are two ways the semantics for a sigmask changing system call can be defined. The naive way and by reading posix. I will pick on pselect. The naive way: int pselect(int

RE: pselect/etc semantics (Was: [PATCH v2] signal: Adjust error codes according to restore_user_sigmask())

2019-05-30 Thread David Laight
From: Eric Wong > Sent: 29 May 2019 19:50 ... > > Personally I think that is wrong. > > Given code like the above that has: > > while (!interrupted) { > > pselect(..., ); > > // process available data > >

Re: pselect/etc semantics

2019-05-29 Thread Eric W. Biederman
Arnd Bergmann writes: > On Wed, May 29, 2019 at 6:12 PM Oleg Nesterov wrote: >> >> Al, Linus, Eric, please help. >> >> The previous discussion was very confusing, we simply can not understand each >> other. >> >> To me everything looks very simple and clear, but perhaps I missed something >>

Re: pselect/etc semantics (Was: [PATCH v2] signal: Adjust error codes according to restore_user_sigmask())

2019-05-29 Thread Arnd Bergmann
On Wed, May 29, 2019 at 6:12 PM Oleg Nesterov wrote: > > Al, Linus, Eric, please help. > > The previous discussion was very confusing, we simply can not understand each > other. > > To me everything looks very simple and clear, but perhaps I missed something > obvious? Please correct me. Thanks

Re: pselect/etc semantics (Was: [PATCH v2] signal: Adjust error codes according to restore_user_sigmask())

2019-05-29 Thread Eric Wong
interrupted = 1; > > } > > > > int main(void) > > { > > sigset_t sigint, empty; > > > > sigemptyset(); > > sigaddset(, SIGINT); > > sigprocmask(SIG_BLOCK, , NULL);

Re: pselect/etc semantics (Was: [PATCH v2] signal: Adjust error codes according to restore_user_sigmask())

2019-05-29 Thread Deepa Dinamani
sigset_t sigint, empty; > > sigemptyset(); > sigaddset(, SIGINT); > sigprocmask(SIG_BLOCK, , NULL); > > signal(SIGINT, sigint_handler); > > sigemptyset();// so pselect() unblocks SIGINT > >

Re: pselect/etc semantics (Was: [PATCH v2] signal: Adjust error codes according to restore_user_sigmask())

2019-05-29 Thread Deepa Dinamani
ed = 1; > } > > int main(void) > { > sigset_t sigint, empty; > > sigemptyset(); > sigaddset(, SIGINT); > sigprocmask(SIG_BLOCK, , NULL); > > signal(SIGINT, sigint_handler); > >

RE: pselect/etc semantics (Was: [PATCH v2] signal: Adjust error codes according to restore_user_sigmask())

2019-05-29 Thread David Laight
ty; > > sigemptyset(); > sigaddset(, SIGINT); > sigprocmask(SIG_BLOCK, , NULL); > > signal(SIGINT, sigint_handler); > > sigemptyset();// so pselect() unblocks SIGINT > > ret =

pselect/etc semantics (Was: [PATCH v2] signal: Adjust error codes according to restore_user_sigmask())

2019-05-29 Thread Oleg Nesterov
); signal(SIGINT, sigint_handler); sigemptyset();// so pselect() unblocks SIGINT ret = pselect(..., ); if (ret >= 0) // sucess or timeout assert(!interrupted); if (interrup

Re: [PATCH v4 0/5] y2038: Make ppoll, io_pgetevents and pselect y2038 safe

2018-12-06 Thread Arnd Bergmann
On 9/20/18, Deepa Dinamani wrote: > The series transitions the ppoll, io_getevents, and pselect syscalls > to be y2038 safe. > > This is part of the work proceeding for syscalls for y2038. > It is based on the series [1] from Arnd Bergmann. > > The overview of the se

[RFC PATCH 2/3] use hrtimer in select and pselect

2007-03-04 Thread Arnd Bergmann
This changes the select and pselect system calls to use the new schedule_timeout_hr function. Since many applications use the select function instead of nanosleep, this provides a higher resolution sleep to them. BUG: the same needs to be done for the compat syscalls, the current patch breaks

[RFC PATCH 2/3] use hrtimer in select and pselect

2007-03-04 Thread Arnd Bergmann
This changes the select and pselect system calls to use the new schedule_timeout_hr function. Since many applications use the select function instead of nanosleep, this provides a higher resolution sleep to them. BUG: the same needs to be done for the compat syscalls, the current patch breaks

Re: Add pselect, ppoll system calls.

2005-08-26 Thread Michael Kerrisk
David, > On Fri, 2005-08-05 at 14:49 +0200, Michael Kerrisk wrote: > > If I change your program to do something like the above, I also > > do not see a message from the handler -- i.e., it is not being > > called, and I'm pretty sure it should be. > > Hm, yes. What happens is we come back out of

Re: Add pselect, ppoll system calls.

2005-08-26 Thread Michael Kerrisk
David, On Fri, 2005-08-05 at 14:49 +0200, Michael Kerrisk wrote: If I change your program to do something like the above, I also do not see a message from the handler -- i.e., it is not being called, and I'm pretty sure it should be. Hm, yes. What happens is we come back out of the

Re: Add pselect, ppoll system calls.

2005-08-24 Thread Ulrich Drepper
is necessary that the handler is called. This is the purpose of these interfaces. If this means more complexity is needed then this is how the cookie crumbles. One use case for pselect would be something like this: int got_signal; void sigint_handler(int sig) { got_signal = 1; } { ..

Re: Add pselect, ppoll system calls.

2005-08-24 Thread Ulrich Drepper
that the handler is called. This is the purpose of these interfaces. If this means more complexity is needed then this is how the cookie crumbles. One use case for pselect would be something like this: int got_signal; void sigint_handler(int sig) { got_signal = 1; } { ... while (1

Re: pselect() modifying timeout

2005-08-08 Thread Alan Cox
On Gwe, 2005-08-05 at 12:42 +0200, Michael Kerrisk wrote: > 1. POSIX made the behaviour of pselect() explicit -- the >timeout must not be modified. The idea was to avoid the >vagueness of the select() specification; it had to be vague >because of existing imp

Re: pselect() modifying timeout

2005-08-08 Thread Alan Cox
On Gwe, 2005-08-05 at 12:42 +0200, Michael Kerrisk wrote: 1. POSIX made the behaviour of pselect() explicit -- the timeout must not be modified. The idea was to avoid the vagueness of the select() specification; it had to be vague because of existing implementations. By contrast

Re: pselect() modifying timeout

2005-08-05 Thread Michael Kerrisk
> Michael Kerrisk wrote: > > Please consider making Linux pselect() conform to POSIX on this > > point. > > There is no question the implementation will conform. But this not > dependent on changing the syscall interface. We deliberately decided to > not r

Re: pselect() modifying timeout

2005-08-05 Thread Ulrich Drepper
Michael Kerrisk wrote: > Please consider making Linux pselect() conform to POSIX on this > point. There is no question the implementation will conform. But this not dependent on changing the syscall interface. We deliberately decided to not require the kernel interface to be differen

Re: Add pselect, ppoll system calls.

2005-08-05 Thread Michael Kerrisk
> From: David Woodhouse <[EMAIL PROTECTED]> > Subject: Re: Add pselect, ppoll system calls. > Date: Wed, 15 Jun 2005 12:36:54 +0100 > > On Mon, 2005-06-13 at 08:38 -0700, Ulrich Drepper wrote: > > > Eep -- I hadn't noticed that difference. Will update patch > &g

pselect() modifying timeout

2005-08-05 Thread Michael Kerrisk
Hello David, By the way, looking at the comments to the last version of the pselect()/ppoll()patch, I see that the treatment of the timeout argument is made dependent on the personality. http://marc.theaimsgroup.com/?l=linux-kernel=111883591220436=2 I'm not sure that this is a good idea; my

pselect() modifying timeout

2005-08-05 Thread Michael Kerrisk
Hello David, By the way, looking at the comments to the last version of the pselect()/ppoll()patch, I see that the treatment of the timeout argument is made dependent on the personality. http://marc.theaimsgroup.com/?l=linux-kernelm=111883591220436w=2 I'm not sure that this is a good idea

Re: Add pselect, ppoll system calls.

2005-08-05 Thread Michael Kerrisk
From: David Woodhouse [EMAIL PROTECTED] Subject: Re: Add pselect, ppoll system calls. Date: Wed, 15 Jun 2005 12:36:54 +0100 On Mon, 2005-06-13 at 08:38 -0700, Ulrich Drepper wrote: Eep -- I hadn't noticed that difference. Will update patch accordingly. And change [the poll timeout

Re: pselect() modifying timeout

2005-08-05 Thread Ulrich Drepper
Michael Kerrisk wrote: Please consider making Linux pselect() conform to POSIX on this point. There is no question the implementation will conform. But this not dependent on changing the syscall interface. We deliberately decided to not require the kernel interface to be different from

Re: pselect() modifying timeout

2005-08-05 Thread Michael Kerrisk
Michael Kerrisk wrote: Please consider making Linux pselect() conform to POSIX on this point. There is no question the implementation will conform. But this not dependent on changing the syscall interface. We deliberately decided to not require the kernel interface to be different

Re: pselect

2001-03-19 Thread Jens-Uwe Mager
>For people who prefer programming above documenting, >here is a simple small thing to do: > >POSIX.1g and Austin document a pselect() call intended to >remove the race condition that is present when one wants >to wait on either a signal or some file descriptor. >(See also

Re: pselect

2001-03-19 Thread Jens-Uwe Mager
For people who prefer programming above documenting, here is a simple small thing to do: POSIX.1g and Austin document a pselect() call intended to remove the race condition that is present when one wants to wait on either a signal or some file descriptor. (See also Stevens, Unix Network

pselect

2001-03-18 Thread Andries . Brouwer
For people who prefer programming above documenting, here is a simple small thing to do: POSIX.1g and Austin document a pselect() call intended to remove the race condition that is present when one wants to wait on either a signal or some file descriptor. (See also Stevens, Unix Network

pselect

2001-03-18 Thread Andries . Brouwer
For people who prefer programming above documenting, here is a simple small thing to do: POSIX.1g and Austin document a pselect() call intended to remove the race condition that is present when one wants to wait on either a signal or some file descriptor. (See also Stevens, Unix Network