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

[6.11-hardened kernel] CONFIG_RANDSTRUCT patch not working for me on NixOS #16849

Open
cawilliamson opened this issue Dec 9, 2024 · 4 comments
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@cawilliamson
Copy link

cawilliamson commented Dec 9, 2024

System information

Type Version/Name
Distribution Name NixOS
Distribution Version 24.11 (Vicuna)
Kernel Version 6.11-hardened1
Architecture x86_64
OpenZFS Version 2.3.0-rc3

Describe the problem you're observing

I am trying to upgrade my system from a v6.6 hardened kernel to a v6.11 hardened kernel and it didn't mount my ZFS partitions after reboot. Some problem with loading the module - OK, let's investigate!

So I looked into the issue and found this fix: #16805 - that would make sense since my kernel config does indeed use that option. So I applied that fix, recompiled and rebooted and... exact same result!

The compilation DID succeed with that patch in place but the outcome remains sadly the same and I have no idea where to look next.

My relevant NixOS config is:

boot = {
  kernelPackages = pkgs.linuxPackages_6_11_hardened;
  supportedFilesystems = [ "zfs" ];
  zfs.package = pkgs.zfs_unstable.overrideAttrs (oldAttrs: rec {
    patches = (oldAttrs.patches or []) ++ [
      (pkgs.fetchpatch {
        url = "https://patch-diff.githubusercontent.com/raw/openzfs/zfs/pull/16805.diff";
        sha256 = "sha256-GA8hwHwEZgVmF0LIWXYM2FzWBdxhh6OCX9QywEbqW8Q=";
      })
    ];
  });
};

This is obviously very Nix specific but essentially it is pulling the diff from the patch listed above, applying it and then compiling v2.3.0-rc3 with that additional patch.

Describe how to reproduce the problem

  1. Add the above to your kernel config on an existing working install of NixOS
  2. Rebuild (nixos-rebuild switch)
  3. Reboot
  4. Observe the very unwelcome "sysctl table check failed: kernel/spl/(null) No proc_handler" messages spamming your screen whilst the zfs module fails to load successfully.
@cawilliamson cawilliamson added the Type: Defect Incorrect behavior (e.g. crash, hang) label Dec 9, 2024
@IvanVolosyuk
Copy link
Contributor

Did you run ./autogen.sh after applying the patch? The change is only used when run ./autogen.sh before ./configure as it changes the configure script itself.

@cawilliamson
Copy link
Author

Did you run ./autogen.sh after applying the patch? The change is only used when run ./autogen.sh before ./configure as it changes the configure script itself.

That is likely the problem to be honest - I'll invesigate and report back.

@qubitnano
Copy link

That only triggers a rebuild of the userland tools, try this:

  boot = {
    kernelPackages = pkgs.linuxPackages_6_11_hardened;
    supportedFilesystems = [ "zfs" ];
    zfs.package = pkgs.zfs_unstable.overrideAttrs (oldAttrs: {
      patches = (oldAttrs.patches or [ ]) ++ [
        (pkgs.fetchpatch {
          url = "https://patch-diff.githubusercontent.com/raw/openzfs/zfs/pull/16805.diff";
          hash = "sha256-GA8hwHwEZgVmF0LIWXYM2FzWBdxhh6OCX9QywEbqW8Q=";
        })
      ];
    });
    zfs.modulePackage = config.boot.kernelPackages.zfs_unstable.overrideAttrs (oldAttrs: {
      patches = (oldAttrs.patches or [ ]) ++ [
        (pkgs.fetchpatch {
          url = "https://patch-diff.githubusercontent.com/raw/openzfs/zfs/pull/16805.diff";
          hash = "sha256-GA8hwHwEZgVmF0LIWXYM2FzWBdxhh6OCX9QywEbqW8Q=";
        })
      ];
    });
  };

@AllKind
Copy link
Contributor

AllKind commented Dec 11, 2024

This was just posted in another already closed thread: #16847 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

No branches or pull requests

4 participants