Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gdb failing to obtain symbols when attaching #61

Open
ntrrgc opened this issue Oct 9, 2024 · 8 comments
Open

gdb failing to obtain symbols when attaching #61

ntrrgc opened this issue Oct 9, 2024 · 8 comments

Comments

@ntrrgc
Copy link
Member

ntrrgc commented Oct 9, 2024

In the past this has worked for me, but today I found this in my laptop while trying to attach gdb. Both gdb and WebKitWebProcess are running in the same container:

$ gdb
(gdb) attach 361837
Attaching to program: /host/home/ntrrgc/Apps/webkit/WebKitBuild/GTK/Debug/bin/WebKitWebProcess, process 361837
[New LWP 423389]
[New LWP 423367]
...
Error while mapping shared library sections:
Could not open `target:/host/home/ntrrgc/Apps/webkit/WebKitBuild/GTK/Debug/lib/libwebkitgtk-6.0.so.4' as an executable file: Operation not permitted
Error while mapping shared library sections:
Could not open `target:/lib/x86_64-linux-gnu/libepoxy.so.0' as an executable file: Operation not permitted
Error while mapping shared library sections:
Could not open `target:/lib/x86_64-linux-gnu/libfontconfig.so.1' as an executable file: Operation not permitted
(... tons of similar errors ...)
(gdb) bt
#0  0x00007fbc3652725d in ?? ()
#1  0x00007fbc36b6d40d in ?? ()
#2  0x0000000000020000 in ?? ()
#3  0x0000000000000001 in ?? ()
#4  0x00007fbc35f2d3e0 in ?? ()
#5  0x0000000000000001 in ?? ()
#6  0x00007fbc35f6cc70 in ?? ()
#7  0x000055f323a1bba0 in ?? ()
#8  0x00007fbc35f19768 in ?? ()
#9  0x00007fbc35e9c7da in ?? ()
#10 0x00007fbc3d6c1390 in ?? ()
#11 0x000055f323a1bc38 in ?? ()
#12 0x0000000000000002 in ?? ()
#13 0x00007ffe80525c60 in ?? ()
#14 0x000055f323a1bba0 in ?? ()
#15 0x00007ffe80525d90 in ?? ()
#16 0x0000000000000000 in ?? ()
@q66
Copy link

q66 commented Oct 9, 2024

this should only really happen when the process and the debugger run in different namespaces, so likely interference from the bwrap sandbox? (try forcing it off, there is an env var for it)

@ntrrgc
Copy link
Member Author

ntrrgc commented Oct 9, 2024

@q66 shouldn't it work regardless? I would expect attaching a debugger to be something that works by default.

@TingPing
Copy link
Member

TingPing commented Oct 9, 2024

Inside the SDK the sandbox disables the pid namespacing.

FWIW it works fine here.

@q66
Copy link

q66 commented Oct 9, 2024

@ntrrgc it probably should, but that's separate from what i said :) i'm just trying to find the cause of the error here

@ntrrgc
Copy link
Member Author

ntrrgc commented Oct 9, 2024

@q66 I just tried with WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS=1 and it found the symbols. So that's confirmed at least.

@q66
Copy link

q66 commented Oct 9, 2024

@ntrrgc the pid namespace is unshared when enableDebugPermissions() returns false https://github.com/WebKit/WebKit/blob/b1ed27f4948073a31795dc90b845554fda214420/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp#L784

looking at that, it checks an env var: https://github.com/WebKit/WebKit/blob/b1ed27f4948073a31795dc90b845554fda214420/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp#L465

so next thing you can try is setting WEBKIT_ENABLE_DEBUG_PERMISSIONS_IN_SANDBOX=1 in the environment instead of a full disable

if that works, and if what Patrick says is correct, it would mean your configuration having that messed up for some reason (but i dunno enough about how the container sdk works to tell by myself)

@ntrrgc
Copy link
Member Author

ntrrgc commented Oct 9, 2024

The issue still happens with WEBKIT_ENABLE_DEBUG_PERMISSIONS_IN_SANDBOX=1.

@q66
Copy link

q66 commented Oct 9, 2024

hm, maybe it's one of the other namespaces then? or some change in bwrap behavior? the only ones the launcher seems to use are user, pid, ipc, uts, and network... doesn't sound like any of the others should be relevant

would need somebody to collect a bunch more information i guess...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants