linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Johannes Hirte <johannes.hirte@datenkhaos.de>
Cc: Borislav Petkov <bp@suse.de>,
	Sami Tolvanen <samitolvanen@google.com>,
	linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH] x86/build: Move _etext to actual end of .text
Date: Tue, 14 May 2019 08:43:19 -0700	[thread overview]
Message-ID: <201905140842.21066115C5@keescook> (raw)
In-Reply-To: <20190514120416.GA11736@probook>

On Tue, May 14, 2019 at 02:04:21PM +0200, Johannes Hirte wrote:
> On 2019 Apr 23, Kees Cook wrote:
> > When building x86 with Clang LTO and CFI, CFI jump regions are
> > automatically added to the end of the .text section late in linking. As a
> > result, the _etext position was being labelled before the appended jump
> > regions, causing confusion about where the boundaries of the executable
> > region actually are in the running kernel, and broke at least the fault
> > injection code. This moves the _etext mark to outside (and immediately
> > after) the .text area, as it already the case on other architectures
> > (e.g. arm64, arm).
> > 
> > Reported-and-tested-by: Sami Tolvanen <samitolvanen@google.com>
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> > ---
> >  arch/x86/kernel/vmlinux.lds.S | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
> > index bad8c51fee6e..de94da2366e7 100644
> > --- a/arch/x86/kernel/vmlinux.lds.S
> > +++ b/arch/x86/kernel/vmlinux.lds.S
> > @@ -141,11 +141,11 @@ SECTIONS
> >  		*(.text.__x86.indirect_thunk)
> >  		__indirect_thunk_end = .;
> >  #endif
> > -
> > -		/* End of text section */
> > -		_etext = .;
> >  	} :text = 0x9090
> >  
> > +	/* End of text section */
> > +	_etext = .;
> > +
> >  	NOTES :text :note
> >  
> >  	EXCEPTION_TABLE(16) :text = 0x9090
> > -- 
> > 2.17.1
> 
> This breaks the build on my system:
> 
>   RELOCS  arch/x86/boot/compressed/vmlinux.relocs
>   CC      arch/x86/boot/compressed/early_serial_console.o
>   CC      arch/x86/boot/compressed/kaslr.o
>   AS      arch/x86/boot/compressed/mem_encrypt.o
>   CC      arch/x86/boot/compressed/kaslr_64.o
> Invalid absolute R_X86_64_32S relocation: _etext
> make[2]: *** [arch/x86/boot/compressed/Makefile:130: arch/x86/boot/compressed/vmlinux.relocs] Error 1
> make[2]: *** Deleting file 'arch/x86/boot/compressed/vmlinux.relocs'
> make[2]: *** Waiting for unfinished jobs....
> make[1]: *** [arch/x86/boot/Makefile:112: arch/x86/boot/compressed/vmlinux] Error 2
> make: *** [arch/x86/Makefile:283: bzImage] Error 2

Interesting! Can you send along your .config and compiler details?

-- 
Kees Cook

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

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23 18:38 [PATCH] x86/build: Move _etext to actual end of .text Kees Cook
2019-04-24 11:12 ` [tip:x86/mm] " tip-bot for Kees Cook
2019-05-14 12:04 ` [PATCH] " Johannes Hirte
2019-05-14 15:43   ` Kees Cook [this message]
2019-05-14 16:10     ` Johannes Hirte
2019-05-15 18:54       ` Kees Cook
2019-05-16 13:56         ` Johannes Hirte
2019-05-16 17:51           ` Kees Cook
2019-06-01  8:51 Klaus Kusche
2019-06-05 16:08 Alec Ari
2019-06-05 18:16 ` Kees Cook
2019-06-05 18:43   ` Greg KH
2019-06-09  9:35 Klaus Kusche
2019-06-09 18:40 ` Johannes Hirte
2019-06-19 18:37   ` Ross Zwisler
2019-06-20 17:58     ` Kees Cook

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=201905140842.21066115C5@keescook \
    --to=keescook@chromium.org \
    --cc=bp@suse.de \
    --cc=johannes.hirte@datenkhaos.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samitolvanen@google.com \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).