#GDB on VSCodium

1 messages · Page 1 of 1 (latest)

neat furnace
#

Hi, I'm trying to debug C++ using the native debugger extension on the VSCodium flatpak. I've layered gdb onto my system, and pointed the native debug config file to its executable. It launches successfully, but finds it's unable to trace the inferior process and quits.

warning: Could not trace the inferior process.
warning: ptrace: Operation not permitted```
#

i gave the vscodium flatpak access to development syscalls but i'm not sure that is exactly what's going wrong here

amber tapir
#

maybe it's the wider ptrace scope?

amber tapir
#

ideally 2, and then use setcap on your IDE to give CAP_SYS_PTRACE? idk how that'll work with flatpak

neat furnace
teal niche
amber tapir
#

by default on linux, without yama, every process can do that to every other process i think

#

so it's best to restrict it in some way

neat furnace
amber tapir
#

just not with kernel.yama.ptrace_scope=2

#

i was suggesting setting it to 2 (better than 0 or 1) and then giving vscode the CAP_SYS_PTRACE capability

#

so you can avoid letting other apps use ptrace

#

instead, you might have to set it to 1

#

fwiw this isn't a secureblue limitation: other distros set the ptrace scope wayy too permissively, as it turns out

neat furnace
#

yeah

neat furnace
#

but it feels like

#

if every flatpak has ptrace

#

even if i don't give an app any particular permissions

#

it can monitor the memory of every other program and still overreach

amber tapir
#

that's with scope 0

amber tapir
#

and also flatpak has a ptrace toggle, the devel one

#

so not every flatpak would get it iirc

neat furnace
#

sweet

#

so scope 1 + devel should be typical functionality for vscodium w/o breaking my security

#

(i actually think scope 2 + setcap would be worse since a ptrace admin can change the ptrace level to 0 and monitor any other program, so if there was some malware in an extension or something)

amber tapir
#

still a degradation, but better than 0

amber tapir
#

they should really have separated that cap

neat furnace
amber tapir
#

which would break IDEs anyway

#

best to use a VM then

#

iirc @distant lake writes C++ on a hardened system, idk how they do it

distant lake
#

I hate IDEs

#

For debugging yeah, a VM

amber tapir
teal niche
amber tapir
teal niche
#

Basically

neat furnace
#

kind of

#

Not really sure what's happening here

#

this is my debugger config

#

but like

#

everything i send to gdb gets scrambled?

#

the good news is gdb runs? 😭

#

oh it should be my debug program

#

weird

#

nvm it just works

#

sure hope ptrace scope 1 isn't insecure

carmine vale
neat furnace