Skip to content

Systemd coredump zstd, enable elfutils support for stack traces in coredump #146573

Merged
flokli merged 2 commits intoNixOS:stagingfrom
SuperSandro2000:systemd-coredump-zstd
Nov 28, 2021
Merged

Systemd coredump zstd, enable elfutils support for stack traces in coredump #146573
flokli merged 2 commits intoNixOS:stagingfrom
SuperSandro2000:systemd-coredump-zstd

Conversation

@SuperSandro2000
Copy link
Member

Motivation for this change

I wanted to have stack traces in coredumpctl. Also enabled zstd support which was missing.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added the 6.topic: systemd Software suite that provides an array of system components for Linux operating systems. label Nov 19, 2021
@ofborg ofborg bot requested review from andir, edolstra, flokli and kloenk November 19, 2021 02:08
@ofborg ofborg bot added 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Nov 19, 2021
@SuperSandro2000 SuperSandro2000 changed the base branch from master to staging November 19, 2021 02:21
@SuperSandro2000 SuperSandro2000 changed the title Systemd coredump zstd Systemd coredump zstd, enable elfutils support for stack traces in coredump Nov 19, 2021
@SuperSandro2000
Copy link
Member Author

SuperSandro2000 commented Nov 19, 2021

zstd compression reduces the size of the stack traces for my test form 3.0M to 1.4M.

stack traces are now generated like they are on Debian like systems.

@trofi
Copy link
Contributor

trofi commented Nov 22, 2021

Until very recently systemd was frequently crashing at stack trace generation time. Worth checking if nixos has a form of systemd/systemd#20354 backported.

@flokli
Copy link
Member

flokli commented Nov 22, 2021

@trofi did this end up in systemd-stable, and if not, could you poke upstream to cherry-pick it there?

We usually don't add non-NixOS-specific patches, but wait for patches to trickle into systemd-stable.

@trofi
Copy link
Contributor

trofi commented Nov 23, 2021

@trofi did this end up in systemd-stable, and if not, could you poke upstream to cherry-pick it there?

We usually don't add non-NixOS-specific patches, but wait for patches to trickle into systemd-stable.

Aha! Yeah, two patches I was concerned about are already in nixpkgs/master:

@dasJ
Copy link
Member

dasJ commented Nov 24, 2021

I like this change a lot. Is this also backportworthy to staging-21.11?

@flokli
Copy link
Member

flokli commented Nov 28, 2021

@trofi I didn't build this yet, as it's quite a large rebuild. Is there a chance you could cherry-pick this into a local checkout and give it a spin?

@trofi
Copy link
Contributor

trofi commented Nov 28, 2021

@trofi I didn't build this yet, as it's quite a large rebuild. Is there a chance you could cherry-pick this into a local checkout and give it a spin?

Sure! Works here just fine:

$ cat a.c
void t(){ __builtin_trap(); }
void r(){ t(); }
void a(){ r(); }
void p(){ a(); }
int main() { p(); }
$ sudo gcc a.c -o /a -ggdb3
$ /a
Illegal instruction
$ journalctl -r | head -n 30
-- Journal begins at Mon 2021-08-30 17:56:01 BST, ends at Sun 2021-11-28 21:00:22 GMT. --
ноя 28 21:00:22 nz systemd[1]: [email protected]: Deactivated successfully.
ноя 28 21:00:22 nz systemd-coredump[3968807]: Process 3968795 (a) of user 1000 dumped core.

                                                 Found module linux-vdso.so.1 with build-id: e1fae3fd1e8fbc9a72b8ae8d16fdc9c059c8da47
                                                 Found module ld-linux-x86-64.so.2 with build-id: b60b89b6921053c086d6640f5ecc02035efc1570
                                                 Found module libc.so.6 with build-id: 30f69e92c5e710c15fcda2dec8c5316b040db347
                                                 Found module a without build-id.
                                                 Stack trace of thread 3968795:
                                                 #0  0x000000000040110a t (a + 0x110a)
                                                 #1  0x000000000040111a r (a + 0x111a)
                                                 #2  0x000000000040112b a (a + 0x112b)
                                                 #3  0x000000000040113c p (a + 0x113c)
                                                 #4  0x000000000040114d main (a + 0x114d)
                                                 #5  0x00007f79e16bc780 __libc_start_main (libc.so.6 + 0x27780)
                                                 #6  0x000000000040104a _start (a + 0x104a)

@github-actions
Copy link
Contributor

Successfully created backport PR #147777 for staging-21.11.

@SuperSandro2000 SuperSandro2000 deleted the systemd-coredump-zstd branch December 23, 2021 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: systemd Software suite that provides an array of system components for Linux operating systems. 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants