2
if [ `id -u` -ne 0 ]; then
3
echo "Must run as root"
9
echo "Please install nsexec from ppa:serge-hallyn/nsexec"
15
echo "gdb not installed, not running tests"
19
gdbcommands=/etc/gdbcommands
20
if [ ! -f "$f" ]; then
21
gdbcommands=./gdbcommands
24
# Can I ptrace my own tasks
26
gdb -x $gdbcommands -p $!
28
if [ $ret -ne 0 ]; then
29
echo "Error: root could not ptrace his own tasks"
33
# Can I ptrace tasks in child userns
34
nsexec -cU /bin/sleep 60 &
36
gdb -x $gdbcommands -p $p
38
if [ $ret -ne 0 ]; then
39
echo "Error: could not ptrace tasks in child userns"
43
# untested: can a non-root task ptrace tasks in child uersns he created?
45
# Can child userns ptrace task in parent userns?
47
nsexec -ceU $gdb -x $gdbcommands -p $!
49
if [ $ret -eq 0 ]; then
50
echo "Error: child userns can ptrace parent userns"
54
echo "All ptrace userns tests passed"