From a6080762a6813ad26ed6d17353b8b214367fe013 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Tue, 27 Feb 2024 11:52:04 -0800 Subject: [PATCH] ANDROID: GKI: Completely disable module autoloading Android's SELinux policy prohibits module autoloading, so init(1) disables the kernel's module loader using the sysctl interface during its early-init phase (see aosp/1254748). However, this leaves a window of time between when the SELinux policy is loaded and when the init script is processed where the kernel can try and fail to autoload a module. This failure was observed on some SiFive platforms, where an Ethernet controller driver is loaded from the vendor ramdisk, and the kernel later attempts to autoload a PHY driver module based on its MDIO ID. If the module loading attempt occurs during the race window, it is denied by SELinux, and PHY initialization fails instead of falling back to the generic PHY driver. This prevents the Ethernet driver from probing. Fix the race by disabling module autoloading statically, instead of during boot. This is achieved by using an empty string for the module loader path, as in aosp/1254748. Bug: 327245884 Change-Id: I0d140695baf451885148d61b2e38f09b63ad40d0 Signed-off-by: Samuel Holland --- arch/arm64/configs/gki_defconfig | 1 + arch/riscv/configs/gki_defconfig | 1 + arch/x86/configs/gki_defconfig | 1 + 3 files changed, 3 insertions(+) diff --git a/arch/arm64/configs/gki_defconfig b/arch/arm64/configs/gki_defconfig index 874c6e17f719..20f55fabf909 100644 --- a/arch/arm64/configs/gki_defconfig +++ b/arch/arm64/configs/gki_defconfig @@ -87,6 +87,7 @@ CONFIG_MODVERSIONS=y CONFIG_MODULE_SCMVERSION=y CONFIG_MODULE_SIG=y CONFIG_MODULE_SIG_PROTECT=y +CONFIG_MODPROBE_PATH="" CONFIG_BLK_DEV_ZONED=y CONFIG_BLK_CGROUP_IOPRIO=y CONFIG_BLK_INLINE_ENCRYPTION=y diff --git a/arch/riscv/configs/gki_defconfig b/arch/riscv/configs/gki_defconfig index 8fb56dc95841..e9aa70c39034 100644 --- a/arch/riscv/configs/gki_defconfig +++ b/arch/riscv/configs/gki_defconfig @@ -72,6 +72,7 @@ CONFIG_MODVERSIONS=y CONFIG_MODULE_SCMVERSION=y CONFIG_MODULE_SIG=y CONFIG_MODULE_SIG_PROTECT=y +CONFIG_MODPROBE_PATH="" CONFIG_BLK_DEV_ZONED=y CONFIG_BLK_CGROUP_IOPRIO=y CONFIG_BLK_INLINE_ENCRYPTION=y diff --git a/arch/x86/configs/gki_defconfig b/arch/x86/configs/gki_defconfig index d97ae3856351..af0e6136cb16 100644 --- a/arch/x86/configs/gki_defconfig +++ b/arch/x86/configs/gki_defconfig @@ -84,6 +84,7 @@ CONFIG_MODVERSIONS=y CONFIG_MODULE_SCMVERSION=y CONFIG_MODULE_SIG=y CONFIG_MODULE_SIG_PROTECT=y +CONFIG_MODPROBE_PATH="" CONFIG_BLK_DEV_ZONED=y CONFIG_BLK_CGROUP_IOPRIO=y CONFIG_BLK_INLINE_ENCRYPTION=y