Received: by 10.223.176.46 with SMTP id f43csp2645771wra; Mon, 22 Jan 2018 00:47:51 -0800 (PST) X-Google-Smtp-Source: AH8x225VC6pi0GDuDcNUy6AOsrERSTWgMiJNlvBPneDHfJU4HRkS+gzas8Rb6hNXz7BWPZG3zlpx X-Received: by 10.98.67.82 with SMTP id q79mr7704182pfa.144.1516610871412; Mon, 22 Jan 2018 00:47:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516610871; cv=none; d=google.com; s=arc-20160816; b=DC18k/NHE7GCBU9QepJ4uRUgoqtGRylDEArgGAwpeBhnjIso2qFvjI4esBnDu3EnqQ 9xmRiNmS/W2KbKD3e2OSA60T3b5mRme1AojUA47rrYoU8bAHClEYvCC5aZ6q6EWe+gly NH62ctYk7cdjZRtyXQDbRpOXgAdLeCCFlGhG9BeoAI93U8VgjL2WnNjAkyZrs1N1Xd29 wkbV6VXAdrpESzP/9fMSdurSkU5/+eGHTlBbrWqIdlMevddcdrOfOOm3Ck2MIvYPibji x/FX/Fj9XlC+xlsOqkm+izQX8vDkDuEjjxT4KZ6uh9/nhV10o5Tdp6RObb+JykKx5c0M NOTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=j41SKYEZSlgNwyS44zH3/RZqF37+uyseDusmLPVYOzE=; b=C64bH5CfXX1PrNtXaTHdgEY86f2PEOSmJOd7Dy0wtYyHQYdnzETHZ4i0cu16PM403K N/+XKe9Ro/kAT4HRgaHu7LDrfgMvqyDXxpJ1WVv/mJwzYyDiivN4Es9sTiXDvJOmQh5B OZmX7rIat0VHsxMD02PNoFW8I+2OCtElu9Zgfad8zt5ad9WDAUCNVJPNRUpwHTEbCWm/ +rFl793DYJzMAhxnQZKFoHyf9swoc/Y/phiJAQ05/LKRsCBgWeU/2LVQWTSll5kfdAJW O2t1wWfgLn2d6Tbo2Ndq/J85ym3m/pjSedRrjYYzaaDNJml2SuHMhlm4ceLYouvwxBEx 933A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b34-v6si1082599pld.389.2018.01.22.00.47.37; Mon, 22 Jan 2018 00:47:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751812AbeAVIqa (ORCPT + 99 others); Mon, 22 Jan 2018 03:46:30 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:59054 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751440AbeAVImq (ORCPT ); Mon, 22 Jan 2018 03:42:46 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 37BC3FB5; Mon, 22 Jan 2018 08:42:45 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Thomas Gleixner , David Woodhouse , Andi Kleen , Peter Zijlstra , Ananth N Mavinakayanahalli , Arjan van de Ven , Greg Kroah-Hartman Subject: [PATCH 4.4 49/53] retpoline: Introduce start/end markers of indirect thunk Date: Mon, 22 Jan 2018 09:40:41 +0100 Message-Id: <20180122083912.717880760@linuxfoundation.org> X-Mailer: git-send-email 2.16.0 In-Reply-To: <20180122083910.299610926@linuxfoundation.org> References: <20180122083910.299610926@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Masami Hiramatsu commit 736e80a4213e9bbce40a7c050337047128b472ac upstream. 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 Signed-off-by: Thomas Gleixner Acked-by: David Woodhouse Cc: Andi Kleen Cc: Peter Zijlstra Cc: Ananth N Mavinakayanahalli Cc: Arjan van de Ven Cc: Greg Kroah-Hartman Link: https://lkml.kernel.org/r/151629206178.10241.6828804696410044771.stgit@devbox Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/nospec-branch.h | 3 +++ arch/x86/kernel/vmlinux.lds.S | 7 +++++++ arch/x86/lib/retpoline.S | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -171,6 +171,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 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -104,6 +104,13 @@ SECTIONS IRQENTRY_TEXT *(.fixup) *(.gnu.warning) + +#ifdef CONFIG_RETPOLINE + __indirect_thunk_start = .; + *(.text.__x86.indirect_thunk) + __indirect_thunk_end = .; +#endif + /* End of text section */ _etext = .; } :text = 0x9090 --- 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