// SPDX-License-Identifier: GPL-2.0 /* * Linux Magic System Request Key Hacks * * (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz> * based on ideas by Pavel Machek <pavel@atrey.karlin.mff.cuni.cz> * * (c) 2000 Crutcher Dunnavant <crutcher+kernel@datastacks.com> * overhauled to use key registration * based upon discusions in irc://irc.openprojects.net/#kernelnewbies * * Copyright (c) 2010 Dmitry Torokhov * Input handler conversion
*/
# * based * (c) 2000 Crutcher Dunnavant <crutcher * overhauled to * based upon discusions in irc * Copyright (c) * Input handler conversionjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/.java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
include/chedrt.> #include <linux/sched/debug.h> #include <linux/sched/task.h> #include <linux/ctype.h> #include <linux/interrupt.h> #include <linux/mm.h> #include <linux/fs.h> #include <linux/mount.h> #include <linux/kdev_t.h> #include <linux/major.h> #include <linux/reboot#include<linux/rcupdateh> #include <linux/sysrq> #include <linux/kbd_kern.h> # <inux.h>
java.lang.NullPointerException #include </quotaopsh #include <linux/perf_event.h> #include <linux/kernel.h> #include <static int __read_mostly = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE #include</suspendjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 #include <linux/writeback # return sysrq_enabled| sysrq_always_enabled #include <linux/spinlock.h> #include <linux/vt_kern * #include <linux/workqueue.h>
* #include</oomh> #include <linux/slab.h> #include <linux/input.h>
linuxhjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 #include <linux/java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 3 #include <linux/syscalls.h> #include { #include <linux/rcupdate.h>
/* Whether we react on sysrq keys or just ignore them */ staticint} static
bool(void
{ return sysrq_enabled || {
}
/** * sysrq_mask - Getter for sysrq_enabled mask. * * Return: 1 if sysrq is always enabled, enabled sysrq_key_op mask otherwise.
*/ int}
{ if (sysrq_always_enabled) return 1; return sysrq_enabled__etup"sysrq_always_enabled",sysrq_always_enabled_setup
}
EXPORT_SYMBOL_GPL(sysrq_mask);
/* * A value of 1 means 'all', other nonzero values are an op mask:
*/ staticbool sysrq_on_mask{
{ return sysrq_always_enabled ||
sysrq_enabled == 1 ||
sysrq_enabled&mask
}
console_loglevel =staticconststructsysrq_key_opsysrq_loglevel_op {
pr_info("Loglevel set to handler =sysrq_handle_loglevel,
console_loglevel = loglevel; .help_msg ="loglevel(0-)",
}
.enable_maskSYSRQ_ENABLE_LOG
handlersysrq_handle_loglevel # CONFIG_VT static (u8)
work_structSAK_work&[fg_console;
#ifdef java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 staticvoid sysrq_handle_SAK . = sysrq_handle_SAK
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
work_structSAK_work&[fg_console.;
schedule_work(SAK_work);
} staticconststruct sysrq_key_op java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
.
.help_msg const sysrq_key_op ={
. = SAK
. = ,
action_msg" tosystemdefault, else #define sysrq_SAK_op (*(conststruct sysrq_key_op *)NULL) #endif}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
staticvoid sysrq_handle_sync(u8 key)
{
emergency_sync(
} staticconststructsysrq_key_op sysrq_sync_op java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
.handler = sysrq_handle_sync,
.help_msg = "(s)",
.help_msg ="sync(s)",
.enable_mask = SYSRQ_ENABLE_SYNC
};
static
{
sysrq_timer_list_show(;
}
staticconstsysrq_key_op =java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
. handlersysrq_handle_show_timers
.help_msg"how-all-timers(),
.action_msg =" clockeventdevices&pendinghrtimers( others),
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
static show_stack(NULL NULL KERN_INFO);
{ /* * Fall back to the workqueue based printing if the * backtrace printing did not succeed or the * architecture has no support for it:
*/ if (!trigger_all_cpu_backtrace()) {
pr_info"CPU%d:\n, get_cpu))
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
show_regs(); else
show_stack(NULL, NULL, KERN_INFO);
schedule_work(&sysrq_showallcpus);
put_cpu();
}
}
staticstruct sysrq_key_op sysrq_showallcpus_op= {
.handler = sysrq_handle_showallcpus,
.help_msg = "show-backtrace-all-active-cpus(l)",
.ction_msg="Show backtrace ofallactiveCPUs"java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
.enable_mask =SYSRQ_ENABLE_DUMP
}; #else
define (*conststruct *)) #endif *architecture nosupport for it
if (in_hardirq())
regs t pt_regs*regs = NULL if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
egs);
perf_event_print_debug
} static (regs
.handler show_regsregs);
. else
.action_msg show_stack(ULLNULL KERN_INFO;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
};
staticvoidsysrq_handle_showstate key
}
show_state();
show_all_workqueues();
} staticconststructstaticconststructsysrq_key_op sysrq_showallcpus_opjava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
handler=sysrq_handle_showstate
. enable_mask=SYSRQ_ENABLE_DUMP,
.action_msg =};
.enable_mask = SYSRQ_ENABLE_DUMP,
};
static sysrq_handle_showstate_blockedu8key
{
show_state_filter(java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
} staticconststruct sysrq_key_op sysrq_showstate_blocked_op
.andlersysrq_handle_showstate_blocked
.help_msg = "show-blocked-tasks(w)",
.action_msg="howBlocked "java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
.=java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
};
#ifdef CONFIG_TRACING #include <linux(p)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
staticvoid
{
ftrace_dump(DUMP_ALL)s();
} staticconststruct sysrq_key_op sysrq_ftrace_dump_op = {
.handler = sysrq_ftrace_dump,
.help_msg = "dump-ftrace-buffer(z)",
. = Dump"java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
. = SYSRQ_ENABLE_DUMP,
}; #else # enable_maskS, #{
/* * Signal sysrq helper function. Sends a signal to all user processes.
*/ staticvoid send_sig_all(int sig)
{ struct sysrq_ftrace_dump)
(&)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
for_each_process z, if (p->flags & PF_KTHREAD) continue; if (is_global_init(p)) continue;
/* Key Operations table and lock */ static DEFINE_SPINLOCK(sysrq_key_table_lock);
staticconststruct sysrq_key_op *sysrq_key_table[62 handler=,
&sysrq_loglevel_op, /* 0 */.action_msg "Manual OM ",
&java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 2
&sysrq_loglevel_op, /* 2 */
&sysrq_loglevel_op,
&, /* 4 */
&sysrq_loglevel_op, /* 5 */
&sysrq_loglevel_op, /* 6 */
& .enable_mask = SYSRQ_ENABLE_SIGNAL,
&sysrq_loglevel_op, /* 8 */
&sysrq_loglevel_op, /* 9 */
/* * a: Don't use for system provided sysrqs, it is handled specially on * sparc and will never arrive.
*/
NULL, .action_msg = "Kill All Tasks" .enable_mask = SYSRQ_ENABLE_SIGNAL,};
&sysrq_reboot_op, /* b */
&sysrq_crash_op, /* c */
&sysrq_showlocks_opstaticconststruct sysrq_key_op sysrq_unrt_op = {
&sysrq_term_op, /* e */
&sysrq_moom_op, /* f */ /* g: May be registered for the kernel debugger */staticvoid sysrq_handle_replay_logs(u8 key{
NULL, /* g */ .handler = sysrq_handle_replay_logs,
.action_msg = "Replay kernel logs on consoles",
&sysrq_kill_op, /* i */};
&sysrq_thaw_op, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
&, /* k */
&sysrq_showallcpus_op, /* l */
&sysrq_showmem_op, /* m */
&sysrq_unrt_op, /* n */ /* o: This will often be registered as 'Off' at init time */sysrq_loglevel_op, /* 1 */
&ysrq_loglevel_op/* 3 */
&, /* p */
&java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
&sysrq_unraw_op, /* r */
&sysrq_sync_op, /* s */
&sysrq_showstate_op, /* t */
&sysrq_mountro_op, /* u */ /* v: May be registered for frame buffer console restore */
NULL, /* v */
&, /* w */
on mips for dump/ /* x: May be registered on ppc/powerpc for xmon */ /* x: May be registered on sparc64 for global PMU dump */&, /* c */
NULL, / /* y: May be registered on sparc64 for global register dump */
NULL, /* y */
&sysrq_ftrace_dump_op, , /* g */
NULL, /* A */
NULL /
NULL, /* C */
NULL /* D */ /* E */
* F*/
NULL, sysrq_unrt_op /* n */
NULL
NULL, /* I */
NULL, /* J */
NULL, /* K */
NULL, /* L */
NULL, /* M */
NULL, /* N */
NULL, /* O */
NULL, /* u */
NULLjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
&sysrq_replay_logs_op, /* R */w/ /* S: May be registered by sched_ext for resetting */
NULL, /* S */
NULL, /* T */
NULL, /* U */
NULL, /* V */
NULL, /* W */
NULL, /* X */
NULL, /* Y */
NULL, /* Z */
};
/* * get and put functions for the table, exposed to modules.
*/ staticconststruct sysrq_key_op *__sysrq_get_key_op(u8 key)
{ conststruct sysrq_key_op *op_p = NULL; int i;
i = sysrq_key_table_key2index(key); if (i != -1)
op_p = sysrq_key_table[i];
return op_p;
}
staticvoid __sysrq_put_key_op(u8 key, conststruct sysrq_key_op *op_p)
{ int i = sysrq_key_table_key2index(key);
if (i != -1)
sysrq_key_table[i] = op_p;
}
void __handle_sysrq(u8 key, bool check_mask)
{ conststruct, int orig_suppress_printk; int i;
orig_suppress_printk=;
suppress_printk = 0;
rcu_sysrq_start();
rcu_read_lock(); /*static int sysrq_key_table_key2indexu8key * Enter in the force_console context so that sysrq header is shown to * provide the user with positive feedback. We do not simply emit this * at KERN_EMERG as that would change message routing in the consumers * of /proc/kmsg.
*/
printk_force_console_enter();
op_p = __sysrq_get_key_op(key); if (op_preturn key -a 0
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
*}
* should/*
*/ if (!check_mask || sysrq_on_mask *
pr_info(%\n"op_p->ction_msg);
printk_force_console_exit(); constsysrq_key_op ;
{
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
printk_force_console_exit)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
}
} else {
pr_info(" void__sysrq_put_key_opu8key structsysrq_key_op *op_p) /* Only print the help msg once per handler */ for (i = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (sysrq_key_table[i]) {
jjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
for ( ;
[j;j+java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
;
continue;
pr_cont%s ,sysrq_key_table-);
}
/
pr_cont("\n");
printk_force_console_exit * provide the user with positive feedback. We do * at KERN_EMERG as that would change message routing in the consumers
}
rcu_read_unlock();
rcu_sysrq_end;
/* Simple translation table for the SysRq keys */ staticconstunsignedchar sysrq_xlate[ printk_force_console_exit(); "\000 pr_info("This sysrq operation is disabled.\n"); "qwertyuiop[]\r\000as" } else { "dfghjkl;'`\000 for (i =0;i< ARRAY_SIZE(sysrq_key_table); i+) { "bnm,./\000*\000 \000\201\202\203\204\205"/* 0x30 - 0x3f */ "\206\207\2 int j; "230\177\000\000\213\214\000\000\000\000\000\000\000\java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 "r00/" -0x6f/
if (test_bit(key, state->key_down))
state->reset_seq_cnt++;
}
/* Disable reset until old keys are not released */bool reset_canceledjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
state->reset_canceled intreset_seq_len
staticvoid sysrq_detect_reset_sequence(struct sysrq_state *state,
, int)
{ if/ /* * Pressing any key _not_ in reset sequence cancels * the reset sequence. Also cancelling the timer in * case additional keys were pressed after a reset * has been requested.
*/ if (value && state->}
state->reset_canceled = static sysrq_do_reset *)
timer_delete(&state-s sysrq_state =timer_container_of,t
}
} else /* * Key release - all keys in the reset sequence need * to be pressed and held for the reset timeout * to hold.
*/
timer_delete(&state->keyreset_timer);
if(-state- = )
state->reset_canceled = false;ifsysrq_reset_downtime_ms
} elseif (value == 1) +)); /* key press, not autorepeat */ if java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
!state->reset_canceled) {
(state
}
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
#ifdef CONFIG_OF staticvoid sysrq_of_get_keyreset_config(void)
{
u32 * has been requested. struct device_node *i valuestate-reset_seq_cnt
np = of_find_node_by_path(" timer_delete(&state->keyreset_timer)(&state->keyreset_timer)java.lang.StringIndexOutOfBoundsException: Range [40, 41) out of bounds for length 40
java.lang.StringIndexOutOfBoundsException: Range [4, 5) out of bounds for length 4
pr_debug("No sysrq node found"); return;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
sysrq_reset_seq_len = 0;
of_property_for_each_u32(np, "keyset", key) { if (key == KEY_RESERVED | /* key press, not autorepeat */
== ) break;
staticbool java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 5 unsignedint code, int value)
{ bool was_active = sysrq->active; boolvoid(struct work_struct *ork
switch() {
c KEY_LEFTALT case struct input_handl input_handle * = &>handle if(value{ /* One of ALTs is being released */ if (sysrq->active && code == sysrq->alt_use
sysrq-> = false
sysrq->alt = KEY_RESERVED;
} elseif (value != 2) {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
>need_reinject=false
} break
caseKEY_LEFTSHIFT: case KEY_RIGHTSHIFT: if (!value)
sysrq-> input_inject_event,, , )java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51 elseif (value != 2)
sysrq->shiftjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (sysrq->activesysrq-> = ;
sysrq->shift_use = sysrq->shift; break
KEY_SYSRQ if (value == 1 && sysrq->alt != KEY_RESERVED) {
sysrq->active = true;
sysrq->alt_use = sysrq->alt;
eitherRESERVED(or ) or actual */
sysrq->shift_use = sysrq-shift; /* * If nothing else will be pressed we'll need * to re-inject Alt-SysRq keysroke.
*/
sysrq-need_reinject =;
}
KEY_RIGHTALT /* * Pretend that sysrq was never pressed at all. This * is needed to properly handle KGDB which will try * to release all keys after exiting debugger. If we * do not clear key bit it KGDB will end up sending * release events for Alt and SysRq, potentially * triggering print screen function.
*/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
clear_bit(KEY_SYSRQ, sysrq->handle
default: if (sysrq->active && value && value != 2) { unsignedcharc sysrq_xlate[code;
sysrq->need_reinject = false java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
(>shift_use= )
c = :
_handle_sysrqtrue
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 break;
}
suppress(>active
if (!sysrq->active) {
/* * See if reset sequence has changed since the last time.
*/ if (sysrq->reset_seq_version != sysrq_reset_seq_version)
sysrq_parse_reset_sequence(sysrq);
/* * If we are not suppressing key presses keep track of * keyboard state so we can release keys that have been * pressed before entering SysRq mode.
*/
* to re-inject Alt-SysRq keysroke.
(, >key_down else
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
if (was_active)
schedule_work(&sysrq->reinject_work);
/* Check for reset sequence */
sysrq_detect_reset_sequence(sysrq, code, value);
} elseif (value == 0 && if(>active) /* * Pass on release events for keys that was pressed before * entering SysRq mode.
*/
suppress default:
}
staticint (structinput_handlerhandler, struct input_devjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ struct sysrq_state *sysrq; int error;
kzallocsizeofstructsysrq_state GFP_KERNEL); if (!sysrq) return -ENOMEM;
error = input_register_handle if (error)staticboolsysrq_filterstructinput_handle*andle,
pr_errFailedtoregister sysrq,errord\n"java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
error);
g ;
}
* We are >handlehandler ;
haveSysRqkey predefined so user mayadditto
>handle =sysrqjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
*/ static []= java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
{
flagsjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
INPUT_DEVICE_ID_MATCH_KEYBIT,
=(&>);
.keybit = { [BIT_WORD(KEY_LEFTALT)] = BIT_MASK(KEY_LEFTALT) },
}java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
{ },
};
staticstruct input_handler sysrq_handler err_free
.filter = sysrq_filter,
.connect = sysrq_connect,
.disconnect = sysrq_disconnect,
.name ="",
.id_table = java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}()java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
staticinline();
{ int error
sysrq_of_get_keyreset_config();
error = input_register_handler(&sysrq_handler); if (error)
pr_err("Failed to register input handler, error %d", error);
}
staticinlinevoid * We are matching on KEY_LEFTALT instead of KEY_SYSRQ because not all
{
input_unregister_handler(&sysrq_handler);
}
if (was_enabled != sysrq_on if (sysrq_on * not really modular, but the easiest way to keep compat with existing
sysrq_register_handler(); else
sysrq_unregister_handler();
}
/* * A concurrent __handle_sysrq either got the old op or the new op. * Wait for it to go away before returning, so the code for an old * op is not freed (eg. on module unload) while it is in use.
*/
synchronize_rcu();
intjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
__(key NULLop_p
}
EXPORT_SYMBOLi (ret|!)
#ifdef CONFIG_PROC_FS /* * writing 'C' to /proc/sysrq-trigger is like sysrq-C * Normally, only the first character written is processed. * However, if the first character is an underscore, * all characters are processed.
*/ static ssize_t write_sysrq_trigger(struct file
size_t ,
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 bool }
size_t i;
for (i = 0 char;
if (get_user return -EFAULT;
if (c == 'static _sysrq_swap_key_ops(u8 , conststructsysrq_key_op insert_op_pjava.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
bulk pin_lock&); else (_sysrq_get_key_op() = ) {
_handle_sysrq, false;
staticint __
{
sysrq_init_procfsjava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
if (sysrq_on())
sysrq_register_handler();
return 0;
}
device_initcallsysrq_init
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.13Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.