public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: x86@kernel.org
Cc: hpa@zytor.com, Arnd Bergmann <arnd@arndb.de>,
	Kees Cook <keescook@chromium.org>,
	Heiko Carstens <hca@linux.ibm.com>,
	Joerg Roedel <jroedel@suse.de>,
	Bob Haarman <inglorion@google.com>,
	hjl.tools@gmail.com, Arvind Sankar <nivedita@alum.mit.edu>,
	Dmitry Safonov <0x7f454c46@gmail.com>,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Subject: [PATCH] x86, vmlinux.lds: Page-Align end of ..page_aligned sections
Date: Tue, 21 Jul 2020 11:34:48 +0200	[thread overview]
Message-ID: <20200721093448.10417-1-joro@8bytes.org> (raw)

From: Joerg Roedel <jroedel@suse.de>

Align the end of the .bss..page_aligned and .data..page_aligned section
on page-size too. Otherwise the linker might place other objects on the
page of the last ..page_aligned object. This is inconsistent with other
objects in those sections, which all have their own page.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 arch/x86/kernel/vmlinux.lds.S     | 1 +
 include/asm-generic/vmlinux.lds.h | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 3bfc8dd8a43d..9a03e5b23135 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -358,6 +358,7 @@ SECTIONS
 	.bss : AT(ADDR(.bss) - LOAD_OFFSET) {
 		__bss_start = .;
 		*(.bss..page_aligned)
+		. = ALIGN(PAGE_SIZE);
 		*(BSS_MAIN)
 		BSS_DECRYPTED
 		. = ALIGN(PAGE_SIZE);
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 3ceb4b7279ec..bd6302bd1d0f 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -360,7 +360,8 @@
 
 #define PAGE_ALIGNED_DATA(page_align)					\
 	. = ALIGN(page_align);						\
-	*(.data..page_aligned)
+	*(.data..page_aligned)						\
+	. = ALIGN(page_align);
 
 #define READ_MOSTLY_DATA(align)						\
 	. = ALIGN(align);						\
@@ -758,6 +759,7 @@
 	.bss : AT(ADDR(.bss) - LOAD_OFFSET) {				\
 		BSS_FIRST_SECTIONS					\
 		*(.bss..page_aligned)					\
+		. = ALIGN(PAGE_SIZE);					\
 		*(.dynbss)						\
 		*(BSS_MAIN)						\
 		*(COMMON)						\
-- 
2.27.0

             reply	other threads:[~2020-07-21  9:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-21  9:34 Joerg Roedel [this message]
2020-07-21 18:44 ` [PATCH] x86, vmlinux.lds: Page-Align end of ..page_aligned sections Kees Cook
2020-07-21 20:05   ` Thomas Gleixner
2020-07-21 21:18     ` 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=20200721093448.10417-1-joro@8bytes.org \
    --to=joro@8bytes.org \
    --cc=0x7f454c46@gmail.com \
    --cc=arnd@arndb.de \
    --cc=hca@linux.ibm.com \
    --cc=hjl.tools@gmail.com \
    --cc=hpa@zytor.com \
    --cc=inglorion@google.com \
    --cc=jroedel@suse.de \
    --cc=keescook@chromium.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nivedita@alum.mit.edu \
    --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