Messages in this thread |  | | Subject | Re: [PATCH] kconfig: Add kernel config option for fuzz testing. | From | Tetsuo Handa <> | Date | Wed, 18 Dec 2019 19:29:47 +0900 |
| |
On 2019/12/17 17:36, Dmitry Vyukov wrote: > FWIW we've just disabled sysrq entirely: > https://github.com/google/syzkaller/blob/master/dashboard/config/bits-syzbot.config#L182 > because random packets over usb can trigger a panic sysrq (again > almost impossible to reliably filter these out on fuzzer side).
Excuse me, but CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x0 helps only if show_state() etc. are called via the __handle_sysrq() handler in drivers/tty/sysrq.c .
static void sysrq_handle_showstate(int key) { show_state(); show_workqueue_state(); } static struct sysrq_key_op sysrq_showstate_op = { .handler = sysrq_handle_showstate, .help_msg = "show-task-states(t)", .action_msg = "Show State", .enable_mask = SYSRQ_ENABLE_DUMP, };
The k_spec() handler in drivers/tty/vt/keyboard.c calls show_state() etc. without evaluating sysrq_enabled value.
#define FN_HANDLERS\ fn_null, fn_enter, fn_show_ptregs, fn_show_mem,\ fn_show_state, fn_send_intr, fn_lastcons, fn_caps_toggle,\ fn_num, fn_hold, fn_scroll_forw, fn_scroll_back,\ fn_boot_it, fn_caps_on, fn_compose, fn_SAK,\ fn_dec_console, fn_inc_console, fn_spawn_con, fn_bare_num typedef void (fn_handler_fn)(struct vc_data *vc); static fn_handler_fn FN_HANDLERS; static fn_handler_fn *fn_handler[] = { FN_HANDLERS };
static void fn_show_state(struct vc_data *vc) { show_state(); }
static void k_spec(struct vc_data *vc, unsigned char value, char up_flag) { if (up_flag) return; if (value >= ARRAY_SIZE(fn_handler)) return; if ((kbd->kbdmode == VC_RAW || kbd->kbdmode == VC_MEDIUMRAW || kbd->kbdmode == VC_OFF) && value != KVAL(K_SAK)) return; /* SAK is allowed even in raw mode */ fn_handler[value](vc); }
Therefore, we need to guard at either callee side (e.g. show_state_filter()) or caller side (e.g. k_spec()) using kernel config (or something equivalent) in order to avoid forever calling show_state() from timer function.
|  |