[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACT4Y+aRqZ7r-XedUS6P51Dpf+GRAuZABH6FuKDU19UepE6KCw@mail.gmail.com>
Date: Thu, 19 Dec 2019 18:21:31 +0100
From: Dmitry Vyukov <dvyukov@...gle.com>
To: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
Andrey Konovalov <andreyknvl@...gle.com>
Cc: Andi Kleen <ak@...ux.intel.com>,
"Theodore Y. Ts'o" <tytso@....edu>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Petr Mladek <pmladek@...e.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Arnd Bergmann <arnd@...db.de>, Jiri Slaby <jslaby@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kconfig: Add kernel config option for fuzz testing.
On Wed, Dec 18, 2019 at 11:30 AM Tetsuo Handa
<penguin-kernel@...ove.sakura.ne.jp> wrote:
>
> 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.
+Andrey, please take a look if CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE
covers everything we need, or we need to disable sysrq entirely.
Powered by blists - more mailing lists