From: Chris Wright <chris@wirex.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Chris Wright <chris@wirex.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sys_capget should use current if the pid argument is 0
Date: Tue, 19 Nov 2002 16:55:56 -0800 [thread overview]
Message-ID: <20021119165556.A5806@figure1.int.wirex.com> (raw)
In-Reply-To: <20021119211453.GA20562@nevyn.them.org>; from dan@debian.org on Tue, Nov 19, 2002 at 04:14:53PM -0500
* Daniel Jacobowitz (dan@debian.org) wrote:
> On Fri, Oct 11, 2002 at 07:58:46PM -0700, Linus Torvalds wrote:
> >
> > On Thu, 10 Oct 2002, Chris Wright wrote:
> > >
> > > The patch below fixes my oversight. The locking is left the way it was,
> > > and just the pid 0 part is fixed as well as the duplicate code removed.
> >
> > All right, call me stupid, but twhere is the "duplication" in the code you
> > removed?
> >
> > I see the "security/capability.c" thing, yes, but I also look at
> > "security/dummy.c", and it appears that at least for that case nobody
> > would ever initialize the capabilities that we return to user space at
> > all.
> >
> > So there's a bug somewhere there, and removing the duplication makes
> > things worse (admittedly for a case which isn't enabled in the regular
> > kernel, but still..)
> >
> > So I'd ask you to have patience with me, and send a third patch that gets
> > this thing right too..
>
> Since this is still broken a month later... I don't know what to do
> about the "duplication" question, but I'll leave that to Chris. This
> is the uncontroversial portion of Chris's patch; its affect is to
> change my zsh shell prompt back to a '%' as I'd expect.
Thanks Daniel. I've been using the patch below, which differs only
slightly from the one you posted (code style matches the same lookup in
sys_capset). I'll follow up with the patch that removes the duplicate
code.
[PATCH] sys_capget should use current if the pid argument is 0
===== kernel/capability.c 1.5 vs edited =====
--- 1.5/kernel/capability.c Sun Sep 15 12:19:29 2002
+++ edited/kernel/capability.c Tue Nov 19 15:57:15 2002
@@ -54,11 +54,14 @@
spin_lock(&task_capability_lock);
read_lock(&tasklist_lock);
- target = find_task_by_pid(pid);
- if (!target) {
- ret = -ESRCH;
- goto out;
- }
+ if (pid && pid != current->pid) {
+ target = find_task_by_pid(pid);
+ if (!target) {
+ ret = -ESRCH;
+ goto out;
+ }
+ } else
+ target = current;
data.permitted = cap_t(target->cap_permitted);
data.inheritable = cap_t(target->cap_inheritable);
next prev parent reply other threads:[~2002-11-20 0:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-10 0:15 [PATCH] 2.5.41 capget fix Chris Wright
2002-10-10 19:36 ` Linus Torvalds
2002-10-10 21:47 ` Chris Wright
2002-10-12 2:58 ` Linus Torvalds
2002-11-19 21:14 ` [PATCH] sys_capget should use current if the pid argument is 0 Daniel Jacobowitz
2002-11-20 0:55 ` Chris Wright [this message]
2002-11-20 2:49 ` [PATCH] remove duplicated assignment from sys_capget Chris Wright
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=20021119165556.A5806@figure1.int.wirex.com \
--to=chris@wirex.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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