On 2019/05/09 18:58, Sergey Senozhatsky wrote:
>> +#ifdef CONFIG_DEBUG_AID_FOR_SYZBOT
>> +static int initial_loglevel;
>> +static void check_loglevel(struct timer_list *timer)
>> +{
>> +    if (console_loglevel < initial_loglevel)
>> +            panic("Console loglevel changed (%d->%d)!", initial_loglevel,
>> +                  console_loglevel);
>> +    mod_timer(timer, jiffies + HZ);
>> +}
>> +static int __init loglevelcheck_init(void)
>> +{
>> +    static DEFINE_TIMER(timer, check_loglevel);
>> +
>> +    initial_loglevel = console_loglevel;
>> +    mod_timer(&timer, jiffies + HZ);
>> +    return 0;
>> +}
>> +late_initcall(loglevelcheck_init);
>> +#endif
> 
> I suppose this patch is for internal testing at Google only. I don't
> think we can consider upstreaming it.

Right. There is CONFIG_DEBUG_AID_FOR_SYZBOT option for testing at 
linux-next.git only.



> 
>> By the way, recently we are hitting false positives caused by "WARNING:"
>> string from not WARN() messages but plain printk() messages (e.g.
>>
>>   
>> https://syzkaller.appspot.com/bug?id=31bdef63e48688854fde93e6edf390922b70f8a4
>>   
>> https://syzkaller.appspot.com/bug?id=faae4720a75cadb8cd0dbda5c4d3542228d37340
>>
>> ) and we need to avoid emitting "WARNING:" string from plain printk() 
>> messages
>> during fuzzing testing. I guess we want to add something like
>> CONFIG_DEBUG_AID_FOR_SYZBOT to all kernels in order to mask such string...
> 
> I thought that we have MSG_FORMAT_SYSLOG exactly for things like these,
> so you can look at actual message level <%d> and then decide if it's a
> warning or a false alarm.

Since syzbot needs to use console output, message level is not available.

> 
> These are pr_info() level messages, but the text contains "WARNING: "
> 
> [..]
> pvr2_trace(PVR2_TRACE_ERROR_LEGS,
>          "WARNING: Detected a wedged cx25840 chip; the device will not 
> work.");
> [..]
> 
> I would suggest to fix pvrusb2-i2c-core.c. I don't think we really
> want to $text =~ s/WARNING//g in printk.

Of course, I don't want to try $text =~ s/WARNING//g in printk().
What I meant is guard the callers like
https://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git/commit/?h=next-tomoyo&id=5c6b31e31adc31bd12636b196d3311f845dcc9d8
using a kernel config option which will be acceptable for upstreaming, for
we need to apply to all kernels which syzbot is testing.

Reply via email to