[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210413085522.2caee809@gandalf.local.home>
Date: Tue, 13 Apr 2021 08:55:22 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Dmitry Vyukov <dvyukov@...gle.com>
Cc: Yonghong Song <yhs@...com>,
syzbot <syzbot+774c590240616eaa3423@...kaller.appspotmail.com>,
Andrew Morton <akpm@...ux-foundation.org>, andrii@...nel.org,
Alexei Starovoitov <ast@...nel.org>,
Borislav Petkov <bp@...en8.de>, bpf <bpf@...r.kernel.org>,
Daniel Borkmann <daniel@...earbox.net>,
David Miller <davem@...emloft.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Jim Mattson <jmattson@...gle.com>,
John Fastabend <john.fastabend@...il.com>,
Joerg Roedel <joro@...tes.org>,
Martin KaFai Lau <kafai@...com>, kpsingh@...nel.org,
Jakub Kicinski <kuba@...nel.org>,
KVM list <kvm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Mark Rutland <mark.rutland@....com>, masahiroy@...nel.org,
Ingo Molnar <mingo@...hat.com>,
netdev <netdev@...r.kernel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
rafael.j.wysocki@...el.com,
Sean Christopherson <seanjc@...gle.com>,
Song Liu <songliubraving@...com>,
syzkaller-bugs <syzkaller-bugs@...glegroups.com>,
Thomas Gleixner <tglx@...utronix.de>, vkuznets@...hat.com,
wanpengli@...cent.com, will@...nel.org, x86@...nel.org
Subject: Re: [syzbot] WARNING in bpf_test_run
On Tue, 13 Apr 2021 09:56:40 +0200
Dmitry Vyukov <dvyukov@...gle.com> wrote:
> Thanks for looking into this.
> If this is not a kernel bug, then it must not use WARN_ON[_ONCE]. It
> makes the kernel untestable for both automated systems and humans:
>
> https://lwn.net/Articles/769365/
>
> <quote>
> Greg Kroah-Hartman raised the problem of core kernel API code that
> will use WARN_ON_ONCE() to complain about bad usage; that will not
> generate the desired result if WARN_ON_ONCE() is configured to crash
> the machine. He was told that the code should just call pr_warn()
> instead, and that the called function should return an error in such
> situations. It was generally agreed that any WARN_ON() or
> WARN_ON_ONCE() calls that can be triggered from user space need to be
> fixed.
> </quote>
I agree. WARN_ON(_ONCE) should be reserved for anomalies that should not
happen ever. Anything that the user could trigger, should not trigger a
WARN_ON.
A WARN_ON is perfectly fine for detecting an accounting error inside the
kernel. I have them scattered all over my code, but they should never be
hit, even if something in user space tries to hit it. (with an exception of
an interface I want to deprecate, where I want to know if it's still being
used ;-) Of course, that wouldn't help bots testing the code. And I haven't
done that in years)
Any anomaly that can be triggered by user space doing something it should
not be doing really needs a pr_warn().
Thanks,
-- Steve
Powered by blists - more mailing lists