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

coredump: no need for full dump with bundled files #213

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

fabled
Copy link
Contributor

@fabled fabled commented Oct 29, 2024

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.

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.
@fabled fabled requested review from a team as code owners October 29, 2024 08:23
// Restore coredump filter mask upon leaving the function.
defer func() {
//nolint:gosec
err2 := os.WriteFile(coredumpFilterPath, prevMask, 0o644)
Copy link
Member

@christos68k christos68k Oct 29, 2024

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

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this fixes it.

Copy link
Member

@christos68k christos68k left a 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)

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

Successfully merging this pull request may close these issues.

2 participants