mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
Sysrq must be enabled via /proc/sys/kernel/sysrq as a security measure to enable various critical fiq debugger commands that either leak information or can be used as a system attack. Default disabled, this will leave the reboot, reset, irqs, sleep, nosleep, console and ps commands. Reboot and reset commands will be restricted from taking any parameters. We will also switch to showing the limited command set in this mode. Signed-off-by: Mark Salyzyn <salyzyn@google.com> Bug: 32402555 Change-Id: I3f74b1ff5e4971d619bcb37a911fed68fbb538d5 [dcagle@codeaurora.org: Resolve merge conflict] Git-repo: https://android.googlesource.com/kernel/msm Git-commit: 1031836c0895f1f5a05c25efec83bfa11aa08ca9 Signed-off-by: Dennis Cagle <dcagle@codeaurora.org>
78 lines
1.8 KiB
C
78 lines
1.8 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* -*- linux-c -*-
|
|
*
|
|
* $Id: sysrq.h,v 1.3 1997/07/17 11:54:33 mj Exp $
|
|
*
|
|
* Linux Magic System Request Key Hacks
|
|
*
|
|
* (c) 1997 Martin Mares <mj@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
|
|
*/
|
|
|
|
#ifndef _LINUX_SYSRQ_H
|
|
#define _LINUX_SYSRQ_H
|
|
|
|
#include <linux/errno.h>
|
|
#include <linux/types.h>
|
|
|
|
/* Possible values of bitmask for enabling sysrq functions */
|
|
/* 0x0001 is reserved for enable everything */
|
|
#define SYSRQ_ENABLE_LOG 0x0002
|
|
#define SYSRQ_ENABLE_KEYBOARD 0x0004
|
|
#define SYSRQ_ENABLE_DUMP 0x0008
|
|
#define SYSRQ_ENABLE_SYNC 0x0010
|
|
#define SYSRQ_ENABLE_REMOUNT 0x0020
|
|
#define SYSRQ_ENABLE_SIGNAL 0x0040
|
|
#define SYSRQ_ENABLE_BOOT 0x0080
|
|
#define SYSRQ_ENABLE_RTNICE 0x0100
|
|
|
|
struct sysrq_key_op {
|
|
void (*handler)(int);
|
|
char *help_msg;
|
|
char *action_msg;
|
|
int enable_mask;
|
|
};
|
|
|
|
#ifdef CONFIG_MAGIC_SYSRQ
|
|
|
|
/* Generic SysRq interface -- you may call it from any device driver, supplying
|
|
* ASCII code of the key, pointer to registers and kbd/tty structs (if they
|
|
* are available -- else NULL's).
|
|
*/
|
|
|
|
bool sysrq_on(void);
|
|
void handle_sysrq(int key);
|
|
void __handle_sysrq(int key, bool check_mask);
|
|
int register_sysrq_key(int key, struct sysrq_key_op *op);
|
|
int unregister_sysrq_key(int key, struct sysrq_key_op *op);
|
|
struct sysrq_key_op *__sysrq_get_key_op(int key);
|
|
|
|
int sysrq_toggle_support(int enable_mask);
|
|
|
|
#else
|
|
|
|
static inline void handle_sysrq(int key)
|
|
{
|
|
}
|
|
|
|
static inline void __handle_sysrq(int key, bool check_mask)
|
|
{
|
|
}
|
|
|
|
static inline int register_sysrq_key(int key, struct sysrq_key_op *op)
|
|
{
|
|
return -EINVAL;
|
|
}
|
|
|
|
static inline int unregister_sysrq_key(int key, struct sysrq_key_op *op)
|
|
{
|
|
return -EINVAL;
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* _LINUX_SYSRQ_H */
|