Received: by 10.223.176.5 with SMTP id f5csp2842899wra; Mon, 5 Feb 2018 10:47:51 -0800 (PST) X-Google-Smtp-Source: AH8x226Qy72SDycWnjiblbJ/9wwNTK04qjVv5oJIw/O5kC3d7soTZGOAX2xZrStiRhvz3YtP+XsE X-Received: by 10.98.10.199 with SMTP id 68mr21930673pfk.202.1517856471651; Mon, 05 Feb 2018 10:47:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517856471; cv=none; d=google.com; s=arc-20160816; b=JnY2kNb4qVMAQVtpOnbc+u8PI9cfgkOgXaSsF+A0tWJnkiGPUxGXBLU5IEIkSYNC7r bnOLcILELsIOJ2aOurPndrPxzUUi4MKKjXyIi/z5s4oOAIC9H66a2Pkr0Y886k5byX2g d2SaBhFRkPBCkqdzmybU7HVaUN5/SvkAX/+wDKFHg1vfQfxTNxGBj6oFiH6Gu9fRh0KD MZPt50pCDlQlj1kBg1uyaFYXeutKk4V/bJsW+3JoxtqLj2SaYdGQ4jFvplUwhV6AbsCr 9XBRP1ohriqpsEWkdJHI09Q6b8DmkbEwntO/KIxipx9LRHs5xkdbhK1uxkthYCSlOys2 a3ng== 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=/q+vbY6vljct3Ij9Z3knpqR88K4gLQ9yCKf7jtRGIyA=; b=x53Uh2C5nixYOreumuGRreCvCQPJobdUSFzpvfL3ezePb+ldHkYimJ6ZtLfQ3KTpzt tsC6JqIkp8Z/og57GHOOqYjEN0QEbwOrqimGlZsiJFCG0YrxflXIVPF79gB5zhUcaigm p9j9qsMGveMmM/S368byE5ghA+IGbLvIvIYQSXjkSCJknAbm5pgS8lNbvFWoUY/Ptbs/ zn6g3L+/46kqLq1FE1vArMJBxuGZZhqVMRS6l7HF1q+YYp5OHGMPz+sXUeiDN2/rqcgZ zti8QAsBIIbkc4J8YVShzghvPM4Si21IcCAVZhZUlbpVdkq2U6zljTVyGRHpkBrc4iVY m2Tw== 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 98-v6si4674708pla.756.2018.02.05.10.47.37; Mon, 05 Feb 2018 10:47:51 -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 S1753675AbeBESpb (ORCPT + 99 others); Mon, 5 Feb 2018 13:45:31 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:53200 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752582AbeBES0K (ORCPT ); Mon, 5 Feb 2018 13:26:10 -0500 Received: from localhost (unknown [104.132.1.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5AF8A1005; Mon, 5 Feb 2018 18:25:57 +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.15 50/60] x86/retpoline: Avoid retpolines for built-in __init functions Date: Mon, 5 Feb 2018 10:23:23 -0800 Message-Id: <20180205182216.300380140@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180205182213.902626065@linuxfoundation.org> References: <20180205182213.902626065@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.15-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 __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)