Skip to content

align kernel configs for 6.1 and 6.12 - #216

Merged
bcressey merged 3 commits into
bottlerocket-os:developfrom
bcressey:align-kernel-configs
Jul 23, 2025
Merged

align kernel configs for 6.1 and 6.12#216
bcressey merged 3 commits into
bottlerocket-os:developfrom
bcressey:align-kernel-configs

Conversation

@bcressey

Copy link
Copy Markdown
Contributor

Issue number:
Fixes: #212

Description of changes:
Switch to zboot for arm64 images on the 6.1 kernel, now that Amazon Linux has backported the remainder of zboot support.

Use lz4 for zram compression with the 6.1 kernel, to match the 6.12 config.

Turn on the Landlock LSM for the 6.1 kernel, and enable it by default for both kernels.

Testing done:
Verified that zboot is used for aarch64:

# uname -a
Linux i-030a1f3f698bf1b9c.us-west-2.compute.internal 6.1.141 #1 SMP Mon Jul 21 22:00:26 UTC 2025 aarch64 GNU/Linux

# ls -latr /boot/vmlinuz
-rwx------. 1 root root 13441016 Jul 21 22:14 /boot/vmlinuz

$ mokutil --sb-state
SecureBoot enabled

Verified that lz4 is used for zram:

# zramctl
NAME       ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lz4             1G   4K   44B    4K       4 [SWAP]

Verified that Landlock is enabled and that landrun works:

$ go install github.com/zouuup/landrun/cmd/landrun@latest
$ export PATH=${PATH}:${HOME}/go/bin

$ landrun --rox /usr --best-effort touch /tmp/foo
touch: cannot touch '/tmp/foo': Permission denied
 
$ landrun --rox /usr --rw /tmp --best-effort touch /tmp/foo
$ ls -latr /tmp/foo
-rw-rw-r--. 1 fedora fedora 0 Jul 21 22:30 /tmp/foo

dmesg before the change shows Landlock is not enabled:

[    0.064726] LSM: initializing lsm=lockdown,capability,yama,selinux,bpf

dmesg after the change shows Lockdown is enabled:

[    0.066150] LSM: initializing lsm=lockdown,capability,landlock,yama,selinux,bpf
[    0.066150] landlock: Up and running.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

Ben Cressey added 2 commits July 22, 2025 15:33
The zboot patches that missed the 6.1 merge window were backported
to Amazon Linux's 6.1 kernel, so the issue that blocked adoption -
the need to sign both the "outer" EFI decompressor and the "inner"
kernel payload - is no longer present, and zboot-compressed kernel
images now work fine with Secure Boot.

Signed-off-by: Ben Cressey <bcressey@amazon.com>
This follows the equivalent change to the 6.12 kernel in 6dfbd17.

Signed-off-by: Ben Cressey <bcressey@amazon.com>
@bcressey
bcressey requested review from arnaldo2792 and rpkelly July 22, 2025 15:52
Build the kernel with support for the Landlock LSM, and include it in
the list of LSMs that will be enabled during boot.

Signed-off-by: Ben Cressey <bcressey@amazon.com>
@bcressey
bcressey force-pushed the align-kernel-configs branch from 0bd1d54 to f9058f4 Compare July 22, 2025 16:38
CONFIG_SECURITY_LANDLOCK=y

# Add landlock to the list of LSMs.
CONFIG_LSM="landlock,lockdown,yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor,bpf"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the upstream default for kernel 6.1: Kconfig.

CONFIG_SECURITY_LANDLOCK=y

# Add landlock to the list of LSMs.
CONFIG_LSM="landlock,lockdown,yama,loadpin,safesetid,selinux,smack,tomoyo,apparmor,ipe,bpf"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the upstream default for kernel 6.12: Kconfig.

@arnaldo2792
arnaldo2792 self-requested a review July 22, 2025 17:17
@bcressey
bcressey merged commit fe1b156 into bottlerocket-os:develop Jul 23, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CONFIG_SECURITY_LANDLOCK to kernel

3 participants