All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Nathan Chancellor <natechancellor@gmail.com>,
	clang-built-linux <clang-built-linux@googlegroups.com>,
	Nathan Chancellor <nathanchance@gmail.com>,
	Jordan Rupprect <rupprecht@google.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] lkdtm: support llvm-objcopy
Date: Wed, 15 May 2019 09:42:56 -0700	[thread overview]
Message-ID: <201905150935.3AFE8CC68B@keescook> (raw)
In-Reply-To: <CAKwvOdn2ESh+-T8=YFT=W=gjZHPpCY8QJVS7ytPHM04tN1v13g@mail.gmail.com>

On Tue, May 14, 2019 at 01:24:37PM -0700, Nick Desaulniers wrote:
> On Tue, May 14, 2019 at 11:11 AM Kees Cook <keescook@chromium.org> wrote:
> >
> > On Mon, May 13, 2019 at 04:50:05PM -0700, Nick Desaulniers wrote:
> > > On Mon, May 13, 2019 at 4:29 PM Nathan Chancellor
> > > <natechancellor@gmail.com> wrote:
> > > >
> > > > On Mon, May 13, 2019 at 03:21:09PM -0700, 'Nick Desaulniers' via Clang Built Linux wrote:
> > > > > With CONFIG_LKDTM=y and make OBJCOPY=llvm-objcopy, llvm-objcopy errors:
> > > > > llvm-objcopy: error: --set-section-flags=.text conflicts with
> > > > > --rename-section=.text=.rodata
> > > > >
> > > > > Rather than support setting flags then renaming sections vs renaming
> > > > > then setting flags, it's simpler to just change both at the same time
> > > > > via --rename-section.
> 
> I'm not sure I want to call it a bug in the initial implementation.  I've filed:
> https://sourceware.org/bugzilla/show_bug.cgi?id=24554 for
> clarification.  Jordan, I hope you can participate in any discussion
> there?

Based on the hint from Alan Modra, it seems PROGBITS/NOBITS can be
controlled with the presence/absence of the "load" section flag. This
appears to work for both BFD and LLVM:

$ objcopy --rename-section .text=.rodata,alloc,readonly,load rodata.o rodata_objcopy.o
$ readelf -WS rodata_objcopy.o | grep \.rodata
 [ 1] .rodata    PROGBITS     0000000000000000 000040 000002 00   A  0   0 16

$ llvm-objcopy --rename-section .text=.rodata,alloc,readonly,load rodata.o rodata_objcopy.o
$ readelf -WS rodata_objcopy.o | grep \.rodata
 [ 1] .rodata    PROGBITS     0000000000000000 000040 000002 00   A  0   0 16

So, that's an easy change that could be folded into the original version
of this patch (no need for my two-phase work-around).

-- 
Kees Cook

  reply	other threads:[~2019-05-15 16:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-13 22:21 [PATCH] lkdtm: support llvm-objcopy Nick Desaulniers
2019-05-13 22:26 ` Nick Desaulniers
2019-05-13 23:04 ` Kees Cook
2019-05-13 23:29 ` Nathan Chancellor
2019-05-13 23:38   ` Jordan Rupprecht
2019-05-13 23:47     ` Nathan Chancellor
2019-05-13 23:50   ` Nick Desaulniers
2019-05-14 18:10     ` Kees Cook
2019-05-14 20:24       ` Nick Desaulniers
2019-05-15 16:42         ` Kees Cook [this message]
2019-05-15 17:37           ` Nick Desaulniers
2019-05-15 18:12             ` [PATCH v2] " Nick Desaulniers
2019-05-15 18:19               ` Nathan Chancellor
2019-05-15 18:24                 ` [PATCH v3] " Nick Desaulniers
     [not found]                   ` <20190517001002.D1A262084A@mail.kernel.org>
2019-05-17  4:06                     ` Nathan Chancellor
2019-05-17  4:09                       ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201905150935.3AFE8CC68B@keescook \
    --to=keescook@chromium.org \
    --cc=arnd@arndb.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=nathanchance@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=rupprecht@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.