From: "Andrew G. Morgan" <morgan@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Shi Weihua <shiwh@cn.fujitsu.com>,
"Serge E. Hallyn" <serue@us.ibm.com>,
linux-security-module@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
jmorris@namei.org, ltp-list@lists.sourceforge.net
Subject: Re: [PATCH] fix sys_prctl() returned uninitialized value
Date: Wed, 21 May 2008 22:01:17 -0700 [thread overview]
Message-ID: <4834FE1D.10909@kernel.org> (raw)
In-Reply-To: <20080521203212.ddf05254.akpm@linux-foundation.org>
[-- Attachment #1: Type: text/plain, Size: 1564 bytes --]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Looks like I goofed here. :*(
Andrew Morton wrote:
| Oh dear, there are so many things wrong with this...
|
| - if security_task_prctl() is returning "fail" then why on earth
| isn't it setting the error code?
Its not failing, as Shi points out in their patch preamble, its simply
passing-through - security_task_prctl() doesn't implement the requested
PR_* code, so it expects something else (sys_prctl() proper) to set this
value.
| - cap_task_prctl() _does_ set `error' is if returns non-zero, so it
| must be one of the other myriad backend implementations of
| security_task_prctl() which is busted. Which one is it?
None of them. In this case, none of the security modules implement the
requested PRCTL.
| - With the above patch applied, sys_prctl() will return zero (ie:
| "success") even though it just failed.
Not sure what you mean here. The switch statement only sets a non-zero
value for error on a failing path. It assumes that the error value is
initially zero.
| - Can't we remove the sixth argument to security_task_prctl() and
| just return the result code like a sane function would do?
A bunch of capability related prctl()s will cease to work.
I'd prefer the attached patch, but I don't object to Shi's. In which case:
~ Acked-by: Andrew G. Morgan <morgan@kernel.org>
Cheers
Andrew
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
iD8DBQFINP4d+bHCR3gb8jsRAj9pAJ4g8WqzSOomhIirAdjt2nZ//mCAoACcDA+0
EKUYQcvgTgbPig1erxmglsA=
=n5ae
-----END PGP SIGNATURE-----
[-- Attachment #2: Bug-fix-default-error-to-success.patch --]
[-- Type: text/plain, Size: 794 bytes --]
From 5064e50b4a10cef2fe48a5716ffb3845488f0a14 Mon Sep 17 00:00:00 2001
From: Andrew G. Morgan <morgan@kernel.org>
Date: Wed, 21 May 2008 21:46:35 -0700
Subject: [PATCH] Bug fix: default error to success
this is the default expected by the subsequent switch ().
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
---
kernel/sys.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/kernel/sys.c b/kernel/sys.c
index 895d2d4..cb25a64 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1657,6 +1657,8 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
if (security_task_prctl(option, arg2, arg3, arg4, arg5, &error))
return error;
+ error = 0;
+
switch (option) {
case PR_SET_PDEATHSIG:
if (!valid_signal(arg2)) {
--
1.5.3.7
next prev parent reply other threads:[~2008-05-22 5:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-22 3:19 [PATCH] fix sys_prctl() returned uninitialized value Shi Weihua
2008-05-22 3:32 ` Andrew Morton
2008-05-22 4:34 ` [LTP] " Li Zefan
2008-05-22 4:57 ` Andrew Morton
2008-05-22 5:01 ` Andrew G. Morgan [this message]
2008-05-22 5:15 ` Andrew Morton
2008-05-22 5:25 ` Andrew Morton
2008-05-22 13:07 ` Andrew G. Morgan
2008-05-22 19:17 ` Serge E. Hallyn
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=4834FE1D.10909@kernel.org \
--to=morgan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=ltp-list@lists.sourceforge.net \
--cc=serue@us.ibm.com \
--cc=shiwh@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.