From: Olaf Hering <olaf@aepfle.de>
To: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: [PATCH] reject taskset for kernel threads
Date: Wed, 21 Mar 2007 21:53:53 +0100 [thread overview]
Message-ID: <20070321205353.GA32529@aepfle.de> (raw)
Do not allow taskset for kernel threads.
These commands will cause oopses due to stack corruption:
ls /proc/*/task | grep -v ^/ | xargs echo | xargs -n1 taskset -pc 2-9
taskset -pc 1 $$
taskset -pc 0 $((pidof john))
Possible fix in userland:
for i in ` ls /proc/*/task | grep -v ^/ `
do
e=/proc/*/task/$i/exe
if test -e $e
then
taskset -pc 2-9 $i
fi
done
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
kernel/sched.c | 2 ++
1 file changed, 2 insertions(+)
Index: linux-2.6.20/kernel/sched.c
===================================================================
--- linux-2.6.20.orig/kernel/sched.c
+++ linux-2.6.20/kernel/sched.c
@@ -4310,6 +4310,8 @@ long sched_setaffinity(pid_t pid, cpumas
read_unlock(&tasklist_lock);
retval = -EPERM;
+ if (!p->mm)
+ goto out_unlock;
if ((current->euid != p->euid) && (current->euid != p->uid) &&
!capable(CAP_SYS_NICE))
goto out_unlock;
next reply other threads:[~2007-03-21 20:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-21 20:53 Olaf Hering [this message]
2007-03-21 21:50 ` [PATCH] reject taskset for kernel threads Andrew Morton
2007-03-22 21:28 ` Olaf Hering
2007-03-22 23:01 ` Olaf Hering
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=20070321205353.GA32529@aepfle.de \
--to=olaf@aepfle.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.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 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.