linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Greg KH <greg@kroah.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Hugh Dickins <hugh@veritas.com>,
	Christoph Lameter <clameter@engr.sgi.com>,
	"David S. Miller" <davem@davemloft.net>, Andi Kleen <ak@suse.de>,
	"Luck, Tony" <tony.luck@intel.com>,
	Rik van Riel <riel@redhat.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Roland McGrath <roland@redhat.com>,
	Stephen Smalley <sds@tycho.nsa.gov>
Subject: Re: incoming
Date: Fri, 4 May 2007 09:14:34 -0700	[thread overview]
Message-ID: <20070504091434.106ad04d.akpm@linux-foundation.org> (raw)
In-Reply-To: <20070504133728.GA19460@kroah.com>

On Fri, 4 May 2007 06:37:28 -0700 Greg KH <greg@kroah.com> wrote:

> On Wed, May 02, 2007 at 03:02:52PM -0700, Andrew Morton wrote:
> > - One little security patch
> 
> Care to cc: linux-stable with it so we can do a new 2.6.21 release with
> it if needed?
> 

Ah.  The patch affects security code, but it doesn't actually address any
insecurity.  I didn't think it was needed for -stable?



From: Roland McGrath <roland@redhat.com>

wait* syscalls return -ECHILD even when an individual PID of a live child
was requested explicitly, when security_task_wait denies the operation. 
This means that something like a broken SELinux policy can produce an
unexpected failure that looks just like a bug with wait or ptrace or
something.

This patch makes do_wait return -EACCES (or other appropriate error returned
from security_task_wait() instead of -ECHILD if some children were ruled out
solely because security_task_wait failed.

[jmorris@namei.org: switch error code to EACCES]
Signed-off-by: Roland McGrath <roland@redhat.com>
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Chris Wright <chrisw@sous-sol.org>
Cc: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 kernel/exit.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff -puN kernel/exit.c~return-eperm-not-echild-on-security_task_wait-failure kernel/exit.c
--- a/kernel/exit.c~return-eperm-not-echild-on-security_task_wait-failure
+++ a/kernel/exit.c
@@ -1033,6 +1033,8 @@ asmlinkage void sys_exit_group(int error
 
 static int eligible_child(pid_t pid, int options, struct task_struct *p)
 {
+	int err;
+
 	if (pid > 0) {
 		if (p->pid != pid)
 			return 0;
@@ -1066,8 +1068,9 @@ static int eligible_child(pid_t pid, int
 	if (delay_group_leader(p))
 		return 2;
 
-	if (security_task_wait(p))
-		return 0;
+	err = security_task_wait(p);
+	if (err)
+		return err;
 
 	return 1;
 }
@@ -1449,6 +1452,7 @@ static long do_wait(pid_t pid, int optio
 	DECLARE_WAITQUEUE(wait, current);
 	struct task_struct *tsk;
 	int flag, retval;
+	int allowed, denied;
 
 	add_wait_queue(&current->signal->wait_chldexit,&wait);
 repeat:
@@ -1457,6 +1461,7 @@ repeat:
 	 * match our criteria, even if we are not able to reap it yet.
 	 */
 	flag = 0;
+	allowed = denied = 0;
 	current->state = TASK_INTERRUPTIBLE;
 	read_lock(&tasklist_lock);
 	tsk = current;
@@ -1472,6 +1477,12 @@ repeat:
 			if (!ret)
 				continue;
 
+			if (unlikely(ret < 0)) {
+				denied = ret;
+				continue;
+			}
+			allowed = 1;
+
 			switch (p->state) {
 			case TASK_TRACED:
 				/*
@@ -1570,6 +1581,8 @@ check_continued:
 		goto repeat;
 	}
 	retval = -ECHILD;
+	if (unlikely(denied) && !allowed)
+		retval = denied;
 end:
 	current->state = TASK_RUNNING;
 	remove_wait_queue(&current->signal->wait_chldexit,&wait);
_


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-05-04 16:14 UTC|newest]

Thread overview: 208+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-02 22:02 incoming Andrew Morton
2007-05-02 22:31 ` incoming Benjamin Herrenschmidt
2007-05-03  7:55 ` incoming Russell King
2007-05-03  8:05   ` incoming Andrew Morton
2007-05-04 13:37 ` incoming Greg KH
2007-05-04 16:14   ` Andrew Morton [this message]
2007-05-04 17:02     ` incoming Greg KH
2007-05-04 18:57     ` incoming Roland McGrath
2007-05-04 19:24       ` incoming Greg KH
2007-05-04 19:29         ` incoming Roland McGrath
     [not found] <20190716162536.bb52b8f34a8ecf5331a86a42@linux-foundation.org>
2019-07-17  8:47 ` incoming Vlastimil Babka
2019-07-17  8:57   ` incoming Bhaskar Chowdhury
2019-07-17 16:13   ` incoming Linus Torvalds
2019-07-17 17:09     ` incoming Christian Brauner
2019-07-17 18:13     ` incoming Vlastimil Babka
2019-08-25  0:54 incoming Andrew Morton
2019-08-30 23:04 incoming Andrew Morton
2019-09-23 22:31 incoming Andrew Morton
2019-09-24  0:55 ` incoming Linus Torvalds
2019-09-24  4:31   ` incoming Andrew Morton
2019-09-24  7:48     ` incoming Michal Hocko
2019-09-24 15:34       ` incoming Linus Torvalds
2019-09-25  6:36         ` incoming Michal Hocko
2019-09-24 19:55       ` incoming Vlastimil Babka
2019-09-25 23:45 incoming Andrew Morton
2019-10-07  0:57 incoming Andrew Morton
2019-10-14 21:11 incoming Andrew Morton
2019-10-19  3:19 incoming Andrew Morton
2019-11-06  5:16 incoming Andrew Morton
2019-11-16  1:34 incoming Andrew Morton
2019-11-22  1:53 incoming Andrew Morton
2019-12-01  1:47 incoming Andrew Morton
2019-12-01  5:17 ` incoming James Bottomley
2019-12-01 21:07 ` incoming Linus Torvalds
2019-12-02  8:21   ` incoming Steven Price
2019-12-05  0:48 incoming Andrew Morton
2019-12-18  4:50 incoming Andrew Morton
2020-01-04 20:55 incoming Andrew Morton
2020-01-14  0:28 incoming Andrew Morton
2020-01-31  6:10 incoming Andrew Morton
2020-02-04  1:33 incoming Andrew Morton
2020-02-04  2:27 ` incoming Linus Torvalds
2020-02-04  2:46   ` incoming Andrew Morton
2020-02-04  3:11     ` incoming Linus Torvalds
2020-02-21  4:00 incoming Andrew Morton
2020-02-21  4:03 ` incoming Andrew Morton
2020-02-21 18:21 ` incoming Linus Torvalds
2020-02-21 18:32   ` incoming Konstantin Ryabitsev
2020-02-27  9:59     ` incoming Vlastimil Babka
2020-02-21 19:33   ` incoming Linus Torvalds
2020-03-06  6:27 incoming Andrew Morton
2020-03-22  1:19 incoming Andrew Morton
2020-03-29  2:14 incoming Andrew Morton
2020-04-02  4:01 incoming Andrew Morton
2020-04-07  3:02 incoming Andrew Morton
2020-04-10 21:30 incoming Andrew Morton
2020-04-12  7:41 incoming Andrew Morton
2020-04-21  1:13 incoming Andrew Morton
2020-05-08  1:35 incoming Andrew Morton
2020-05-14  0:50 incoming Andrew Morton
2020-05-23  5:22 incoming Andrew Morton
2020-05-28  5:20 incoming Andrew Morton
2020-05-28 20:10 ` incoming Linus Torvalds
2020-05-29 20:31   ` incoming Andrew Morton
2020-05-29 20:38     ` incoming Linus Torvalds
2020-05-29 21:12       ` incoming Andrew Morton
2020-05-29 21:20         ` incoming Linus Torvalds
2020-06-02  4:44 incoming Andrew Morton
2020-06-02 20:08 ` incoming Andrew Morton
2020-06-02 20:45   ` incoming Linus Torvalds
2020-06-02 21:38     ` incoming Andrew Morton
2020-06-02 22:18       ` incoming Linus Torvalds
2020-06-02 20:09 incoming Andrew Morton
2020-06-03 22:55 incoming Andrew Morton
2020-06-04 23:45 incoming Andrew Morton
2020-06-08  4:35 incoming Andrew Morton
2020-06-09  4:29 incoming Andrew Morton
2020-06-09 16:58 ` incoming Linus Torvalds
2020-06-11  1:40 incoming Andrew Morton
2020-06-12  0:30 incoming Andrew Morton
2020-06-26  3:28 incoming Andrew Morton
2020-06-26  6:51 ` incoming Linus Torvalds
2020-06-26  7:31   ` incoming Linus Torvalds
2020-06-26 17:39   ` incoming Konstantin Ryabitsev
2020-06-26 17:40     ` incoming Konstantin Ryabitsev
2020-07-03 22:14 incoming Andrew Morton
2020-07-24  4:14 incoming Andrew Morton
2020-08-07  6:16 incoming Andrew Morton
2020-08-12  1:29 incoming Andrew Morton
2020-08-15  0:29 incoming Andrew Morton
2020-08-21  0:41 incoming Andrew Morton
2020-09-04 23:34 incoming Andrew Morton
2020-09-19  4:19 incoming Andrew Morton
2020-09-26  4:17 incoming Andrew Morton
2020-10-03  5:20 incoming Andrew Morton
2020-10-11  6:15 incoming Andrew Morton
2020-10-13 23:46 incoming Andrew Morton
2020-10-16  2:40 incoming Andrew Morton
2020-10-16  3:03 ` incoming Andrew Morton
2020-10-17 23:13 incoming Andrew Morton
2020-11-02  1:06 incoming Andrew Morton
2020-11-14  6:51 incoming Andrew Morton
2020-11-22  6:16 incoming Andrew Morton
2020-12-06  6:14 incoming Andrew Morton
2020-12-11 21:35 incoming Andrew Morton
2020-12-15  3:02 incoming Andrew Morton
2020-12-15  3:25 ` incoming Linus Torvalds
2020-12-15  3:30   ` incoming Linus Torvalds
2020-12-15 14:04     ` incoming Konstantin Ryabitsev
2020-12-15 20:32 incoming Andrew Morton
2020-12-15 21:00 ` incoming Linus Torvalds
2020-12-15 22:48 ` incoming Linus Torvalds
2020-12-15 22:49   ` incoming Linus Torvalds
2020-12-15 22:55     ` incoming Andrew Morton
2020-12-16  4:41 incoming Andrew Morton
2020-12-18 22:00 incoming Andrew Morton
2020-12-22 19:58 incoming Andrew Morton
2020-12-22 21:43 ` incoming Linus Torvalds
2020-12-29 23:13 incoming Andrew Morton
2021-01-12 23:48 incoming Andrew Morton
2021-01-15 23:32 ` incoming Linus Torvalds
2021-01-24  5:00 incoming Andrew Morton
2021-02-05  2:31 incoming Andrew Morton
2021-02-09 21:41 incoming Andrew Morton
2021-02-10 19:30 ` incoming Linus Torvalds
2021-02-13  4:52 incoming Andrew Morton
2021-02-24 19:58 incoming Andrew Morton
2021-02-24 21:30 ` incoming Linus Torvalds
2021-02-24 21:37   ` incoming Linus Torvalds
2021-02-25  8:53     ` incoming Arnd Bergmann
2021-02-25  9:12       ` incoming Andrey Ryabinin
2021-02-25 11:07         ` incoming Walter Wu
2021-02-26  1:14 incoming Andrew Morton
2021-02-26 17:55 ` incoming Linus Torvalds
2021-02-26 19:16   ` incoming Andrew Morton
2021-03-13  5:06 incoming Andrew Morton
2021-03-25  4:36 incoming Andrew Morton
2021-04-09 20:26 incoming Andrew Morton
2021-04-16 22:45 incoming Andrew Morton
2021-04-23 21:28 incoming Andrew Morton
2021-04-30  5:52 incoming Andrew Morton
2021-05-05  1:32 incoming Andrew Morton
2021-05-05  1:47 ` incoming Linus Torvalds
2021-05-05  3:16   ` incoming Andrew Morton
2021-05-05 17:10     ` incoming Linus Torvalds
2021-05-05 17:44       ` incoming Andrew Morton
2021-05-06  3:19         ` incoming Anshuman Khandual
2021-05-07  1:01 incoming Andrew Morton
2021-05-07  7:12 ` incoming Linus Torvalds
2021-05-15  0:26 incoming Andrew Morton
2021-05-23  0:41 incoming Andrew Morton
2021-06-05  3:00 incoming Andrew Morton
2021-06-16  1:22 incoming Andrew Morton
2021-06-25  1:38 incoming Andrew Morton
2021-06-29  2:32 incoming Andrew Morton
2021-07-01  1:46 incoming Andrew Morton
2021-07-03  0:28 ` incoming Linus Torvalds
2021-07-03  1:06   ` incoming Linus Torvalds
2021-07-08  0:59 incoming Andrew Morton
2021-07-15  4:26 incoming Andrew Morton
2021-07-23 22:49 incoming Andrew Morton
2021-07-29 21:52 incoming Andrew Morton
2021-08-13 23:53 incoming Andrew Morton
2021-08-20  2:03 incoming Andrew Morton
2021-08-25 19:17 incoming Andrew Morton
2021-09-02 21:48 incoming Andrew Morton
2021-09-02 21:49 ` incoming Andrew Morton
2021-09-08  2:52 incoming Andrew Morton
2021-09-08  8:57 ` incoming Vlastimil Babka
2021-09-08 22:17 incoming Andrew Morton
2021-09-09  1:08 incoming Andrew Morton
2021-09-10  3:09 incoming Andrew Morton
2021-09-10 17:11 ` incoming Kees Cook
2021-09-10 20:13   ` incoming Kees Cook
2021-09-24 22:42 incoming Andrew Morton
2021-10-18 22:14 incoming Andrew Morton
2021-10-28 21:35 incoming Andrew Morton
2021-11-05 20:34 incoming Andrew Morton
2021-11-09  2:30 incoming Andrew Morton
2021-11-11  4:32 incoming Andrew Morton
2021-11-20  0:42 incoming Andrew Morton
2021-12-10 22:45 incoming Andrew Morton
2021-12-25  5:11 incoming Andrew Morton
2021-12-31  4:12 incoming Andrew Morton
2022-01-14 22:02 incoming Andrew Morton
2022-01-20  2:07 incoming Andrew Morton
2022-01-22  6:10 incoming Andrew Morton
2022-01-29  2:13 incoming Andrew Morton
2022-01-29  4:25 ` incoming Matthew Wilcox
2022-01-29  6:23   ` incoming Andrew Morton
2022-01-29 21:40 incoming Andrew Morton
2022-02-04  4:48 incoming Andrew Morton
2022-02-12  0:27 incoming Andrew Morton
2022-02-12  2:02 ` incoming Linus Torvalds
2022-02-12  5:24   ` incoming Andrew Morton
2022-02-26  3:10 incoming Andrew Morton
2022-03-05  4:28 incoming Andrew Morton
2022-03-16 23:14 incoming Andrew Morton
2022-03-22 21:38 incoming Andrew Morton
2022-03-23 23:04 incoming Andrew Morton
2022-03-25  1:07 incoming Andrew Morton
2022-04-01 18:20 incoming Andrew Morton
2022-04-01 18:27 ` incoming Andrew Morton
2022-04-01 18:27 incoming Andrew Morton
2022-04-08 20:08 incoming Andrew Morton
2022-04-15  2:12 incoming Andrew Morton
2022-04-21 23:35 incoming Andrew Morton
2022-04-27 19:41 incoming Andrew Morton

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=20070504091434.106ad04d.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ak@suse.de \
    --cc=benh@kernel.crashing.org \
    --cc=clameter@engr.sgi.com \
    --cc=davem@davemloft.net \
    --cc=greg@kroah.com \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@redhat.com \
    --cc=roland@redhat.com \
    --cc=sds@tycho.nsa.gov \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).