Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1707750

Re: new ELF marking

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From "H.J. Lu" <hjl.tools@gmail.com>
Newsgroups linux.kernel
Subject Re: new ELF marking
Date Wed, 09 Aug 2017 20:50:01 +0200
Message-ID <ucEdj-2Fa-3@gated-at.bofh.it> (permalink)
References <ucCEB-1Ng-103@gated-at.bofh.it> <ucCOh-1QT-85@gated-at.bofh.it> <ucDTX-2tC-5@gated-at.bofh.it>
X-Original-To Kees Cook <keescook@google.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=7qtpC7POuFLntCV9RIeKxzbhmBj4veqvUHVlt4n2NGA=; b=NlMG0voNqKCch5Pewr5vPRWm1tQGtGsIJxrPfB0rrB4hcdsMaGVSCQ9PrtIMEuqPSe M6PLRE7lFvzqRAIIMQ0EzEaa74mgxyya17jSpkfHDcgyb0VM14mCbMUTpmmj/uhasaVG LJ2foHv5hrnentejgWITZfdI3sYd/QGggBXP+1a5n6LytqwTPrrrggGyLy7oxuHuqnWv iT1f6pzXLKaaP9V/lzVNdJ91XGLo6/YZYiADBYJ8blOWekGbewIvw0d29rpZU8O+WrqJ kjFmd9ArPuDyRYRuiBGHfuULEp+LG1K9F7pUoR4Mf9GngbsUXptWk1+j6HvL1MK/MH4E aTZQ==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=7qtpC7POuFLntCV9RIeKxzbhmBj4veqvUHVlt4n2NGA=; b=mB5wJgbabzlxvFbWoeUJPhQqi4UKPd6AYazUWN33xdOQ62tE0voPNCh9WEdByLOVdT EhHaKr1XzzjBvx4XHDONGmY/t8Ldv81EdV6277B49qSU39NE9mEcyB2yMlpQ5kZ2BQx0 KCs7acu7KeCneELLp8NLZWRsaZHJNhvolPlPYkBUuDUUUTfAUJFBSX0ECEPqvlHu1NRe yOCdLTig95R3cas+ZjaV24AERXhVUVo2ovhdby92VkBdQpb+XeggBkliLoeUK9zZzuoW mIqp9CqmDQmpS95Cr7r7Ak8mdeT8womIdHaK2wojXU335zTsmEvjEfPZ7hNZxuBMz09I 4aEA==
X-Gm-Message-State AHYfb5iYYz0n3lN8X9/Vzxjk4INgykGKDqaNzYSB/jCrBp+idPuHyEBt Bg8aTjIk3xNrc+lbUb4V3hx2oPe1dw==
X-Received by 10.202.75.68 with SMTP id y65mr9271597oia.97.1502304384937; Wed, 09 Aug 2017 11:46:24 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset="UTF-8"
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 65
Organization linux.* mail to news gateway
X-Original-Cc LKML <linux-kernel@vger.kernel.org>, Binutils <binutils@sourceware.org>
X-Original-Date Wed, 9 Aug 2017 11:46:24 -0700
X-Original-Message-ID <CAMe9rOoXKbPKoUjWw4u-AbHRTnfU9A57dW+vJ3+diXZ04wCMYA@mail.gmail.com>
X-Original-References <CAGXu5jL2iY8=VhWyqhhUqxAs1akywodrWezU77rnrq-Ksbzwow@mail.gmail.com> <CAMe9rOqH1=wOi_8AyZFURVpN999Ty1WFoTQwcOwHiBJWF_WeMA@mail.gmail.com> <CAGXu5jL1HRG7Dn9vraw8Hu7LF+69k3EDpztt1Ju7ijEzmvRdhA@mail.gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1707750

Show key headers only | View raw


On Wed, Aug 9, 2017 at 11:26 AM, Kees Cook <keescook@google.com> wrote:
> On Wed, Aug 9, 2017 at 10:16 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Wed, Aug 9, 2017 at 10:07 AM, Kees Cook via binutils
>> <binutils@sourceware.org> wrote:
>>> Hi,
>>>
>>> I'd like to be able to mark an ELF binary in such a way that Linux's
>>> binfmt_elf.c will collapse a PIE text area into the mmap region
>>> (currently they are separately randomized in memory). This is desired
>>> by AddressSanitizer to avoid having an ASan-built binary have its text
>>> area moving into an unexpected location[1] (ASLR is still desired, but
>>> doesn't need to have a PIE/mmap split).
>>>
>>> I see a few ways:
>>>
>>> - Add parsing for NOTE program headers and add a new NOTE type
>>> (NT_GNU_EXEC_FLAGS), though notes tend to be strings...
>>>
>>> - Add a new Program Header (GNU_EXEC_FLAGS), which is similar to how
>>> GNU_STACK and GNU_RELRO were handled. This could sort of be like NOTE
>>> except just lots of bit flags.
>>>
>>> - Use a filesystem xattr. This is fragile, in the case of copying
>>> binaries between systems or filesystems.
>>>
>>> Thoughts?
>>>
>>>
>>
>> Why don't you use  NT_GNU_PROPERTY_TYPE_0?
>
> Ah, interesting. I hadn't seen this before. Docs I found were:
> https://github.com/hjl-tools/linux-abi/commit/a24f6898c4172e09b2e476ae9f160621528a1d92
>
>  \item[pr_datasz] The size of the \code{pr_data} field.  A 4-byte
>    integer in the format of the target processor.
>  \item[pr_data] The program property descriptor.  An array of 4-byte
>    integers in 32-bit object or 8-byte integers in 64-bit objects, in
>    the format of the target processor.
>
> Is pr_data length always a multiple of 4 (or 8)? I found this language

Yes.

> confusing, given that pr_datasz doesn't mention this.
>
> Also, given the definition, should the kernel examine these, or should
> it remain limited to the runtimer loader?

Both kernel and run-time loaders should check it.  I am working on
static PIE, which is loaded by kernel.

> If the kernel should, would it be better to add
> GNU_PROPERTY_EXEC_FLAGS, for future bits, or should it be something
> like GNU_PROPERTY_NO_COPY_ON_PROTECTED with a pr_datasz == 0?

Please use bits.  Is this an output only bit?  Will it appear in an input file?

> (And should the kernel already be parsing GNU_PROPERTY_STACK_SIZE?)
>

Kernel should.

-- 
H.J.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

new ELF marking Kees Cook <keescook@google.com> - 2017-08-09 19:10 +0200
  Re: new ELF marking "H.J. Lu" <hjl.tools@gmail.com> - 2017-08-09 19:20 +0200
    Re: new ELF marking Kees Cook <keescook@google.com> - 2017-08-09 20:30 +0200
      Re: new ELF marking "H.J. Lu" <hjl.tools@gmail.com> - 2017-08-09 20:50 +0200
        Re: new ELF marking Kees Cook <keescook@google.com> - 2017-08-09 21:00 +0200
          Re: new ELF marking "H.J. Lu" <hjl.tools@gmail.com> - 2017-08-09 21:10 +0200
            Re: new ELF marking Kostya Serebryany <kcc@google.com> - 2017-08-09 22:40 +0200
              Re: new ELF marking "H.J. Lu" <hjl.tools@gmail.com> - 2017-08-09 23:30 +0200
                Re: new ELF marking Carlos O'Donell <carlos@redhat.com> - 2017-08-10 00:40 +0200

csiph-web