Received: by 10.223.176.5 with SMTP id f5csp2622600wra; Thu, 1 Feb 2018 03:28:18 -0800 (PST) X-Google-Smtp-Source: AH8x224jE6TNaxCGdx9U2smKY8cKj0Z7k6DmPsEVV+gK88viQxrb4Hl+UnyRaiS44t2DcUaAjImT X-Received: by 10.98.226.24 with SMTP id a24mr36952345pfi.192.1517484498007; Thu, 01 Feb 2018 03:28:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517484497; cv=none; d=google.com; s=arc-20160816; b=cjT0iZkbwGamd/uuUpbM4HpHuOSZaLNwqSqXOF7aUZ8JI+0Fcc2ftmDsjAq3Dg8Ciz BY1q2CPpX/yZGTs9vhGlqkqbshkTU2mQ69PUi7QcWaEEKrrALigSvX5ZNBTpmm6PbZeH px8clEm5hUnMaCMVQvt00TQ8y3FohelP5gAKROgIextjAh55rlNAkeMd8rfqB1CieTrR jCxOvWCuekeY9SmQaJl2PsYDmeNjq1/BiHyXJZ4Hb3dNupxmRgJacEw+/Ghb20JDq5y0 Xnkbtd1X+NPgqSASkf1ZYseBHSywHso2ranZ/8QAHCu6wAXxi3Doqwy+om76tPiPc59q TaHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:arc-authentication-results; bh=IbCY6Ec9Z0nwXcrB3oUYvgvzgVgyY/wR+lpoJVBkec8=; b=GD8Ieie1pW1ktvlquKrOe4YgYkc9BEHn54Uj7MiQFcDzkTDMuva0D5/LhmV4BzxKnV 8jIGyiGAOWHAXWGidH8NFdFei7UEGndsxPlK2cSsDX6/MveZ30EjsGkUGYaZskHuulnz v9RoUm3uf/HO6+ntLR0L33LX2wkRiCmYcVr4hipH9PYXgJlNcRK4aV18sN7La/L3EdhT YytSmCX43ZiKxbp+sYOHgzmDyBi/5jhi9G/g6i+gakt3b7Htv5p6aGweYLr8nBdqu6xA 3URKJ2kb8f79XL4wz0ab0AS9nTk6YvhbEI3QX0cw2iMktoTf86l15iURF0RC3pPCoamx u1sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.co.uk header.s=amazon201209 header.b=q5gOuofl; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v7si1203315pgt.141.2018.02.01.03.28.02; Thu, 01 Feb 2018 03:28:17 -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; dkim=pass header.i=@amazon.co.uk header.s=amazon201209 header.b=q5gOuofl; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752126AbeBAL1i (ORCPT + 99 others); Thu, 1 Feb 2018 06:27:38 -0500 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]:5136 "EHLO smtp-fw-6001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751761AbeBAL1h (ORCPT ); Thu, 1 Feb 2018 06:27:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.co.uk; i=@amazon.co.uk; q=dns/txt; s=amazon201209; t=1517484456; x=1549020456; h=from:to:subject:date:message-id:in-reply-to:references; bh=IbCY6Ec9Z0nwXcrB3oUYvgvzgVgyY/wR+lpoJVBkec8=; b=q5gOuoflYmy/5JMgDW2N/AazBbOqqQqTND1iE5M45ya7CsnRvKLzzCny CQDGsIiLOpCjxtwTIYTTRcaL2WbccZVvkT+yYJ3qqg63bllGPBJYk5D5K a15VkiOeHf/QqCXmTWxU1Pv4DHsEyN/t19f2crDtEuX2zddZokYm3kEH1 4=; X-IronPort-AV: E=Sophos;i="5.46,443,1511827200"; d="scan'208";a="330077957" Received: from iad6-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1a-67b371d8.us-east-1.amazon.com) ([10.124.125.6]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 01 Feb 2018 11:27:35 +0000 Received: from uc8d3ff76b9bc5848a9cc.ant.amazon.com (iad1-ws-svc-lb91-vlan3.amazon.com [10.0.103.150]) by email-inbound-relay-1a-67b371d8.us-east-1.amazon.com (8.14.7/8.14.7) with ESMTP id w11BRU16116881 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 1 Feb 2018 11:27:32 GMT Received: from uc8d3ff76b9bc5848a9cc.ant.amazon.com (localhost [127.0.0.1]) by uc8d3ff76b9bc5848a9cc.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTP id w11BRTmO001537; Thu, 1 Feb 2018 11:27:29 GMT Received: (from dwmw@localhost) by uc8d3ff76b9bc5848a9cc.ant.amazon.com (8.15.2/8.15.2/Submit) id w11BRSjW001536; Thu, 1 Feb 2018 11:27:28 GMT From: David Woodhouse To: tglx@linutronix.de, karahmed@amazon.de, x86@kernel.org, linux-kernel@vger.kernel.org, bp@alien8.de, peterz@infradead.org Subject: [PATCH 1/2] x86/retpoline: No retpolines for built-in __init functions Date: Thu, 1 Feb 2018 11:27:20 +0000 Message-Id: <1517484441-1420-2-git-send-email-dwmw@amazon.co.uk> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517484441-1420-1-git-send-email-dwmw@amazon.co.uk> References: <1517484441-1420-1-git-send-email-dwmw@amazon.co.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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) -- 2.7.4