lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200113230642.GA2000869@rani.riverdale.lan>
Date:   Mon, 13 Jan 2020 18:06:43 -0500
From:   Arvind Sankar <nivedita@...m.mit.edu>
To:     Tom Lendacky <thomas.lendacky@....com>
Cc:     Arvind Sankar <nivedita@...m.mit.edu>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
        linux-kernel@...r.kernel.org, Kees Cook <keescook@...omium.org>,
        Mauro Rossi <issor.oruam@...il.com>,
        Michael Matz <matz@...e.de>
Subject: Re: [PATCH v3] x86/vmlinux: Fix vmlinux.lds.S with pre-2.23 binutils

On Mon, Jan 13, 2020 at 03:46:04PM -0600, Tom Lendacky wrote:
> > @@ -372,7 +374,7 @@ SECTIONS
> >  	 * explicitly reserved using memblock_reserve() or it will be discarded
> >  	 * and treated as available memory.
> >  	 */
> > -	__end_of_kernel_reserve = .;
> > +	__end_of_kernel_reserve = __bss_stop;
> 
> The only thing I worry about is if someone inserts a section between
> the bss section and here and doesn't update this value.
> 
> Thanks,
> Tom

Could do something like this, or maybe with just the comment?

diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index bad4e22384dc..25aa1b30068e 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -373,9 +373,16 @@ SECTIONS
 	 * automatically reserved in setup_arch(). Anything after here must be
 	 * explicitly reserved using memblock_reserve() or it will be discarded
 	 * and treated as available memory.
+	 *
+	 * Note that this is defined to use __bss_stop rather than dot for
+	 * compatibility with binutils <2.23, so the definition MUST be updated
+	 * if another section is added after .bss.
 	 */
 	__end_of_kernel_reserve = __bss_stop;
 
+	/* Used for build-time check that __end_of_kernel_reserve is correct */
+	__end_of_kernel_reserve_check = .;
+
 	. = ALIGN(PAGE_SIZE);
 	.brk : AT(ADDR(.brk) - LOAD_OFFSET) {
 		__brk_base = .;
@@ -451,6 +458,9 @@ INIT_PER_CPU(irq_stack_backing_store);
 
 #endif /* CONFIG_X86_32 */
 
+. = ASSERT(__end_of_kernel_reserve == __end_of_kernel_reserve_check,
+	   "__end_of_kernel_reserve is incorrectly defined");
+
 #ifdef CONFIG_KEXEC_CORE
 #include <asm/kexec.h>
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ