From 4e1776cedfaa68fab341e657e025ae31eb95f194 Mon Sep 17 00:00:00 2001 From: Will Deacon Date: Fri, 31 May 2024 15:34:18 +0000 Subject: [PATCH] Revert "Load modules from _16K dir when running on 16K kernel" This reverts commit ffdb017e7d0141d09d67c735913196a8dc166671. Overriding an explicitly-specified module path (e.g. passed via the '-d ' argument) because the kernel is using 16KiB pages is inconsistent and unexpected. Revert this change in anticipation of filtering incompatible modules instead. Bug: 343971855 Test: Verified that _16k module directory is excluded by modprobe when running in userspace fastboot with 4k pages. Change-Id: If9c6e2d26fc53b12f543d531d64ef3d288ddc179 --- toolbox/modprobe.cpp | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/toolbox/modprobe.cpp b/toolbox/modprobe.cpp index b0e76ea81..45dd9b8c1 100644 --- a/toolbox/modprobe.cpp +++ b/toolbox/modprobe.cpp @@ -15,7 +15,6 @@ */ #include -#include #include #include @@ -28,7 +27,6 @@ #include #include -#include namespace { @@ -107,11 +105,6 @@ static int KernelVersionNameFilter(const dirent* de) { return 0; } -std::string GetPageSizeSuffix() { - static const size_t page_size = sysconf(_SC_PAGE_SIZE); - return android::base::StringPrintf("_%zuk", page_size / 1024); -} - } // anonymous namespace extern "C" int modprobe_main(int argc, char** argv) { @@ -240,19 +233,6 @@ extern "C" int modprobe_main(int argc, char** argv) { // Allow modules to be directly inside /lib/modules mod_dirs.emplace_back(LIB_MODULES_PREFIX); } - if (getpagesize() != 4096) { - struct utsname uts {}; - if (uname(&uts)) { - PLOG(FATAL) << "Failed to get kernel version"; - } - const auto module_dir = android::base::StringPrintf("/lib/modules/%s%s", uts.release, - GetPageSizeSuffix().c_str()); - struct stat st {}; - if (stat(module_dir.c_str(), &st) == 0 && S_ISDIR(st.st_mode)) { - mod_dirs.clear(); - mod_dirs.emplace_back(module_dir); - } - } LOG(DEBUG) << "mode is " << mode; LOG(DEBUG) << "mod_dirs is: " << android::base::Join(mod_dirs, " ");