Re: [PATCH] i8042: Add debug_kbd option
From: Joe Perches <joe@perches.com>
Date: 2015-06-25 20:00:22
Also in:
lkml
On Thu, 2015-06-25 at 15:25 -0400, cpaul@redhat.com wrote:
From: Stephen Chandler Paul <redacted> A big problem with the current i8042 debugging option is that it outputs data going to and from the keyboard by default. As a result, many dmesg logs uploaded by users will unintentionally contain sensitive information such as their password, as such it's probably a good idea not to output data coming from the keyboard unless specifically enabled by the user.
Seems sensible. Coupla trivial bits:
quoted hunk ↗ jump to hunk
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
[]
quoted hunk ↗ jump to hunk
@@ -88,6 +88,23 @@ MODULE_PARM_DESC(nopnp, "Do not use PNP to detect controller settings"); static bool i8042_debug; module_param_named(debug, i8042_debug, bool, 0600); MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off"); + +static bool i8042_debug_kbd; +module_param_named(debug_kbd, i8042_debug_kbd, bool, 0600); +MODULE_PARM_DESC(i8042_kbd, "Turn i8042 kbd debugging output on or off");
It's unclear this depends on i8042_debug. Maybe add something like " (enabling requires i8042_debug=1)"
+#define str_dbg(str, data, format, args...) \
+ do { \
+ if (!i8042_debug) \
+ break; \
+ \
+ if (str & I8042_STR_AUXDATA || i8042_debug_kbd) \
+ dbg("%02x " format, data, ##args); \
+ else \
+ dbg("** " format, ##args); \
+ } while (0)
+#else
+#define str_dbg(str, data, format, args...) do { } while (0)
#endifThis should probably go into i8042.h where the dbg macro is #defined