Received: by 10.223.176.5 with SMTP id f5csp711527wra; Fri, 9 Feb 2018 06:04:58 -0800 (PST) X-Google-Smtp-Source: AH8x225aAlwo93103haWuxeOsq2HCB7102G8QweZZM8mRsl+WurfpZk7Lkm2sz1UIHStvGby2hKR X-Received: by 10.101.82.134 with SMTP id y6mr2562102pgp.101.1518185097935; Fri, 09 Feb 2018 06:04:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518185097; cv=none; d=google.com; s=arc-20160816; b=kTlhMRzZoP/uMKimOogUGd5vF7u7caV3t8boh9IsT9/t9bK5+SEcpTgMVQw/C8+UM0 riSudqOe00URycfxYRb1ixOQGJElpVpcGrforaBUV2UccV5FH9GsPkXafs4UdZqJH2WD KiQM3pgvAyOM64XlH1Dl0xTFcoONNEELgI0Q6vWzk4hmPglOR5jgRd7k6OxAwJcMs0h6 XrQUpL/nn5yYj4QB8XznQa/8MnUG2dXIWGPJ9DVhIArLGkkzHyWda0a3HuYVlPgMNJND ubkXIYHnRpgLdeD7dF9kh8eHtRH+t5aLAht0tBgQTNveffbr+wvVG0clWUdkE9qWOWqT 0/CQ== 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=f/v85SbPLypmrNgA6Rndb+qd27z6xDDl7YiikB+I78w=; b=eSDequfn6s33BQSrabZBxO5YKrAYu4iCy1+837IvW1035ljQDotSmkj3KzAwDWpHsM 9SFRH3HgNryaVNqmgHgNO8oi9UaB/OQkS+k7kzKxJkBr5ZAHyvW3z0OoqpGEKxbZrfI6 geEo2mHGjtfsh1tOOo5pGg3RA9k1P2wXdIP6EuPkFLz8P3agyLawk60UGLsAzVzg5GBy P+9+Dg7CnJrUlNa77g3d/O2TV1RMJc+TAZ+Q/yPjU8XSGyOXFthEgvrxicu3y4GpVISE bRVA33WAZHheuXTZL40SVG4v5yVT6uPS7uM4b+iuOyliQk5bDJLsOXIY6lj+pGeI98HZ ux+A== 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 m186si1761210pfm.25.2018.02.09.06.04.42; Fri, 09 Feb 2018 06:04:57 -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 S1753409AbeBIOC6 (ORCPT + 99 others); Fri, 9 Feb 2018 09:02:58 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:50924 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753234AbeBINnj (ORCPT ); Fri, 9 Feb 2018 08:43:39 -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 2FFED1080; Fri, 9 Feb 2018 13:43:35 +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.9 72/92] x86/retpoline: Avoid retpolines for built-in __init functions Date: Fri, 9 Feb 2018 14:39:41 +0100 Message-Id: <20180209133936.436291131@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180209133931.211869118@linuxfoundation.org> References: <20180209133931.211869118@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: 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 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 __latent_entropy +#define __init __section(.init.text) __cold notrace __latent_entropy __noretpoline #define __initdata __section(.init.data) #define __initconst __section(.init.rodata) #define __exitdata __section(.exit.data)