bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12478: cat SEGV when I press Ctrl-Alt-SysRq-1 on text console


From: Bob Proulx
Subject: bug#12478: cat SEGV when I press Ctrl-Alt-SysRq-1 on text console
Date: Mon, 1 Oct 2012 14:53:45 -0600
User-agent: Mutt/1.5.21 (2010-09-15)

Rafal W. wrote:
> Thanks. Without Control more things are working.
> Alt-SysRq-m and other letters works, doesn't kill the process.
> So the only problems are numbers:
> Alt-SysRq-1 to 9 (exempt 5 & 6) is killing the process.
> Looks like 5 and 6 have some special privileges.

Typically 5 and 6 will change the kernel logging level to those
values.  For whatever reason on my Debian system the other numbers are
not enabled to change the log level.  I have never bothered to
investigate why.  On my system the other number 1-4,7-9,0 keys appear
to do nothing.  But it is documented that the Alt-SysRq-0 through
Alt-SysRq-9 keys set the console log level.

  http://kernel.org/doc/Documentation/sysrq.txt

The useful kernel log levels are:

  #define KERN_EMERG   "<0>" /* system is unusable                    */
  #define KERN_ALERT   "<1>" /* action must be taken immediately      */
  #define KERN_CRIT    "<2>" /* critical conditions                   */
  #define KERN_ERR     "<3>" /* error conditions                      */
  #define KERN_WARNING "<4>" /* warning conditions                    */
  #define KERN_NOTICE  "<5>" /* normal but significant condition      */
  #define KERN_INFO    "<6>" /* informational                         */
  #define KERN_DEBUG   "<7>" /* debug-level messages                  */

The linux kernel default is 8 so that all messages are logged to the
console.  This can produce a large amount of noise to the point of
making the console unusable on a firewall machine with an active
Internet connection since this will cause many log events rapidly
consuming the screen display.  At least one distro sets it to 3 and
another leaves it at the linux kernel default setting of 8.  I
normally set this to 5 to reduce the noise on the console.  I normally
do this with the 'dmesg -n5' command in the firewall init scripts but
there are several different ways to set this.  The key sequence is
intended to restore usability to a console that is getting bombarded
with log events and Alt-SysRq-5 is useful for that purpose.

I think you should determine what actions are enabled on your system.
You can do this by using the /proc kernel interface directly.

  $ cat /proc/sys/kernel/sysrq

What level number is produced there?

  # echo h > /proc/sysrq-trigger
  # tail /var/log/syslog (or tail /var/log/messages or whatever)

On my system it shows:

  $ cat /proc/sys/kernel/sysrq
  438

That is 0x1b6 or 2 + 4 + 16 + 32 + 128 + 256 and with this bitmap we
can see that some features are not enabled by default on my system.

          2 - enable control of console logging level
          4 - enable control of keyboard (SAK, unraw)
          8 - enable debugging dumps of processes etc.
         16 - enable sync command
         32 - enable remount read-only
         64 - enable signalling of processes (term, kill, oom-kill)
        128 - allow reboot/poweroff
        256 - allow nicing of all RT tasks

  # echo h > /proc/sysrq-trigger
  # tail /var/log/syslog
  ... SysRq : HELP : loglevel(0-9) reBoot Crash terminate-all-tasks(E) 
memory-full-oom-kill(F) kill-all-tasks(I) thaw-filesystems(J) saK 
show-backtrace-all-active-cpus(L) show-memory-usage(M) nice-all-RT-tasks(N) 
powerOff show-registers(P) show-all-timers(Q) unRaw Sync show-task-states(T) 
Unmount force-fb(V) show-blocked-tasks(W) dump-ftrace-buffer(Z)

Running 'tail -f /var/log/syslog' (or /var/log/messages, or whatever)
while you are testing pressing those keys is useful because the kernel
will log actions taken there.

Bob





reply via email to

[Prev in Thread] Current Thread [Next in Thread]