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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250617051930.3376981-2-matthew.schwartz@linux.dev>
Date: Mon, 16 Jun 2025 22:19:29 -0700
From: Matthew Schwartz <matthew.schwartz@...ux.dev>
To: dmitry.torokhov@...il.com
Cc: linux-input@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Matthew Schwartz <matthew.schwartz@...ux.dev>
Subject: [PATCH 1/2] Input: i8042 - Add nokbdwakeup quirk to stop keyboard wakeup from s2idle

Some platforms will register volume buttons via an i8042 keyboard device,
even though they lack a physical keyboard or lid like a traditional laptop.
In such cases, allowing the i8042 keyboard to wake the device from s2idle 
may not be desirable behavior.

In order to account for this, add a new quirk, nokbdwakeup, to disable
the keyboard wakeup functionality in i8042 on such platforms.

Signed-off-by: Matthew Schwartz <matthew.schwartz@...ux.dev>
---
 drivers/input/serio/i8042-acpipnpio.h | 8 ++++++--
 drivers/input/serio/i8042.c           | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/input/serio/i8042-acpipnpio.h b/drivers/input/serio/i8042-acpipnpio.h
index 6ed9fc34948cb..6dbe9d8523f49 100644
--- a/drivers/input/serio/i8042-acpipnpio.h
+++ b/drivers/input/serio/i8042-acpipnpio.h
@@ -84,6 +84,7 @@ static inline void i8042_write_command(int val)
 #define SERIO_QUIRK_DRITEK		BIT(13)
 #define SERIO_QUIRK_NOPNP		BIT(14)
 #define SERIO_QUIRK_FORCENORESTORE	BIT(15)
+#define SERIO_QUIRK_NOKBDWAKEUP		BIT(16)
 
 /* Quirk table for different mainboards. Options similar or identical to i8042
  * module parameters.
@@ -1725,6 +1726,8 @@ static void __init i8042_check_quirks(void)
 #endif
 	if (quirks & SERIO_QUIRK_FORCENORESTORE)
 		i8042_forcenorestore = true;
+	if (quirks & SERIO_QUIRK_NOKBDWAKEUP)
+		i8042_nokbdwakeup = true;
 }
 #else
 static inline void i8042_check_quirks(void) {}
@@ -1758,7 +1761,7 @@ static int __init i8042_platform_init(void)
 
 	i8042_check_quirks();
 
-	pr_debug("Active quirks (empty means none):%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+	pr_debug("Active quirks (empty means none):%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
 		i8042_nokbd ? " nokbd" : "",
 		i8042_noaux ? " noaux" : "",
 		i8042_nomux ? " nomux" : "",
@@ -1782,7 +1785,8 @@ static int __init i8042_platform_init(void)
 #else
 		"",
 #endif
-		i8042_forcenorestore ? " forcenorestore" : "");
+		i8042_forcenorestore ? " forcenorestore" : "",
+		i8042_nokbdwakeup ? " nokbdwakeup" : "");
 
 	retval = i8042_pnp_init();
 	if (retval)
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index cab5a4c5baf52..056a83cb69d66 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -49,6 +49,10 @@ static bool i8042_probe_defer;
 module_param_named(probe_defer, i8042_probe_defer, bool, 0);
 MODULE_PARM_DESC(probe_defer, "Allow deferred probing.");
 
+static bool i8042_nokbdwakeup;
+module_param_named(nokbdwakeup, i8042_nokbdwakeup, bool, 0);
+MODULE_PARM_DESC(nokbdwakeup, "Disable keyboard port from waking up the system.");
+
 enum i8042_controller_reset_mode {
 	I8042_RESET_NEVER,
 	I8042_RESET_ALWAYS,
@@ -423,13 +427,13 @@ static int i8042_start(struct serio *serio)
 	/*
 	 * On platforms using suspend-to-idle, allow the keyboard to
 	 * wake up the system from sleep by enabling keyboard wakeups
-	 * by default.  This is consistent with keyboard wakeup
+	 * by default unless quirked. This is consistent with keyboard wakeup
 	 * behavior on many platforms using suspend-to-RAM (ACPI S3)
 	 * by default.
 	 */
 	if (pm_suspend_default_s2idle() &&
 	    serio == i8042_ports[I8042_KBD_PORT_NO].serio) {
-		device_set_wakeup_enable(&serio->dev, true);
+		device_set_wakeup_enable(&serio->dev, !i8042_nokbdwakeup);
 	}
 
 	guard(spinlock_irq)(&i8042_lock);
-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ