Received: by 10.223.176.5 with SMTP id f5csp2857295wra; Mon, 5 Feb 2018 11:03:14 -0800 (PST) X-Google-Smtp-Source: AH8x2263yQqOl1oTk063f8SxikPp9UpSDsB1iRnPCRTdZFyVW9RgRlufNDAqZSgFpIWpvi47Pi/6 X-Received: by 2002:a17:902:8d97:: with SMTP id v23-v6mr39691835plo.248.1517857394768; Mon, 05 Feb 2018 11:03:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517857394; cv=none; d=google.com; s=arc-20160816; b=TO31tNSKenz5ITVG7wUf8eYCTq8/D1ysvhd8hHCu0b1/lID8+yUwjz+mD4qNYCeFl6 mfbUALYsGvJddsflquypAJ4Fe51EoySgVxrKA4dBCn5+XDMmYv0CXL5RbYIlrEo+/loF 92peVTH1uZLBGh90R79TDcjrAljgErRbtzDgcPjuiPVPIbDkatHkMu4j0NVOXRXQoPvx HlxKbxEANjPlLkCG9PfTzKjjepjo8u/tvRQcTGXGd9krZmGWAo44JFmwu1oQTD4cySnM qQFS4Pr7ltuRLXMAp3LLedoTEx5HSX+WNMo8srECyAiTE0Uh1jKjs2jR+rOk2hH26ZLR 9IeQ== 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=Js9TZI84IPNk+Ew8ZTvxnk+WmSl6+hlvCYeZ3yRxLVQ=; b=BCM2QJUcasXfDoUi21pY3ismjmIK9fsQgDwgQeJQFTNl+uCoQIs5W7yqv0dBhkr3ch lflZfSYIao+ou5KQZ7JEFKioPkwweP3uTW/JFy5TuyEU4qyNFWGW+UVpxfVeLtGub6X1 e4s+FjXLZXvuZMDcbC8wVbRNT3p2NmqhboPpXn+qDAIwod7y3kvA7XSou6yRu8+y8c8v RsF48esHjvxEz39peSzosDwwEahc2TqrXSucjEcnGklwK3kz7dLTwI17Dszx1O8kYiOg xzwxPla8EeUIAobQt6dZ2TZs0QL1jbUDe/h1KEg7RKDH+TuhmhyUsm51bQcpN8dNNn1v 1EEg== 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 t12si1367389pgq.379.2018.02.05.11.02.59; Mon, 05 Feb 2018 11:03:14 -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 S1753627AbeBETCi (ORCPT + 99 others); Mon, 5 Feb 2018 14:02:38 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:51716 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753546AbeBESY3 (ORCPT ); Mon, 5 Feb 2018 13:24:29 -0500 Received: from localhost (unknown [104.132.1.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 438DC10EA; Mon, 5 Feb 2018 18:24:25 +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 Subject: [PATCH 4.14 54/64] x86/retpoline: Avoid retpolines for built-in __init functions Date: Mon, 5 Feb 2018 10:23:13 -0800 Message-Id: <20180205182140.797161571@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180205182138.571333346@linuxfoundation.org> References: <20180205182138.571333346@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Woodhouse dwmw@amazon.co.uk 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: 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 @@ -5,6 +5,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 @@ -40,7 +47,7 @@ /* These are for everybody (although not all archs will actually discard it in modules) */ -#define __init __section(.init.text) __cold __inittrace __latent_entropy +#define __init __section(.init.text) __cold __inittrace __latent_entropy __noretpoline #define __initdata __section(.init.data) #define __initconst __section(.init.rodata) #define __exitdata __section(.exit.data)