[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190416072744.GB127769@gmail.com>
Date: Tue, 16 Apr 2019 09:27:44 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Andy Lutomirski <luto@...nel.org>
Cc: Elena Reshetova <elena.reshetova@...el.com>,
LKML <linux-kernel@...r.kernel.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Kees Cook <keescook@...omium.org>,
Jann Horn <jannh@...gle.com>,
"Perla, Enrico" <enrico.perla@...el.com>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Greg KH <gregkh@...uxfoundation.org>
Subject: Re: [PATCH 1/1] x86/entry/64: randomize kernel stack offset upon
syscall
* Andy Lutomirski <luto@...nel.org> wrote:
> On Wed, Apr 10, 2019 at 4:43 AM Ingo Molnar <mingo@...nel.org> wrote:
> >
> >
> > * Elena Reshetova <elena.reshetova@...el.com> wrote:
> >
> > > 2) Andy's tests, misc-tests: ./timing_test_64 10M sys_enosys
> > > base: 10000000 loops in 1.62224s = 162.22 nsec / loop
> > > random_offset (prandom_u32() every syscall): 10000000 loops in 1.64660s = 166.26 nsec / loop
> >
> > Stupid question, how did you manage to buil timing_test_64? Here it fails
> > with a bog standard gcc 7.3.0 x86-64 distro toolchain:
> >
> > dagon:~/luto-misc-tests.git> make timing_test_64
> > g++ -m64 -o timing_test_64 -O2 -g -std=gnu++11 -pthread -Wall timing_test.cc -lrt -ldl
> > /usr/bin/ld: /tmp/cc8VRkuV.o: relocation R_X86_64_32S against `.text.startup' can not be used when making a PIE object; recompile with -fPIC
> > /usr/bin/ld: final link failed: Nonrepresentable section on outputcollect2: error: ld returned 1 exit status
> > Makefile:39: recipe for target 'timing_test_64' failed
> >
>
> I think your toolchain is screwy. If I create this file as ingo.c:
>
> #include <stdio.h>
>
> int main(int argc, char **argv)
> {
> printf("Hello world!");
>
> return 0;
> }
>
> And build it like this, it fails:
>
> $ gcc -o ingo -g ingo.c -pie
> /usr/bin/ld: /tmp/ccofYU9N.o: relocation R_X86_64_32 against `.rodata'
> can not be used when making a PIE object; recompile with -fPIC
> /usr/bin/ld: final link failed: nonrepresentable section on output
> collect2: error: ld returned 1 exit status
>
> Which I assume means that -pie requires -fPIC, and your toolchain is
> screwed up and is defaulting to useless options. I'm guessing you
> should file a bug against your distro gcc package. For me, it works
> if I remove -pie.
It's just a bog standard Ubuntu x86-64 installation.
Thanks,
Ingo
Powered by blists - more mailing lists