NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.29k stars 14.27k forks source link

profiles/hardened: combination of greetd and scudo memory allocator causes slowdown #191589

Open ngkz opened 2 years ago

ngkz commented 2 years ago

Describe the bug

greetd with scudo memory allocator causes a significant delay (around 25s on my system) when login, logout, shutdown, and reboot. No slowdown when environment.memoryAllocator.provider is "libc".

Steps To Reproduce

Steps to reproduce the behavior:

  1. import hardened profile and enable greetd
    services.greetd = {
    enable = true;
    settings = {
      default_session = {
        command = "${pkgs.greetd.greetd}/bin/agreety";
        user = "greeter";
      };
    };
    };
  2. logging in to a session with greetd, logging out from the session, or shutdown/reboot the system.
  3. greetd eats 100% of CPU core and causes a significant delay

Expected behavior

greetd does not cause slowdown

Notify maintainers

greetd: @queezle42 hardened.nix: @joachifm @emilazy

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.64-hardened1, NixOS, 22.05 (Quokka), 22.05.20220909.45b56b5`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.8.1`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
joachifm commented 2 years ago

The scudo allocator has some tunables that may alleviate the issue, but I have no suggestions about what it is about greetd's allocator usage that is causing the slowdown and so which tunables may be relevant to you. It may also be that scudo is revealing memory allocation bugs in greetd itself, in which case it may be considered an upstream bug.

06kellyjac commented 2 years ago

@ngkz have you raised this upstream?

https://git.sr.ht/~kennylevinsen/greetd#how-to-discuss

ngkz commented 2 years ago

@06kellyjac no