Re: [syzbot] WARNING in bpf_verifier_vlog

From: Peilin Ye
Date: Fri Sep 09 2022 - 17:57:56 EST


On Fri, Sep 09, 2022 at 02:43:18PM -0700, sdf@xxxxxxxxxx wrote:
> On 09/09, Peilin Ye wrote:
> > On Fri, Sep 09, 2022 at 12:54:06PM -0700, sdf@xxxxxxxxxx wrote:
> > > On 09/09, Benjamin Tissoires wrote:
> > > Yeah, good point. I've run the repro. I think the issue is that
> > > syzkaller is able to pass btf with a super long random name which
> > > then hits BPF_VERIFIER_TMP_LOG_SIZE while printing the verifier
> > > log line. Seems like a non-issue to me, but maybe we need to
> > > add some extra validation..
>
> > In btf_func_proto_check_meta():
>
> > if (t->name_off) {
> > btf_verifier_log_type(env, t, "Invalid name");
> > return -EINVAL;
> > }
>
> > In the verifier log, maybe we should just say that BTF_KIND_FUNC_PROTO
> > "must
> > not have a name" [1], instead of printing out the user-provided
> > (potentially very long) name and say it's "Invalid" ?
>
> > Similarly, for name-too-long errors, should we truncate the name to
> > KSYM_NAME_LEN bytes (see __btf_name_valid()) in the log ?
>
> Both suggestions sound good to me. Care to cook and send a patch with a
> fix?

Sure, I will work on it.

Thanks,
Peilin Ye