Re: WARNING in tracing_func_proto

From: Dmitry Vyukov
Date: Fri Mar 06 2020 - 01:54:32 EST


On Fri, Jan 24, 2020 at 4:28 PM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> On Fri, 24 Jan 2020 11:44:13 +0100
> Dmitry Vyukov <dvyukov@xxxxxxxxxx> wrote:
>
> > FWIW this is invalid use of WARN macros:
> > https://elixir.bootlin.com/linux/v5.5-rc7/source/include/asm-generic/bug.h#L72
> > This should be replaced with pr_err (if really necessary, kernel does
> > not generally spew stacks on every ENOMEM/EINVAL).
>
> That message was added in 2018. The WARN macro in question here, was
> added in 2011. Thus, this would be more of a clean up fix.
>
> >
> > There are no _lots_ such wrong uses of WARN in the kernel. There were
> > some, all get fixed over time, we are still discovering long tail, but
> > it's like one per months at most. Note: syzbot reports each and every
> > WARNING. If there were lots, you would notice :)
>
> Hmm, I haven't looked, but are all these correct usage?
>
> $ git grep WARN_ON HEAD | wc -l
> 15384

Hard to say, nobody knows. But there is no need to check/fix all of
them proactively, at least not due to syzbot. It stomps on wrong uses
with very low rate now (<1/month), and then for these there is a
reason to fix (but then we also know precisely which one is that).


> I also checked the number of WARN_ON when that WARN_ON was added:
>
> $ git grep WARN_ON 07d777fe8c3985bc83428c2866713c2d1b3d4129 | wc -l
> 4730
>
> A lot more were added since then!

Adding WARNs is not necessarily wrong/bad. There are totally
legitimate uses for them. Especially in the context of general desire
to have fewer BUGs and replace more of them with WARNs.



> > Sorting this out is critical for just any kernel testing. Otherwise no
> > testing system will be able to say if a test triggers something bad in
> > kernel or not.
> >
> > FWIW there are no local trees for syzbot. It only tests public trees
> > as is. Doing otherwise would not work/scale as a process.
>
> Anyway, I'll happily take a patch converting that WARN_ON macro to a
> pr_err() print.
>
> -- Steve