Received: by 10.223.176.46 with SMTP id f43csp2675420wra; Mon, 22 Jan 2018 01:22:12 -0800 (PST) X-Google-Smtp-Source: AH8x2256m1fU9K+Hs9t0f4c8JuNEzU9BnRXSXx3MbIj/K6u950knJEZyXrxOSPwosW4K29Nfdjsj X-Received: by 10.99.43.13 with SMTP id r13mr2151627pgr.242.1516612932293; Mon, 22 Jan 2018 01:22:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516612932; cv=none; d=google.com; s=arc-20160816; b=OgG2xKohhKm743aSwrwBpnova3f7n0yAVLpC24YGHT7MgwGoz05W4HvDQrDmRDCQe7 w2M95c6T8UfTFrQdCBHy5GGpaGNo5hnwq9HQO1DBMBhKION8xBRHXSD4/UIw/Qvp07L2 XjUGbob2rL7nhl+5UbRzlt+xIpjdEQGoM58+a2uTnRAJe9qeiFOpXQ2CQL9Ox8PFha9X V7jAm68KY5Fbf2APlJ4SWzJcO4DAM5JP+mwtduxLqMy8UKd5DOFSmjqeffoe6cApELxu 1V+orvsmNtd/4YC/VkCXsqYiZc/izWl84iMrMakRJd/pthauFWj3PVPEW3bWNQvXv+YU a6ug== 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=dnpi9vXqb68VPMkWkaLMogCS37p2A+wG/NsxMSCi7qk=; b=XWfMG59Heabz9tX3uw2nQoXE+8oimPkSvJ866f/OewiWSavltlbTgvDsMAB6vBud8Q DC6LH6kgFjeGXc1+v6M0btPngD7ofENmp9wMuCe9KqGnKMVo0xRYHSejfXI0JmxBnOtF EF5zPHE7SrQ2x3akpGgdJDlXzKcLrl2KHcnqk+JA747V4GAPglfiXlOB3sFMprEDGdUj NVaUmvrlO3id8SN2eZANqCThg880CZOIM8NfiUmX5QxPnflOaPkKzlGxAMSC+jnQ3GJS HaKbTXyPXmdS29HSKOlItW8FudzkKotoIHikbP6Kmw0lidHkA/mNj7QMzNegUBFP1uPN fqpA== 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 d25si15168816pfl.211.2018.01.22.01.21.58; Mon, 22 Jan 2018 01:22:12 -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 S1751645AbeAVItY (ORCPT + 99 others); Mon, 22 Jan 2018 03:49:24 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:60664 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752494AbeAVItU (ORCPT ); Mon, 22 Jan 2018 03:49:20 -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 58848E10; Mon, 22 Jan 2018 08:49:19 +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.9 43/47] retpoline: Introduce start/end markers of indirect thunk Date: Mon, 22 Jan 2018 09:45:54 +0100 Message-Id: <20180122083928.744239769@linuxfoundation.org> X-Mailer: git-send-email 2.16.0 In-Reply-To: <20180122083925.568134913@linuxfoundation.org> References: <20180122083925.568134913@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.9-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 @@ -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 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -105,6 +105,13 @@ SECTIONS SOFTIRQENTRY_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