Re: [PATCH] reject taskset for kernel threads

From: Olaf Hering
Date: Thu Mar 22 2007 - 17:28:37 EST


On Wed, Mar 21, Andrew Morton wrote:

> On Wed, 21 Mar 2007 21:53:53 +0100
> Olaf Hering <olaf@xxxxxxxxx> wrote:
>
> >
> > 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))
>
> Why does the kernel oops?

I guess I have to find out. Sometimes it just deadlocks.
Linus tree (+patches) crashes nicely and loops in xmon exceptions, see below.

#/bin/bash
numcpus=`grep -Ec '^cpu[0-9]' /proc/stat || echo 1`
forked=
john=
for i in `seq 1 $numcpus`
do
echo $i
bash -c 'declare -i x=1 ; while test $x != 0 ; do : $(( x++ )) ; done' &
forked="$forked $!"
done
echo "forked $forked"
nice -n -19 bash -c 'declare -i x=1 ; while test $x != 0 ; do : $(( x++ )) ; done' &
john=$!
sleep 3
ls -A /proc/*/task | grep -v ^/ | xargs echo | xargs -n1 taskset -pc 2-$numcpus
taskset -pc 2 $$
taskset -pc 0 $john
sleep 3
kill $forked $john



...
pid 4796's new affinity list: 2,3
pid 4797's current affinity list: 0-3
Page fault in user mode within_atomic() = 0 mm = 0000000000000000
NIP = fd8e590 MSR = 4000f032
cpu 0x1: Vector: 401 (Instruction Access) at [c0000000e9dfbea0]
pc: 000000000fd8e590
lr: 000000000fdf3cec
sp: ffc2
0c90
msr: 4000f032
current = 0xc0000000e74e2800
paca = 0xc0000000005b3000
pid = 4797, comm = bash
cpu 0x2: Vector: 400 (Instr------------[ cuut here ]--------c----
tion Access) at [c0000000e9dfb380]
cpu 0x2: Vector: 3865000000000400 at [c0000000e9dfac60]
pc: c0000000e9dfae00
lr: c0000000e9dfae00
sp: c0000000e9dfaee0
msr: c0000000004e6220
cur e?n tfeorr ?h eflopr
shxl 0 0pacfScP2 0(cf9f0c)2 0ics9 0i)n iuss eirns puasceer
pac h
p1i:dm o n >= 4797, comm = bash
cpu 0x2: Exception 3835360000000400 in xmon, returning to main loop
cpu 0x2: Vector: 300 (Data Access) at [c0000000e9dfac10]
...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/