On Tue, Apr 02, 2019 at 10:39:29AM -0700, Alexei Starovoitov wrote:
> On Tue, Apr 02, 2019 at 04:37:19PM +0200, Daniel Borkmann wrote:
> > On 04/02/2019 01:58 PM, Paul Chaignon wrote:
> > > Three checks for verifier bugs were introduced in commit f4d7e40 ("bpf:
> > > introduce function calls (verification)"). The bugs were reported as
> > > incorrect programs instead of kernel warnings as the present patch
> > > implements.
> > >
> > > Signed-off-by: Paul Chaignon <[email protected]>
> >
> > Thanks for the patch, I think these WARN_ONCE() are a bit out of context
> > though,
> > meaning it lacks additional information about the program in kernel log
> > once we
> > actually manage to trigger it which we'd otherwise would potentially have
> > had with
> > the verbose() log. And from a program debugging pov, it makes it harder
> > after this
> > patch when verification log would suggest that all is fine. Looks like we
> > already
> > have a few WARN_ONCE() in verifier, they should probably be converted to
> > verbose()
> > as well to be consistent. If we really want to have a kernel warn, then
> > lets add a
> > helper macro verbose_and_warn(...) which will trigger a one-time warning,
> > but keeps
> > the verbose log intact as well.
>
> I think they should stay as verbose() messages and some of the WARN_ON
> should be converted to verbose().
> I don't think there is a need for verbose_and_warn().
>
Agreed for the verbose messages; it makes sense. I'm a bit surprised you
don't think the verifier should warn on verifier bugs though. It already
warns for other internal bugs such as 'regno >= MAX_BPF_REG'. Or should
these be converted to verbose() as well?