Received: by 10.223.185.116 with SMTP id b49csp1116836wrg; Fri, 23 Feb 2018 12:12:54 -0800 (PST) X-Google-Smtp-Source: AH8x224mKEhtSKJHl807iNuLvU0Sw4VOvao0NEljTUzjUHe+RMAjEy6RNi3Y65L1DhsaUHz0hFof X-Received: by 2002:a17:902:6783:: with SMTP id g3-v6mr2743903plk.179.1519416774819; Fri, 23 Feb 2018 12:12:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519416774; cv=none; d=google.com; s=arc-20160816; b=zx0gfGq3VFwyyVPpCPPGI0Y5bLiAXZm8CvptoY2L3a4JTVDVwOF7nDzAzcKZSKi0Ok GFgpCiTpQACAVY/Z3DX4Hp22qZmsj8jogKsPL9dX5Ru8dGE7Ox5zCXfjz6odQPdhHRct FV+WxBnJ5GcSf9HJzNwYYT/VK/jT3mFYOdPwx4ICRZp3031sjNNytliXvjtqf332D68w 7mXn31VCe2N6U6dqP0WgLF1KBEguXNvmcKR+m67Dc6frYqOmG07T0h3h9p5OI34Gacqd B2qMLFDY8XYR+qznkfD/zp4ruYMzXVgfiqbJb9QK4EtP/TWmbzPdTOY+0wdPxMiV6/46 emSA== 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=CcE5SCXA9A4vEWKys2eCfwjb875D85kE0v9SeeRUNFM=; b=Z6nZ6Y/Le7+UT23BFkACRWJeuZ38jNynsZlARmb+nLrRXAigDPN4S8/wyT+VM5waY/ bGOY37KOuFqFFhAyiFU9gVrStEwOC5Rijc+RLf8/DeUQSfyTHHB4vUNhukHTqZTYCL4U FP0hpmVg7X1A/4M7YGos35fO3YuDvyqdpAedokAFGBrXJziSl9HLpGtMFjshN6c2kx6D f6fzd7oJ/bWrC47zxxLFVK+Jky7uok66Yj3A++C/pawPL7b2PkqUxurTlqWYvdaxOL+4 qlMkNIUqSR9Qit00KjmyA2XVEZYvOhRNXfDGt4LSe+VFCMK1LFOwsRU1rcU6ttMfHl80 mhWg== 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 g24si2287534pfe.107.2018.02.23.12.12.40; Fri, 23 Feb 2018 12:12:54 -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 S932983AbeBWUMD (ORCPT + 99 others); Fri, 23 Feb 2018 15:12:03 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:40628 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932862AbeBWSlb (ORCPT ); Fri, 23 Feb 2018 13:41:31 -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 9661612B2; Fri, 23 Feb 2018 18:41:30 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Woodhouse , Thomas Gleixner , karahmed@amazon.de, peterz@infradead.org, bp@alien8.de, Jack Wang Subject: [PATCH 4.4 185/193] x86/retpoline: Avoid retpolines for built-in __init functions Date: Fri, 23 Feb 2018 19:26:58 +0100 Message-Id: <20180223170355.228144146@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170325.997716448@linuxfoundation.org> References: <20180223170325.997716448@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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: David Woodhouse (cherry picked from commit 66f793099a636862a71c59d4a6ba91387b155e0c) There's no point in building init code with retpolines, since it runs before any potentially hostile userspace does. And before the retpoline is actually ALTERNATIVEd into place, for much of it. Signed-off-by: David Woodhouse Signed-off-by: Thomas Gleixner Cc: karahmed@amazon.de Cc: peterz@infradead.org Cc: bp@alien8.de Link: https://lkml.kernel.org/r/1517484441-1420-2-git-send-email-dwmw@amazon.co.uk Signed-off-by: David Woodhouse [jwang: port to 4.4] Signed-off-by: Jack Wang Signed-off-by: Greg Kroah-Hartman --- include/linux/init.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/include/linux/init.h +++ b/include/linux/init.h @@ -4,6 +4,13 @@ #include #include +/* Built-in __init functions needn't be compiled with retpoline */ +#if defined(RETPOLINE) && !defined(MODULE) +#define __noretpoline __attribute__((indirect_branch("keep"))) +#else +#define __noretpoline +#endif + /* These macros are used to mark some functions or * initialized data (doesn't apply to uninitialized data) * as `initialization' functions. The kernel can take this @@ -39,7 +46,7 @@ /* These are for everybody (although not all archs will actually discard it in modules) */ -#define __init __section(.init.text) __cold notrace +#define __init __section(.init.text) __cold notrace __noretpoline #define __initdata __section(.init.data) #define __initconst __constsection(.init.rodata) #define __exitdata __section(.exit.data)