|
|
Log in / Subscribe / Register

Get the kernel out of this business

Get the kernel out of this business

Posted Jun 7, 2025 9:51 UTC (Sat) by quotemstr (subscriber, #45331)
Parent article: Slowing the flow of core-dump-related CVEs

Crash dumping is something userspace can do all by itself --- consider breakpad and crashpad. Wire up a signal handler; make direct system calls to fork and execve a helper; ptrace your parent. Now you can dump the process without the kernel's help, the usual way, with normal privileges. The whole kernel-driven core dump mechanism is more trouble than it's worth. libc can provide a default handler that approximates what we have today if we really need it.


to post comments

Get the kernel out of this business

Posted Jun 7, 2025 16:31 UTC (Sat) by jwadams (subscriber, #123485) [Link] (1 responses)

Getting this right completely in process is extremely hard to do (using only async-safe interfaces, possibly racing with other signal handlers trying to do the same thing, etc), and has a good chance of destroying the state you were trying to report.

Get the kernel out of this business

Posted Jun 7, 2025 23:30 UTC (Sat) by quotemstr (subscriber, #45331) [Link]

> Getting this right completely in process is extremely hard

Yet it's done. Every major Android app uses some kind of in-process signal-based crash reporting system and it works fine. You barely have to do anything in an async-signal-safe way: just use direct system calls like in https://github.com/linux-on-ibm-z/linux-syscall-support/b..., vfork, and execve a crash handler that ptrace it parent and run normal signal-unsafe code at its leisure to dump the crashing process --- probably to a format better than traditional coredumps, one like minidump.

Speaking of minidumps: Windows crash dumps are all-userspace and work just fine.

At the most, I'd approve of the Linux kernel having a mechanism to signal some kind of registered crash daemon over IPC when another process crashes. This way, the crashing process doesn't need a signal handler or any async-signal-safe code at all. Linux should just delete all the code that produces actual core dumps and delegate the dirty work to userspace.

> possibly racing with other signal handlers

Safely sharing signal handlers is a problem all its own. Besides: futex works fine even in async-signal-safe code.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds