From: Jeff Dike <jdike@karaya.com>
To: James Morris <jmorris@intercode.com.au>
Cc: Alan Cox <alan@redhat.com>, "David S. Miller" <davem@redhat.com>,
kuznet@ms2.inr.ac.ru, Andi Kleen <ak@muc.de>,
linux-kernel@vger.kernel.org, Matthew Wilcox <willy@debian.org>
Subject: Re: [PATCH][RFC] sigurg/sigio cleanup for 2.5.31
Date: Fri, 16 Aug 2002 11:25:54 -0500 [thread overview]
Message-ID: <200208161625.LAA02494@ccure.karaya.com> (raw)
In-Reply-To: Your message of "Fri, 16 Aug 2002 03:16:57 +1000." <Mutt.LNX.4.44.0208160302100.28909-100000@blackbird.intercode.com.au>
jmorris@intercode.com.au said:
> o Fixed fowner race (lockless technique suggested by Alan Cox).
This looks broken to me.
+static void f_modown(struct file *filp, unsigned long pid,
+ uid_t uid, uid_t euid)
+{
+ filp->f_owner.pid = PID_INVALID;
+ wmb();
+ filp->f_owner.uid = uid;
+ filp->f_owner.euid = euid;
+ wmb();
+ filp->f_owner.pid = pid;
+}
@@ -469,6 +491,9 @@
struct task_struct * p;
int pid = fown->pid;
+ if (!pid || pid == PID_INVALID)
+ return;
+
This introduces a window within which SIGIO will be dropped. As it stands,
this will break UML. Lost SIGIOs will cause UML hangs.
If you're determined to avoid spinlocks, why not do something like this:
+ if (!pid)
+ return;
+ while(fown->pid == PID_INVALID) ;
maybe with a cpu_relax() in the loop.
But that starts looking a lot like a spinlock.
Also, shouldn't there be a capable(CAP_KILL) in here rather than a check
for uid == 0?
+static inline int sigio_perm(struct task_struct *p,
+ struct fown_struct *fown)
+{
+ return ((fown->euid == 0) ||
+ (fown->euid == p->suid) || (fown->euid == p->uid) ||
+ (fown->uid == p->suid) || (fown->uid == p->uid));
+}
+
Jeff
next prev parent reply other threads:[~2002-08-16 15:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-15 17:16 [PATCH][RFC] sigurg/sigio cleanup for 2.5.31 James Morris
2002-08-15 19:04 ` Matthew Wilcox
2002-08-16 0:10 ` James Morris
2002-08-15 22:36 ` kuznet
2002-08-16 13:07 ` James Morris
2002-08-16 14:50 ` kuznet
2002-08-16 15:03 ` James Morris
2002-08-16 15:16 ` kuznet
2002-08-16 7:06 ` Chris Wright
2002-08-16 16:25 ` Jeff Dike [this message]
2002-08-16 15:59 ` James Morris
2002-08-17 18:16 ` Alan Cox
2002-08-18 0:57 ` James Morris
2002-08-19 1:16 ` James Morris
2002-08-17 2:58 ` [PATCH][RFC] sigurg/sigio cleanup for 2.5.31 [version 2] James Morris
2002-08-19 2:28 ` Jeff Dike
2002-08-19 1:37 ` James Morris
2002-08-19 10:14 ` [PATCH][RFC] sigurg/sigio cleanup for 2.5.31 [version 3] James Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200208161625.LAA02494@ccure.karaya.com \
--to=jdike@karaya.com \
--cc=ak@muc.de \
--cc=alan@redhat.com \
--cc=davem@redhat.com \
--cc=jmorris@intercode.com.au \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=willy@debian.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox