From: Joerg Roedel <joro@8bytes.org>
To: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>
Cc: hpa@zytor.com, Linus Torvalds <torvalds@linux-foundation.org>,
Dave Hansen <dave.hansen@intel.com>,
Andy Lutomirski <luto@amacapital.net>,
Borislav Petkov <bp@alien8.de>, Jiri Kosina <jkosina@suse.cz>,
linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
x86@kernel.org, Joerg Roedel <jroedel@suse.de>
Subject: [PATCH 2/3] x86/pti: Call pti_init() after mark_readonly()
Date: Tue, 3 Jul 2018 13:52:25 +0200 [thread overview]
Message-ID: <1530618746-23116-3-git-send-email-joro@8bytes.org> (raw)
In-Reply-To: <1530618746-23116-1-git-send-email-joro@8bytes.org>
From: Joerg Roedel <jroedel@suse.de>
PTI init code clones some parts of the kernel mappings to the user-space
page-table. For the kernel and user-space page-table to be consistent,
the cloning should happen when the relevant parts of the kernel
page-table are finished, which is right after mark_readonly() returns.
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
init/main.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/init/main.c b/init/main.c
index 3b4ada1..0b5d0f1 100644
--- a/init/main.c
+++ b/init/main.c
@@ -524,8 +524,6 @@ static void __init mm_init(void)
ioremap_huge_init();
/* Should be run before the first non-init thread is created */
init_espfix_bsp();
- /* Should be run after espfix64 is set up. */
- pti_init();
}
asmlinkage __visible void __init start_kernel(void)
@@ -1065,6 +1063,12 @@ static int __ref kernel_init(void *unused)
jump_label_invalidate_initmem();
free_initmem();
mark_readonly();
+ /*
+ * Kernel text/rodata/data sections have the right protections
+ * now. If necessary, init PTI and clone the relevant pieces
+ * to the user-space page-table.
+ */
+ pti_init();
system_state = SYSTEM_RUNNING;
numa_default_policy();
--
2.7.4
next prev parent reply other threads:[~2018-07-03 11:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-03 11:52 [PATCH 0/3] " Joerg Roedel
2018-07-03 11:52 ` [PATCH 1/3] x86/pti: Move pti_init() code out of __init Joerg Roedel
2018-07-03 11:52 ` Joerg Roedel [this message]
2018-07-03 11:52 ` [PATCH 3/3] x86/pti: Call pti_clone_kernel_text() from pti_init() Joerg Roedel
2018-07-10 13:19 ` [PATCH 0/3] x86/pti: Call pti_init() after mark_readonly() Joerg Roedel
2018-07-10 20:25 ` Thomas Gleixner
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=1530618746-23116-3-git-send-email-joro@8bytes.org \
--to=joro@8bytes.org \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=hpa@zytor.com \
--cc=jkosina@suse.cz \
--cc=jroedel@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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
Powered by JetHome