Re: printk feature for syzbot?

From: Sergey Senozhatsky
Date: Mon Apr 23 2018 - 21:33:47 EST

Let me Cc Petr, Steven and Fengguang on this

On (04/23/18 15:40), Dmitry Vyukov wrote:
> On Mon, Apr 23, 2018 at 3:33 PM, Tetsuo Handa
> <penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote:
> > Hello, Sergey.
> >
> > Recently I'm fixing bugs reported by syzbot ( ).
> >
> > Since syzbot frequently makes printk() flooding (e.g. memory allocation fault
> > injection), it is always difficult to distinguish which line is from which event.
> >
> > I wish printk() can prefix context identifier.
> > If I recall correctly, you are using some extra output for debugging, aren't you?
> +syzkaller mailing list for history
> Hi Tetsuo, Sergey,
> Something like TID prefix would be useful. Potentially it would allow
> us to untangle multiple intermixed crash reports.


Yes, Tetsuo, we use a bunch of "printk prefix" extensions at Samsung.
For instance, we prefix printk messages with the CPU number: messages
sometimes mix up, we also see partial pr_cont flushes, and so on.
Grep-ping serial logs by CPU number is quite powerful.

Upstreaming those printk prefixes can be a bit challenging, but may
be it's not all so bad. I personally think that syzbot, and build-test
bots in general [like 0day], are helpful indeed, and I don't see why life
should be any more complex for syzbot/0day guys. If printk prefixes can
help - then we probably should consider such an extension.

The main argument from the upstream is that tweaking struct printk_log
breaks user space (tools like crash, and so on). But I guess we can do
something about it. E.g. put a PRINTK_CONTEXT_TRACKING_PREFIX kconfig
option somewhere in "Kernel hacking"->"printk and dmesg options" and
make available only for DEBUG kernels, or something similar.

Petr, Steven, Fengguang, what do you think? Do you have any objections?