mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #3671] GDB a process inside FireJail #2311
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#2311
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mtayyab01 on GitHub (Oct 14, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3671
With --allow-debuggers flag when gdb is executed inside the firejail, Firejail crashes. If with gdb a breakpoint is set, the run command to gdb will crash firejail parent process and exit.
Here is an example of simple helloworld firejailed program (app) to be debugged. I could not find another way to debug a jailed program from man pages.
firejail --allow-debuggers gdb ./app
Reading profile /usr/local/etc/firejail/default.profile
Reading profile /usr/local/etc/firejail/disable-common.inc
Reading profile /usr/local/etc/firejail/disable-passwdmgr.inc
Reading profile /usr/local/etc/firejail/disable-programs.inc
** Note: you can use --noprofile to disable default.profile **
Parent pid 10812, child pid 10813
Warning: cleaning all supplementary groups
Child process initialized in 33.96 ms
GNU gdb (Ubuntu 8.2-0ubuntu1~18.04) 8.2
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./app...done.
(gdb) run
Starting program: /home/mtayyab/Desktop/Code/Example/build/app
Hello world
[Inferior 1 (process 5) exited normally]
[12]+ Stopped firejail --allow-debuggers gdb ./app
mtayyab@mtayyab:$ firejail --allow-debuggers gdb ./app
Reading profile /usr/local/etc/firejail/default.profile
Reading profile /usr/local/etc/firejail/disable-common.inc
Reading profile /usr/local/etc/firejail/disable-passwdmgr.inc
Reading profile /usr/local/etc/firejail/disable-programs.inc
** Note: you can use --noprofile to disable default.profile **
Parent pid 10822, child pid 10823
Warning: cleaning all supplementary groups
Child process initialized in 33.72 ms
GNU gdb (Ubuntu 8.2-0ubuntu1~18.04) 8.2
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./app...done.
(gdb) break main
Breakpoint 1 at 0x862: file /home/mtayyab/Desktop/Code/Example/main.cpp, line 7.
(gdb) run
Starting program: /home/mtayyab/Desktop/Code/Example/build/app
Breakpoint 1, main () at /home/mtayyab/Desktop/Code/Example/main.cpp:7
7 int variable=0;
[13]+ Stopped firejail --allow-debuggers gdb ./app
@ScoreUnder commented on GitHub (Oct 14, 2020):
This says "stopped" and gives a job ID, so what happens if you
fgit?@rusty-snake commented on GitHub (Oct 16, 2020):
It hangs/freezes on my system with
firejail --allow-debuggers gdb ./helloand hello.cjournalctl:
Looks like
--allow-debuggersdoes not switchseccompfrom @default-nodebuggers to @default anymore.cc @topimiettinen
@topimiettinen commented on GitHub (Oct 18, 2020):
Gdb works for me with
--allow-debuggers(not fully, as with OP it stops) but not at all without, so I think the seccomp list is changed with--allow-debuggers. Syscall 135 isrt_sigprocmask, which should not be blocked. I don't see this error in logs either. Maybe this is not related to seccomp, has something changed with signal handling recently?@rusty-snake commented on GitHub (Oct 18, 2020):
seccompblocks all syscalls in @default-nodebuggers (which is@default-nodebuggers=@default,ptrace,personality,process_vm_readv) except if it is used withallow-debuggers, then it only blocks @default.I bisect this tomorrow.
@topimiettinen commented on GitHub (Oct 18, 2020):
Nice tricks, I used
Even easier is if you have
ausearch, flag-iin for exampleausearch -ts boot -i -m SECCOMPreplaces the number of system call with its name.@rusty-snake commented on GitHub (Oct 19, 2020):
ok
firejail --noprofile --allow-debuggers --seccomp gdb ./testdoes not fail on seccomp.But even just noprfoile (
firejail --noprofile gdb ./test) goes in background withbreak main,run. You can bring is back withfgand it goes in background again if you enter run again.