lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 18 Jun 2021 22:07:04 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Daniel Borkmann <daniel@...earbox.net>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Andrii Nakryiko <andriin@...com>, netdev@...r.kernel.org,
        bpf@...r.kernel.org, Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...omium.org>
Subject: Re: [PATCH bpf-next] bpf, x86: Remove unused cnt increase from EMIT
 macro

On Thu, Jun 17, 2021 at 01:04:08PM +0200, Daniel Borkmann wrote:
> On 6/16/21 3:34 PM, Jiri Olsa wrote:
> > Removing unused cnt increase from EMIT macro together
> > with cnt declarations. This was introduced in commit [1]
> > to ensure proper code generation. But that code was
> > removed in commit [2] and this extra code was left in.
> > 
> > [1] b52f00e6a715 ("x86: bpf_jit: implement bpf_tail_call() helper")
> > [2] ebf7d1f508a7 ("bpf, x64: rework pro/epilogue and tailcall handling in JIT")
> > 
> > Signed-off-by: Jiri Olsa <jolsa@...hat.com>
> > ---
> >   arch/x86/net/bpf_jit_comp.c | 39 ++++++++++---------------------------
> >   1 file changed, 10 insertions(+), 29 deletions(-)
> > 
> > diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
> > index 2a2e290fa5d8..19715542cd9c 100644
> > --- a/arch/x86/net/bpf_jit_comp.c
> > +++ b/arch/x86/net/bpf_jit_comp.c
> > @@ -31,7 +31,7 @@ static u8 *emit_code(u8 *ptr, u32 bytes, unsigned int len)
> >   }
> >   #define EMIT(bytes, len) \
> > -	do { prog = emit_code(prog, bytes, len); cnt += len; } while (0)
> > +	do { prog = emit_code(prog, bytes, len); } while (0)
> >   #define EMIT1(b1)		EMIT(b1, 1)
> >   #define EMIT2(b1, b2)		EMIT((b1) + ((b2) << 8), 2)
> > @@ -239,7 +239,6 @@ struct jit_context {
> >   static void push_callee_regs(u8 **pprog, bool *callee_regs_used)
> >   {
> >   	u8 *prog = *pprog;
> > -	int cnt = 0;
> >   	if (callee_regs_used[0])
> >   		EMIT1(0x53);         /* push rbx */
> > @@ -255,7 +254,6 @@ static void push_callee_regs(u8 **pprog, bool *callee_regs_used)
> >   static void pop_callee_regs(u8 **pprog, bool *callee_regs_used)
> >   {
> >   	u8 *prog = *pprog;
> > -	int cnt = 0;
> >   	if (callee_regs_used[3])
> >   		EMIT2(0x41, 0x5F);   /* pop r15 */
> > @@ -303,7 +301,6 @@ static void emit_prologue(u8 **pprog, u32 stack_depth, bool ebpf_from_cbpf,
> 
> nit: In emit_prologue() we also have cnt that we could just replace with X86_PATCH_SIZE
> directly as well.

right, will send v2

thanks,
jirka

> 
> >   static int emit_patch(u8 **pprog, void *func, void *ip, u8 opcode)
> >   {
> >   	u8 *prog = *pprog;
> 
> Otherwise, lgtm.
> 
> Thanks,
> Daniel
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ