-
Notifications
You must be signed in to change notification settings - Fork 273
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
coredump: no need for full dump with bundled files #213
base: main
Are you sure you want to change the base?
Conversation
Avoid full process coredumps when the ELF files are bundled. This significantly reduces the size of coredumps from large processes. Add "coredump new -sysroot" option to specify sysroot prefix for finding the files to be bundled. Update instructions accordingly.
tools/coredump/new.go
Outdated
// Restore coredump filter mask upon leaving the function. | ||
defer func() { | ||
//nolint:gosec | ||
err2 := os.WriteFile(coredumpFilterPath, prevMask, 0o644) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should convert prevMask
to a hex string and write that to coredump_filter
, otherwise we may run into the following (we're writing in octal):
WARN[0000] Failed to restore previous coredump filter: write /proc/367787/coredump_filter: invalid argument
Or just from the shell:
$ cat /proc/367787/coredump_filter
00000033
$ echo 00000033 >/proc/367787/coredump_filter
$ cat /proc/367787/coredump_filter
0000001b
$ echo 0000001b >/proc/367787/coredump_filter
-bash: echo: write error: Invalid argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange kernel inconsistency. And this is just code I reindented. But added a fix by just prepending a 0x
literal in the front.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this fixes it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (also tested and works fine)
Avoid full process coredumps when the ELF files are bundled. This significantly reduces the size of coredumps from large processes.
Add "coredump new -sysroot" option to specify sysroot prefix for finding the files to be bundled.
Update instructions accordingly.