[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8736kf3rks.fsf@xmission.com>
Date: Wed, 12 Jun 2019 07:40:03 -0500
From: ebiederm@...ssion.com (Eric W. Biederman)
To: David Laight <David.Laight@...LAB.COM>
Cc: 'Oleg Nesterov' <oleg@...hat.com>,
'Andrew Morton' <akpm@...ux-foundation.org>,
'Deepa Dinamani' <deepa.kernel@...il.com>,
"'linux-kernel\@vger.kernel.org'" <linux-kernel@...r.kernel.org>,
"'arnd\@arndb.de'" <arnd@...db.de>,
"'dbueso\@suse.de'" <dbueso@...e.de>,
"'axboe\@kernel.dk'" <axboe@...nel.dk>,
"'dave\@stgolabs.net'" <dave@...olabs.net>,
"'e\@80x24.org'" <e@...24.org>,
"'jbaron\@akamai.com'" <jbaron@...mai.com>,
"'linux-fsdevel\@vger.kernel.org'" <linux-fsdevel@...r.kernel.org>,
"'linux-aio\@kvack.org'" <linux-aio@...ck.org>,
"'omar.kilani\@gmail.com'" <omar.kilani@...il.com>,
"'tglx\@linutronix.de'" <tglx@...utronix.de>,
'Al Viro' <viro@...IV.linux.org.uk>,
'Linus Torvalds' <torvalds@...ux-foundation.org>,
"'linux-arch\@vger.kernel.org'" <linux-arch@...r.kernel.org>
Subject: Re: [RFC PATCH 1/5] signal: Teach sigsuspend to use set_user_sigmask
David Laight <David.Laight@...LAB.COM> 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 no - after sigset(SIGALRM, SIG_IGN) I'd expect absolutely
> nothing to happen when kill(pid, SIGALRM) is called.
>
> However if I run:
>
> struct itimerval itimerval = {{1, 0}, {1, 0}};
> setitimer(ITIMER_REAL, &itimerval, NULL);
> sigset(SIGALRM, SIG_IGN);
>
> poll(0, 0, big_timeout);
>
> I see (with strace) poll() repeatedly returning ERESTART_RESTARTBLOCK
> and being restarted.
> Replacing poll() with pselect() returns ERESTARTNOHAND.
> (In both cases the timeout must be updated since the application
> does see the timeout.)
>
> I'm sure other unix kernels completely ignore signals set to SIG_IGN.
> So this restart dance just isn't needed.
We also ignore such signals except when the signal is blocked when it is
received.
We don't currently but it would be perfectly legitimate for
set_current_blocked to dequeue and drop signals that have become
unblocked whose handler is SIG_IGN.
The dance would still be needed for the rare case where TIF_SIGPENDING
gets set for a non-signal.
Dropping the signal while it is blocked if it's handler is SIG_IGN looks
like a bad idea.
Eric
Powered by blists - more mailing lists