Skip to contentSkip to conversation

ACPI / EC: Mark the ec_sys write_support param as module_param_hw()

PATCH In review Hans de Goede 3 participants 3 messages Nov 25, 2021 – Dec 1, 2021 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI / EC: Mark the ec_sys write_support param as module_param_hw()

Using write_support=1 with the ec_sys module changes the mode of the "io" debugfs file to 0600. This will cause any attempts to access it under a kernel in lockdown mode to return -EPERM, which makes the entire ec_sys module unusable.

Use the special module_param_hw() macro for module parameters which may not be used while in lockdown mode, to avoid this.

---
 drivers/acpi/ec_sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/ec_sys.c +1 -1
index fd39c14493ab..c074a0fae059 100644
@@ -19,7 +19,7 @@ MODULE_DESCRIPTION("ACPI EC sysfs access driver");
 MODULE_LICENSE("GPL");
 
 static bool write_support;
-module_param(write_support, bool, 0644);
+module_param_hw(write_support, bool, other, 0644);
 MODULE_PARM_DESC(write_support, "Dangerous, reboot and removal of battery may "
 		 "be needed.");
 
Signature · 1 line
2.33.1
#1 lore raw
Quoted 20 lines · Hans de Goede

Using write_support=1 with the ec_sys module changes the mode of the "io" debugfs file to 0600. This will cause any attempts to access it under a kernel in lockdown mode to return -EPERM, which makes the entire ec_sys module unusable.

Use the special module_param_hw() macro for module parameters which may not be used while in lockdown mode, to avoid this.

---
 drivers/acpi/ec_sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/ec_sys.c +0 -0
index fd39c14493ab..c074a0fae059 100644

drivers/acpi/ec_sys.c MODULE_DESCRIPTION("ACPI EC sysfs access driver"); · line 25

Quoted 8 lines
drivers/acpi/ec_sys.c +1 -1
@@ -19,7 +19,7 @@ MODULE_DESCRIPTION("ACPI EC sysfs access driver");
 MODULE_LICENSE("GPL");
 
 static bool write_support;
-module_param(write_support, bool, 0644);
+module_param_hw(write_support, bool, other, 0644);
 MODULE_PARM_DESC(write_support, "Dangerous, reboot and removal of battery may "
 		 "be needed.");
 

Looks good to me. Thanks Hans
Mark

#2 lore raw
Quoted 24 lines · Mark Pearson
Quoted 21 lines · Hans de Goede

Using write_support=1 with the ec_sys module changes the mode of the "io" debugfs file to 0600. This will cause any attempts to access it under a kernel in lockdown mode to return -EPERM, which makes the entire ec_sys module unusable.

Use the special module_param_hw() macro for module parameters which may not be used while in lockdown mode, to avoid this.

---
 drivers/acpi/ec_sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/ec_sys.c +0 -0
index fd39c14493ab..c074a0fae059 100644
@@ -19,7 +19,7 @@ MODULE_DESCRIPTION("ACPI EC sysfs access driver");
 MODULE_LICENSE("GPL");
 
Quoted 9 lines

drivers/acpi/ec_sys.c MODULE_DESCRIPTION("ACPI EC sysfs access driver"); · line 25

Quoted 7 lines
drivers/acpi/ec_sys.c +1 -1
 static bool write_support;
-module_param(write_support, bool, 0644);
+module_param_hw(write_support, bool, other, 0644);
 MODULE_PARM_DESC(write_support, "Dangerous, reboot and removal of battery may "
               "be needed.");
 

Looks good to me. Thanks Hans
Mark

Patch applied as 5.17 material, thanks!