lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 20 Nov 2017 10:24:06 -0800 From: "Luis R. Rodriguez" <mcgrof@...nel.org> To: gregkh@...uxfoundation.org Cc: akpm@...ux-foundation.org, keescook@...omium.org, mfuzzey@...keon.com, zohar@...ux.vnet.ibm.com, dhowells@...hat.com, pali.rohar@...il.com, tiwai@...e.de, arend.vanspriel@...adcom.com, zajec5@...il.com, nbroeking@...com, markivx@...eaurora.org, stephen.boyd@...aro.org, broonie@...nel.org, dmitry.torokhov@...il.com, dwmw2@...radead.org, torvalds@...ux-foundation.org, Abhay_Salunke@...l.com, bjorn.andersson@...aro.org, jewalt@...innovations.com, linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org, "Luis R. Rodriguez" <mcgrof@...nel.org> Subject: [PATCH v2 20/23] firmware: add debug facility to emulate disabling sysfs fallback One can build a kernel without CONFIG_FW_LOADER_USER_HELPER being enabled, but testing it requires a unique kernel configuration most folks do not enable. This makes it hard to test. Provide a debugfs facility to enable us to emulate such kernels. Signed-off-by: Luis R. Rodriguez <mcgrof@...nel.org> --- drivers/base/firmware_debug.c | 5 +++++ drivers/base/firmware_debug.h | 14 ++++++++++++++ drivers/base/firmware_loader.c | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/drivers/base/firmware_debug.c b/drivers/base/firmware_debug.c index f2817eb6f480..9332f0acfa8f 100644 --- a/drivers/base/firmware_debug.c +++ b/drivers/base/firmware_debug.c @@ -20,6 +20,11 @@ int __init register_fw_debugfs(void) &fw_debug.force_sysfs_fallback)) goto err_out; + if (!debugfs_create_bool("ignore_sysfs_fallback", S_IRUSR | S_IWUSR, + debugfs_firmware, + &fw_debug.ignore_sysfs_fallback)) + goto err_out; + return 0; err_out: debugfs_remove_recursive(debugfs_firmware); diff --git a/drivers/base/firmware_debug.h b/drivers/base/firmware_debug.h index bc41bbca9a54..5f551d8b9003 100644 --- a/drivers/base/firmware_debug.h +++ b/drivers/base/firmware_debug.h @@ -12,9 +12,13 @@ * as if one had enabled CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y. * Useful to help debug a CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y * functionality on a kernel where that config entry has been disabled. + * @ignore_sysfs_fallback: force to disable the sysfs fallback mechanism. + * This emulates the behaviour as if we had set the kernel + * config CONFIG_FW_LOADER_USER_HELPER=n. */ struct firmware_debug { bool force_sysfs_fallback; + bool ignore_sysfs_fallback; }; extern struct firmware_debug fw_debug; @@ -26,6 +30,11 @@ static inline bool fw_debug_force_sysfs_fallback(void) { return fw_debug.force_sysfs_fallback; } + +static inline bool fw_debug_ignore_sysfs_fallback(void) +{ + return fw_debug.ignore_sysfs_fallback; +} #else static inline int register_fw_debugfs(void) { @@ -39,6 +48,11 @@ static inline bool fw_debug_force_sysfs_fallback(void) { return false; } + +static inline bool fw_debug_ignore_sysfs_fallback(void) +{ + return false; +} #endif /* CONFIG_FW_LOADER_DEBUG */ #endif /* __FIRMWARE_DEBUG_H */ diff --git a/drivers/base/firmware_loader.c b/drivers/base/firmware_loader.c index b2b52ba9f245..6c44ede98be0 100644 --- a/drivers/base/firmware_loader.c +++ b/drivers/base/firmware_loader.c @@ -1170,6 +1170,11 @@ static bool fw_force_sysfs_fallback(unsigned int opt_flags) static bool fw_run_sysfs_fallback(unsigned int opt_flags) { + if (fw_debug_ignore_sysfs_fallback()) { + pr_info("Ignoring firmware sysfs fallback due to debugfs knob\n"); + return false; + } + if ((opt_flags & FW_OPT_NOFALLBACK)) return false; -- 2.15.0
Powered by blists - more mailing lists