All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: only print sysrq help for handlers that are enabled
@ 2013-12-03 15:55 Shawn Landden
  2013-12-13  2:32 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Shawn Landden @ 2013-12-03 15:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby; +Cc: linux-kernel, Shawn Landden

Also print out a notice when sysrq is in selective mode.

Signed-off-by: Shawn Landden <shawn@churchofgit.com>
---
 drivers/tty/sysrq.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index ce396ec..4eee0e4 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -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;
 	}
-- 
1.8.4.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tty: only print sysrq help for handlers that are enabled
  2013-12-03 15:55 [PATCH] tty: only print sysrq help for handlers that are enabled Shawn Landden
@ 2013-12-13  2:32 ` Greg Kroah-Hartman
  2013-12-24  5:04   ` shawn
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2013-12-13  2:32 UTC (permalink / raw)
  To: Shawn Landden; +Cc: Jiri Slaby, linux-kernel

On Tue, Dec 03, 2013 at 07:55:25AM -0800, Shawn Landden wrote:
> Also print out a notice when sysrq is in selective mode.
> 
> Signed-off-by: Shawn Landden <shawn@churchofgit.com>
> ---
>  drivers/tty/sysrq.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
> index ce396ec..4eee0e4 100644
> --- a/drivers/tty/sysrq.c
> +++ b/drivers/tty/sysrq.c
> @@ -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;
>  	}

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tty: only print sysrq help for handlers that are enabled
  2013-12-13  2:32 ` Greg Kroah-Hartman
@ 2013-12-24  5:04   ` shawn
  2013-12-24 12:43     ` Peter Hurley
  0 siblings, 1 reply; 4+ messages in thread
From: shawn @ 2013-12-24  5:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Shawn Landden, Jiri Slaby, linux-kernel

> On Tue, Dec 03, 2013 at 07:55:25AM -0800, Shawn Landden wrote:
>> Also print out a notice when sysrq is in selective mode.
>>
>> Signed-off-by: Shawn Landden <shawn@churchofgit.com>
>> ---
>>  drivers/tty/sysrq.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
>> index ce396ec..4eee0e4 100644
>> --- a/drivers/tty/sysrq.c
>> +++ b/drivers/tty/sysrq.c
>> @@ -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;
>>  	}
>
> 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
>
> thanks,
>
> greg k-h
>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tty: only print sysrq help for handlers that are enabled
  2013-12-24  5:04   ` shawn
@ 2013-12-24 12:43     ` Peter Hurley
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Hurley @ 2013-12-24 12:43 UTC (permalink / raw)
  To: shawn, Greg Kroah-Hartman; +Cc: Jiri Slaby, linux-kernel

On 12/24/2013 12:04 AM, shawn@churchofgit.com wrote:
>> On Tue, Dec 03, 2013 at 07:55:25AM -0800, Shawn Landden wrote:
>>> Also print out a notice when sysrq is in selective mode.
>>>
>>> Signed-off-by: Shawn Landden <shawn@churchofgit.com>
>>> ---
>>>   drivers/tty/sysrq.c | 7 ++++++-
>>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
>>> index ce396ec..4eee0e4 100644
>>> --- a/drivers/tty/sysrq.c
>>> +++ b/drivers/tty/sysrq.c
>>> @@ -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;
>>>   	}
>>
>> 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

But all operations are enabled when triggered via /proc/sysrq-trigger.
How about indicating key-disabled operations with a symbol instead?

Regards,
Peter Hurley


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-12-24 12:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-03 15:55 [PATCH] tty: only print sysrq help for handlers that are enabled Shawn Landden
2013-12-13  2:32 ` Greg Kroah-Hartman
2013-12-24  5:04   ` shawn
2013-12-24 12:43     ` Peter Hurley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.