[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200109132307.GA32252@kernel.org>
Date: Thu, 9 Jan 2020 10:23:07 -0300
From: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To: Martin Lau <kafai@...com>
Cc: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
David Miller <davem@...emloft.net>,
Kernel Team <Kernel-team@...com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next v4 01/11] bpf: Save PTR_TO_BTF_ID register state
when spilling to stack
Em Thu, Jan 09, 2020 at 05:47:06AM +0000, Martin Lau escreveu:
> On Wed, Jan 08, 2020 at 10:06:44PM -0300, Arnaldo Carvalho de Melo wrote:
> > On January 8, 2020 9:44:24 PM GMT-03:00, Martin KaFai Lau <kafai@...com> wrote:
> > >This patch makes the verifier save the PTR_TO_BTF_ID register state
> > >when
> > >spilling to the stack.
> >
> > You say what it does, but not why that is needed :-/
> It is the same as other existing bpf_reg_type (i.e. the above switch
> cases in is_spillable_regtype()).
>
> When a register spills to the stack, the verifier decides if the reg's
> state can be saved (i.e. what the is_spillable_regtype() is checking).
> If the state is not saved, the verifier cannot recognize its state
> later.
Thanks for the explanation, I suggest that next time you include it in
the cset comment, to help make sense of the patch by having a why + how
to match with the actual patch.
- Arnaldo
> > - Arnaldo
> > >
> > >Acked-by: Yonghong Song <yhs@...com>
> > >Signed-off-by: Martin KaFai Lau <kafai@...com>
> > >---
> > > kernel/bpf/verifier.c | 1 +
> > > 1 file changed, 1 insertion(+)
> > >
> > >diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> > >index 6f63ae7a370c..d433d70022fd 100644
> > >--- a/kernel/bpf/verifier.c
> > >+++ b/kernel/bpf/verifier.c
> > >@@ -1916,6 +1916,7 @@ static bool is_spillable_regtype(enum
> > >bpf_reg_type type)
> > > case PTR_TO_TCP_SOCK:
> > > case PTR_TO_TCP_SOCK_OR_NULL:
> > > case PTR_TO_XDP_SOCK:
> > >+ case PTR_TO_BTF_ID:
> > > return true;
> > > default:
> > > return false;
> >
--
- Arnaldo
Powered by blists - more mailing lists