mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 06:06:02 -06:00
24 lines
870 B
Bash
Executable file
24 lines
870 B
Bash
Executable file
#!/bin/bash
|
|
# This file is part of Firejail project
|
|
# Copyright (C) 2014-2026 Firejail Authors
|
|
# License GPL v2
|
|
set -x
|
|
|
|
# gdb setuid helper script.
|
|
# This script forks a background process as the current user which will
|
|
# immediately send itself a `STOP` signal. Then gdb running as root will
|
|
# attach to that process, which will send it the `CONT` signal to continue
|
|
# execution. Then the backgrounded process will exec the program with the
|
|
# given arguments. This will allow the root gdb to trace the unprivileged
|
|
# setuid firejail process from the absolute beginning.
|
|
|
|
if [ -z "${1##*/firejail}" ]; then
|
|
FIREJAIL=$1
|
|
else
|
|
# First argument is not named firejail, then add default unless environment
|
|
# variable already set.
|
|
set -- ${FIREJAIL:=$(command -v firejail)} "$@"
|
|
fi
|
|
|
|
bash -c "kill -STOP \$\$; exec \"\$0\" \"\$@\"" "$@" &
|
|
sudo gdb -e "$FIREJAIL" -p "$!"
|