mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Juergen Gross" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Juergen Gross <jgross@suse.com>, Borislav Petkov <bp@suse.de>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/urgent] x86: Clear .brk area at early boot
Date: Sat, 02 Jul 2022 09:54:27 -0000	[thread overview]
Message-ID: <165675566764.15455.13299455113008964537.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20220630071441.28576-3-jgross@suse.com>

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     38fa5479b41376dc9d7f57e71c83514285a25ca0
Gitweb:        https://git.kernel.org/tip/38fa5479b41376dc9d7f57e71c83514285a25ca0
Author:        Juergen Gross <jgross@suse.com>
AuthorDate:    Thu, 30 Jun 2022 09:14:40 +02:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Fri, 01 Jul 2022 11:11:34 +02:00

x86: Clear .brk area at early boot

The .brk section has the same properties as .bss: it is an alloc-only
section and should be cleared before being used.

Not doing so is especially a problem for Xen PV guests, as the
hypervisor will validate page tables (check for writable page tables
and hypervisor private bits) before accepting them to be used.

Make sure .brk is initially zero by letting clear_bss() clear the brk
area, too.

Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20220630071441.28576-3-jgross@suse.com
---
 arch/x86/kernel/head64.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index e7e2332..6a3cfaf 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -430,6 +430,8 @@ void __init clear_bss(void)
 {
 	memset(__bss_start, 0,
 	       (unsigned long) __bss_stop - (unsigned long) __bss_start);
+	memset(__brk_base, 0,
+	       (unsigned long) __brk_limit - (unsigned long) __brk_base);
 }
 
 static unsigned long get_cmd_line_ptr(void)

  reply	other threads:[~2022-07-02  9:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30  7:14 [PATCH v3 0/3] x86: fix brk area initialization Juergen Gross
2022-06-30  7:14 ` [PATCH v3 1/3] x86/xen: use clear_bss() for Xen PV guests Juergen Gross
2022-07-02  9:54   ` [tip: x86/urgent] x86/xen: Use " tip-bot2 for Juergen Gross
2022-06-30  7:14 ` [PATCH v3 2/3] x86: clear .brk area at early boot Juergen Gross
2022-07-02  9:54   ` tip-bot2 for Juergen Gross [this message]
2022-06-30  7:14 ` [PATCH v3 3/3] x86: fix .brk attribute in linker script Juergen Gross
2022-07-02  9:54   ` [tip: x86/urgent] x86: Fix " tip-bot2 for Juergen Gross

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=165675566764.15455.13299455113008964537.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=bp@suse.de \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®