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

boot.kernel.features: add nixos option for setting kernel features #34791

Merged
merged 5 commits into from Feb 15, 2018

Conversation

bendlas
Copy link
Contributor

@bendlas bendlas commented Feb 9, 2018

Motivation for this change

The motivation is submitted in the form of additional commits on this PR:

  • provide options for installing systemtap and criu; both profit from / require custom kernel config
  • optionally enabling CONFIG_DEBUG_INFO, for use with systemtap
  • optionally enabling CONFIG_CHECKPOINT_RESTORE, which is required by criu
Review requested
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
cannot find section .dynamic
/nix/store/lxvqgcmllzd2if24js1nyd43r3msczlr-linux-4.9.80

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Partial log (click to expand)

  CC [M]  drivers/pci/hotplug/shpchp_hpc.o
  LD [M]  drivers/pci/hotplug/shpchp.o
  CC [M]  drivers/pci/hotplug/acpiphp_ibm.o
  CC      drivers/pci/pcie/aspm.o
  CC      drivers/pci/pcie/portdrv_core.o
  CC      drivers/pci/pcie/portdrv_pci.o
  CC      drivers/pci/pcie/portdrv_bus.o
  CC      drivers/pci/pcie/portdrv_acpi.o
building of ‘/nix/store/70w8ifg3wvndk7c47c4gnrkb6vghj8hf-linux-4.9.80.drv’ timed out after 3600 seconds
error: build of ‘/nix/store/70w8ifg3wvndk7c47c4gnrkb6vghj8hf-linux-4.9.80.drv’ failed

default = {};
example = literalExample "{ debug = true; }";
description = ''
This option allows to enable or certain kernel features.
Copy link
Member

Choose a reason for hiding this comment

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

seems like there is an disable missing in the description

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

@andir
Copy link
Member

andir commented Feb 10, 2018

I like the idea of exposing kernel features like that. We could eventually also use that for things like the spectre and meltdown mitigations. I know that @fpletz was thinking about such a way to configure this.
The general way to configure features looks fine to me.

I can not judge the configuration for CRIU or systemtap.

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

/nix/store/lxvqgcmllzd2if24js1nyd43r3msczlr-linux-4.9.80

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
/nix/store/d962jhp5pqaywvcw9bmb5hgfs5sb96r5-linux-4.9.80

@NeQuissimus
Copy link
Member

@GrahamcOfBorg test kernel-lts

@NeQuissimus
Copy link
Member

@GrahamcOfBorg test kernel-latest

@NeQuissimus
Copy link
Member

@GrahamcOfBorg test kernel-copperhead

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Partial log (click to expand)

while evaluating the option `boot.kernelPackages':
while evaluating the attribute 'isDefined' at /var/lib/gc-of-borg/nix-test-rs-1/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-1/lib/modules.nix:344:5:
while evaluating 'filterOverrides' at /var/lib/gc-of-borg/nix-test-rs-1/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-1/lib/modules.nix:419:21, called from /var/lib/gc-of-borg/nix-test-rs-1/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-1/lib/modules.nix:328:18:
while evaluating 'concatMap' at /var/lib/gc-of-borg/nix-test-rs-1/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-1/lib/lists.nix:102:18, called from /var/lib/gc-of-borg/nix-test-rs-1/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-1/lib/modules.nix:425:8:
while evaluating 'concatMap' at /var/lib/gc-of-borg/nix-test-rs-1/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-1/lib/lists.nix:102:18, called from /var/lib/gc-of-borg/nix-test-rs-1/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-1/lib/modules.nix:323:17:
while evaluating anonymous function at /var/lib/gc-of-borg/nix-test-rs-1/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-1/lib/modules.nix:323:28, called from undefined position:
while evaluating 'dischargeProperties' at /var/lib/gc-of-borg/nix-test-rs-1/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-1/lib/modules.nix:386:25, called from /var/lib/gc-of-borg/nix-test-rs-1/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-1/lib/modules.nix:324:62:
while evaluating the attribute 'value' at /var/lib/gc-of-borg/nix-test-rs-1/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-1/lib/modules.nix:216:48:
while evaluating the attribute 'config.kernelPackages' at /var/lib/gc-of-borg/nix-test-rs-1/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-1/nixos/tests/kernel-copperhead.nix:9:7:
attribute 'linuxPackages_hardened_copperhead' missing, at /var/lib/gc-of-borg/nix-test-rs-1/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/grahamc-aarch64-community-1/nixos/tests/kernel-copperhead.nix:9:29

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

machine# [    7.467137] dhcpcd[763]: eth0: IAID 00:12:34:56
machine# [    7.467784] dhcpcd[763]: eth0: adding address fe80::5054:ff:fe12:3456
machine# [    7.681703] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input4
machine: exit status 0
test script finished in 8.57s
cleaning up
killing machine (pid 593)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/wc33p63rxdbgzffdbp0z4dps7wiy519l-vm-test-run-kernel-lts

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Partial log (click to expand)

while evaluating the option `boot.kernelPackages':
while evaluating the attribute 'isDefined' at /home/borg/borg-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/7c6f434c-buildbox/lib/modules.nix:344:5:
while evaluating 'filterOverrides' at /home/borg/borg-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/7c6f434c-buildbox/lib/modules.nix:419:21, called from /home/borg/borg-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/7c6f434c-buildbox/lib/modules.nix:328:18:
while evaluating 'concatMap' at /home/borg/borg-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/7c6f434c-buildbox/lib/lists.nix:102:18, called from /home/borg/borg-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/7c6f434c-buildbox/lib/modules.nix:425:8:
while evaluating 'concatMap' at /home/borg/borg-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/7c6f434c-buildbox/lib/lists.nix:102:18, called from /home/borg/borg-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/7c6f434c-buildbox/lib/modules.nix:323:17:
while evaluating anonymous function at /home/borg/borg-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/7c6f434c-buildbox/lib/modules.nix:323:28, called from undefined position:
while evaluating 'dischargeProperties' at /home/borg/borg-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/7c6f434c-buildbox/lib/modules.nix:386:25, called from /home/borg/borg-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/7c6f434c-buildbox/lib/modules.nix:324:62:
while evaluating the attribute 'value' at /home/borg/borg-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/7c6f434c-buildbox/lib/modules.nix:216:48:
while evaluating the attribute 'config.kernelPackages' at /home/borg/borg-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/7c6f434c-buildbox/nixos/tests/kernel-copperhead.nix:9:7:
attribute 'linuxPackages_hardened_copperhead' missing, at /home/borg/borg-rs/repo/38dca4e3aa6bca43ea96d2fcc04e8229/builder/7c6f434c-buildbox/nixos/tests/kernel-copperhead.nix:9:29

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Partial log (click to expand)

cannot build derivation ‘/nix/store/yvyzrr7alliivyy1shvlb3a1p1l9h8y5-etc.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/lbggcwgm9wqyr9yzdkp4ylnsc8sm0h12-stage-1-init.sh.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/ihp2f95zwgshkz8f3jp32yqfljzgrbsk-initrd.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/sb2l8xsvfish2n7j8bhkw76l6gr0qbpi-nixos-system-machine-18.03.git.69f14c0.drv’: 5 dependencies couldn't be built
cannot build derivation ‘/nix/store/fd4k0rp27qchfn5v96xii159i6fgprsi-closure-info.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/shx2lrly2bjlyjpa8kr2hmqmlshbx4hw-run-nixos-vm.drv’: 2 dependencies couldn't be built
cannot build derivation ‘/nix/store/lcnrdiqlzy1gc17qq32d1d6qwd7syvy3-nixos-vm.drv’: 2 dependencies couldn't be built
cannot build derivation ‘/nix/store/6d7ci4kr2mvb70x89mc8q5wv5ys8adbl-nixos-test-driver-kernel-latest.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/c89yxzn26df9c7mp7jj8y5hqhbzgym9m-vm-test-run-kernel-latest.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/c89yxzn26df9c7mp7jj8y5hqhbzgym9m-vm-test-run-kernel-latest.drv’ failed

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

machine: exit status 1
syncing
machine: running command: sync
machine: exit status 0
test script finished in 14.27s
cleaning up
killing machine (pid 627)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/pknym1flwk8qbyrf2ry5r29v7fg9zvnx-vm-test-run-kernel-lts

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

machine: exit status 1
syncing
machine: running command: sync
machine: exit status 0
test script finished in 14.61s
cleaning up
killing machine (pid 627)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/31wwxqiwbzq12jjq2dmp3ava1ak75k7v-vm-test-run-kernel-latest

Copy link
Contributor Author

@bendlas bendlas left a comment

Choose a reason for hiding this comment

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

features should be introduced to the kernel via the existing override in kernelPackages

inherit (config.boot.kernelPackages) kernel;
kernel = config.boot.kernelPackages.kernel.override {
inherit (config.boot.kernel) features;
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this override doesn't work at all. besides, it's ugly.
it should be overridden in boot.kernelPackages, a few lines down.
I'm currently running a build for that.

@bendlas
Copy link
Contributor Author

bendlas commented Feb 14, 2018

I redid the override, hopefully fixing it.
I also set the option to internal, because it's not clear to me how to properly document it.

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
cannot find section .dynamic
/nix/store/zhmb4jv153l3glh1dxb8vvnhr96g2ycz-linux-4.9.81

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Partial log (click to expand)

  CC [M]  drivers/net/wireless/realtek/rtlwifi/rtl8192cu/dm.o
  CC [M]  drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.o
  CC [M]  drivers/net/wireless/realtek/rtlwifi/rtl8192cu/led.o
  CC [M]  drivers/net/wireless/realtek/rtlwifi/rtl8192cu/mac.o
  CC [M]  drivers/net/wireless/realtek/rtlwifi/rtl8192cu/phy.o
  CC [M]  drivers/net/wireless/realtek/rtlwifi/rtl8192cu/rf.o
  CC [M]  drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.o
  CC [M]  drivers/net/wireless/realtek/rtlwifi/rtl8192cu/table.o
building of ‘/nix/store/ap7p0i32zmdirrxj68nwh3spbb31i9vk-linux-4.9.81.drv’ timed out after 3600 seconds
error: build of ‘/nix/store/ap7p0i32zmdirrxj68nwh3spbb31i9vk-linux-4.9.81.drv’ failed

this allows setting the features attribute for
pkgs/os-specific/linux/kernel/common-config.nix
This isn't useful as public API. It should be used by options to
activate kernel features for use with specific programs.
@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
cannot find section .dynamic
/nix/store/zhmb4jv153l3glh1dxb8vvnhr96g2ycz-linux-4.9.81

@bendlas bendlas merged commit 23b5421 into NixOS:master Feb 15, 2018
@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Partial log (click to expand)

  CC [M]  drivers/net/wireless/marvell/mwifiex/11n.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/11ac.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/11n_aggr.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/11n_rxreorder.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/scan.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/join.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/sta_ioctl.o
  CC [M]  drivers/net/wireless/marvell/mwifiex/sta_cmd.o
building of ‘/nix/store/ap7p0i32zmdirrxj68nwh3spbb31i9vk-linux-4.9.81.drv’ timed out after 3600 seconds
error: build of ‘/nix/store/ap7p0i32zmdirrxj68nwh3spbb31i9vk-linux-4.9.81.drv’ failed

@bendlas bendlas deleted the nixos-kernel-features branch October 22, 2023 02:00
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

4 participants