From patchwork Thu Sep 26 17:55:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1168067 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46fNd20ckcz9sNw for ; Fri, 27 Sep 2019 04:24:54 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Kt0MPBp1"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46fNd16hqrzDqht for ; Fri, 27 Sep 2019 04:24:53 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=chromium.org (client-ip=2607:f8b0:4864:20::542; helo=mail-pg1-x542.google.com; envelope-from=keescook@chromium.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Kt0MPBp1"; dkim-atps=neutral Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46fN0D5cWZzDqnx for ; Fri, 27 Sep 2019 03:56:28 +1000 (AEST) Received: by mail-pg1-x542.google.com with SMTP id w10so1954989pgj.7 for ; Thu, 26 Sep 2019 10:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4OoO9/kqQZ9xXFd9jmzh+sji+0+urCkP2+LVDe5fGPM=; b=Kt0MPBp1vWYay/J6CTJNxtKhAw6G5wCCoEhbJ7e0+7qQp53wQoH32XMsB7VcjjW8cx 4n5ei4jcLt5cOlGxwseK9CUNEa1PwMGgojB41dyPkTZ+0nnKv4yyR9ehnWwAElksl0oo UL/EWa4ETLAK1IJlRMikbUdclaao+PPrUmFXo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4OoO9/kqQZ9xXFd9jmzh+sji+0+urCkP2+LVDe5fGPM=; b=A7hoQv+WwOqEYIzzpgtRovfwBdBIP0LZLdYOvMcRQVTkJbIX2HND/vN3PBDiWIAofU j7sPsN2JdR8zirENCav9S4MxbVcjzhKlBoHe8XpQ5V9J68yDprhYONi0lVmWSOgIl8QU c1RKl5y8Y07uDok659LTxLV5kchzTgi01lgVdapdDXNvoSqFNCvyh2tpFo8fakmheCOw YhJbVkrd8SiizgLPERVQKimLyIyZmhy8aMg6EYNY0u/hlKDz54z+lVtuQRvDR2Z/0/kF EDa93BtYZDBPAIU+Vv5kWq0fuPp93NUFi1EFrOZg1yb1rNsmTVB9r324WJlw+HtnH4En ABFA== X-Gm-Message-State: APjAAAWC7RH1aDvX8vYcJMixtQaZv8iOXG21ZI0V7t74GeD0N/r47TGZ qA+mbrOA3AwW0pDcpc4se4qzxg== X-Google-Smtp-Source: APXvYqxweRYyy+FuCakseDUP9otT1JrAAZ6K77sV80DCrLZqyiEF0oUZBPpm9+PnY/7XVYYbKaiWnA== X-Received: by 2002:a63:e514:: with SMTP id r20mr4651534pgh.275.1569520586692; Thu, 26 Sep 2019 10:56:26 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d10sm1358129pgm.4.2019.09.26.10.56.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 10:56:26 -0700 (PDT) From: Kees Cook To: Thomas Gleixner Subject: [PATCH 14/29] vmlinux.lds.h: Allow EXCEPTION_TABLE to live in RO_DATA Date: Thu, 26 Sep 2019 10:55:47 -0700 Message-Id: <20190926175602.33098-15-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190926175602.33098-1-keescook@chromium.org> References: <20190926175602.33098-1-keescook@chromium.org> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Michal Simek , linux-alpha@vger.kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, linux-kernel@vger.kernel.org, Dave Hansen , x86@kernel.org, Yoshinori Sato , Ingo Molnar , Borislav Petkov , linux-parisc@vger.kernel.org, Andy Lutomirski , "H. Peter Anvin" , Rick Edgecombe , linuxppc-dev@lists.ozlabs.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Many architectures have an EXCEPTION_TABLE that needs only to be read-only. As such, it should live in RO_DATA. This creates a macro to identify this case for the architectures that can move EXCEPTION_TABLE into RO_DATA. Signed-off-by: Kees Cook Acked-by: Will Deacon --- include/asm-generic/vmlinux.lds.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index d57a28786bb8..35a6cba39d9f 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -69,6 +69,17 @@ #define NOTES_HEADERS_RESTORE #endif +/* + * Some architectures have non-executable read-only exception tables. + * They can be added to the RO_DATA segment by specifying their desired + * alignment. + */ +#ifdef RO_DATA_EXCEPTION_TABLE_ALIGN +#define RO_DATA_EXCEPTION_TABLE EXCEPTION_TABLE(RO_DATA_EXCEPTION_TABLE_ALIGN) +#else +#define RO_DATA_EXCEPTION_TABLE +#endif + /* Align . to a 8 byte boundary equals to maximum function alignment. */ #define ALIGN_FUNCTION() . = ALIGN(8) @@ -508,6 +519,7 @@ __stop___modver = .; \ } \ \ + RO_DATA_EXCEPTION_TABLE \ NOTES \ \ . = ALIGN((align)); \