[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090817174001.GA17535@redhat.com>
Date: Mon, 17 Aug 2009 19:40:01 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: stephane eranian <eranian@...glemail.com>
Cc: Jamie Lokier <jamie@...reable.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>, mingo@...e.hu,
linux-kernel@...r.kernel.org, tglx@...utronix.de,
robert.richter@....com, paulus@...ba.org, andi@...stfloor.org,
mpjohn@...ibm.com, cel@...ibm.com, cjashfor@...ibm.com,
mucci@...s.utk.edu, terpstra@...s.utk.edu,
perfmon2-devel@...ts.sourceforge.net, mtk.manpages@...glemail.com,
roland@...hat.com
Subject: Re: F_SETOWN_TID: F_SETOWN was thread-specific for a while
Forgot to show the patch,
On 08/17, Oleg Nesterov wrote:
>
> And again, this is even documented. The change is trivial but user-space
> visible, it may confuse the (stupid) app which uses SIGIO + SA_SIGINFO
> without F_SETSIG.
Oleg.
Personally I do not really think this change is good idea. (and in any
case it should be re-diffed on top of Peter's OWN_EX patch).
Btw. _in theory_, "case 0" is not right wrt security_file_send_sigiotask(sig).
I think we shouldn't worry.
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -431,6 +431,7 @@ static void send_sigio_to_task(struct ta
int fd,
int reason)
{
+ siginfo_t si;
/*
* F_SETSIG can change ->signum lockless in parallel, make
* sure we read it once and use the same value throughout.
@@ -439,33 +440,33 @@ static void send_sigio_to_task(struct ta
if (!sigio_perm(p, fown, signum))
return;
+ /* Queue a rt signal with the appropriate fd as its
+ value. We use SI_SIGIO as the source, not
+ SI_KERNEL, since kernel signals always get
+ delivered even if we can't queue. Failure to
+ queue in this case _should_ be reported; we fall
+ back to SIGIO in that case. --sct */
+ si.si_errno = 0;
+ si.si_fd = fd;
+ si.si_code = reason;
+ /* Make sure we are called with one of the POLL_*
+ reasons, otherwise we could leak kernel stack into
+ userspace. */
+ BUG_ON((reason & __SI_MASK) != __SI_POLL);
+ if (reason - POLL_IN >= NSIGPOLL)
+ si.si_band = ~0L;
+ else
+ si.si_band = band_table[reason - POLL_IN];
switch (signum) {
- siginfo_t si;
default:
- /* Queue a rt signal with the appropriate fd as its
- value. We use SI_SIGIO as the source, not
- SI_KERNEL, since kernel signals always get
- delivered even if we can't queue. Failure to
- queue in this case _should_ be reported; we fall
- back to SIGIO in that case. --sct */
si.si_signo = signum;
- si.si_errno = 0;
- si.si_code = reason;
- /* Make sure we are called with one of the POLL_*
- reasons, otherwise we could leak kernel stack into
- userspace. */
- BUG_ON((reason & __SI_MASK) != __SI_POLL);
- if (reason - POLL_IN >= NSIGPOLL)
- si.si_band = ~0L;
- else
- si.si_band = band_table[reason - POLL_IN];
- si.si_fd = fd;
if (!group_send_sig_info(signum, &si, p))
break;
/* fall-through: fall back on the old plain SIGIO signal */
case 0:
- group_send_sig_info(SIGIO, SEND_SIG_PRIV, p);
+ si.si_signo = SIGIO;
+ group_send_sig_info(SIGIO, &si, p);
}
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists