Received: by 10.223.176.5 with SMTP id f5csp640432wra; Fri, 2 Feb 2018 03:48:53 -0800 (PST) X-Google-Smtp-Source: AH8x226mK53T7r8II2ppTmStMjyVODN6THmz/uuhGMhiSB8lqy/iD6LzMW9o9bURWFIpZjSjMgMg X-Received: by 2002:a17:902:9044:: with SMTP id w4-v6mr35137123plz.354.1517572133401; Fri, 02 Feb 2018 03:48:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517572133; cv=none; d=google.com; s=arc-20160816; b=cLJ60kE63X4MrrbM0+iy14oMOlhu9cXqL6NmswSnCv7rm7VW3DyC0AlAXyliNtEkXd zWf5ThGFNjfLlFs+VMN/f4/XLkJpkMPML1vyOdAJbxRJY5yn8pIhr2P4ZQNUQmy3CXs7 y/2mtN6RhkTkMSHCVaFwdcXQgJTnqhmRW6nv/nMczpn1Vm9VS58nWbM4SEndDQx1H6pQ H9/k4OAL9WahC+7InPdxAKRykqkyvfqH1y9Tp75JeMYKeQyR+NJTC8npetv44REaz7CW NG2KC/OTnD6QLFCS6O4hkbv4ABdMdSQVMfaglbH+IAvDlEg92uWOpXwrCerfqeo+aEXf vnBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=UnJDiv2xQ0i+VTTMDSRMgD2qKQIveV5Xo8MGkgA9O2w=; b=GMwhRkQ7cfQwKo3wXaCwXcLwejVUXixyIcQnNvex85Eg3JWcEYVEs9PFiG2q2dTQTX ce2dfXRsXOWOI2pz0luyj7GTp9tr4mgavXSDPqnV+vVsfWyk8tZjnnLJsCD83sEZKH8U c+mCmEd9hKH8o2O+jhiwvaxnUzGMe+vdzQx7oxtbcSEFqw8O0tAwfe5dzyhbgXS45vhY AGIobfPM021/9KcGwifxtToiq9P0PVxKfzpuRMK3UF1Nkov8pMK5GUQjplcAnIlkqDbw IUUyfWWxrTaEY7XAWmYYmUl/Fvsym6zDFYOcDS5oK5ViO1nnhRdJwRARquhrjacwV0jN 2ucA== 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 186si1629740pfe.411.2018.02.02.03.48.37; Fri, 02 Feb 2018 03:48:53 -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 S1751544AbeBBLr7 (ORCPT + 99 others); Fri, 2 Feb 2018 06:47:59 -0500 Received: from terminus.zytor.com ([65.50.211.136]:46857 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750773AbeBBLrx (ORCPT ); Fri, 2 Feb 2018 06:47:53 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w12BkfIF005382; Fri, 2 Feb 2018 03:46:41 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w12Bkf8G005379; Fri, 2 Feb 2018 03:46:41 -0800 Date: Fri, 2 Feb 2018 03:46:41 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for David Woodhouse Message-ID: Cc: mingo@kernel.org, tglx@linutronix.de, hpa@zytor.com, dwmw@amazon.co.uk, linux-kernel@vger.kernel.org Reply-To: mingo@kernel.org, dwmw@amazon.co.uk, linux-kernel@vger.kernel.org, tglx@linutronix.de, hpa@zytor.com In-Reply-To: <1517484441-1420-2-git-send-email-dwmw@amazon.co.uk> References: <1517484441-1420-2-git-send-email-dwmw@amazon.co.uk> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/pti] x86/retpoline: Avoid retpolines for built-in __init functions Git-Commit-ID: 66f793099a636862a71c59d4a6ba91387b155e0c X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 66f793099a636862a71c59d4a6ba91387b155e0c Gitweb: https://git.kernel.org/tip/66f793099a636862a71c59d4a6ba91387b155e0c Author: David Woodhouse AuthorDate: Thu, 1 Feb 2018 11:27:20 +0000 Committer: Thomas Gleixner CommitDate: Fri, 2 Feb 2018 12:28:27 +0100 x86/retpoline: Avoid retpolines for built-in __init functions 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 --- include/linux/init.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/linux/init.h b/include/linux/init.h index ea1b311..506a981 100644 --- 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 __latent_entropy +#define __init __section(.init.text) __cold __latent_entropy __noretpoline #define __initdata __section(.init.data) #define __initconst __section(.init.rodata) #define __exitdata __section(.exit.data)