mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00

Using gdb in batch mode, put a breakpoint on _start and spawn the process. Then using the built-in python interpreter print the confinement label on the process and terminate everything. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
9 lines
333 B
Bash
Executable file
9 lines
333 B
Bash
Executable file
#!/bin/sh
|
|
exec gdb \
|
|
--quiet \
|
|
--batch \
|
|
--eval-command='set breakpoint pending on' \
|
|
--eval-command='break _start' \
|
|
--eval-command='run' \
|
|
--eval-command='python import os; os.fdopen(3, "wt").write(open("/proc/{}/attr/current".format(gdb.selected_inferior().pid), "rt").read())' \
|
|
"$@" 3>/dev/stdout 1>/dev/null 2>/dev/null
|