Repository navigation
ui: Disable core dumps for the UI process - #263
Conversation
f0380dc to
e8b2757
Compare
iinuwa
left a comment
There was a problem hiding this comment.
Thanks for this: besides fixing the merge conflict, we should also add a Meson option to disable this hardening It should be on by default, in both release and debug profiles, but if a developer wants to investigate a crash, then they should be able to enable the option easily with meson setup reconfigure -Denable_core_dumps=true build, for example.
The UI handles PINs typed by the user, so set RLIMIT_CORE to zero (soft and hard) at startup. systemd-coredump honours this and stores no core. prctl(PR_SET_DUMPABLE, 0) was considered, but it makes /proc/<pid>/root unreadable to xdg-desktop-portal, which then rejects every portal call from the process, including the Settings portal GTK uses. Part of linux-credentials#209.
e8b2757 to
ae4459d
Compare
|
Rebased on main (the conflict was It defaults to |
|
Thanks for merging, @iinuwa! I have some time to contribute more. If there's an issue you'd like help with, or one that's a priority for you, feel free to assign it to me and I'll pick it up. |
|
@kpanuragh thanks for your efforts! I think that the next biggest thing we need help with is Debian packaging. I created an issue 268 (not linking so that it doesn't show as related) with some information. Feel free to discuss on that issue or our matrix channel, #credentials-for-linux:matrix.org, if you are interested! |
Split out of #261 as requested. Part of #209.
credentialsd-uihandles PINs typed by the user. This PR setsRLIMIT_COREto 0, both soft and hard, at startup, so that no core dump is written. systemd-coredump honours the limit: it logs "Resource limits disable core dumping" and stores nothing.prctl(PR_SET_DUMPABLE, 0)would also block ptrace from other processes running as the same user. However, it makes/proc/<pid>/rootunreadable to xdg-desktop-portal, which then rejects every portal call from the UI with "Portal operation not allowed: Unable to open /proc//root". That includesSettings.ReadOne, which GTK uses for the colour scheme (tested with xdg-desktop-portal 1.22.1). Until xdg-desktop-portal identifies callers another way, ptrace protection is left to Yama.Testing
cargo test -p credentialsd-ui: a new test checks that the soft and hard core limits are both 0.credentialsd-ui:/proc/<pid>/limitsshowsMax core file size 0 0.SIGSEGV:coredumpctllists it withCOREFILE none.