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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200506211945.4qhrxqplzmt4ul66@treble>
Date:   Wed, 6 May 2020 16:19:45 -0500
From:   Josh Poimboeuf <jpoimboe@...hat.com>
To:     Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Network Development <netdev@...r.kernel.org>,
        bpf <bpf@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>,
        X86 ML <x86@...nel.org>, Peter Zijlstra <peterz@...radead.org>,
        Randy Dunlap <rdunlap@...radead.org>,
        Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH] bpf: Tweak BPF jump table optimizations for objtool
 compatibility

On Wed, May 06, 2020 at 09:45:01AM -0700, Alexei Starovoitov wrote:
> On Wed, May 6, 2020 at 8:53 AM Josh Poimboeuf <jpoimboe@...hat.com> wrote:
> >
> > On Tue, May 05, 2020 at 04:59:39PM -0700, Alexei Starovoitov wrote:
> > > As far as workaround I prefer the following:
> > > From 94bbc27c5a70d78846a5cb675df4cf8732883564 Mon Sep 17 00:00:00 2001
> > > From: Alexei Starovoitov <ast@...nel.org>
> > > Date: Tue, 5 May 2020 16:52:41 -0700
> > > Subject: [PATCH] bpf,objtool: tweak interpreter compilation flags to help objtool
> > >
> > > tbd
> > >
> > > Fixes: 3193c0836f20 ("bpf: Disable GCC -fgcse optimization for ___bpf_prog_run()")
> > > Reported-by: Randy Dunlap <rdunlap@...radead.org>
> > > Reported-by: Arnd Bergmann <arnd@...db.de>
> > > Signed-off-by: Alexei Starovoitov <ast@...nel.org>
> > > ---
> > >  include/linux/compiler-gcc.h | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
> > > index d7ee4c6bad48..05104c3cc033 100644
> > > --- a/include/linux/compiler-gcc.h
> > > +++ b/include/linux/compiler-gcc.h
> > > @@ -171,4 +171,4 @@
> > >  #define __diag_GCC_8(s)
> > >  #endif
> > >
> > > -#define __no_fgcse __attribute__((optimize("-fno-gcse")))
> > > +#define __no_fgcse __attribute__((optimize("-fno-gcse,-fno-omit-frame-pointer")))
> > > --
> > > 2.23.0
> > >
> > > I've tested it with gcc 8,9,10 and clang 11 with FP=y and with ORC=y.
> > > All works.
> > > I think it's safer to go with frame pointers even for ORC=y considering
> > > all the pain this issue had caused. Even if objtool gets confused again
> > > in the future __bpf_prog_run() will have frame pointers and kernel stack
> > > unwinding can fall back from ORC to FP for that frame.
> > > wdyt?
> >
> > It seems dangerous to me.  The GCC manual recommends against it.
> 
> The manual can says that it's broken. That won't stop the world from using it.
> Just google projects that are using it. For example: qt, lz4, unreal engine, etc
> Telling compiler to disable gcse via flag is a guaranteed way to avoid
> that optimization that breaks objtool whereas messing with C code is nothing
> but guess work. gcc can still do gcse.

But the manual's right, it is broken.  How do you know other important
flags won't also be stripped?

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ