forked from Minki/linux
6e42aec7c7
LoadPin expects the file with trusted verity root digests to be an ASCII file with one digest (hex value) per line. A pinned root could contain files that meet these format requirements, even though the hex values don't represent trusted root digests. Add a new requirement to the file format which consists in the first line containing a fixed string. This prevents attackers from feeding files with an otherwise valid format to LoadPin. Suggested-by: Sarthak Kukreti <sarthakkukreti@chromium.org> Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20220906181725.1.I3f51d1bb0014e5a5951be4ad3c5ad7c7ca1dfc32@changeid
42 lines
1.6 KiB
Plaintext
42 lines
1.6 KiB
Plaintext
# SPDX-License-Identifier: GPL-2.0-only
|
|
config SECURITY_LOADPIN
|
|
bool "Pin load of kernel files (modules, fw, etc) to one filesystem"
|
|
depends on SECURITY && BLOCK
|
|
help
|
|
Any files read through the kernel file reading interface
|
|
(kernel modules, firmware, kexec images, security policy)
|
|
can be pinned to the first filesystem used for loading. When
|
|
enabled, any files that come from other filesystems will be
|
|
rejected. This is best used on systems without an initrd that
|
|
have a root filesystem backed by a read-only device such as
|
|
dm-verity or a CDROM.
|
|
|
|
config SECURITY_LOADPIN_ENFORCE
|
|
bool "Enforce LoadPin at boot"
|
|
depends on SECURITY_LOADPIN
|
|
help
|
|
If selected, LoadPin will enforce pinning at boot. If not
|
|
selected, it can be enabled at boot with the kernel parameter
|
|
"loadpin.enforce=1".
|
|
|
|
config SECURITY_LOADPIN_VERITY
|
|
bool "Allow reading files from certain other filesystems that use dm-verity"
|
|
depends on SECURITY_LOADPIN && DM_VERITY=y && SECURITYFS
|
|
help
|
|
If selected LoadPin can allow reading files from filesystems
|
|
that use dm-verity. LoadPin maintains a list of verity root
|
|
digests it considers trusted. A verity backed filesystem is
|
|
considered trusted if its root digest is found in the list
|
|
of trusted digests.
|
|
|
|
The list of trusted verity can be populated through an ioctl
|
|
on the LoadPin securityfs entry 'dm-verity'. The ioctl
|
|
expects a file descriptor of a file with verity digests as
|
|
parameter. The file must be located on the pinned root and
|
|
start with the line:
|
|
|
|
# LOADPIN_TRUSTED_VERITY_ROOT_DIGESTS
|
|
|
|
This is followed by the verity digests, with one digest per
|
|
line.
|