From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: ACJfBovzo6YYF7+uW7FnStJ5CHSLK1ZcrnOltHYxFtdJnsCHERMpHbW5nfF+QmMDcjBCWggQHJba ARC-Seal: i=1; a=rsa-sha256; t=1516292086; cv=none; d=google.com; s=arc-20160816; b=Pxr26U5uEpNJ45oHO5yMBJyfSBnXmWcZh+cJvzGolYMwlush+r3IlVATdRSVOBtPE1 H7Lp87OjFIGvnH+Zx76nEGGMc4MnvlIvgfB0svywS45B/I+2BYhH7bfqri4whcpvb8vQ eTFZ5Kk+AWVZexLmgA7jd8Lflxu7QTwLRrJfsfThVHyRaZQ39SVPu4E5sI/4QCgwUpWh cNVyVfciXuGVdYDqo4tXcbl9iExPDTZxFYA9g+y6sNZHNzyuze6szVZ/2LlbryNN+w62 qKCEI9Lnf2VoXZhSpZwoNdkG8Xw2cGFwcd0ef3BOXE468gPt6MmrGTO2GYbnU614vdyM s2kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=prtytJkeGv6CK8C/5F04szhPyOpLU1Lii1JhU/1fqUw=; b=VPs1/B0kwOy1NXkuj99mTod5mCDdmZ69INm8PQinviOQPatSK5ZdMmuonk6lyR2HK3 P17MMERkJdMZzyv+rIgVs/3xtFBQedUwjfEp5bF8vJ5WkxRWrItJ6YAWohDv/Unjv1qz U8r9XUJV1GSawrovyHs8zFtOHezxEwwfoLwbxj4sC9DzvIHJDtK7xDxu5zHSZQd2rZ+1 +OfhItKDz0n4tSO+D1uzqEm4ust8QIPZocwyDqDB8hoorjrmIQh/6O9GHDU5wTQ0oBb1 C7FmTiLucn6PFc9sW+VQh95Cr9J9E5hgJNEKXlpVkkrIwXuRNdQFfAagyisKSML0MltK CIyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of mhiramat@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=mhiramat@kernel.org Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of mhiramat@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=mhiramat@kernel.org DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F323421747 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org From: Masami Hiramatsu To: Ingo Molnar , David Woodhouse Cc: Masami Hiramatsu , linux-kernel@vger.kernel.org, Andi Kleen , Greg Kroah-Hartman , Arjan van de Ven , Peter Zijlstra , Ananth N Mavinakayanahalli , Thomas Gleixner , "H . Peter Anvin" Subject: [PATCH v2 tip/master 1/3] retpoline: Introduce start/end markers of indirect thunk Date: Fri, 19 Jan 2018 01:14:21 +0900 Message-Id: <151629206178.10241.6828804696410044771.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <151629203720.10241.17490679760505352230.stgit@devbox> References: <151629203720.10241.17490679760505352230.stgit@devbox> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1589931570462984334?= X-GMAIL-MSGID: =?utf-8?q?1589947490339094523?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: Introduce start/end markers of __x86_indirect_thunk_* functions. To make it easy, consolidate .text.__x86.indirect_thunk.* sections to one .text.__x86.indirect_thunk section and put it in the end of kernel text section and adds __indirect_thunk_start/end so that other subsystem (e.g. kprobes) can identify it. Signed-off-by: Masami Hiramatsu --- Changes in v2: - Consolidate .text.__x86.indirect_thunk.* sections to one .text.__x86.indirect_thunk section. (Thanks David!) --- arch/x86/include/asm/nospec-branch.h | 3 +++ arch/x86/kernel/vmlinux.lds.S | 6 ++++++ arch/x86/lib/retpoline.S | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h index 7b45d8424150..19ba5ad19c65 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -194,6 +194,9 @@ enum spectre_v2_mitigation { SPECTRE_V2_IBRS, }; +extern char __indirect_thunk_start[]; +extern char __indirect_thunk_end[]; + /* * On VMEXIT we must ensure that no RSB predictions learned in the guest * can be followed in the host, by overwriting the RSB completely. Both diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 1e413a9326aa..9b138a06c1a4 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -124,6 +124,12 @@ SECTIONS ASSERT(. - _entry_trampoline == PAGE_SIZE, "entry trampoline is too big"); #endif +#ifdef CONFIG_RETPOLINE + __indirect_thunk_start = .; + *(.text.__x86.indirect_thunk) + __indirect_thunk_end = .; +#endif + /* End of text section */ _etext = .; } :text = 0x9090 diff --git a/arch/x86/lib/retpoline.S b/arch/x86/lib/retpoline.S index cb45c6cb465f..d3415dc30f82 100644 --- a/arch/x86/lib/retpoline.S +++ b/arch/x86/lib/retpoline.S @@ -9,7 +9,7 @@ #include .macro THUNK reg - .section .text.__x86.indirect_thunk.\reg + .section .text.__x86.indirect_thunk ENTRY(__x86_indirect_thunk_\reg) CFI_STARTPROC