Re: [PATCH 0/3] Relocate GOT before calling EFI stub

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 7 Jan 2020 at 20:23, Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx> wrote:
>
> On Tue, 7 Jan 2020 at 20:14, Arvind Sankar <nivedita@xxxxxxxxxxxx> wrote:
> >
> > On Tue, Jan 07, 2020 at 08:03:18PM +0100, Ard Biesheuvel wrote:
> > > On Tue, 7 Jan 2020 at 19:32, Arvind Sankar <nivedita@xxxxxxxxxxxx> wrote:
> > > >
> > > > On Tue, Jan 07, 2020 at 07:10:34PM +0100, Ard Biesheuvel wrote:
> > > > > On Tue, 7 Jan 2020 at 19:08, Arvind Sankar <nivedita@xxxxxxxxxxxx> wrote:
> > > > > >
> > > > > > On Tue, Jan 07, 2020 at 06:59:57PM +0100, Ard Biesheuvel wrote:
> > > > > > > On Tue, 7 Jan 2020 at 18:58, Arvind Sankar <nivedita@xxxxxxxxxxxx> wrote:
> > > > > > > >
> > > > > > > > On Tue, Jan 07, 2020 at 03:28:31PM +0100, Ard Biesheuvel wrote:
> > > > > > > > >
> > > > > > > > > Unfortunately, the command line option implements a weaker form of
> > > > > > > > > visibility than the pragma, so it probably comes down to setting the
> > > > > > > > > pragma in a .h file that gets -include'd via the command line so it is
> > > > > > > > > guaranteed to be seen first.
> > > > > > > >
> > > > > > > > Tried hacking that in and it works, tested with gcc 4.6.4.
> > > > > > >
> > > > > > > Excellent. But in my testing locally, I don't get any GOT entries in
> > > > > > > the first place, strangely enough. So what changes in the output for
> > > > > > > you with visibility hidden compared to before?
> > > > > >
> > > > > > Works with 32-bit as well.
> > > > > >
> > > > > > Are you checking libstub or boot/compressed? Below is with gcc 4.6 (but
> > > > > > latest binutils). With gcc 9, there's only one left -- trampoline_32bit_src
> > > > > > in pgtable_64.
> > > > > >
> > > > >
> > > > > I am looking at the size of the .got section in
> > > > > boot/compressed/vmlinux, and it is 0x0 on 64-bit, and 0xc (i.e., only
> > > > > the .got.plt fixup code) on 32-bit.
> > > > >
> > > > > Could you please check whether passing -Bsymbolic to the linker gives
> > > > > the same result btw?
> > > > >
> > > >
> > > > With new ld all those GOTPCRELX's get eliminated. If you add --no-relax
> > > > you'll get them in the .got. I don't have an old version of binutils so
> > > > I can't check, but I think they will be assembled as GOTPCREL and remain
> > > > in the .got section after linking.
> > > >
> > >
> > > Right, unless you use hidden visibility, no?
> > >
> >
> > Right, that's what I said works before -- with hidden visibility the
> > compiler (even an old one) does not generate any GOT-using relocations.
> > We're trying to debug why you don't see any .got entries even before
> > turning on hidden visibility, while I do, no?
> >
>
> Yeah. I have just reinstalled Ubuntu Trusty in a VM, which has
> binutils 2.4 and has a GCC 4.6 package available, but I haven't tried
> building the 64-bit kernel yet.
>

I see the same thing: all GOT entries are gone when using -include to
set the pragma, with the exception of the first 0x18 bytes of the
.got.plt section, which we can ignore.

So in summary, we should be able ASSERT() in the linker script that
(_egot - _got) <= 3 * word size, and get rid of all the GOT fixup code
entirely. Or perhaps it is better to add a section marker, and assert
that the *(.got) part is really empty.



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux