[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABg9mcuVj7XL=3LyQHxjep_k4eBYe7OcV3W4jrOzXrHaD6iCaA@mail.gmail.com>
Date: Thu, 17 Dec 2015 16:00:45 -0800
From: Z Lim <zlim.lnx@...il.com>
To: Daniel Borkmann <daniel@...earbox.net>
Cc: "David S. Miller" <davem@...emloft.net>,
Alexei Starovoitov <ast@...nel.org>,
Michael Holzheu <holzheu@...ux.vnet.ibm.com>,
Network Development <netdev@...r.kernel.org>,
Yang Shi <yang.shi@...aro.org>
Subject: Re: [PATCH net-next 2/5] bpf: move clearing of A/X into classic to
eBPF migration prologue
On Thu, Dec 17, 2015 at 2:51 PM, Daniel Borkmann <daniel@...earbox.net> wrote:
> Back in the days where eBPF (or back then "internal BPF" ;->) was not
> exposed to user space, and only the classic BPF programs internally
> translated into eBPF programs, we missed the fact that for classic BPF
> A and X needed to be cleared. It was fixed back then via 83d5b7ef99c9
> ("net: filter: initialize A and X registers"), and thus classic BPF
> specifics were added to the eBPF interpreter core to work around it.
>
> This added some confusion for JIT developers later on that take the
> eBPF interpreter code as an example for deriving their JIT. F.e. in
> f75298f5c3fe ("s390/bpf: clear correct BPF accumulator register"), at
> least X could leak stack memory. Furthermore, since this is only needed
> for classic BPF translations and not for eBPF (verifier takes care
> that read access to regs cannot be done uninitialized), more complexity
> is added to JITs as they need to determine whether they deal with
> migrations or native eBPF where they can just omit clearing A/X in
> their prologue and thus reduce image size a bit, see f.e. cde66c2d88da
> ("s390/bpf: Only clear A and X for converted BPF programs"). In other
> cases (x86, arm64), A and X is being cleared in the prologue also for
> eBPF case, which is unnecessary.
>
> Lets move this into the BPF migration in bpf_convert_filter() where it
> actually belongs as long as the number of eBPF JITs are still few. It
> can thus be done generically; allowing us to remove the quirk from
> __bpf_prog_run() and to slightly reduce JIT image size in case of eBPF,
> while reducing code duplication on this matter in current(/future) eBPF
> JITs.
>
> Signed-off-by: Daniel Borkmann <daniel@...earbox.net>
> Acked-by: Alexei Starovoitov <ast@...nel.org>
> Reviewed-by: Michael Holzheu <holzheu@...ux.vnet.ibm.com>
> Tested-by: Michael Holzheu <holzheu@...ux.vnet.ibm.com>
> Cc: Zi Shen Lim <zlim.lnx@...il.com>
> Cc: Yang Shi <yang.shi@...aro.org>
> ---
> arch/arm64/net/bpf_jit_comp.c | 6 ------
For the arm64 bits:
Acked-by: Zi Shen Lim <zlim.lnx@...il.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists