[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <195C83C0-067C-4B55-89BD-9CF3155C6E69@amacapital.net>
Date: Wed, 23 May 2018 17:01:00 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Laura Abbott <labbott@...hat.com>,
Andrew Lutomirski <luto@...nel.org>, mjw@...oraproject.org,
"H.J. Lu" <hjl.tools@...il.com>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
the arch/x86 maintainers <x86@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
nickc@...hat.com, ccoutant@...il.com,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>
Subject: Re: [PATCHv3 2/2] x86/vdso: Add build salt to the vDSO
> On May 23, 2018, at 4:55 PM, Linus Torvalds <torvalds@...ux-foundation.org> wrote:
>
>> On Wed, May 23, 2018 at 3:53 PM Laura Abbott <labbott@...hat.com> wrote:
>>
>> Actually I remember now why this is necessary: there is not a simple way
>> to encode a string into a linker file as it has to be spit out byte
>> by byte.
>
> I think you can use the "fill" thing to basically add any random data to a
> section.
>
> So you can do something like
>
> . = ALIGN(16);
> .salt : AT(ADDR(.salt) - LOAD_OFFSET) {
> LONG(0xffaa5500);
> . = ALIGN(16);
> } =0x01234567890abcdef
>
> in the lds file, and you'll get a section that looks like this:
>
> [torvalds@i7 linux]$ objdump -h vmlinux -j .salt -s
>
> vmlinux: file format elf64-x86-64
>
> Sections:
> Idx Name Size VMA LMA File off
> Algn
> 15 .salt 00000010 ffffffff8432b000 000000000432b000 0352b000
> 2**0
> CONTENTS, ALLOC, LOAD, DATA
> Contents of section .salt:
> ffffffff8432b000 0055aaff 00123456 7890abcd ef001234 .U....4Vx......4
>
> Now whether that is sufficient for your needs, I dunno.
>
I don’t know whether I’m missing something obvious, but can’t this be in C?
asm (“.pushsection \”.comment\”; .ascii \”” WHATEVER “\”; .popsection”);
Or the .S equivalent.
Powered by blists - more mailing lists