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

oci-seccomp-bpf-hook: move to linuxPackages #96892

Merged
merged 1 commit into from Sep 2, 2020
Merged

oci-seccomp-bpf-hook: move to linuxPackages #96892

merged 1 commit into from Sep 2, 2020

Conversation

zowoq
Copy link
Contributor

@zowoq zowoq commented Sep 1, 2020

Motivation for this change

Needs to be built against the system kernel.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@saschagrunert
Copy link
Member

saschagrunert commented Sep 1, 2020

Thank you for the draft: I tried to run it in a nixos-shell like this vm.nix:

{ pkgs, ... }:
{
  boot.kernelPackages = pkgs.linuxPackages_latest;

  virtualisation = {
    podman.enable = true;
    containers.containersConf.extraConfig = ''
      [engine]
      hooks_dir = [
        "${pkgs.linuxPackages.oci-seccomp-bpf-hook}",
      ]
    '';
  };
}
> export NIX_PATH=nixpkgs=$PWD && nixos-shell

When applying the patch from #96761 (comment), then it sill complains to lookup the old kernel sources on runtime:

> podman run --annotation io.containers.trace-syscall="of:/tmp/out.json" -it alpine echo hi
…
Error: chdir(/nix/store/37fqbzwkv23r3c340jw7bcy2zl3yn98i-linux-5.4.61-dev/lib/modules/5.8.4/build):

If we do not change the kernel packages and remove the

boot.kernelPackages = pkgs.linuxPackages_latest;

from vm.nix, then it works as expected.

@zowoq
Copy link
Contributor Author

zowoq commented Sep 1, 2020

I think this should work:

{ config, pkgs, ... }:
{
  boot.kernelPackages = pkgs.linuxPackages_latest;

  virtualisation = {
    podman.enable = true;
    containers.containersConf.extraConfig = ''
      [engine]
      hooks_dir = [
        "${config.boot.kernelPackages.oci-seccomp-bpf-hook}",
      ]
    '';
  };
}

@saschagrunert
Copy link
Member

saschagrunert commented Sep 1, 2020

I think this should work:

Yep, this works! Thank you again I'll update my PR to use the new config.

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

LGTM

@zowoq zowoq marked this pull request as ready for review September 1, 2020 09:24
@zowoq
Copy link
Contributor Author

zowoq commented Sep 1, 2020

@saschagrunert Does this have a minimum kernel version that we need to set?

@saschagrunert
Copy link
Member

@saschagrunert Does this have a minimum kernel version that we need to set?

I think so, but I'm not sure which one exactly. For sake of security we could go with the current NixOS 20.03 default. This one should at least work.

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

/lgtm

@ofborg ofborg bot requested a review from saschagrunert September 2, 2020 08:14
@zowoq zowoq merged commit ee0d559 into NixOS:master Sep 2, 2020
@zowoq zowoq deleted the oci-seccomp branch September 2, 2020 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants