tty: only print sysrq help for handlers that are enabled
PATCH 1/1 tty: only print sysrq help for handlers that are enabled
Also print out a notice when sysrq is in selective mode.
--- drivers/tty/sysrq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/tty/sysrq.c +6 -1
@@ -548,9 +548,14 @@ void __handle_sysrq(int key, bool check_mask) ;if (j != i)continue ; -printk ("%s " , sysrq_key_table[i]->help_msg); +/* only print if handler is enabled */ +if (sysrq_enabled &1 || + sysrq_enabled & sysrq_key_table[i]->enable_mask) +printk ("%s " , sysrq_key_table[i]->help_msg); } } +if (!(sysrq_enabled &1 )) +printk ("(some options are disabled)" );printk ("\n" ); console_loglevel = orig_log_level; }
Signature · 1 line
1.8.4.4
Greg Kroah-Hartman
maintainerQuoted 17 lines · Shawn Landden
Also print out a notice when sysrq is in selective mode.
Signed-off-by Shawn Landden <[email protected]>--- drivers/tty/sysrq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/tty/sysrq.c +1
-1@@ -548,9 +548,14 @@ void __handle_sysrq(int key, bool check_mask) ;if (j != i)continue ; -printk ("%s " , sysrq_key_table[i]->help_msg); +/* only print if handler is enabled */
drivers/tty/sysrq.c void __handle_sysrq(int key, bool check_mask) · line 561
Quoted 10 lines
drivers/tty/sysrq.c +5
-0+if (sysrq_enabled &1 || + sysrq_enabled & sysrq_key_table[i]->enable_mask) +printk ("%s " , sysrq_key_table[i]->help_msg); } } +if (!(sysrq_enabled &1 )) +printk ("(some options are disabled)" );printk ("\n" ); console_loglevel = orig_log_level; }
What exactly is this fixing? What is broken here that this change resolves? Where is it applicable? I need a lot more context here please.
thanks,
greg k-h
Quoted 24 lines · Shawn Landden
Quoted 23 lines
Also print out a notice when sysrq is in selective mode.
Signed-off-by Shawn Landden <[email protected]>--- drivers/tty/sysrq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/tty/sysrq.c +5
-1@@ -548,9 +548,14 @@ void __handle_sysrq(int key, bool check_mask) ;if (j != i)continue ; -printk ("%s " , sysrq_key_table[i]->help_msg); +/* only print if handler is enabled */ +if (sysrq_enabled &1 || + sysrq_enabled & sysrq_key_table[i]->enable_mask) +printk ("%s " , sysrq_key_table[i]->help_msg); } } +if (!(sysrq_enabled &1 ))
Quoted 8 lines
drivers/tty/sysrq.c void __handle_sysrq(int key, bool check_mask) · line 561
Quoted 4 lines
drivers/tty/sysrq.c +1
-0+printk ("(some options are disabled)" );printk ("\n" ); console_loglevel = orig_log_level; }What exactly is this fixing? What is broken here that this change resolves? Where is it applicable? I need a lot more context here please.
Without this patch you get something like
re[b]oot [r]aw [s]ync [h]elp ....
even if none of these sysrq triggers are available because of the setting mask of
kernel.sysrq
With this patch then if (e.g.)
kernel.sysrq = 16
then you will only see
[s]ync
i.e. those commands you have privilege to issue via sysrq keypresses. Contact me if you need more,
Shawn
Quoted 5 lines
thanks,
greg k-h
Quoted 33 lines · On 12/24/2013 12:04 AM, [email protected] wrote:
Quoted 24 lines · Shawn Landden
Quoted 23 lines
Also print out a notice when sysrq is in selective mode.
Signed-off-by Shawn Landden <[email protected]>--- drivers/tty/sysrq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/tty/sysrq.c +5
-1@@ -548,9 +548,14 @@ void __handle_sysrq(int key, bool check_mask) ;if (j != i)continue ; -printk ("%s " , sysrq_key_table[i]->help_msg); +/* only print if handler is enabled */ +if (sysrq_enabled &1 || + sysrq_enabled & sysrq_key_table[i]->enable_mask) +printk ("%s " , sysrq_key_table[i]->help_msg); } } +if (!(sysrq_enabled &1 ))Quoted 8 lines
drivers/tty/sysrq.c void __handle_sysrq(int key, bool check_mask) · line 561
Quoted 4 lines
drivers/tty/sysrq.c +1
-0+printk ("(some options are disabled)" );printk ("\n" ); console_loglevel = orig_log_level; }What exactly is this fixing? What is broken here that this change resolves? Where is it applicable? I need a lot more context here please.
Quoted 12 lines
Without this patch you get something like
re[b]oot [r]aw [s]ync [h]elp ....
even if none of these sysrq triggers are available because of the setting mask of
kernel.sysrq
With this patch then if (e.g.)
kernel.sysrq = 16
then you will only see
[s]ync
i.e. those commands you have privilege to issue via sysrq keypresses. Contact me if you need more,
Shawn
But all operations are enabled when triggered via /proc/sysrq-trigger. How about indicating key-disabled operations with a symbol instead?
Regards,
Peter Hurley