public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "PaX Team" <pageexec@freemail.hu>
To: Laura Abbott <labbott@redhat.com>, Kees Cook <keescook@chromium.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Jeremy Linton <jeremy.linton@arm.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Arnd Bergmann <arnd@arndb.de>,
	"kernel-hardening@lists.openwall.com" 
	<kernel-hardening@lists.openwall.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] lkdtm: add test for executing .rodata
Date: Thu, 18 Feb 2016 11:32:37 +0100	[thread overview]
Message-ID: <56C59DC5.19217.28FA99@pageexec.freemail.hu> (raw)
In-Reply-To: <CAGXu5j+P=8HnkJA895wuKrEb6n+hK4RqFJhFSQqUhRWbxhpoag@mail.gmail.com>

On 17 Feb 2016 at 12:29, Kees Cook wrote:

> >> +static void __attribute__((__section__(".rodata,\"a\",@progbits#")))
> >> +do_nothing_rodata(void)
> >> +{
> >> +       return;
> >> +}
> >> +
> >
> >
> >>
> >
> > This doesn't cross compile for me on arm64 with two different toolchains
> >
> > CC drivers/misc/lkdtm.o
> > /tmp/ccHzIWIx.s: Assembler messages:
> > /tmp/ccHzIWIx.s:21: Error: junk at end of line, first unrecognized character
> > is `#'
> > /tmp/ccHzIWIx.s: Error: unaligned opcodes detected in executable segment
> > scripts/Makefile.build:258: recipe for target 'drivers/misc/lkdtm.o' failed
> > make[2]: *** [drivers/misc/lkdtm.o] Error 1
> > scripts/Makefile.build:407: recipe for target 'drivers/misc' failed
> > make[1]: *** [drivers/misc] Error 2
> > Makefile:950: recipe for target 'drivers' failed
> > make: *** [drivers] Error 2
> >
> > I don't know the assembler well enough to give any insight.
> 
> Hm, bummer. I was trying to get fancy with the function forced into
> .rodata by trying to force the bits. Looks like "#" is not seen as a
> comment character by the toolchain you're using.
> 
> Anyone else successfully done tricks like this?

wouldn't it be a better and more generic/reusable approach to

#define __ro_text __attribute__((__section__(".rodata.text")))

and move this function there by the linker script similar to how it's done
for other code that goes into special sections?

  parent reply	other threads:[~2016-02-18 10:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16 21:49 [PATCH] lkdtm: add test for executing .rodata Kees Cook
2016-02-17  1:06 ` Laura Abbott
2016-02-17 20:29   ` Kees Cook
2016-02-17 21:06     ` Kees Cook
2016-02-18 10:32     ` PaX Team [this message]
2016-02-18 11:34       ` Ard Biesheuvel
2016-02-18 11:55         ` Ard Biesheuvel
2016-02-18 12:07         ` Arnd Bergmann
2016-02-18 12:46           ` Ard Biesheuvel
2016-02-18 20:04             ` Kees Cook
2016-02-18 21:27         ` PaX Team
2016-02-22 20:46           ` Kees Cook
2016-02-22 23:21             ` PaX Team
2016-02-23 20:53               ` Kees Cook
2016-02-23 22:00                 ` PaX Team
2016-02-23 22:02                   ` Kees Cook
2016-02-23 20:31             ` [kernel-hardening] " David Brown
2016-02-23 20:51               ` Kees Cook
2016-02-17 21:44 ` Arnd Bergmann
2016-02-17 21:45   ` Arnd Bergmann

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=56C59DC5.19217.28FA99@pageexec.freemail.hu \
    --to=pageexec@freemail.hu \
    --cc=ard.biesheuvel@linaro.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jeremy.linton@arm.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=labbott@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox