From patchwork Fri Oct 11 00:05:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174843 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 46q7nD3jwPz9s7T for ; Fri, 11 Oct 2019 11:17:20 +1100 (AEDT) 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="fUPnxPNk"; 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 46q7nD2ssvzDqLs for ; Fri, 11 Oct 2019 11:17:20 +1100 (AEDT) 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="fUPnxPNk"; 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 46q7Xf2d5nzDqQs for ; Fri, 11 Oct 2019 11:06:26 +1100 (AEDT) Received: by mail-pg1-x542.google.com with SMTP id p30so4699685pgl.2 for ; Thu, 10 Oct 2019 17:06:26 -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=WqLTzjTdYtu13eBI1Hsh3syPKd5R5C/bZSENvznkqN8=; b=fUPnxPNkLbKz79eLdwRoDJjW70ASz4RGYombh+MpItuFQQCQWGWcKvPqy4gl6E62bz YXcrXM4MjXChDuBwxAdJsCaz9rjKO2RPeC3DbmTKU7AZ15ypootuMHyTiE2LYXks+fRY MfiZIZu5Q++w2SE3zrFSij8n4HmJ+XDt2oi0w= 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=WqLTzjTdYtu13eBI1Hsh3syPKd5R5C/bZSENvznkqN8=; b=GlozOlWnjTqeOdtYbyq0J0J6wXmzUWdARvcsMi+KGnOZisqmZLLpUVMEZkvAkMNpi0 lgSkg2TT5ExBJtkWsswaWRS4oEUCfvqlLcFvjk0etxV/OqopHhlK2AIIXLmCcmy/dgNd yGbOcmNXOsVcE4vRQx3GUZhSnD3V+1zLTa9XQ7+xcU0XzWC/YoS9q0RD2TkveiMRMkRW v5Oxc4XeL2H1I0u/J0fXX4Oxo1cLkzMAYSP5ioH1+533csUxKSmBnDq5Z5ymMoaFeq7+ xGf4s43xvyRUtIyQUzGO32Exvte2yBvxSH+KQUQdRLkyyEEN+HufJetrpFLac1d8DV2o iT6Q== X-Gm-Message-State: APjAAAVlajvkEj3nl8IZihcJQEuN/L5cA30gN4gOI7mfzmlN9A3+GOei BzBWOUHMmzP3ctkrsm97oZ+8ZA== X-Google-Smtp-Source: APXvYqwSvIKQzn0Wh29UPciSLsyXo4RVbmYIVzpELs7182W3aoZycw+TLoXbSJd3JfRFzRbTSmYlrw== X-Received: by 2002:a63:fb0a:: with SMTP id o10mr13787651pgh.258.1570752384285; Thu, 10 Oct 2019 17:06:24 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id e192sm9402924pfh.83.2019.10.10.17.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:20 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 01/29] powerpc: Rename "notes" PT_NOTE to "note" Date: Thu, 10 Oct 2019 17:05:41 -0700 Message-Id: <20191011000609.29728-2-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The Program Header identifiers are internal to the linker scripts. In preparation for moving the NOTES segment declaration into RO_DATA, standardize the identifier for the PT_NOTE entry to "note" as used by all other architectures that emit PT_NOTE. Signed-off-by: Kees Cook Acked-by: Michael Ellerman --- arch/powerpc/kernel/vmlinux.lds.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 060a1acd7c6d..81e672654789 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -19,7 +19,7 @@ ENTRY(_stext) PHDRS { kernel PT_LOAD FLAGS(7); /* RWX */ - notes PT_NOTE FLAGS(0); + note PT_NOTE FLAGS(0); dummy PT_NOTE FLAGS(0); /* binutils < 2.18 has a bug that makes it misbehave when taking an @@ -177,7 +177,7 @@ SECTIONS #endif EXCEPTION_TABLE(0) - NOTES :kernel :notes + NOTES :kernel :note /* The dummy segment contents for the bug workaround mentioned above near PHDRS. */ From patchwork Fri Oct 11 00:05:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174839 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 46q7c006W1z9s7T for ; Fri, 11 Oct 2019 11:09:20 +1100 (AEDT) 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="Zkm/RKe8"; 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 46q7bz4pfCzDqMd for ; Fri, 11 Oct 2019 11:09:19 +1100 (AEDT) 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::541; helo=mail-pg1-x541.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="Zkm/RKe8"; dkim-atps=neutral Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) (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 46q7Xc4M7FzDqQl for ; Fri, 11 Oct 2019 11:06:24 +1100 (AEDT) Received: by mail-pg1-x541.google.com with SMTP id z12so4688819pgp.9 for ; Thu, 10 Oct 2019 17:06:24 -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=7dmckIaKuL5uoyVhYLyxQgvD7laB8s0ddXfS7YNycCU=; b=Zkm/RKe8e+Liv+qZ7ZPm9kwWeSr+NIaspEW7t3lmnI5dNpUpSo6dTzux6vNvY1O0iZ mXmbpcaYzINbphQms11pCzDFWcPo5ulCRYCfFRW5DOq8KNnHUZoPg9cYONZAaxdOzKmE WYECp/MY1nFT0o4uteh9HzWwnmK7DhrJcJDFU= 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=7dmckIaKuL5uoyVhYLyxQgvD7laB8s0ddXfS7YNycCU=; b=kdaXrXBuEzDVSqgqyCQXoAjcJhxHxuvwPH9MKSJrNLPWBqTnY+CzEAGYuxCssCYoiX FcZLGLUXKGtX6kU2sDFuQXp5SbT9T6p7BuSWvhmykxAF4/vZZEv3ciY/EzFDS+pjtfSc SAOdGG5qbbbjXfflN9MJfSBDOWwrX0Ku9DGBxaBeAkIYRwvFKB6449fMnpO6DFNivhtw UoCos90c8CDKWB+9Ibtu6AB1VWljnd/T0XA6yiOpGmGi+GORYrE/9P/RYhyqwh6p+rFJ d3dc8C2vC9GaouOOPlIQepr0X4BgvdaT7BZNUXsZhdxdVl4ADGubV5ehEj/+SvPa+5VS kscQ== X-Gm-Message-State: APjAAAWUjjh2lv9gkcHfT8+QxKQDPtDlT/gnCN5xhBtjK7HLokGbG8Vc uFUyApr5ZbxMx1Opw8J5LaPalA== X-Google-Smtp-Source: APXvYqy8lBsu/lNnf25rns+8k/zkBM8oQHwDv9L6rfwj03NX/IG4fGJ+vORVfGqdbtbZOe/1C8n/Lw== X-Received: by 2002:a63:554b:: with SMTP id f11mr13613094pgm.151.1570752381593; Thu, 10 Oct 2019 17:06:21 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id o42sm12777771pjo.32.2019.10.10.17.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:20 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 02/29] powerpc: Remove PT_NOTE workaround Date: Thu, 10 Oct 2019 17:05:42 -0700 Message-Id: <20191011000609.29728-3-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In preparation for moving NOTES into RO_DATA, remove the PT_NOTE workaround since the kernel requires at least gcc 4.6 now. Signed-off-by: Kees Cook Acked-by: Michael Ellerman --- arch/powerpc/kernel/vmlinux.lds.S | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 81e672654789..a3c8492b2b19 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -20,20 +20,6 @@ ENTRY(_stext) PHDRS { kernel PT_LOAD FLAGS(7); /* RWX */ note PT_NOTE FLAGS(0); - dummy PT_NOTE FLAGS(0); - - /* binutils < 2.18 has a bug that makes it misbehave when taking an - ELF file with all segments at load address 0 as input. This - happens when running "strip" on vmlinux, because of the AT() magic - in this linker script. People using GCC >= 4.2 won't run into - this problem, because the "build-id" support will put some data - into the "notes" segment (at a non-zero load address). - - To work around this, we force some data into both the "dummy" - segment and the kernel segment, so the dummy segment will get a - non-zero load address. It's not enough to always create the - "notes" segment, since if nothing gets assigned to it, its load - address will be zero. */ } #ifdef CONFIG_PPC64 @@ -178,14 +164,8 @@ SECTIONS EXCEPTION_TABLE(0) NOTES :kernel :note - - /* The dummy segment contents for the bug workaround mentioned above - near PHDRS. */ - .dummy : AT(ADDR(.dummy) - LOAD_OFFSET) { - LONG(0) - LONG(0) - LONG(0) - } :kernel :dummy + /* Restore program header away from PT_NOTE. */ + .dummy : { *(.dummy) } :kernel /* * Init sections discarded at runtime From patchwork Fri Oct 11 00:05:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174841 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 46q7hK3w2wz9sQw for ; Fri, 11 Oct 2019 11:13:05 +1100 (AEDT) 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="crQ1Wv7y"; 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 46q7hK0GFVzDqLt for ; Fri, 11 Oct 2019 11:13:04 +1100 (AEDT) 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::441; helo=mail-pf1-x441.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="crQ1Wv7y"; dkim-atps=neutral Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) (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 46q7Xf0stkzDqL8 for ; Fri, 11 Oct 2019 11:06:25 +1100 (AEDT) Received: by mail-pf1-x441.google.com with SMTP id b128so4961639pfa.1 for ; Thu, 10 Oct 2019 17:06:25 -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=ObCdg+imqB9G1d842Lgck/VSTqVGl2xoAH4cm4FkKow=; b=crQ1Wv7yU8u6QDGlDwBktMC8ID6kd2jR2ktjlIEg9lNMaYkSGp+vVyfOhN5n/bbb4w tpNmt7wW87sAgB/gHBbhR1BwKIxx8HWLuqxVFsB9sj+yjEeBVLxwYKqP8+nT6ULOb4qs C5n7z+PSjnqWQlNXFQHms0qNFflOzMMUW6V2Y= 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=ObCdg+imqB9G1d842Lgck/VSTqVGl2xoAH4cm4FkKow=; b=h3X//Aqlr12ddGmxhuzZXrGPluZYm8tVje/SczVRzCqF2JPAWc3T/iZsKA05uK1Ufw +UpGrwjisJ96EJL/xxQYNuYg32Jm5M5dHggx1E93725vqCHu679rckNmPYjyb23u4l6t NUukC5kwt0FP5WBRHiszLiX2Sxg8e7xWnEV5onEg6wsTksS5MhwH/VdO5rsGLlR8kOES U8IYFUmazz7rYvGKTxU4ds2wuxL9jj2VGaaHnV7gDd4zIGnLW4K0VcCoOdVboKSx3ZQw xfbN8CWgkxzixZXXwhAe1q7ZXHl7neQCCwzCGCpOeU/xXM46T8lpQ5/kIIQ2oBlbGOUC jiwg== X-Gm-Message-State: APjAAAV5616ccf7uB+ZwHtfrdjM9fhnqVq0JKNA7uoDPIanBcFm7bsg/ fe88SzF9ceFipk1FFbNvJUBXcg== X-Google-Smtp-Source: APXvYqx+lfPTpnvfcuRRBeqTz2GN8uCmPc7RnUYQGVmNn2nMH+aP0xZQtQocoZFSsUHXgigJlUoJog== X-Received: by 2002:a63:fb0a:: with SMTP id o10mr13787560pgh.258.1570752382982; Thu, 10 Oct 2019 17:06:22 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id k23sm9231444pgi.49.2019.10.10.17.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:20 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 03/29] powerpc: Rename PT_LOAD identifier "kernel" to "text" Date: Thu, 10 Oct 2019 17:05:43 -0700 Message-Id: <20191011000609.29728-4-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In preparation for moving NOTES into RO_DATA, rename the linker script internal identifier for the PT_LOAD Program Header from "kernel" to "text" to match other architectures. Signed-off-by: Kees Cook Acked-by: Michael Ellerman --- arch/powerpc/kernel/vmlinux.lds.S | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index a3c8492b2b19..e184a63aa5b0 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -18,7 +18,7 @@ ENTRY(_stext) PHDRS { - kernel PT_LOAD FLAGS(7); /* RWX */ + text PT_LOAD FLAGS(7); /* RWX */ note PT_NOTE FLAGS(0); } @@ -63,7 +63,7 @@ SECTIONS #else /* !CONFIG_PPC64 */ HEAD_TEXT #endif - } :kernel + } :text __head_end = .; @@ -112,7 +112,7 @@ SECTIONS __got2_end = .; #endif /* CONFIG_PPC32 */ - } :kernel + } :text . = ALIGN(ETEXT_ALIGN_SIZE); _etext = .; @@ -163,9 +163,9 @@ SECTIONS #endif EXCEPTION_TABLE(0) - NOTES :kernel :note + NOTES :text :note /* Restore program header away from PT_NOTE. */ - .dummy : { *(.dummy) } :kernel + .dummy : { *(.dummy) } :text /* * Init sections discarded at runtime @@ -180,7 +180,7 @@ SECTIONS #ifdef CONFIG_PPC64 *(.tramp.ftrace.init); #endif - } :kernel + } :text /* .exit.text is discarded at runtime, not link time, * to deal with references from __bug_table From patchwork Fri Oct 11 00:05:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174842 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 46q7lb6Mm5z9sPc for ; Fri, 11 Oct 2019 11:15:55 +1100 (AEDT) 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="TBJeuKMY"; 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 46q7lb55kXzDqSy for ; Fri, 11 Oct 2019 11:15:55 +1100 (AEDT) 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::443; helo=mail-pf1-x443.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="TBJeuKMY"; dkim-atps=neutral Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) (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 46q7Xf1KRtzDqQl for ; Fri, 11 Oct 2019 11:06:25 +1100 (AEDT) Received: by mail-pf1-x443.google.com with SMTP id v4so4946295pff.6 for ; Thu, 10 Oct 2019 17:06:25 -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=7MxClQbH59XRrbTRajW1Gh8uACzcU2+htsVcXyM7D1g=; b=TBJeuKMY2z8zTRQ1bFw/ImZS5YFoYQAHk+uSCJMry9jQKOeGheQ5i7gXGHU01GWcTB uOgoFqPErAXZia+mP12x9qnkRfY1Ys9PjUB5SmB5We4kWHLZQ5n99yhQi0dIKcFUZu6/ hILLkVhE9upOn1PuRtaesOlh4SL00TV9kLm5U= 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=7MxClQbH59XRrbTRajW1Gh8uACzcU2+htsVcXyM7D1g=; b=uOzGuJCf70E7H2MhlhuoXn2QfsOQdXpgWBwH8Aw0Onq1emDlGfERBqzHkUz5ap/yLr 8TfPz0UtBLKCHWcZPAhOL28OiBZu4AjUN8dymwGTy4Hh0CaXlG34dQtTIsY7CvgBLpu8 rHaoqe4W4fCsvD2FJnyAdys18GeB/ZeJOpHoN2PmfmSH9MHjoLFKWtVcMgNh/Qbbdg55 1fLiVdaOx94dRoLKjG9jhJaCOJ0/viaFK3/cSdV611foFKqhnKX/xQTcqG2A3+aOnCi9 hPQ3IbSE4PHByN3fAuCy436ZNmqC++9iXoGi/4ITqwwTcICxYTAaaoCEvYKgDBrQdQRq lTZA== X-Gm-Message-State: APjAAAWezZp8Mcj7a1QGKQLO2yWRbHZ94c4MAsKyGWLWFERHtjczYYCP 14npDC8prGm/ufSz3nO6kgQd+ky+3lY= X-Google-Smtp-Source: APXvYqwg7IWyK5GALjp45zOGgCtbjryTtA5MoWvVIZiHDTE9GJEt+Ue8rYJCs4VD37qrCGGbQgqtBg== X-Received: by 2002:a62:5bc1:: with SMTP id p184mr12930072pfb.180.1570752383534; Thu, 10 Oct 2019 17:06:23 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d5sm5372814pjw.31.2019.10.10.17.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:20 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 04/29] alpha: Rename PT_LOAD identifier "kernel" to "text" Date: Thu, 10 Oct 2019 17:05:44 -0700 Message-Id: <20191011000609.29728-5-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In preparation for moving NOTES into RO_DATA, rename the linker script internal identifier for the PT_LOAD Program Header from "kernel" to "text" to match other architectures. Signed-off-by: Kees Cook --- arch/alpha/kernel/vmlinux.lds.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S index c4b5ceceab52..781090cacc96 100644 --- a/arch/alpha/kernel/vmlinux.lds.S +++ b/arch/alpha/kernel/vmlinux.lds.S @@ -8,7 +8,7 @@ OUTPUT_FORMAT("elf64-alpha") OUTPUT_ARCH(alpha) ENTRY(__start) -PHDRS { kernel PT_LOAD; note PT_NOTE; } +PHDRS { text PT_LOAD; note PT_NOTE; } jiffies = jiffies_64; SECTIONS { @@ -27,14 +27,14 @@ SECTIONS LOCK_TEXT *(.fixup) *(.gnu.warning) - } :kernel + } :text swapper_pg_dir = SWAPPER_PGD; _etext = .; /* End of text section */ - NOTES :kernel :note + NOTES :text :note .dummy : { *(.dummy) - } :kernel + } :text RODATA EXCEPTION_TABLE(16) From patchwork Fri Oct 11 00:05:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174844 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 46q7pr2xyNz9s7T for ; Fri, 11 Oct 2019 11:18:44 +1100 (AEDT) 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="h/B19WCk"; 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 46q7pq5RK8zDqY6 for ; Fri, 11 Oct 2019 11:18:43 +1100 (AEDT) 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="h/B19WCk"; 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 46q7Xg30htzDqL8 for ; Fri, 11 Oct 2019 11:06:27 +1100 (AEDT) Received: by mail-pg1-x542.google.com with SMTP id x10so4692106pgi.5 for ; Thu, 10 Oct 2019 17:06:27 -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=9QIZQEEx86BzYrPbnl0U6tW2XkUfCUBHfootbZQ3f/s=; b=h/B19WCkyL+xymsA4HFl8hqcGsybKIgVl1/uhhhVSgPKYo6NP7vZ5rRibvBcc9cHi0 dKUj61YWLvd6Paq9o21PGCwAwApZ0KSVPAqMWPWlFGYXaNSsjI/dS7B2W11htDcOzgnE DitiicKTEnEB0ngjDQf+AmKVkG49ZOcGoE0gQ= 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=9QIZQEEx86BzYrPbnl0U6tW2XkUfCUBHfootbZQ3f/s=; b=UgAJukJ9QtdgoNkXlij20QgpC86uKaDRnLS1TSCf0SC5qxCNQZUWGDrtGiA1INkuv9 WZqF0gbez+5DcgyH1WjzkRT/yxj/hyasF+73/EjCrlfkamtbxqgNNTdI8qsdIJZOdmWW jaFf7q+hKg6SdwugOstc57r9uSErOysl274kNrU50MWHF2ECnYn33XmA5lDsNYOiiAHY WdalVDxmsFzcVkXfJBOrqBlFR89wP0ylX4cav4G0ts3VFRZLboqyAL1twKpANkYs9vVI H0ccgMuVFgdMEhnPybm2OW7Qu3BfoCrVHGW/hXCxJt7ileOxpDGs4gViW+0/fibw+MYC 1KwA== X-Gm-Message-State: APjAAAWjn0kTwjjVJya9LTJISSRN2dZFiR1j7GKvIPEU02Yyc3z9dJPK uWAIm13EcIHz1dfX4jGZqBw9Ug== X-Google-Smtp-Source: APXvYqx4W7fel1DIaEF8YA2JM9DuPiq7TPvvITPEvxb/fDK3Ll5VL5/FYyAVhRaQT1eulT76dS3lTQ== X-Received: by 2002:a62:3387:: with SMTP id z129mr13444661pfz.185.1570752385625; Thu, 10 Oct 2019 17:06:25 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 127sm8449250pfw.6.2019.10.10.17.06.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:24 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 05/29] ia64: Rename PT_LOAD identifier "code" to "text" Date: Thu, 10 Oct 2019 17:05:45 -0700 Message-Id: <20191011000609.29728-6-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In preparation for moving NOTES into RO_DATA, rename the linker script internal identifier for the PT_LOAD Program Header from "code" to "text" to match other architectures. Signed-off-by: Kees Cook --- arch/ia64/kernel/vmlinux.lds.S | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S index d9d4e21107cd..2c4f23c390ad 100644 --- a/arch/ia64/kernel/vmlinux.lds.S +++ b/arch/ia64/kernel/vmlinux.lds.S @@ -13,7 +13,7 @@ ENTRY(phys_start) jiffies = jiffies_64; PHDRS { - code PT_LOAD; + text PT_LOAD; percpu PT_LOAD; data PT_LOAD; note PT_NOTE; @@ -36,7 +36,7 @@ SECTIONS { phys_start = _start - LOAD_OFFSET; code : { - } :code + } :text . = KERNEL_START; _text = .; @@ -68,9 +68,9 @@ SECTIONS { /* * Read-only data */ - NOTES :code :note /* put .notes in text and mark in PT_NOTE */ + NOTES :text :note /* put .notes in text and mark in PT_NOTE */ code_continues : { - } : code /* switch back to regular program... */ + } :text /* switch back to regular program... */ EXCEPTION_TABLE(16) @@ -102,9 +102,9 @@ SECTIONS { __start_unwind = .; *(.IA_64.unwind*) __end_unwind = .; - } :code :unwind + } :text :unwind code_continues2 : { - } : code + } :text RODATA @@ -214,7 +214,7 @@ SECTIONS { _end = .; code : { - } :code + } :text STABS_DEBUG DWARF_DEBUG From patchwork Fri Oct 11 00:05:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174845 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 46q7rq1phRz9s7T for ; Fri, 11 Oct 2019 11:20:27 +1100 (AEDT) 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="MPX+iPje"; 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 46q7rq0skQzDqXG for ; Fri, 11 Oct 2019 11:20:27 +1100 (AEDT) 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::544; helo=mail-pg1-x544.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="MPX+iPje"; dkim-atps=neutral Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) (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 46q7Xg5zDzzDqQl for ; Fri, 11 Oct 2019 11:06:27 +1100 (AEDT) Received: by mail-pg1-x544.google.com with SMTP id i76so4704646pgc.0 for ; Thu, 10 Oct 2019 17:06:27 -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=bl12US5Yp4ZwWvaEnQTrcBCg3LoqQRPWnxt7WskOqWM=; b=MPX+iPjeGRBi9W7v8BaGtEQ7Z0gPfVJ+oEGukA1Qx5FZM3UbvHSgUUNTtJdbrvF0DJ Lniffb/JdJpDuc2hFDvI6xqzg3lDsRa6goVJDwHcZqncxHEEePqIwXD0wmcvebpFmc8f hOMnZpwmNvMPGn7QBG585RWKNTpfnKyDCS46Y= 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=bl12US5Yp4ZwWvaEnQTrcBCg3LoqQRPWnxt7WskOqWM=; b=Ver7Y7CBo0XxFhWLxE+L+in7PIZkMaZRVwyM/YHlXzknUZG2bZCl0hs+jsFVpPinxx 14xIyMIzNv28Z9+hljpaw3el1enfra7HvI2NBcScYDIHf0i17rIctIX6LrAiI5v9xRV2 /uYn0UJwknei+IphETAoh79lEWZ6T2JtcV4FBcGT9td9tKwg4jE0gbhvb7YhGHdy/Kqf FO1+Fg93b3+clPgyNdGVG9GUF0wWsG++UYiXEeHxwD5MAlQYCCKTaC/VyttfE/AXdvED UEqg9wUsGJeYYAApBjEhlq1qZlkUWN0y1n9gWzD9JowYgpOGeFomVzbo3SLrStTfJ6uS 0VHA== X-Gm-Message-State: APjAAAX8ElSKvf3+1atZuM1Z1F2Cpk4ZioeWVcipNINIEFPKPArlmZDY neRvil+1kjHE2EH4mkykpyjGhw== X-Google-Smtp-Source: APXvYqx/QRL/EGj1UNqOw9cSZc5qNyXaSBqEdm+ZR6Z42olkPMiWXRzScwFI4gnTT7Nu98OPft+Atg== X-Received: by 2002:a17:90a:9318:: with SMTP id p24mr14062359pjo.31.1570752386117; Thu, 10 Oct 2019 17:06:26 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 6sm10807049pfa.162.2019.10.10.17.06.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:24 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 06/29] s390: Move RO_DATA into "text" PT_LOAD Program Header Date: Thu, 10 Oct 2019 17:05:46 -0700 Message-Id: <20191011000609.29728-7-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In preparation for moving NOTES into RO_DATA, move RO_DATA back into the "text" PT_LOAD Program Header, as done with other architectures. The "data" PT_LOAD now starts with the writable data section. Signed-off-by: Kees Cook Acked-by: Heiko Carstens --- arch/s390/kernel/vmlinux.lds.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index 7e0eb4020917..13294fef473e 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S @@ -52,7 +52,7 @@ SECTIONS NOTES :text :note - .dummy : { *(.dummy) } :data + .dummy : { *(.dummy) } :text RO_DATA_SECTION(PAGE_SIZE) @@ -64,7 +64,7 @@ SECTIONS .data..ro_after_init : { *(.data..ro_after_init) JUMP_TABLE_DATA - } + } :data EXCEPTION_TABLE(16) . = ALIGN(PAGE_SIZE); __end_ro_after_init = .; From patchwork Fri Oct 11 00:05: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: 1174846 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 46q7ts40c8z9s7T for ; Fri, 11 Oct 2019 11:22:13 +1100 (AEDT) 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="GHJrn0r8"; 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 46q7ts34gtzDqWM for ; Fri, 11 Oct 2019 11:22:13 +1100 (AEDT) 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::444; helo=mail-pf1-x444.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="GHJrn0r8"; dkim-atps=neutral Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) (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 46q7Xj0r2vzDqL8 for ; Fri, 11 Oct 2019 11:06:28 +1100 (AEDT) Received: by mail-pf1-x444.google.com with SMTP id q12so4935801pff.9 for ; Thu, 10 Oct 2019 17:06: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=/BlCq1vuoPK6b90i9+3dEN0gsbsUxI5XzRVDtU+Y9n4=; b=GHJrn0r8p4QDRypis6WzxDqJLjyLzu0c9DD31onEhaU6MLFCbVj+PFhPVkLaKrLr36 6/jJ7OuoXZWX6LGkizVGzJHGBfhDDMvBdX6JasWlhwE3Pz+fa+29g8GSrJ2HxibXscDy XREgc77JYPHoKnPPc/FC6vHKtCm5+OUHsSdmQ= 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=/BlCq1vuoPK6b90i9+3dEN0gsbsUxI5XzRVDtU+Y9n4=; b=Rejc54NWdFJJLU2vYzOwiEuTemRFE4Is+YgkJCOZnyasrYXV6vLUC4OWiOiCI6/bX2 QXucLhOZ00tRCMNi77hl8sLJWMQyL/Oho/7gMqx0qEfxgzhRBuKSG6Z4lRiOK4n7nj+y xQXtmmFExCYw9RC1Gti3BdP78ytDZu4V64RHN4epvp/uJgQagxoosBhifhWnD/+S2Jy+ k/O0Cqm+xcr13FUdxFLlpsPIvyXJUoX2p/3vWOQ2SR/oXhAcoKyHGUFAIMRPJyXXAYUR PdJ/15alL+dvzErl9gbg8HCn5YyBHO9bKBKfgqHqwS5UDwEEd1OBAKYJQgIOgyKTE5UI Ujzw== X-Gm-Message-State: APjAAAWBLro/UPHe+9X9E7JzM3lcTprRUoR0Pi+fT2oXXc0WHIkiLbm8 LSpTpFq6mQ+yYK3YqKmYX1GLBQ== X-Google-Smtp-Source: APXvYqxm1QyOZv5u+41ebuDjigq/RdhkNKyMk/fjtAY65tjxQi2WIaaeC50vP1uynwiInzpzpev47Q== X-Received: by 2002:a63:5c07:: with SMTP id q7mr13867865pgb.294.1570752386631; Thu, 10 Oct 2019 17:06:26 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h2sm7642311pfq.108.2019.10.10.17.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:24 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 07/29] x86: Restore "text" Program Header with dummy section Date: Thu, 10 Oct 2019 17:05:47 -0700 Message-Id: <20191011000609.29728-8-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In a linker script, if once places a section in one or more segments using ":PHDR", then the linker will place all subsequent allocatable sections, which do not specify ":PHDR", into the same segments. In order to have the NOTES section in both PT_LOAD (":text") and PT_NOTE (":note"), both segments are marked, and the only way to to undo this to keep subsequent sections out of PT_NOTE is to mark the following section with just the single desired PT_LOAD (":text"). In preparation for having a common NOTES macro, perform the segment assignment use a dummy section (as done by other architectures). Signed-off-by: Kees Cook --- arch/x86/kernel/vmlinux.lds.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index e2feacf921a0..788e78978030 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -147,8 +147,9 @@ SECTIONS } :text = 0x9090 NOTES :text :note + .dummy : { *(.dummy) } :text - EXCEPTION_TABLE(16) :text = 0x9090 + EXCEPTION_TABLE(16) /* .text should occupy whole number of pages */ . = ALIGN(PAGE_SIZE); From patchwork Fri Oct 11 00:05:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174847 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 46q7wq4MqBz9s7T for ; Fri, 11 Oct 2019 11:23:55 +1100 (AEDT) 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="carhZDVu"; 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 46q7wq3FdjzDqdc for ; Fri, 11 Oct 2019 11:23:55 +1100 (AEDT) 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::441; helo=mail-pf1-x441.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="carhZDVu"; dkim-atps=neutral Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) (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 46q7Xj6nWnzDqQl for ; Fri, 11 Oct 2019 11:06:29 +1100 (AEDT) Received: by mail-pf1-x441.google.com with SMTP id h195so4941985pfe.5 for ; Thu, 10 Oct 2019 17:06:29 -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=n5VmKDs7q8vdBz4+9T2sJG9hHU7BSOvzC0pvhvZX8so=; b=carhZDVuV7aWHe/mVOzWup+o5oNODCRSaKYDJLBEexacyYhrHfUMNbKXFo59HsfLdT wZ6hMFSRQexCI22v5IG5NUFM2WcEObK5BgW99c0DZtHkj30esilAfjApmPDIP3pjvWiL pfzZb27IerlCy8SvvnyBoQgndOKKC0Ory7bvc= 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=n5VmKDs7q8vdBz4+9T2sJG9hHU7BSOvzC0pvhvZX8so=; b=D9TS1cu5pqLboRTS31i/n5nxOnyjLCDbzkBK638H19q+VwnRxEnEMt2WzASQpiBnzk F6JDyO8+jhi8EI3qf5yBI0Jc+A5eU2HKYCpFw5clSRcY0FhU9qJ81m+dQev5ftAf+AOX QlZGKJJ1h5aPb8Uki169LjR0QTZ1h0PluBlrghxWm559PLcivkxu+XCMAjZVY5YnrWYC wxuENtaRxfQvvzQornEDgvTqRUOtgeEZuTVSbJEHOreuI+MfAc8isRWBgeB+ZcViS0nG GVyvwx3KBLp0qjdNM4JhC2UTKg2gQ/xiVULEuV/5ynyQVDHpeR/qpnyPO/8QDHvjPpQc zTDg== X-Gm-Message-State: APjAAAWDNic135F4z1mfmTACKpvJvob+XkOEHT/yVDBwE114WBZyQ8WY mf21OiMq5mg0F2qD9XVfgduTNw== X-Google-Smtp-Source: APXvYqx8Gwnw4oVnhwjvlupfQ+jLMpTkOFUHSLw0DgIUj0K31Z94tjG2CFAjw0mYBaG87MVpGGwzjQ== X-Received: by 2002:a62:1b45:: with SMTP id b66mr13449656pfb.34.1570752387906; Thu, 10 Oct 2019 17:06:27 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d19sm6444280pjz.5.2019.10.10.17.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:24 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 08/29] vmlinux.lds.h: Provide EMIT_PT_NOTE to indicate export of .notes Date: Thu, 10 Oct 2019 17:05:48 -0700 Message-Id: <20191011000609.29728-9-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In preparation for moving NOTES into RO_DATA, provide a mechanism for architectures that want to emit a PT_NOTE Program Header to do so. Signed-off-by: Kees Cook --- arch/alpha/kernel/vmlinux.lds.S | 3 +++ arch/ia64/kernel/vmlinux.lds.S | 2 ++ arch/mips/kernel/vmlinux.lds.S | 12 ++++++------ arch/powerpc/kernel/vmlinux.lds.S | 1 + arch/s390/kernel/vmlinux.lds.S | 2 ++ arch/x86/kernel/vmlinux.lds.S | 2 ++ include/asm-generic/vmlinux.lds.h | 8 ++++++++ 7 files changed, 24 insertions(+), 6 deletions(-) diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S index 781090cacc96..363a60ba7c31 100644 --- a/arch/alpha/kernel/vmlinux.lds.S +++ b/arch/alpha/kernel/vmlinux.lds.S @@ -1,4 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ + +#define EMITS_PT_NOTE + #include #include #include diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S index 2c4f23c390ad..7cf4958b732d 100644 --- a/arch/ia64/kernel/vmlinux.lds.S +++ b/arch/ia64/kernel/vmlinux.lds.S @@ -5,6 +5,8 @@ #include #include +#define EMITS_PT_NOTE + #include OUTPUT_FORMAT("elf64-ia64-little") diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S index 33ee0d18fb0a..1c95612eb800 100644 --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S @@ -10,6 +10,11 @@ */ #define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir) +/* Cavium Octeon should not have a separate PT_NOTE Program Header. */ +#ifndef CONFIG_CAVIUM_OCTEON_SOC +#define EMITS_PT_NOTE +#endif + #include #undef mips @@ -76,12 +81,7 @@ SECTIONS __stop___dbe_table = .; } -#ifdef CONFIG_CAVIUM_OCTEON_SOC -#define NOTES_HEADER -#else /* CONFIG_CAVIUM_OCTEON_SOC */ -#define NOTES_HEADER :note -#endif /* CONFIG_CAVIUM_OCTEON_SOC */ - NOTES :text NOTES_HEADER + NOTES NOTES_HEADERS .dummy : { *(.dummy) } :text _sdata = .; /* Start of data section */ diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index e184a63aa5b0..7e26e20c8324 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -6,6 +6,7 @@ #endif #define BSS_FIRST_SECTIONS *(.bss.prominit) +#define EMITS_PT_NOTE #include #include diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index 13294fef473e..646d939346df 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S @@ -15,6 +15,8 @@ /* Handle ro_after_init data on our own. */ #define RO_AFTER_INIT_DATA +#define EMITS_PT_NOTE + #include #include diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 788e78978030..2e18bf5c1aed 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -21,6 +21,8 @@ #define LOAD_OFFSET __START_KERNEL_map #endif +#define EMITS_PT_NOTE + #include #include #include diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index dae64600ccbf..f5dd45ce73f1 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -54,6 +54,14 @@ #define LOAD_OFFSET 0 #endif +/* + * Only some architectures want to have the .notes segment visible in + * a separate PT_NOTE ELF Program Header. + */ +#ifdef EMITS_PT_NOTE +#define NOTES_HEADERS :text :note +#endif + /* Align . to a 8 byte boundary equals to maximum function alignment. */ #define ALIGN_FUNCTION() . = ALIGN(8) From patchwork Fri Oct 11 00:05:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174857 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 46q8104QyNz9s7T for ; Fri, 11 Oct 2019 11:27:32 +1100 (AEDT) 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="bRMOq0IW"; 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 46q80z6909zDqbh for ; Fri, 11 Oct 2019 11:27:31 +1100 (AEDT) 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::642; helo=mail-pl1-x642.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="bRMOq0IW"; dkim-atps=neutral Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) (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 46q7Xm5rkLzDqQx for ; Fri, 11 Oct 2019 11:06:32 +1100 (AEDT) Received: by mail-pl1-x642.google.com with SMTP id f21so3579450plj.10 for ; Thu, 10 Oct 2019 17:06:32 -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=+3bCi815qDNxWXNrKwLag9umK9x4HOIYX8e5T++c31U=; b=bRMOq0IWtWeHkkuzrRxpAOjG+rR4hWqjBGGYrfiCb+g0Wo93lleOSNL5PlbwrMlX2m UcAArEZAR28PhZpJ9ZQ2+Jx+5/XMFJo+6I1v47AsbgjpXxkd6kYBN+6tNzEwHNlN3EwO GygHfZgrHj6MFQQb22vJtjl9/O27IaD4iLe3I= 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=+3bCi815qDNxWXNrKwLag9umK9x4HOIYX8e5T++c31U=; b=VQElfio/E/KXdZGS7ROay14Okw21L8TM9vjdI+euv4u7+sWAdifwdavF5yyZAFQ9Ag dNA/EYKvax2TYF4z2P5DKIha65f3b1EJMjWkky3gQvcQCmppW16MSjCbYbUj3lvENv44 LhGumUmOeVSMsxJJz4NpODl6bUIX05uDLxHylbqKj5IDiX/RStystVp91YZYX/bWAJoY QlLhZymPJmF6Uy71+zm78ReiqHJLD5wP6VAXmFKAUdZqWPq4zcYa2AzxfTXFGQIPol6y R9Y5vngUKvoh9iRTE++ZJ4h8aGecZ+il3+wj/vTKVSeEzHubhbcBv2yJO4uON1wkQEkp qstg== X-Gm-Message-State: APjAAAUEXlthLnIItegSr7B58ib0wmHh/uzY8Ws1mcAst3frshmOrscw sHGh6H5N5OHUMpCCtL3e6H5IQQ== X-Google-Smtp-Source: APXvYqy0SXetX4NVbIikmpWxxdgAixqZ0JQVCss4X5LB0rtMMzElGLP4iAy5+ASzEE3vf1MUkTjFzA== X-Received: by 2002:a17:902:8218:: with SMTP id x24mr11712571pln.139.1570752390532; Thu, 10 Oct 2019 17:06:30 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id i8sm7454975pgl.18.2019.10.10.17.06.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:24 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 09/29] vmlinux.lds.h: Move Program Header restoration into NOTES macro Date: Thu, 10 Oct 2019 17:05:49 -0700 Message-Id: <20191011000609.29728-10-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In preparation for moving NOTES into RO_DATA, make the Program Header assignment restoration be part of the NOTES macro itself. Signed-off-by: Kees Cook --- arch/alpha/kernel/vmlinux.lds.S | 5 +---- arch/ia64/kernel/vmlinux.lds.S | 4 +--- arch/mips/kernel/vmlinux.lds.S | 3 +-- arch/powerpc/kernel/vmlinux.lds.S | 4 +--- arch/s390/kernel/vmlinux.lds.S | 4 +--- arch/x86/kernel/vmlinux.lds.S | 3 +-- include/asm-generic/vmlinux.lds.h | 13 +++++++++++-- 7 files changed, 17 insertions(+), 19 deletions(-) diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S index 363a60ba7c31..cdfdc91ce64c 100644 --- a/arch/alpha/kernel/vmlinux.lds.S +++ b/arch/alpha/kernel/vmlinux.lds.S @@ -34,10 +34,7 @@ SECTIONS swapper_pg_dir = SWAPPER_PGD; _etext = .; /* End of text section */ - NOTES :text :note - .dummy : { - *(.dummy) - } :text + NOTES RODATA EXCEPTION_TABLE(16) diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S index 7cf4958b732d..bfc937ec168c 100644 --- a/arch/ia64/kernel/vmlinux.lds.S +++ b/arch/ia64/kernel/vmlinux.lds.S @@ -70,9 +70,7 @@ SECTIONS { /* * Read-only data */ - NOTES :text :note /* put .notes in text and mark in PT_NOTE */ - code_continues : { - } :text /* switch back to regular program... */ + NOTES EXCEPTION_TABLE(16) diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S index 1c95612eb800..6a22f531d815 100644 --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S @@ -81,8 +81,7 @@ SECTIONS __stop___dbe_table = .; } - NOTES NOTES_HEADERS - .dummy : { *(.dummy) } :text + NOTES _sdata = .; /* Start of data section */ RODATA diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 7e26e20c8324..4f19d814d592 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -164,9 +164,7 @@ SECTIONS #endif EXCEPTION_TABLE(0) - NOTES :text :note - /* Restore program header away from PT_NOTE. */ - .dummy : { *(.dummy) } :text + NOTES /* * Init sections discarded at runtime diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index 646d939346df..f88eedeb915a 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S @@ -52,9 +52,7 @@ SECTIONS _etext = .; /* End of text section */ } :text = 0x0700 - NOTES :text :note - - .dummy : { *(.dummy) } :text + NOTES RO_DATA_SECTION(PAGE_SIZE) diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 2e18bf5c1aed..8be25b09c2b7 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -148,8 +148,7 @@ SECTIONS _etext = .; } :text = 0x9090 - NOTES :text :note - .dummy : { *(.dummy) } :text + NOTES EXCEPTION_TABLE(16) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index f5dd45ce73f1..97d4299f14dc 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -56,10 +56,18 @@ /* * Only some architectures want to have the .notes segment visible in - * a separate PT_NOTE ELF Program Header. + * a separate PT_NOTE ELF Program Header. When this happens, it needs + * to be visible in both the kernel text's PT_LOAD and the PT_NOTE + * Program Headers. In this case, though, the PT_LOAD needs to be made + * the default again so that all the following sections don't also end + * up in the PT_NOTE Program Header. */ #ifdef EMITS_PT_NOTE #define NOTES_HEADERS :text :note +#define NOTES_HEADERS_RESTORE __restore_ph : { *(.__restore_ph) } :text +#else +#define NOTES_HEADERS +#define NOTES_HEADERS_RESTORE #endif /* Align . to a 8 byte boundary equals to maximum function alignment. */ @@ -798,7 +806,8 @@ __start_notes = .; \ KEEP(*(.note.*)) \ __stop_notes = .; \ - } + } NOTES_HEADERS \ + NOTES_HEADERS_RESTORE #define INIT_SETUP(initsetup_align) \ . = ALIGN(initsetup_align); \ From patchwork Fri Oct 11 00:05:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174891 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 46q8741cMNz9s7T for ; Fri, 11 Oct 2019 11:32:48 +1100 (AEDT) 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="OQKBcExF"; 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 46q8740WP6zDqYJ for ; Fri, 11 Oct 2019 11:32:48 +1100 (AEDT) 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="OQKBcExF"; 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 46q7Xn6qphzDqRf for ; Fri, 11 Oct 2019 11:06:33 +1100 (AEDT) Received: by mail-pg1-x542.google.com with SMTP id e10so697148pgd.11 for ; Thu, 10 Oct 2019 17:06:33 -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=VrsGi2VZmYoiW+g+QiVO7qh6HvEnyeD+CrJg+uPrkoA=; b=OQKBcExFOiX1HKaPOMjgP0f5M5Rk/R3xX98+Rcyo+3jmCHbA63kWOr2kJUTAaMwpUW J/2hwHvuaDxCAR497+IkpLYGVosGlHsEcV7hJlxMlTqoxdXJ019MBw+vK/M2wqJo9QKt jf52JQ1V7l2DJk51LUQDcUn4rDRJeInHfnnKQ= 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=VrsGi2VZmYoiW+g+QiVO7qh6HvEnyeD+CrJg+uPrkoA=; b=gwtOaFRdTYz3g7SMzRCBGsNAatVfYB2rftjWBO+FSMTLIi2uzDpifDvB63cfNztel2 WKy99qBidMBhPFNbrmP2VfFvHAV9r5V/+CYcte5VrjBVB4064ZDz7RNwrq3I25yUPNJA guosIMHZ2txNAIyir/FuNriXab1CfyMRYnV5C/vRkvFMgeGDaDaHgWA2srFCnmZql3TL dtnug/9x4ukNKf/zAZVtCuYlB/v+Fd2vPNz+i8bMtmCWqIY9eq31QvU0fln+VdnU5EgF 3Ga7n9XfV8/WScqJM5qAb5NAoFGdAQgqfPIxKatdJ8LaBy0a/7BSm2toT8q5i1BqQK2D ooNg== X-Gm-Message-State: APjAAAUoF65bOVHiNCiMmGfjKHrbuogJN9t80Ew1AsnTGHOLMYwFYZ7C jLMXHE+Xb+793cJ+TawX3fsjJw== X-Google-Smtp-Source: APXvYqyG0aLDQjCng0TEFgnQccQ0DvhmHJCw7HgSlyuRckLN4/WMPTG7VcFYDq0E8KeXg/Briln7FA== X-Received: by 2002:a17:90a:3acb:: with SMTP id b69mr14517610pjc.75.1570752391821; Thu, 10 Oct 2019 17:06:31 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id e192sm9403017pfh.83.2019.10.10.17.06.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:24 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 10/29] vmlinux.lds.h: Move NOTES into RO_DATA Date: Thu, 10 Oct 2019 17:05:50 -0700 Message-Id: <20191011000609.29728-11-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The .notes section should be non-executable read-only data. As such, move it to the RO_DATA macro instead of being per-architecture defined. Signed-off-by: Kees Cook --- arch/alpha/kernel/vmlinux.lds.S | 2 -- arch/arc/kernel/vmlinux.lds.S | 2 -- arch/arm/kernel/vmlinux-xip.lds.S | 2 -- arch/arm/kernel/vmlinux.lds.S | 2 -- arch/arm64/kernel/vmlinux.lds.S | 1 - arch/c6x/kernel/vmlinux.lds.S | 1 - arch/csky/kernel/vmlinux.lds.S | 1 - arch/h8300/kernel/vmlinux.lds.S | 1 - arch/hexagon/kernel/vmlinux.lds.S | 1 - arch/ia64/kernel/vmlinux.lds.S | 2 -- arch/microblaze/kernel/vmlinux.lds.S | 1 - arch/mips/kernel/vmlinux.lds.S | 2 -- arch/nds32/kernel/vmlinux.lds.S | 1 - arch/nios2/kernel/vmlinux.lds.S | 1 - arch/openrisc/kernel/vmlinux.lds.S | 1 - arch/parisc/kernel/vmlinux.lds.S | 1 - arch/powerpc/kernel/vmlinux.lds.S | 2 -- arch/riscv/kernel/vmlinux.lds.S | 1 - arch/s390/kernel/vmlinux.lds.S | 2 -- arch/sh/kernel/vmlinux.lds.S | 1 - arch/sparc/kernel/vmlinux.lds.S | 1 - arch/um/include/asm/common.lds.S | 1 - arch/unicore32/kernel/vmlinux.lds.S | 1 - arch/x86/kernel/vmlinux.lds.S | 2 -- arch/xtensa/kernel/vmlinux.lds.S | 1 - include/asm-generic/vmlinux.lds.h | 9 +++++---- 26 files changed, 5 insertions(+), 38 deletions(-) diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S index cdfdc91ce64c..bf28043485f6 100644 --- a/arch/alpha/kernel/vmlinux.lds.S +++ b/arch/alpha/kernel/vmlinux.lds.S @@ -34,8 +34,6 @@ SECTIONS swapper_pg_dir = SWAPPER_PGD; _etext = .; /* End of text section */ - NOTES - RODATA EXCEPTION_TABLE(16) diff --git a/arch/arc/kernel/vmlinux.lds.S b/arch/arc/kernel/vmlinux.lds.S index 6c693a9d29b6..1d6eef4b6976 100644 --- a/arch/arc/kernel/vmlinux.lds.S +++ b/arch/arc/kernel/vmlinux.lds.S @@ -118,8 +118,6 @@ SECTIONS /DISCARD/ : { *(.eh_frame) } #endif - NOTES - . = ALIGN(PAGE_SIZE); _end = . ; diff --git a/arch/arm/kernel/vmlinux-xip.lds.S b/arch/arm/kernel/vmlinux-xip.lds.S index 8c74037ade22..d2a9651c24ad 100644 --- a/arch/arm/kernel/vmlinux-xip.lds.S +++ b/arch/arm/kernel/vmlinux-xip.lds.S @@ -70,8 +70,6 @@ SECTIONS ARM_UNWIND_SECTIONS #endif - NOTES - _etext = .; /* End of text and rodata section */ ARM_VECTORS diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 23150c0f0f4d..068db6860867 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -81,8 +81,6 @@ SECTIONS ARM_UNWIND_SECTIONS #endif - NOTES - #ifdef CONFIG_STRICT_KERNEL_RWX . = ALIGN(1< X-Patchwork-Id: 1174856 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 46q7z24DMkz9s7T for ; Fri, 11 Oct 2019 11:25:50 +1100 (AEDT) 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="cHZ91CVx"; 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 46q7z23CW6zDqcW for ; Fri, 11 Oct 2019 11:25:50 +1100 (AEDT) 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::441; helo=mail-pf1-x441.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="cHZ91CVx"; dkim-atps=neutral Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) (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 46q7Xl1zg2zDqL8 for ; Fri, 11 Oct 2019 11:06:31 +1100 (AEDT) Received: by mail-pf1-x441.google.com with SMTP id a2so4933616pfo.10 for ; Thu, 10 Oct 2019 17:06:31 -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=NdxCafKKRqXAoKJS3a+7E7MX2efPsfhraTr7Vwa5zkA=; b=cHZ91CVxuyng0UUZxGcb/ber128JimxZzD4s8SDtIkcbdkfkK9QM8pnThLhmF0agpR T7rmBmBvoM7a8G3Gx26RdR3XR/1f8VRXaujTb/vPtdDG1XhtEUbWfIJWjMRQdw9gHq3B iOZPAybj973b7Yiu/eaaA1VBQXDHW1/4thP5g= 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=NdxCafKKRqXAoKJS3a+7E7MX2efPsfhraTr7Vwa5zkA=; b=iVs56hvv3lbxv/c0qOmpZXDb6yFiqczop8HsC6cjlVqajdBsfu0zgFwqSfUHulA8RI mSyiWS3iHeOUGXEzTqW6gaKKuebbyF5VOLh4gUN0jUOrMC2bFurhjbKa+M35lTSS7Hgq eMni6Xg27vvuK8KAH5Pyy3deZm/EIvaY6Tc0kbx4dYmKpP4HYsmX1iRz22gyHeRE8Uhb YNXHt9q7l/4IZeh7iUMbtM9b0g0szxnLSBPdSvC5CSVA8S9ma6YuK6jGCh6YyU2RaKoD +ltGk87HbAZQ7SKbP0NZM3//hHLKzFYAPz9eoitu6WcC5NU/xLhI2f1A4TQ4UQ3qcaQB 3YYw== X-Gm-Message-State: APjAAAVZuQnD5360EW4Ih5TkvlOLosF5Ndx8N4CxhqTM+0EL3KDOvj7c E8+ae3EdcT11J8UoAXU9k77h7A== X-Google-Smtp-Source: APXvYqz3ed6UFMtmTs9WyLDFjU7LZoWgRldfZKGM1qhYTNl+e8Jhzebc8fAsIpgzugR9ERVwOeUjmA== X-Received: by 2002:a62:1bd3:: with SMTP id b202mr13350926pfb.50.1570752388551; Thu, 10 Oct 2019 17:06:28 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 64sm9017564pfx.31.2019.10.10.17.06.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:24 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 11/29] vmlinux.lds.h: Replace RODATA with RO_DATA Date: Thu, 10 Oct 2019 17:05:51 -0700 Message-Id: <20191011000609.29728-12-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" There's no reason to keep the RODATA macro: replace the callers with the expected RO_DATA macro. Signed-off-by: Kees Cook Reported-by: noreply@ellerman.id.au --- arch/alpha/kernel/vmlinux.lds.S | 2 +- arch/ia64/kernel/vmlinux.lds.S | 2 +- arch/microblaze/kernel/vmlinux.lds.S | 2 +- arch/mips/kernel/vmlinux.lds.S | 2 +- arch/um/include/asm/common.lds.S | 2 +- arch/xtensa/kernel/vmlinux.lds.S | 2 +- include/asm-generic/vmlinux.lds.h | 4 +--- 7 files changed, 7 insertions(+), 9 deletions(-) diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S index bf28043485f6..af411817dd7d 100644 --- a/arch/alpha/kernel/vmlinux.lds.S +++ b/arch/alpha/kernel/vmlinux.lds.S @@ -34,7 +34,7 @@ SECTIONS swapper_pg_dir = SWAPPER_PGD; _etext = .; /* End of text section */ - RODATA + RO_DATA(4096) EXCEPTION_TABLE(16) /* Will be freed after init */ diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S index fae077595756..11d5115bc44d 100644 --- a/arch/ia64/kernel/vmlinux.lds.S +++ b/arch/ia64/kernel/vmlinux.lds.S @@ -104,7 +104,7 @@ SECTIONS { code_continues2 : { } :text - RODATA + RO_DATA(4096) .opd : AT(ADDR(.opd) - LOAD_OFFSET) { __start_opd = .; diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S index d008e50bb212..2299694748ea 100644 --- a/arch/microblaze/kernel/vmlinux.lds.S +++ b/arch/microblaze/kernel/vmlinux.lds.S @@ -51,7 +51,7 @@ SECTIONS { } . = ALIGN(16); - RODATA + RO_DATA(4096) EXCEPTION_TABLE(16) /* diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S index 91e566defc16..a5f00ec73ea6 100644 --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S @@ -82,7 +82,7 @@ SECTIONS } _sdata = .; /* Start of data section */ - RODATA + RO_DATA(4096) /* writeable */ .data : { /* Data */ diff --git a/arch/um/include/asm/common.lds.S b/arch/um/include/asm/common.lds.S index 91aca356095f..7145ce699982 100644 --- a/arch/um/include/asm/common.lds.S +++ b/arch/um/include/asm/common.lds.S @@ -9,7 +9,7 @@ _sdata = .; PROVIDE (sdata = .); - RODATA + RO_DATA(4096) .unprotected : { *(.unprotected) } . = ALIGN(4096); diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S index a0a843745695..b97e5798b9cf 100644 --- a/arch/xtensa/kernel/vmlinux.lds.S +++ b/arch/xtensa/kernel/vmlinux.lds.S @@ -124,7 +124,7 @@ SECTIONS . = ALIGN(16); - RODATA + RO_DATA(4096) /* Relocation table */ diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index dc3390ec6b60..a0a989fbe411 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -518,9 +518,7 @@ . = ALIGN((align)); \ __end_rodata = .; -/* RODATA & RO_DATA provided for backward compatibility. - * All archs are supposed to use RO_DATA() */ -#define RODATA RO_DATA_SECTION(4096) +/* All archs are supposed to use RO_DATA() */ #define RO_DATA(align) RO_DATA_SECTION(align) /* From patchwork Fri Oct 11 00:05:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174890 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 46q84Z6qqQz9sPc for ; Fri, 11 Oct 2019 11:30:38 +1100 (AEDT) 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="Vr/ouYU4"; 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 46q84X2zzWzDqTY for ; Fri, 11 Oct 2019 11:30:36 +1100 (AEDT) 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::443; helo=mail-pf1-x443.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="Vr/ouYU4"; dkim-atps=neutral Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) (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 46q7Xn29tMzDqRZ for ; Fri, 11 Oct 2019 11:06:33 +1100 (AEDT) Received: by mail-pf1-x443.google.com with SMTP id y22so4947223pfr.3 for ; Thu, 10 Oct 2019 17:06:33 -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=DuZAsZxZLPZkISe3dR0RWEfgmN2J22w1LR1gS9Q060Y=; b=Vr/ouYU4DY+c+dPQgQCkZkPiefEjf85+Y3JixQCNriQRX8TUgPrqjfwH2oAScfYlP0 v87cpbqpOqc05HYBtGLLLUi6frPtF1HntlUxhqWMdWSbbc0OGbFX6+Vj/cbPADRpI4my m83qvTkkG7ExaRX6A003rjgQHcCwPYDISXCGA= 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=DuZAsZxZLPZkISe3dR0RWEfgmN2J22w1LR1gS9Q060Y=; b=aK9LwxebvVkouSo6EJV9Ay628e06Yg1A71BPptdWv0arbsQ0VQiG+3wnznR4CjQtLE vQDEy6ILT/A/d8AyY8F9fr4hz+PVlsdsMknJwvCGyuelfxNhNTna0MYnpPt1fPYqJpde TznIySdbLcVCpRHGzd4/CUjPvMUxK+TxjW93KPq4sEXppnTg8u52ew8cjajGjtatmRDP RxcrP8R+1/jlP+yWpAdOJXRsqxo2tg1xLN/X6VigBtHJSQRgMNr80/XRhaW+ggdxvX6O rRbR/5PHHOS7u8DjcKEAoCemkoOXu4S4BYRyEXKFCcw2j0m/+ya9QLdIHpS0K2rIiYTx v13A== X-Gm-Message-State: APjAAAWoiNlBckiyOriL9xaV2LeAf1awFfYDum4+9Wpfdgzxd4lVZDRO P1Vvj6ZPDB+GZQC2S5l9YQGWLg== X-Google-Smtp-Source: APXvYqy4FSC3v/ZdArK/c4Ac15cpP2VC7Cyr72iHZzxLlMtXtVU20YHYU76YTX+x0YEjwevhm39Xxw== X-Received: by 2002:a62:b616:: with SMTP id j22mr13290419pff.35.1570752391278; Thu, 10 Oct 2019 17:06:31 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id w2sm7929867pfn.57.2019.10.10.17.06.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:24 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 12/29] vmlinux.lds.h: Replace RO_DATA_SECTION with RO_DATA Date: Thu, 10 Oct 2019 17:05:52 -0700 Message-Id: <20191011000609.29728-13-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Finish renaming RO_DATA_SECTION to RO_DATA. (Calling this a "section" is a lie, since it's multiple sections and section flags cannot be applied to the macro.) Signed-off-by: Kees Cook Acked-by: Geert Uytterhoeven --- arch/arc/kernel/vmlinux.lds.S | 2 +- arch/c6x/kernel/vmlinux.lds.S | 2 +- arch/csky/kernel/vmlinux.lds.S | 2 +- arch/h8300/kernel/vmlinux.lds.S | 2 +- arch/hexagon/kernel/vmlinux.lds.S | 2 +- arch/m68k/kernel/vmlinux-nommu.lds | 2 +- arch/nds32/kernel/vmlinux.lds.S | 2 +- arch/nios2/kernel/vmlinux.lds.S | 2 +- arch/openrisc/kernel/vmlinux.lds.S | 4 ++-- arch/parisc/kernel/vmlinux.lds.S | 4 ++-- arch/riscv/kernel/vmlinux.lds.S | 2 +- arch/s390/kernel/vmlinux.lds.S | 2 +- arch/unicore32/kernel/vmlinux.lds.S | 2 +- include/asm-generic/vmlinux.lds.h | 7 ++----- 14 files changed, 17 insertions(+), 20 deletions(-) diff --git a/arch/arc/kernel/vmlinux.lds.S b/arch/arc/kernel/vmlinux.lds.S index 1d6eef4b6976..7d1d27066deb 100644 --- a/arch/arc/kernel/vmlinux.lds.S +++ b/arch/arc/kernel/vmlinux.lds.S @@ -95,7 +95,7 @@ SECTIONS _etext = .; _sdata = .; - RO_DATA_SECTION(PAGE_SIZE) + RO_DATA(PAGE_SIZE) /* * 1. this is .data essentially diff --git a/arch/c6x/kernel/vmlinux.lds.S b/arch/c6x/kernel/vmlinux.lds.S index d6e3802536b3..a3547f9d415b 100644 --- a/arch/c6x/kernel/vmlinux.lds.S +++ b/arch/c6x/kernel/vmlinux.lds.S @@ -82,7 +82,7 @@ SECTIONS EXCEPTION_TABLE(16) - RO_DATA_SECTION(PAGE_SIZE) + RO_DATA(PAGE_SIZE) .const : { *(.const .const.* .gnu.linkonce.r.*) diff --git a/arch/csky/kernel/vmlinux.lds.S b/arch/csky/kernel/vmlinux.lds.S index 75dd31412242..8598bd7a7bcd 100644 --- a/arch/csky/kernel/vmlinux.lds.S +++ b/arch/csky/kernel/vmlinux.lds.S @@ -49,7 +49,7 @@ SECTIONS _sdata = .; - RO_DATA_SECTION(PAGE_SIZE) + RO_DATA(PAGE_SIZE) RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) _edata = .; diff --git a/arch/h8300/kernel/vmlinux.lds.S b/arch/h8300/kernel/vmlinux.lds.S index 88776e785245..d3247d33b115 100644 --- a/arch/h8300/kernel/vmlinux.lds.S +++ b/arch/h8300/kernel/vmlinux.lds.S @@ -38,7 +38,7 @@ SECTIONS _etext = . ; } EXCEPTION_TABLE(16) - RO_DATA_SECTION(4) + RO_DATA(4) ROMEND = .; #if defined(CONFIG_ROMKERNEL) . = RAMTOP; diff --git a/arch/hexagon/kernel/vmlinux.lds.S b/arch/hexagon/kernel/vmlinux.lds.S index 6a6e8fc422ee..0145251fa317 100644 --- a/arch/hexagon/kernel/vmlinux.lds.S +++ b/arch/hexagon/kernel/vmlinux.lds.S @@ -50,7 +50,7 @@ SECTIONS _sdata = .; RW_DATA_SECTION(32,PAGE_SIZE,_THREAD_SIZE) - RO_DATA_SECTION(PAGE_SIZE) + RO_DATA(PAGE_SIZE) _edata = .; EXCEPTION_TABLE(16) diff --git a/arch/m68k/kernel/vmlinux-nommu.lds b/arch/m68k/kernel/vmlinux-nommu.lds index cf6edda38971..de80f8b8ae78 100644 --- a/arch/m68k/kernel/vmlinux-nommu.lds +++ b/arch/m68k/kernel/vmlinux-nommu.lds @@ -60,7 +60,7 @@ SECTIONS { #endif _sdata = .; - RO_DATA_SECTION(PAGE_SIZE) + RO_DATA(PAGE_SIZE) RW_DATA_SECTION(16, PAGE_SIZE, THREAD_SIZE) _edata = .; diff --git a/arch/nds32/kernel/vmlinux.lds.S b/arch/nds32/kernel/vmlinux.lds.S index c4f1c5a604c3..10ff570ba95b 100644 --- a/arch/nds32/kernel/vmlinux.lds.S +++ b/arch/nds32/kernel/vmlinux.lds.S @@ -53,7 +53,7 @@ SECTIONS _etext = .; /* End of text and rodata section */ _sdata = .; - RO_DATA_SECTION(PAGE_SIZE) + RO_DATA(PAGE_SIZE) RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) _edata = .; diff --git a/arch/nios2/kernel/vmlinux.lds.S b/arch/nios2/kernel/vmlinux.lds.S index 20e4078b3477..318804a2c7a1 100644 --- a/arch/nios2/kernel/vmlinux.lds.S +++ b/arch/nios2/kernel/vmlinux.lds.S @@ -49,7 +49,7 @@ SECTIONS __init_end = .; _sdata = .; - RO_DATA_SECTION(PAGE_SIZE) + RO_DATA(PAGE_SIZE) RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) _edata = .; diff --git a/arch/openrisc/kernel/vmlinux.lds.S b/arch/openrisc/kernel/vmlinux.lds.S index 142c51c994f5..f73e0d3ea09f 100644 --- a/arch/openrisc/kernel/vmlinux.lds.S +++ b/arch/openrisc/kernel/vmlinux.lds.S @@ -67,8 +67,8 @@ SECTIONS _sdata = .; - /* Page alignment required for RO_DATA_SECTION */ - RO_DATA_SECTION(PAGE_SIZE) + /* Page alignment required for RO_DATA */ + RO_DATA(PAGE_SIZE) _e_kernel_ro = .; /* Whatever comes after _e_kernel_ro had better be page-aligend, too */ diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S index 168d12b2ebb8..e1c563c7dca1 100644 --- a/arch/parisc/kernel/vmlinux.lds.S +++ b/arch/parisc/kernel/vmlinux.lds.S @@ -109,7 +109,7 @@ SECTIONS _sdata = .; /* Architecturally we need to keep __gp below 0x1000000 and thus - * in front of RO_DATA_SECTION() which stores lots of tracepoint + * in front of RO_DATA() which stores lots of tracepoint * and ftrace symbols. */ #ifdef CONFIG_64BIT . = ALIGN(16); @@ -127,7 +127,7 @@ SECTIONS } #endif - RO_DATA_SECTION(8) + RO_DATA(8) /* RO because of BUILDTIME_EXTABLE_SORT */ EXCEPTION_TABLE(8) diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S index df5229c4034d..66dc17d24dd9 100644 --- a/arch/riscv/kernel/vmlinux.lds.S +++ b/arch/riscv/kernel/vmlinux.lds.S @@ -52,7 +52,7 @@ SECTIONS /* Start of data section */ _sdata = .; - RO_DATA_SECTION(L1_CACHE_BYTES) + RO_DATA(L1_CACHE_BYTES) .srodata : { *(.srodata*) } diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index beb4df053e20..b33c4823f8b5 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S @@ -52,7 +52,7 @@ SECTIONS _etext = .; /* End of text section */ } :text = 0x0700 - RO_DATA_SECTION(PAGE_SIZE) + RO_DATA(PAGE_SIZE) . = ALIGN(PAGE_SIZE); _sdata = .; /* Start of data section */ diff --git a/arch/unicore32/kernel/vmlinux.lds.S b/arch/unicore32/kernel/vmlinux.lds.S index 78c4c56057b0..367c80313bec 100644 --- a/arch/unicore32/kernel/vmlinux.lds.S +++ b/arch/unicore32/kernel/vmlinux.lds.S @@ -43,7 +43,7 @@ SECTIONS _etext = .; _sdata = .; - RO_DATA_SECTION(PAGE_SIZE) + RO_DATA(PAGE_SIZE) RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) _edata = .; diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index a0a989fbe411..061e57c609f6 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -23,7 +23,7 @@ * _etext = .; * * _sdata = .; - * RO_DATA_SECTION(PAGE_SIZE) + * RO_DATA(PAGE_SIZE) * RW_DATA_SECTION(...) * _edata = .; * @@ -363,7 +363,7 @@ /* * Read only Data */ -#define RO_DATA_SECTION(align) \ +#define RO_DATA(align) \ . = ALIGN((align)); \ .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ __start_rodata = .; \ @@ -518,9 +518,6 @@ . = ALIGN((align)); \ __end_rodata = .; -/* All archs are supposed to use RO_DATA() */ -#define RO_DATA(align) RO_DATA_SECTION(align) - /* * .text section. Map to function alignment to avoid address changes * during second ld run in second ld pass when generating System.map From patchwork Fri Oct 11 00:05:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174892 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 46q89B0FHFz9s7T for ; Fri, 11 Oct 2019 11:34:38 +1100 (AEDT) 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="KM5dlcCC"; 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 46q8996T4jzDqTD for ; Fri, 11 Oct 2019 11:34:37 +1100 (AEDT) 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::544; helo=mail-pg1-x544.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="KM5dlcCC"; dkim-atps=neutral Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) (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 46q7Xr3wP2zDqL8 for ; Fri, 11 Oct 2019 11:06:36 +1100 (AEDT) Received: by mail-pg1-x544.google.com with SMTP id r1so3497917pgj.12 for ; Thu, 10 Oct 2019 17:06:36 -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=EJBkEWR6Ytr2XDSFYITiqnAtjMhSVp9dR2Ot4Fv1LAw=; b=KM5dlcCCTgyv17xjylw2TIbqN7K6dPZ8B/Ds1xgkN+VH1VnsMLZGDYHw66e+3BUCca riYqc1ojb5gszDWydSqCZ2Fjn9VwsKWKCEOYwWZAWYDNcZ2OqJksDr47PyLR2S5o5UoH YsXGqsdW8L4U3e3tTs2DjLs97Jn8rDnJ2PzHo= 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=EJBkEWR6Ytr2XDSFYITiqnAtjMhSVp9dR2Ot4Fv1LAw=; b=GDDVh5RJDnVYqu3Sxm3uvO/EuQPHw8ip3bJGXyRz5uopH+3WQo1vS7Xn/2lsW7oXgO A95qKTmzR8l7NOz67VoT6ZcSZ+e2ECaYQG0KCH1ME/j9A9hU9yVZW0otkf0IVkGgag4H 0xvul1rMDCLwPvTxvoX+R6uqIQFauMmz/p9QbDWwWtsDrgXK9yH/eFPMPPLrwGzTL4EO FYrmM7sqXXeHU4IHB3V7h9juWZdrbsWTdf+2RfihT8gYUBtWmSZJ80I+CpXoRIS/fKyb iQib4mHkaw6wzbgQeonu6wjLXoss5Fv0nBvmQ1GEmlf06ZwnjD2KDyt40Ujs1frsxv24 Dbbg== X-Gm-Message-State: APjAAAWxyRHcbMvD7h1hxoLknhb6igNiX2MHvFu8M3YvaB3IHp5GqO4O ta7B6o5crCL1c7dWZ/NcKrptDg== X-Google-Smtp-Source: APXvYqx9mwKFFvFnZQH8YPkiWsa+huJ7n+p2MlQyZnW9rZY0KrtTniVpKFOfviihehBQNE3PYdY6uA== X-Received: by 2002:a17:90a:b902:: with SMTP id p2mr13429398pjr.62.1570752394448; Thu, 10 Oct 2019 17:06:34 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id c8sm10527798pfi.117.2019.10.10.17.06.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:32 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 13/29] vmlinux.lds.h: Replace RW_DATA_SECTION with RW_DATA Date: Thu, 10 Oct 2019 17:05:53 -0700 Message-Id: <20191011000609.29728-14-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Rename RW_DATA_SECTION to RW_DATA. (Calling this a "section" is a lie, since it's multiple sections and section flags cannot be applied to the macro.) Signed-off-by: Kees Cook Acked-by: Geert Uytterhoeven --- arch/alpha/kernel/vmlinux.lds.S | 2 +- arch/arc/kernel/vmlinux.lds.S | 2 +- arch/arm/kernel/vmlinux-xip.lds.S | 2 +- arch/arm/kernel/vmlinux.lds.S | 2 +- arch/arm64/kernel/vmlinux.lds.S | 2 +- arch/csky/kernel/vmlinux.lds.S | 2 +- arch/h8300/kernel/vmlinux.lds.S | 2 +- arch/hexagon/kernel/vmlinux.lds.S | 2 +- arch/m68k/kernel/vmlinux-nommu.lds | 2 +- arch/m68k/kernel/vmlinux-std.lds | 2 +- arch/m68k/kernel/vmlinux-sun3.lds | 2 +- arch/microblaze/kernel/vmlinux.lds.S | 2 +- arch/nds32/kernel/vmlinux.lds.S | 2 +- arch/nios2/kernel/vmlinux.lds.S | 2 +- arch/openrisc/kernel/vmlinux.lds.S | 2 +- arch/parisc/kernel/vmlinux.lds.S | 2 +- arch/riscv/kernel/vmlinux.lds.S | 2 +- arch/s390/kernel/vmlinux.lds.S | 2 +- arch/sh/kernel/vmlinux.lds.S | 2 +- arch/sparc/kernel/vmlinux.lds.S | 2 +- arch/unicore32/kernel/vmlinux.lds.S | 2 +- arch/xtensa/kernel/vmlinux.lds.S | 2 +- include/asm-generic/vmlinux.lds.h | 4 ++-- 23 files changed, 24 insertions(+), 24 deletions(-) diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S index af411817dd7d..edc45f45523b 100644 --- a/arch/alpha/kernel/vmlinux.lds.S +++ b/arch/alpha/kernel/vmlinux.lds.S @@ -50,7 +50,7 @@ SECTIONS _sdata = .; /* Start of rw data section */ _data = .; - RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) .got : { *(.got) diff --git a/arch/arc/kernel/vmlinux.lds.S b/arch/arc/kernel/vmlinux.lds.S index 7d1d27066deb..54139a6f469b 100644 --- a/arch/arc/kernel/vmlinux.lds.S +++ b/arch/arc/kernel/vmlinux.lds.S @@ -101,7 +101,7 @@ SECTIONS * 1. this is .data essentially * 2. THREAD_SIZE for init.task, must be kernel-stk sz aligned */ - RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) _edata = .; diff --git a/arch/arm/kernel/vmlinux-xip.lds.S b/arch/arm/kernel/vmlinux-xip.lds.S index d2a9651c24ad..21b8b271c80d 100644 --- a/arch/arm/kernel/vmlinux-xip.lds.S +++ b/arch/arm/kernel/vmlinux-xip.lds.S @@ -112,7 +112,7 @@ SECTIONS . = ALIGN(THREAD_SIZE); _sdata = .; - RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) .data.ro_after_init : AT(ADDR(.data.ro_after_init) - LOAD_OFFSET) { *(.data..ro_after_init) } diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 068db6860867..319ccb10846a 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -141,7 +141,7 @@ SECTIONS __init_end = .; _sdata = .; - RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) _edata = .; BSS_SECTION(0, 0, 0) diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index e7dafc29b1fa..a4b3e6c0680c 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -214,7 +214,7 @@ SECTIONS _data = .; _sdata = .; - RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_ALIGN) + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_ALIGN) /* * Data written with the MMU off but read with the MMU on requires diff --git a/arch/csky/kernel/vmlinux.lds.S b/arch/csky/kernel/vmlinux.lds.S index 8598bd7a7bcd..2ff37beaf2bf 100644 --- a/arch/csky/kernel/vmlinux.lds.S +++ b/arch/csky/kernel/vmlinux.lds.S @@ -50,7 +50,7 @@ SECTIONS _sdata = .; RO_DATA(PAGE_SIZE) - RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) _edata = .; EXCEPTION_TABLE(L1_CACHE_BYTES) diff --git a/arch/h8300/kernel/vmlinux.lds.S b/arch/h8300/kernel/vmlinux.lds.S index d3247d33b115..2ac7bdcd2fe0 100644 --- a/arch/h8300/kernel/vmlinux.lds.S +++ b/arch/h8300/kernel/vmlinux.lds.S @@ -47,7 +47,7 @@ SECTIONS #endif _sdata = . ; __data_start = . ; - RW_DATA_SECTION(0, PAGE_SIZE, THREAD_SIZE) + RW_DATA(0, PAGE_SIZE, THREAD_SIZE) #if defined(CONFIG_ROMKERNEL) #undef ADDR #endif diff --git a/arch/hexagon/kernel/vmlinux.lds.S b/arch/hexagon/kernel/vmlinux.lds.S index 0145251fa317..0ca2471ddb9f 100644 --- a/arch/hexagon/kernel/vmlinux.lds.S +++ b/arch/hexagon/kernel/vmlinux.lds.S @@ -49,7 +49,7 @@ SECTIONS INIT_DATA_SECTION(PAGE_SIZE) _sdata = .; - RW_DATA_SECTION(32,PAGE_SIZE,_THREAD_SIZE) + RW_DATA(32,PAGE_SIZE,_THREAD_SIZE) RO_DATA(PAGE_SIZE) _edata = .; diff --git a/arch/m68k/kernel/vmlinux-nommu.lds b/arch/m68k/kernel/vmlinux-nommu.lds index de80f8b8ae78..7b975420c3d9 100644 --- a/arch/m68k/kernel/vmlinux-nommu.lds +++ b/arch/m68k/kernel/vmlinux-nommu.lds @@ -61,7 +61,7 @@ SECTIONS { _sdata = .; RO_DATA(PAGE_SIZE) - RW_DATA_SECTION(16, PAGE_SIZE, THREAD_SIZE) + RW_DATA(16, PAGE_SIZE, THREAD_SIZE) _edata = .; EXCEPTION_TABLE(16) diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds index 625a5785804f..6e7eb49ed985 100644 --- a/arch/m68k/kernel/vmlinux-std.lds +++ b/arch/m68k/kernel/vmlinux-std.lds @@ -33,7 +33,7 @@ SECTIONS RODATA - RW_DATA_SECTION(16, PAGE_SIZE, THREAD_SIZE) + RW_DATA(16, PAGE_SIZE, THREAD_SIZE) BSS_SECTION(0, 0, 0) diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds index 9868270b0984..1a0ad6b6dd8c 100644 --- a/arch/m68k/kernel/vmlinux-sun3.lds +++ b/arch/m68k/kernel/vmlinux-sun3.lds @@ -30,7 +30,7 @@ SECTIONS EXCEPTION_TABLE(16) :data _sdata = .; /* Start of rw data section */ - RW_DATA_SECTION(16, PAGE_SIZE, THREAD_SIZE) :data + RW_DATA(16, PAGE_SIZE, THREAD_SIZE) :data /* End of data goes *here* so that freeing init code works properly. */ _edata = .; NOTES diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S index 2299694748ea..b8efb08204a1 100644 --- a/arch/microblaze/kernel/vmlinux.lds.S +++ b/arch/microblaze/kernel/vmlinux.lds.S @@ -69,7 +69,7 @@ SECTIONS { } _sdata = . ; - RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE) + RW_DATA(32, PAGE_SIZE, THREAD_SIZE) _edata = . ; /* Under the microblaze ABI, .sdata and .sbss must be contiguous */ diff --git a/arch/nds32/kernel/vmlinux.lds.S b/arch/nds32/kernel/vmlinux.lds.S index 10ff570ba95b..f679d3397436 100644 --- a/arch/nds32/kernel/vmlinux.lds.S +++ b/arch/nds32/kernel/vmlinux.lds.S @@ -54,7 +54,7 @@ SECTIONS _sdata = .; RO_DATA(PAGE_SIZE) - RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) _edata = .; EXCEPTION_TABLE(16) diff --git a/arch/nios2/kernel/vmlinux.lds.S b/arch/nios2/kernel/vmlinux.lds.S index 318804a2c7a1..c55a7cfa1075 100644 --- a/arch/nios2/kernel/vmlinux.lds.S +++ b/arch/nios2/kernel/vmlinux.lds.S @@ -50,7 +50,7 @@ SECTIONS _sdata = .; RO_DATA(PAGE_SIZE) - RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) _edata = .; BSS_SECTION(0, 0, 0) diff --git a/arch/openrisc/kernel/vmlinux.lds.S b/arch/openrisc/kernel/vmlinux.lds.S index f73e0d3ea09f..60449fd7f16f 100644 --- a/arch/openrisc/kernel/vmlinux.lds.S +++ b/arch/openrisc/kernel/vmlinux.lds.S @@ -74,7 +74,7 @@ SECTIONS /* Whatever comes after _e_kernel_ro had better be page-aligend, too */ /* 32 here is cacheline size... recheck this */ - RW_DATA_SECTION(32, PAGE_SIZE, PAGE_SIZE) + RW_DATA(32, PAGE_SIZE, PAGE_SIZE) _edata = .; diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S index e1c563c7dca1..12b3d7d5e9e4 100644 --- a/arch/parisc/kernel/vmlinux.lds.S +++ b/arch/parisc/kernel/vmlinux.lds.S @@ -148,7 +148,7 @@ SECTIONS data_start = .; /* Data */ - RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, PAGE_SIZE) + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, PAGE_SIZE) /* PA-RISC locks requires 16-byte alignment */ . = ALIGN(16); diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S index 66dc17d24dd9..12f42f96d46e 100644 --- a/arch/riscv/kernel/vmlinux.lds.S +++ b/arch/riscv/kernel/vmlinux.lds.S @@ -57,7 +57,7 @@ SECTIONS *(.srodata*) } - RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) .sdata : { __global_pointer$ = . + 0x800; *(.sdata*) diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index b33c4823f8b5..37695499717d 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S @@ -67,7 +67,7 @@ SECTIONS . = ALIGN(PAGE_SIZE); __end_ro_after_init = .; - RW_DATA_SECTION(0x100, PAGE_SIZE, THREAD_SIZE) + RW_DATA(0x100, PAGE_SIZE, THREAD_SIZE) BOOT_DATA_PRESERVED _edata = .; /* End of data section */ diff --git a/arch/sh/kernel/vmlinux.lds.S b/arch/sh/kernel/vmlinux.lds.S index fef39054cc70..c60b19958c35 100644 --- a/arch/sh/kernel/vmlinux.lds.S +++ b/arch/sh/kernel/vmlinux.lds.S @@ -51,7 +51,7 @@ SECTIONS _sdata = .; RO_DATA(PAGE_SIZE) - RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) _edata = .; DWARF_EH_FRAME diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S index 8929fbc35a80..7ec79918b566 100644 --- a/arch/sparc/kernel/vmlinux.lds.S +++ b/arch/sparc/kernel/vmlinux.lds.S @@ -67,7 +67,7 @@ SECTIONS .data1 : { *(.data1) } - RW_DATA_SECTION(SMP_CACHE_BYTES, 0, THREAD_SIZE) + RW_DATA(SMP_CACHE_BYTES, 0, THREAD_SIZE) /* End of data section */ _edata = .; diff --git a/arch/unicore32/kernel/vmlinux.lds.S b/arch/unicore32/kernel/vmlinux.lds.S index 367c80313bec..6fb320b337ef 100644 --- a/arch/unicore32/kernel/vmlinux.lds.S +++ b/arch/unicore32/kernel/vmlinux.lds.S @@ -44,7 +44,7 @@ SECTIONS _sdata = .; RO_DATA(PAGE_SIZE) - RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) + RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) _edata = .; EXCEPTION_TABLE(L1_CACHE_BYTES) diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S index b97e5798b9cf..bdbd7c4056c1 100644 --- a/arch/xtensa/kernel/vmlinux.lds.S +++ b/arch/xtensa/kernel/vmlinux.lds.S @@ -134,7 +134,7 @@ SECTIONS /* Data section */ _sdata = .; - RW_DATA_SECTION(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE) + RW_DATA(XCHAL_ICACHE_LINESIZE, PAGE_SIZE, THREAD_SIZE) _edata = .; /* Initialization code and data: */ diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 061e57c609f6..356078e50a5c 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -24,7 +24,7 @@ * * _sdata = .; * RO_DATA(PAGE_SIZE) - * RW_DATA_SECTION(...) + * RW_DATA(...) * _edata = .; * * EXCEPTION_TABLE(...) @@ -975,7 +975,7 @@ * matches the requirement of PAGE_ALIGNED_DATA. * * use 0 as page_align if page_aligned data is not used */ -#define RW_DATA_SECTION(cacheline, pagealigned, inittask) \ +#define RW_DATA(cacheline, pagealigned, inittask) \ . = ALIGN(PAGE_SIZE); \ .data : AT(ADDR(.data) - LOAD_OFFSET) { \ INIT_TASK_DATA(inittask) \ From patchwork Fri Oct 11 00:05:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174901 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 46q8Xn5XSmz9s7T for ; Fri, 11 Oct 2019 11:51:37 +1100 (AEDT) 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="Gv7TLEhl"; 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 46q8Xn4MQyzDqW6 for ; Fri, 11 Oct 2019 11:51:37 +1100 (AEDT) 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::543; helo=mail-pg1-x543.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="Gv7TLEhl"; dkim-atps=neutral Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (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 46q7h95WkyzDqMM for ; Fri, 11 Oct 2019 11:12:57 +1100 (AEDT) Received: by mail-pg1-x543.google.com with SMTP id y35so4715103pgl.1 for ; Thu, 10 Oct 2019 17:12:57 -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=O8SEsfE9Vx0Hoh9SzPjKsL9yL1yAPo1QWRZUpqQZ5BE=; b=Gv7TLEhljmk67n05hXgtlXOGcw9tGWMBrimWEdgAzAJXSYD424xsVS93uPgKCKbOtA KpknhwokmtlZdLNepzxzaEOUq/9kMlkIhbFFmT4rtodx7TYV09GcbgOeE2Tx2zJJHzL4 OqaceGT7qpam5Y2W3jNCRpS/l3/Ec0FSl0z+s= 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=O8SEsfE9Vx0Hoh9SzPjKsL9yL1yAPo1QWRZUpqQZ5BE=; b=ZjFgzHFm3WTd4LUlFW+9M9+WgUMOdd70W5yQyYpJ7wlRKKCBe0aq3nKNzcuQ0zuzTM 0c2q74Op79bthrZKyc4nKwZzxnXD2eNL+WzJpHFEDbicq5Mk+HqTZ3+6/Ii5kLvtuLFe 9YIDQgJafNwnQxVKO2CWPcLqM29TU1cuIfcJVV7Zyc6PYrOhpllhGfTcO02omfvE9lUW pe9LYKHtl9O7pA9Z5QNyE57Hp4+kGVlZ6sUroSJeAnRiUTGSgKUeKIL4a48CRsp5dZL9 467LYBGhCTO6GAz7se1iXyOcut8vn7ED0eXDTa8p5EpD7EsBBWZSywkztm6elPXhmKkt /a5Q== X-Gm-Message-State: APjAAAX0VZHAGEaKuONrHVG1bY9TwsAfZghUC4xG/zeZ8w4OKpR3UQD6 Pl0PL8Ryk2NMiPZ+j/cacweG4A== X-Google-Smtp-Source: APXvYqzyaJSRYesLvc9/cYfNuiEyqu7JRw4xKIgMuM24rG56rksdn8ZIgzTA7SEJDJgU0X32uEGKXg== X-Received: by 2002:a63:4624:: with SMTP id t36mr11232771pga.376.1570752775059; Thu, 10 Oct 2019 17:12:55 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 2sm6371584pfo.91.2019.10.10.17.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:12:52 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 14/29] vmlinux.lds.h: Allow EXCEPTION_TABLE to live in RO_DATA Date: Thu, 10 Oct 2019 17:05:54 -0700 Message-Id: <20191011000609.29728-15-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.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 only needs to be readable. As such, it should live in RO_DATA. Create 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 356078e50a5c..9867d8e41eed 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_EXCEPTION_TABLE_ALIGN +#define RO_EXCEPTION_TABLE EXCEPTION_TABLE(RO_EXCEPTION_TABLE_ALIGN) +#else +#define RO_EXCEPTION_TABLE +#endif + /* Align . to a 8 byte boundary equals to maximum function alignment. */ #define ALIGN_FUNCTION() . = ALIGN(8) @@ -513,6 +524,7 @@ __stop___modver = .; \ } \ \ + RO_EXCEPTION_TABLE \ NOTES \ \ . = ALIGN((align)); \ From patchwork Fri Oct 11 00:05:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174895 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 46q8Fz27Snz9s7T for ; Fri, 11 Oct 2019 11:38:47 +1100 (AEDT) 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="Cke1k+Wo"; 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 46q8Fy4mdnzDqVZ for ; Fri, 11 Oct 2019 11:38:46 +1100 (AEDT) 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::543; helo=mail-pg1-x543.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="Cke1k+Wo"; dkim-atps=neutral Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (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 46q7Xs4HMSzDqRf for ; Fri, 11 Oct 2019 11:06:37 +1100 (AEDT) Received: by mail-pg1-x543.google.com with SMTP id x10so4692311pgi.5 for ; Thu, 10 Oct 2019 17:06:37 -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=MEsYo+M8tYJs19WnuB4vdd58NV32mqrr8UAWRisKZTU=; b=Cke1k+WoV3d4y7UYLwGR6Cccr6ntETV7w4A+pAdyCIZxanwHXq4EPnvgyBzqAj40+x LiPrWoEPAyegIEPYdAPySyJ4W/aeyE2yAl3to28d7+EqgEkXRjB2PlBmPUXFz9yU7bX0 btdMvXUw872LvztOLh6mK1NAcmtdiy6tXBqrQ= 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=MEsYo+M8tYJs19WnuB4vdd58NV32mqrr8UAWRisKZTU=; b=Vs832SqnlAm8YMWSTZjDAHjfJhKG0NSa+9UFXYtLhrXc1l5qko5rfqLBMj7vKjmwT8 4zvLBocBsLq1ka9jHFDG6VEpWVK2kKixXjMZ0YLgdtOkM/6XDkMHJ4y4ajnPCc6TIwGF syXtioD1Dq8yOYnnPsqFhffERhXvb6PdJDIyV+RSFTx8AKCOq0+6IspL56dWnegPB2FD U3KiqrESXy9x7Gb1YsJY6qUIG0mKk4YSAQmeXbmyK/jnoVP5lN9Rh0IeuJ9mk9btpXLU hCceoBfRDtr6W4bvpJ14bdmLbVcQdue+a9g32rTt8LvYVPMQdc6emyAIn390T6SZL/D8 CjEA== X-Gm-Message-State: APjAAAX7lLJB80aADGtTmZkZZtXDHjc2lM52G8Fel9lCj2nDN9UKaec2 NN2y7YcMUxUHpHCmbpRQPc42Tw== X-Google-Smtp-Source: APXvYqzt84R7YNxqDtZOc2Oqf/NMK/JV4QC0qvTQklX1v+jaEWwrU8bF8lAwLpkYEhqywmtQWhwmNQ== X-Received: by 2002:aa7:8691:: with SMTP id d17mr13279534pfo.218.1570752395513; Thu, 10 Oct 2019 17:06:35 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id y28sm7193083pfq.48.2019.10.10.17.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:32 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 15/29] x86: Actually use _etext for end of text segment Date: Thu, 10 Oct 2019 17:05:55 -0700 Message-Id: <20191011000609.29728-16-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Various calculations are using the end of the exception table (which does not need to be executable) as the end of the text segment. Instead, in preparation for moving the exception table into RO_DATA, move _etext after the exception table and update the calculations. Signed-off-by: Kees Cook --- arch/x86/include/asm/sections.h | 1 - arch/x86/kernel/vmlinux.lds.S | 7 +++---- arch/x86/mm/init_64.c | 6 +++--- arch/x86/mm/pti.c | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/arch/x86/include/asm/sections.h b/arch/x86/include/asm/sections.h index 71b32f2570ab..036c360910c5 100644 --- a/arch/x86/include/asm/sections.h +++ b/arch/x86/include/asm/sections.h @@ -6,7 +6,6 @@ #include extern char __brk_base[], __brk_limit[]; -extern struct exception_table_entry __stop___ex_table[]; extern char __end_rodata_aligned[]; #if defined(CONFIG_X86_64) diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index 41362e90142d..a1a758e25b2b 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -143,15 +143,14 @@ SECTIONS *(.text.__x86.indirect_thunk) __indirect_thunk_end = .; #endif - - /* End of text section */ - _etext = .; } :text = 0x9090 EXCEPTION_TABLE(16) - /* .text should occupy whole number of pages */ + /* End of text section, which should occupy whole number of pages */ + _etext = .; . = ALIGN(PAGE_SIZE); + X86_ALIGN_RODATA_BEGIN RO_DATA(PAGE_SIZE) X86_ALIGN_RODATA_END diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index a6b5c653727b..26299e9ce6da 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -1263,7 +1263,7 @@ int kernel_set_to_readonly; void set_kernel_text_rw(void) { unsigned long start = PFN_ALIGN(_text); - unsigned long end = PFN_ALIGN(__stop___ex_table); + unsigned long end = PFN_ALIGN(_etext); if (!kernel_set_to_readonly) return; @@ -1282,7 +1282,7 @@ void set_kernel_text_rw(void) void set_kernel_text_ro(void) { unsigned long start = PFN_ALIGN(_text); - unsigned long end = PFN_ALIGN(__stop___ex_table); + unsigned long end = PFN_ALIGN(_etext); if (!kernel_set_to_readonly) return; @@ -1301,7 +1301,7 @@ void mark_rodata_ro(void) unsigned long start = PFN_ALIGN(_text); unsigned long rodata_start = PFN_ALIGN(__start_rodata); unsigned long end = (unsigned long) &__end_rodata_hpage_align; - unsigned long text_end = PFN_ALIGN(&__stop___ex_table); + unsigned long text_end = PFN_ALIGN(&_etext); unsigned long rodata_end = PFN_ALIGN(&__end_rodata); unsigned long all_end; diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c index 7f2140414440..44a9f068eee0 100644 --- a/arch/x86/mm/pti.c +++ b/arch/x86/mm/pti.c @@ -574,7 +574,7 @@ static void pti_clone_kernel_text(void) */ unsigned long start = PFN_ALIGN(_text); unsigned long end_clone = (unsigned long)__end_rodata_aligned; - unsigned long end_global = PFN_ALIGN((unsigned long)__stop___ex_table); + unsigned long end_global = PFN_ALIGN((unsigned long)_etext); if (!pti_kernel_image_global_ok()) return; From patchwork Fri Oct 11 00:05:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174894 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 46q8Cn2PgLz9s7T for ; Fri, 11 Oct 2019 11:36:53 +1100 (AEDT) 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="fLT/IFk/"; 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 46q8Cn1St3zDqTR for ; Fri, 11 Oct 2019 11:36:53 +1100 (AEDT) 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::543; helo=mail-pg1-x543.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="fLT/IFk/"; dkim-atps=neutral Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (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 46q7Xs14YgzDqQx for ; Fri, 11 Oct 2019 11:06:37 +1100 (AEDT) Received: by mail-pg1-x543.google.com with SMTP id y35so4707303pgl.1 for ; Thu, 10 Oct 2019 17:06:37 -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=aFfN5juCtHu18am/Lscu0/nkwdENrYqqL+l/G+SE/2I=; b=fLT/IFk/zcWpEKQQpsCuZreeSESJFRNdZ9hKHV0Y/h8n0IfaNLHOqmTYtdPHeZxkjc xWb/DQdE2uR1oDMr4EtvYElJra/mVKFp1aLbbQ6bJ3wnEDggQhIotPy3fghpdD1vLtdp EDoZ6HuknzX/OdZ89Gdo2kWzGjDi4EqKGpRbQ= 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=aFfN5juCtHu18am/Lscu0/nkwdENrYqqL+l/G+SE/2I=; b=YSq7ZdlW2yJBc1dFQxaMSB0284pc4QchFRhh6cDodjfvRMvNeBarpJUKO8cpRY8aEj euUEmkZSzeO21WFXVaLLoRh3FcGGj6ymld2X/9ik07zVp3Xd8AfQ/s6+BA2mqa9mGDhk 1lz6SADNVg8U3pUYsdZA12ZFgL/uNCYUFlOE6V66QkN9om35X01q2jz3HZusUAjtR1nS 4C7dU+FkexvhXsbsihefrkz7P7Oelk+HKI4cTF0IydAx2y2/tOBLWAwi0QiG1tSV32QU lN70Fw1Fc1YGehFVUH/Go15vMGI8IQs3pmbIjHAxrZnNoGwUIyVHk9LjXzF+/kVAPNgA SYVw== X-Gm-Message-State: APjAAAVyXJqxDCfngP6OtYMP8N+TG58ASW02F6g5HcgYWlD0KEms9W/A RkcXH/6KNPWTCyxg2rbCgwQ/9Q== X-Google-Smtp-Source: APXvYqxt91xs+DlKHANMAIgcph9JiYJXmwrfwOJOztv5tZwNFPibvGy6e5lUsAYLGSGL3bBhVSlFEA== X-Received: by 2002:a63:906:: with SMTP id 6mr13901748pgj.324.1570752394983; Thu, 10 Oct 2019 17:06:34 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id f14sm10473924pfq.187.2019.10.10.17.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:32 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 16/29] x86: Move EXCEPTION_TABLE to RO_DATA segment Date: Thu, 10 Oct 2019 17:05:56 -0700 Message-Id: <20191011000609.29728-17-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The exception table was needlessly marked executable. In preparation for execute-only memory, move the table into the RO_DATA segment via the new macro that can be used by any architectures that want to make a similar consolidation. Signed-off-by: Kees Cook --- arch/x86/kernel/vmlinux.lds.S | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index a1a758e25b2b..b06d6e1188de 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -22,6 +22,7 @@ #endif #define EMITS_PT_NOTE +#define RO_EXCEPTION_TABLE_ALIGN 16 #include #include @@ -145,8 +146,6 @@ SECTIONS #endif } :text = 0x9090 - EXCEPTION_TABLE(16) - /* End of text section, which should occupy whole number of pages */ _etext = .; . = ALIGN(PAGE_SIZE); From patchwork Fri Oct 11 00:05:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174898 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 46q8QN3z5bz9s7T for ; Fri, 11 Oct 2019 11:46:04 +1100 (AEDT) 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="UICOc5TK"; 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 46q8QN0xQ2zDqSh for ; Fri, 11 Oct 2019 11:46:04 +1100 (AEDT) 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="UICOc5TK"; 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 46q7h74xqXzDqSZ for ; Fri, 11 Oct 2019 11:12:55 +1100 (AEDT) Received: by mail-pg1-x542.google.com with SMTP id z12so4696960pgp.9 for ; Thu, 10 Oct 2019 17:12:55 -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=C4qrRt1wPf/MBbE+aHUnjpKB3JMiaG6wbnmkvfoIFU0=; b=UICOc5TKza9BTCIUokRpRXRixWvfiu//j+nLFORdk7UGk/JwyzBWx+ycolyJCZr/Zj USYjJEh9S6rYvbkeSR5dqh4t0wO42rK96mEpNN2uDcZMnixq8tbOTsEogIYGcWgVfWSY D4i8QsjQVcM0qjRwO2F5cvKbTZ8BLcWZFx7T8= 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=C4qrRt1wPf/MBbE+aHUnjpKB3JMiaG6wbnmkvfoIFU0=; b=e/zlrVoixZyafs4yYkjVbwDWEEU7k7QENy/OFMC31cZDvbVELCcMoiJEubkfSDEQ0O GeJFI2KGEYY+LJ2fvdICPip+uapVHcLbfI89IqTGbEsVUKcu7uDSl+b1hAV3Pu2Edghh aYCRjaSHv8ibaRl+cMqY3+bb5p/3AdtlFppMjx3Yj+4HYKQCaUGD/RN3we73PL9/cwUE XI+BuaRAI46WEqbefGMaVFNm06Qs/6k1eZbgYl/XKvcuBYlvWHzxEuLPpe8WtetKRHJD 4PkFKpc2a7UuZEwt3fSE6SBx6W2wsDsjQ77h1eklqA0PNwknp9khht/ZzpwZzUI54CqP S+bw== X-Gm-Message-State: APjAAAVj0UpYZHde6ULUYcqne07JRVOvOPDrtYEzMFp2DYoyOch9f5HU vJTteHO1iIPGzUIOFisg0R8n3Q== X-Google-Smtp-Source: APXvYqwliD8aT2m8D5BS3pRkZKxejc1RX6nlHmvajkiWktD94kckhfSBhz7/A5hJ2lTUaMfRy1yv0g== X-Received: by 2002:a62:e206:: with SMTP id a6mr13749471pfi.245.1570752773224; Thu, 10 Oct 2019 17:12:53 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id w2sm7937638pfn.57.2019.10.10.17.12.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:12:52 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 17/29] alpha: Move EXCEPTION_TABLE to RO_DATA segment Date: Thu, 10 Oct 2019 17:05:57 -0700 Message-Id: <20191011000609.29728-18-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Since the EXCEPTION_TABLE is read-only, collapse it into RO_DATA. Signed-off-by: Kees Cook --- arch/alpha/kernel/vmlinux.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S index edc45f45523b..bc6f727278fd 100644 --- a/arch/alpha/kernel/vmlinux.lds.S +++ b/arch/alpha/kernel/vmlinux.lds.S @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ #define EMITS_PT_NOTE +#define RO_EXCEPTION_TABLE_ALIGN 16 #include #include @@ -35,7 +36,6 @@ SECTIONS _etext = .; /* End of text section */ RO_DATA(4096) - EXCEPTION_TABLE(16) /* Will be freed after init */ __init_begin = ALIGN(PAGE_SIZE); From patchwork Fri Oct 11 00:05:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174906 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 46q8jP3N0vz9s7T for ; Fri, 11 Oct 2019 11:59:05 +1100 (AEDT) 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="P4Fuk21m"; 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 46q8jP2SXMzDqWS for ; Fri, 11 Oct 2019 11:59:05 +1100 (AEDT) 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::442; helo=mail-pf1-x442.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="P4Fuk21m"; dkim-atps=neutral Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (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 46q7hG1s5TzDqRy for ; Fri, 11 Oct 2019 11:13:02 +1100 (AEDT) Received: by mail-pf1-x442.google.com with SMTP id y22so4955494pfr.3 for ; Thu, 10 Oct 2019 17:13:02 -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=FW8b8NX2lcqvjxUkqurmeLymDZQTO5emHjisNR3IdMA=; b=P4Fuk21mSaKNwFMUmZxSt/IIxNtkXj+Ys/JxlgIct6Hlb4B3yXk/i320iivrHPWx5w hPi5AFgp8NwZicAqmOBJvk6GzGKldRwbd/3LLSi/srLk+eGZ7yRithSSv41nscZhF3Dk GELZr5uH3JzvVYuz2LSeaVERr6mu//7mpofAQ= 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=FW8b8NX2lcqvjxUkqurmeLymDZQTO5emHjisNR3IdMA=; b=tShBNOdoJUD7SYLl8zJte0Xe3l52XigDnvKZPZ8eHEOKRI1l9x0hhU8hgDheYhjRp7 /LVmJzeiUEiUacyjr3eT/QH57HKPyZ433hVkcofUQLFTHaug3bShBW/0sv0AZoXV24h7 pTdL74VPwaCaUbT7eMR2yUnxyQrx+ektfwteLDi9hw3kbx9IXLE24k4kxv9PxpVqRe6m Z/aDuMhSWzgQOUmsaXPrev7yUbJA97jE1LpcjuW/ghVWjnUcrVT8T2rB2PQdBap6s9O9 LcAlhsQsV/DS0++E8wnPhvoinl5KPgz1Zfcmi4s9s4xIV3BdbEXV+MTk7VN672oVCTBo IbYw== X-Gm-Message-State: APjAAAV1NU/Y6cr8EjkXOncMK1W1H8iTxearWdY/bhLr0BGhK9HxgflL m3Xog4Li6KOpq3G7MJ4jNZEUsQ== X-Google-Smtp-Source: APXvYqwSt3lft0x1k4gSFxtu2q9aicPcZGAiZFY9usQRrxAus3R2IZvqQ+Z/MfqEoiJ8yKOquglteA== X-Received: by 2002:a17:90a:246e:: with SMTP id h101mr14385157pje.133.1570752779910; Thu, 10 Oct 2019 17:12:59 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 7sm5985112pgx.26.2019.10.10.17.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:12:56 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 18/29] arm64: Move EXCEPTION_TABLE to RO_DATA segment Date: Thu, 10 Oct 2019 17:05:58 -0700 Message-Id: <20191011000609.29728-19-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Since the EXCEPTION_TABLE is read-only, collapse it into RO_DATA. Also removes the redundant ALIGN, which is already present at the end of the RO_DATA macro. Signed-off-by: Kees Cook Acked-by: Will Deacon --- arch/arm64/kernel/vmlinux.lds.S | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index a4b3e6c0680c..9128a26eb45b 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -5,6 +5,8 @@ * Written by Martin Mares */ +#define RO_EXCEPTION_TABLE_ALIGN 8 + #include #include #include @@ -135,10 +137,9 @@ SECTIONS . = ALIGN(SEGMENT_ALIGN); _etext = .; /* End of text section */ - RO_DATA(PAGE_SIZE) /* everything from this point to */ - EXCEPTION_TABLE(8) /* __init_begin will be marked RO NX */ + /* everything from this point to __init_begin will be marked RO NX */ + RO_DATA(PAGE_SIZE) - . = ALIGN(PAGE_SIZE); idmap_pg_dir = .; . += IDMAP_DIR_SIZE; From patchwork Fri Oct 11 00:05:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174905 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 46q8g647zFz9s7T for ; Fri, 11 Oct 2019 11:57:06 +1100 (AEDT) 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="C1PlvZ+0"; 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 46q8g63J5pzDqWW for ; Fri, 11 Oct 2019 11:57:06 +1100 (AEDT) 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::441; helo=mail-pf1-x441.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="C1PlvZ+0"; dkim-atps=neutral Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) (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 46q7hG1DJFzDqLK for ; Fri, 11 Oct 2019 11:13:02 +1100 (AEDT) Received: by mail-pf1-x441.google.com with SMTP id b128so4969955pfa.1 for ; Thu, 10 Oct 2019 17:13:01 -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=l+J574mlC+dRmZJG9pHhpppQFEze5VvTPTaNiTnbyaQ=; b=C1PlvZ+0BEdj9jtliX0A0Huqq47ruf9nBVH5STuBjosSplWIN8Wr5Bj0uznajZR412 88yKrget+DCqKxVlllcxd6K5szWGkcPAUypn6xoncOXOV6R6YV83ztEsCSkeh78n0AI2 yKxfXdh2vdcul3D71BzoL2J/wyWHTxCQ4Jyq0= 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=l+J574mlC+dRmZJG9pHhpppQFEze5VvTPTaNiTnbyaQ=; b=A6/SO6JesT9TLT1ZCxmIdVOtlRfuvjXYTw5PUXvkWz9FiVKyUyaIOqtYZk6lJ58gXT outV9EdwGKJq5Y982qSjCeSL1pNkNYh4kTh8jCubTLiLzBhbUjAQ3QJvgtryGF7a11MP etIBFYOHG97JpgrOlIng1Lr//zmCJpzezRb8lOFsAW3IXOMOrzrys1JNkz3rl8iBy6xA SQhmdVbHGlRUxLXqHpBewl7LsZgZ6KF2aPKo4vOdIjiD29hntI+sDrQOfSEl6icn/MhV RY1MliDwnK69y4SPPN+lmiMeRfyavZRb0NA7+AM4qBjt0op/apl1bsx0GcWN46vzT0lJ AAEA== X-Gm-Message-State: APjAAAVa00vT3hvJ1XnTArtqj4lmlpvO+49KpuThn5shKjbTEHYNJhbB vmhcljpqzavNFlh/M4sHrPbNzg== X-Google-Smtp-Source: APXvYqy4PLu05rX5bRRgJJfyDhm9F1ghOcCs3VwNTK0YfAFFK8MX8ZPUgv1lA3bQ8SclnhiYx4k3qw== X-Received: by 2002:a63:44f:: with SMTP id 76mr14137515pge.164.1570752778758; Thu, 10 Oct 2019 17:12:58 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id a8sm7285998pfa.182.2019.10.10.17.12.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:12:56 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 19/29] c6x: Move EXCEPTION_TABLE to RO_DATA segment Date: Thu, 10 Oct 2019 17:05:59 -0700 Message-Id: <20191011000609.29728-20-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Since the EXCEPTION_TABLE is read-only, collapse it into RO_DATA. Signed-off-by: Kees Cook --- arch/c6x/kernel/vmlinux.lds.S | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/c6x/kernel/vmlinux.lds.S b/arch/c6x/kernel/vmlinux.lds.S index a3547f9d415b..ac99ba0864bf 100644 --- a/arch/c6x/kernel/vmlinux.lds.S +++ b/arch/c6x/kernel/vmlinux.lds.S @@ -5,6 +5,9 @@ * Copyright (C) 2010, 2011 Texas Instruments Incorporated * Mark Salter */ + +#define RO_EXCEPTION_TABLE_ALIGN 16 + #include #include #include @@ -80,8 +83,6 @@ SECTIONS *(.gnu.warning) } - EXCEPTION_TABLE(16) - RO_DATA(PAGE_SIZE) .const : { From patchwork Fri Oct 11 00:06:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174896 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46q8KM2gNwz9s7T for ; Fri, 11 Oct 2019 11:41:43 +1100 (AEDT) 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="YSecILoA"; 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 46q8KM053TzDqGL for ; Fri, 11 Oct 2019 11:41:43 +1100 (AEDT) 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::442; helo=mail-pf1-x442.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="YSecILoA"; dkim-atps=neutral Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (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 46q7Xt4DjgzDqRx for ; Fri, 11 Oct 2019 11:06:38 +1100 (AEDT) Received: by mail-pf1-x442.google.com with SMTP id y22so4947322pfr.3 for ; Thu, 10 Oct 2019 17:06:38 -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=zkQRciK9mkrlSR6uxFsvjRswhc34+65nZ5EFVAGwQNE=; b=YSecILoAsuaYNC3glukrCd31elBfhWrMe0PzbA6TDXYdPOVhmOhkQLy8xjOVCWTle3 sWZgpOp1PTW2fO+D3A347Fw7oous07bPkmNpp/aoq4rj0PLZ+w9ksZu6jr+caikG/bpH XU/ce13E03H0+EglsamH4gM2AQvQFCYts7cLo= 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=zkQRciK9mkrlSR6uxFsvjRswhc34+65nZ5EFVAGwQNE=; b=c+X/ILP6WFjSOtUUWOCGn7ZD4XOzrw565d9MGbrK2b/tWvqx2vtePEHqo/AiGTQj++ 3M4nDyK0gfqYI5sD/J3H4sd4ciXLEaQSQWWIeUflhg5Cv+f1chfRA4tiljHu9oUCmuau yPXZMbAXZARlOd3NOSU2bWyWe/rnNXR49YPYskPqpf4kEmIG8tsVWDQi/SqONWRAI4aW za2V13FM94BN5w9/6j4+CYjDKW3VJ/6HpujpQ8NbJ7CkzfQpVJe/Wp77k663YIuV85I+ YXK9LS27juSsZm1XCaSzALycX2Qg7QV3JKgJWQ0LWwu9iqaMUE5AIjkwb7xM9L4owwH9 H/rA== X-Gm-Message-State: APjAAAU8k+HurMFWhNkxhTL86u+joY85G1atueCZHVYRer583ndsNC1S GsvyuOKto4zILSEaI/F9dnBgqQ== X-Google-Smtp-Source: APXvYqynxI+SrUE/IFh3H47ImD9d3o8Z2E9DLcjnFNC1TbOkJf20nhWWRMuV9Tda9+s+1NYxkhzhYQ== X-Received: by 2002:a63:2c7:: with SMTP id 190mr11717225pgc.18.1570752396275; Thu, 10 Oct 2019 17:06:36 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id s141sm8901750pfs.13.2019.10.10.17.06.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:33 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 20/29] h8300: Move EXCEPTION_TABLE to RO_DATA segment Date: Thu, 10 Oct 2019 17:06:00 -0700 Message-Id: <20191011000609.29728-21-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Since the EXCEPTION_TABLE is read-only, collapse it into RO_DATA. Signed-off-by: Kees Cook --- arch/h8300/kernel/vmlinux.lds.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/h8300/kernel/vmlinux.lds.S b/arch/h8300/kernel/vmlinux.lds.S index 2ac7bdcd2fe0..6b1afc2f9b68 100644 --- a/arch/h8300/kernel/vmlinux.lds.S +++ b/arch/h8300/kernel/vmlinux.lds.S @@ -1,4 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ + +#define RO_EXCEPTION_TABLE_ALIGN 16 + #include #include #include @@ -37,7 +40,6 @@ SECTIONS #endif _etext = . ; } - EXCEPTION_TABLE(16) RO_DATA(4) ROMEND = .; #if defined(CONFIG_ROMKERNEL) From patchwork Fri Oct 11 00:06:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174904 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 46q8d950XJz9s7T for ; Fri, 11 Oct 2019 11:55:25 +1100 (AEDT) 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="WAsHYQaw"; 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 46q8d92KL1zDqW9 for ; Fri, 11 Oct 2019 11:55:25 +1100 (AEDT) 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::441; helo=mail-pf1-x441.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="WAsHYQaw"; dkim-atps=neutral Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) (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 46q7hD4wzkzDqRy for ; Fri, 11 Oct 2019 11:13:00 +1100 (AEDT) Received: by mail-pf1-x441.google.com with SMTP id y5so4959445pfo.4 for ; Thu, 10 Oct 2019 17:13:00 -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=BONbSwO3yUZE8RnSGxOUsa1O5SfUej1bEo+UUtcRz+8=; b=WAsHYQawMi4SZmZgp8/tZRHbrTyjaN/efP/1ePAdIKhuzenhHAkQSemi72oSFyzy5T BUP8VJmLQCYcSjbNgTQmhLF0rh39giv7Aj/ab5NbcDAnNRa5xqPwvle+ummM9Ru1MTnT 6FSY7l03L75U7xLgPLADUTO/JJnoTeuiDWO4o= 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=BONbSwO3yUZE8RnSGxOUsa1O5SfUej1bEo+UUtcRz+8=; b=YE7RlxqUx4bETEqPyCWgk78fSoXVPL4BzHohD5uGTYrBsSkIaaoNTOjtc0fPKHppCy 6012BVje3BXX/Rwcf7tIYwFlrwtsK449zlr2SuPBcP0zhrbDN5lR0FXiSmuZjAtN01/7 aCM9LFj2S2VZRK1LS5jZV7eulQTS+NabNqWlo2VJn5cFjLnMzvyCIpnWKm952VYiFvpA tLyE4MncA7KL/gKIjAwq3Zs4y+IyYIzLHe2GG+KM2zccnrNj5H63Rsh2+PRqS+CmllO7 C647GnVZXpld9C0CGLLSryvzpic1fVWHctzS1oyZGE9ohNhpWUMJubxffJHBz878ALcF VZdw== X-Gm-Message-State: APjAAAV3RIA93gQc13t8lUVTtkNIbRZgASN8NdvYbEBg284rFX+pIpGS wdaK29+8xPqvtOfKrl21T5jSTg== X-Google-Smtp-Source: APXvYqxI99kv+xtRG2LlmRclYNJDw1iNLuQgHN4M3GLkprM+ZRb8jXZUnF9huFcBlH1wmB6a5xQwdw== X-Received: by 2002:a62:5284:: with SMTP id g126mr13294604pfb.95.1570752778224; Thu, 10 Oct 2019 17:12:58 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d5sm5379454pjw.31.2019.10.10.17.12.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:12:56 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 21/29] ia64: Move EXCEPTION_TABLE to RO_DATA segment Date: Thu, 10 Oct 2019 17:06:01 -0700 Message-Id: <20191011000609.29728-22-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Since the EXCEPTION_TABLE is read-only, collapse it into RO_DATA. Signed-off-by: Kees Cook --- arch/ia64/kernel/vmlinux.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S index 11d5115bc44d..1ec6b703c5b4 100644 --- a/arch/ia64/kernel/vmlinux.lds.S +++ b/arch/ia64/kernel/vmlinux.lds.S @@ -6,6 +6,7 @@ #include #define EMITS_PT_NOTE +#define RO_EXCEPTION_TABLE_ALIGN 16 #include @@ -70,7 +71,6 @@ SECTIONS { /* * Read-only data */ - EXCEPTION_TABLE(16) /* MCA table */ . = ALIGN(16); From patchwork Fri Oct 11 00:06:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174903 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 46q8b364mbz9s7T for ; Fri, 11 Oct 2019 11:53:35 +1100 (AEDT) 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="VJjnLJGI"; 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 46q8b34zKczDqVF for ; Fri, 11 Oct 2019 11:53:35 +1100 (AEDT) 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::643; helo=mail-pl1-x643.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="VJjnLJGI"; dkim-atps=neutral Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) (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 46q7hB21vKzDqMT for ; Fri, 11 Oct 2019 11:12:58 +1100 (AEDT) Received: by mail-pl1-x643.google.com with SMTP id s17so3589548plp.6 for ; Thu, 10 Oct 2019 17:12:58 -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=bvYKnL/TaFkIaenIAvKRMlAb1gjfrMgYQ33pk+cyLNw=; b=VJjnLJGIO0uGgKBCPhgyxZ/iGefUMJczEPz55L/NXxQm4X5HtH7Z6IwSEISlxXbPIi 0AKWMzRKkEkFoTXpqSQ6so/StMfOF2yJFPqmtCJOuv0Jt6L5qcDOFqlnVgUtBy87cn2m oVq9vePrz89q5V3+gDCK4GhXWqgAgeYpXsYQQ= 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=bvYKnL/TaFkIaenIAvKRMlAb1gjfrMgYQ33pk+cyLNw=; b=iY+2Rz42cUDg+Ld4RDlmnm1kJBGjG7fd87MXLtkKSD2D09GJF572+2XyiuGERp9vXA IU0xi1avRDpNA06ctaIiCpC/Hve1X3tacFKxkXQ+ERTReRcVPkmQwbskviKWIJaGfpzL 8wKLuGCT8euSPlHiyZd+HpP3C8AKbAUJmQ4Z8VmDl9Z1hGVn3/ZGXqQgaqTF5uQsL4kN TfAOUJnIaBD6khKyLT6q2FAnEiVjKsL4IrySx9fJoP0gUyezU5LD/E6/XeMDpI4GT/X/ 4eGCZB+gRPKKd9XssK3QGxFfMee+4IPkd6nWZpm39JRfEYQhdelio4HlpWEdag+rk8kn lKyA== X-Gm-Message-State: APjAAAUu2kCRdZ3u/pAL1KSXLEGocokM+omytzbG2t8mH5uTs5+UJwPn n8O/0cp8S8SD07Hq8Fo41VVAZg== X-Google-Smtp-Source: APXvYqz1nJHbdicuisYaMkUGL4dW9cHVrS4hPr3bZVo4nTa2ffJhe6O1BBJ7QgwtCPb4vvcDzPVB3A== X-Received: by 2002:a17:902:b410:: with SMTP id x16mr12316640plr.46.1570752775741; Thu, 10 Oct 2019 17:12:55 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id j128sm7319082pfg.51.2019.10.10.17.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:12:52 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 22/29] microblaze: Move EXCEPTION_TABLE to RO_DATA segment Date: Thu, 10 Oct 2019 17:06:02 -0700 Message-Id: <20191011000609.29728-23-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Since the EXCEPTION_TABLE is read-only, collapse it into RO_DATA. Signed-off-by: Kees Cook --- arch/microblaze/kernel/vmlinux.lds.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S index b8efb08204a1..760cac41cbfe 100644 --- a/arch/microblaze/kernel/vmlinux.lds.S +++ b/arch/microblaze/kernel/vmlinux.lds.S @@ -11,6 +11,8 @@ OUTPUT_ARCH(microblaze) ENTRY(microblaze_start) +#define RO_EXCEPTION_TABLE_ALIGN 16 + #include #include #include @@ -52,7 +54,6 @@ SECTIONS { . = ALIGN(16); RO_DATA(4096) - EXCEPTION_TABLE(16) /* * sdata2 section can go anywhere, but must be word aligned From patchwork Fri Oct 11 00:06:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174900 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 46q8Vd43Z0z9s7T for ; Fri, 11 Oct 2019 11:49:45 +1100 (AEDT) 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="H+PGC98b"; 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 46q8Vd3GCWzDqVK for ; Fri, 11 Oct 2019 11:49:45 +1100 (AEDT) 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::442; helo=mail-pf1-x442.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="H+PGC98b"; dkim-atps=neutral Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (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 46q7h86G2yzDqMT for ; Fri, 11 Oct 2019 11:12:56 +1100 (AEDT) Received: by mail-pf1-x442.google.com with SMTP id q12so4944070pff.9 for ; Thu, 10 Oct 2019 17:12:56 -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=MdMMErkL0TaCB+AMS9GPl9j3KdOjHrVPYKwcXQnru9o=; b=H+PGC98bol8nQLCHGKVMnumPCpE3rZsdeAzu/63Zl+MVbbl4Sn0Xj0/MJ8+SrojoRq PDLZ+DEdfwhU0nbRPNgAZmDKGI8JIpf0k65nc/pgyy9bqCoX2oIyxBmx8SkXP421+0dD CN9qS2yDtmYN+7Q+QtAoazHu9DvsNkSQPOn/k= 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=MdMMErkL0TaCB+AMS9GPl9j3KdOjHrVPYKwcXQnru9o=; b=YTHFcrBWgDnpqvBv+1tsp/Wy5KKSxLHptimPHwiqyFSL+9DNzSe8QobPmSdB1hzJBV U62giEDuMpccm9DSei6nhAEeQU9FCrbEc7PRwWEB3oNUx3NoJmwsQexdDgqdxzs9yiOr S8I78WRJmEt2GBAZ0hA6czv2BqGOj0/bnKo0CGRziB9uytVjBdOl3zW4JapioIof8wkz Xcp7IF13BMDPQCv8Uk8AXvfQocbvD8sPryBOXd1A3fp24Gw6PPAU2kJM8teDXp+LKo2M T6lywpBgPk0lULfsBpPrGy/jh7TOQP0zeko0ZJMTZ5wQ7HyaXyr1y/4S/mCvzBQfR7e6 UTFg== X-Gm-Message-State: APjAAAWGweNSQKeiEcD4WZ1ir0fjrZN1x8Cn6D2OC4GYaNRm6nXr6WtE VkdYDBu7XyYcBzVKYcLVtr9QNA== X-Google-Smtp-Source: APXvYqxGtnvXMUJ3pY0jopkR+VKX/LuW1ntTFWY/1XeIzuIP03PlTUnb++z5MjVk9/9/m40WTFaCbw== X-Received: by 2002:a63:1201:: with SMTP id h1mr14569419pgl.340.1570752774490; Thu, 10 Oct 2019 17:12:54 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id l22sm6398506pgj.4.2019.10.10.17.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:12:52 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 23/29] parisc: Move EXCEPTION_TABLE to RO_DATA segment Date: Thu, 10 Oct 2019 17:06:03 -0700 Message-Id: <20191011000609.29728-24-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Since the EXCEPTION_TABLE is read-only, collapse it into RO_DATA. Signed-off-by: Kees Cook Acked-by: Helge Deller # parisc --- arch/parisc/kernel/vmlinux.lds.S | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S index 12b3d7d5e9e4..53e29d88f99c 100644 --- a/arch/parisc/kernel/vmlinux.lds.S +++ b/arch/parisc/kernel/vmlinux.lds.S @@ -19,6 +19,7 @@ *(.data..vm0.pte) #define CC_USING_PATCHABLE_FUNCTION_ENTRY +#define RO_EXCEPTION_TABLE_ALIGN 8 #include @@ -129,9 +130,6 @@ SECTIONS RO_DATA(8) - /* RO because of BUILDTIME_EXTABLE_SORT */ - EXCEPTION_TABLE(8) - /* unwind info */ .PARISC.unwind : { __start___unwind = .; From patchwork Fri Oct 11 00:06:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174909 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 46q8rX663Yz9sN1 for ; Fri, 11 Oct 2019 12:05:16 +1100 (AEDT) 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="Vo/YkX68"; 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 46q8rX5Fq1zDqX2 for ; Fri, 11 Oct 2019 12:05:16 +1100 (AEDT) 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::442; helo=mail-pf1-x442.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="Vo/YkX68"; dkim-atps=neutral Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (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 46q7hJ3xH3zDqCR for ; Fri, 11 Oct 2019 11:13:04 +1100 (AEDT) Received: by mail-pf1-x442.google.com with SMTP id y5so4959539pfo.4 for ; Thu, 10 Oct 2019 17:13:04 -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=OvLPSIr20MO1GrkJ0OvwvGngd4/e51+GSaoElj9X+Gc=; b=Vo/YkX68H3JSVeYxOg0wgKZHM0DDpLq1uGIDRlC9At7IoYDSFTbfrL3kzgv//JSf1l wfMMq2ZZ1sw3ulG7OB/Al6Lb7yhUEHFwVbMy0hx6CDWOUEDVNEPAVOGo2TBJff56wZsX 1wJpR43jEKVUBiVd5MS1y8q4VLWL+t/un7fCg= 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=OvLPSIr20MO1GrkJ0OvwvGngd4/e51+GSaoElj9X+Gc=; b=Q8K+5fSiCANeESKy8XxjTv1OFthdIq+2sJbYXvrohn/nv913h4RRtyxzkIcAeRZzAH FzbykKQD4QAutaARG4RHwLvjY18sz+mc0mom1EcH4u+0/7R2pYGGNsq3pXxDgv+L/g7w Lt5412yrre5Gd+qEUUtauElGYAO0+soHH7QoM611pv6OWLjvANXCONWiob9E015aMVbS SljP03ed7nPkfZqmzq2GnD4KJQYkev5YN7c2iwkJ0qWHEgoy+eGGSPTG8UpTFSGUZCWB F7KPL2h1XfVBqQrSOuM//Av6r3jA6qqtknoCOefFKlAnHGoPiGwXmweWzPL5Cdfn4XcQ GuJA== X-Gm-Message-State: APjAAAVHd8ykov9eQAKIpE7O48K1cIOcTx92eVCzAaUqOXwYh7/aqrxa 2ThnIvJOPIrxDbuqCwprkTDWIQ== X-Google-Smtp-Source: APXvYqwcXL9IUcA1NwWjkBG6ihgZ1mTQNQKZY+myfeizvcbcy9RQ9+vXBtLYoNyG3c9FkCNmz89Vqw== X-Received: by 2002:a63:4383:: with SMTP id q125mr13830250pga.373.1570752781928; Thu, 10 Oct 2019 17:13:01 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id v68sm8097683pfv.47.2019.10.10.17.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:12:56 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 24/29] powerpc: Move EXCEPTION_TABLE to RO_DATA segment Date: Thu, 10 Oct 2019 17:06:04 -0700 Message-Id: <20191011000609.29728-25-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Since the EXCEPTION_TABLE is read-only, collapse it into RO_DATA. Signed-off-by: Kees Cook --- arch/powerpc/kernel/vmlinux.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 4e7cec088c8b..8834220036a5 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -7,6 +7,7 @@ #define BSS_FIRST_SECTIONS *(.bss.prominit) #define EMITS_PT_NOTE +#define RO_EXCEPTION_TABLE_ALIGN 0 #include #include @@ -162,7 +163,6 @@ SECTIONS __stop__btb_flush_fixup = .; } #endif - EXCEPTION_TABLE(0) /* * Init sections discarded at runtime From patchwork Fri Oct 11 00:06:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174899 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 46q8SQ4LSJz9sN1 for ; Fri, 11 Oct 2019 11:47:50 +1100 (AEDT) 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="QKMy1WMI"; 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 46q8SP4lvBzDqT5 for ; Fri, 11 Oct 2019 11:47:49 +1100 (AEDT) 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::442; helo=mail-pf1-x442.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="QKMy1WMI"; dkim-atps=neutral Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (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 46q7h83qVBzDqMM for ; Fri, 11 Oct 2019 11:12:56 +1100 (AEDT) Received: by mail-pf1-x442.google.com with SMTP id b128so4969859pfa.1 for ; Thu, 10 Oct 2019 17:12:55 -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=aXC4EKkSKWAzbgJ5UkNW5ASNd77O0uNGfoVDwB8PV7o=; b=QKMy1WMIao8eo2h9Q1TmJ+NvwxmYIJS5BiRFvnKXyWnyHt2NVU1sSJRyaYkSK0bnTI 3g26hGi2M+7oPqpQxxO8mfA0+ckl3W/NOZq89OJYBy8zqpl256YQ/kRKmZl3wcK/Al8o WR97u6SnuI6udJBDDM4eXoslNY2BMQS6h8HHA= 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=aXC4EKkSKWAzbgJ5UkNW5ASNd77O0uNGfoVDwB8PV7o=; b=L9BKaVLs9zsGBLwBlXOs3FftjcfNnkM/5lVNpthSLPUkGcrpbXSHZK5OATybxL9LHH TkTqQfeKp+B6llRWkQ/P20oOk+5Z2pDLqEwn47yZjs8qdBkjM041jHszV9p6eO1VZJxN ZTjuoP+9wGrJJR9xbpyyWE9fk2/aly5C+/bBCdI3/aJYXrp0shQV27gSjnj9fGqJdVyf Z6ad9CZJy76yeQfkhu+DiNgoeIBa95Ta6h7SUux7N/p4uD1GiIF7YVsMULaAv9lHg4Pq OUowtxd/9srHEUMODL9nMrue0LjyaCYN31R6PPWiBvnFDTbBuwllnAyzUrMlndLjhwvq yiYQ== X-Gm-Message-State: APjAAAWmMqtAODiy8sAmAYVh7y9S+/V4vjFO1kSo1CzhMw/qq1F/T/1w 7SJJK0Ed1TWLaGABpxNVdLkZaw== X-Google-Smtp-Source: APXvYqwyN8mvkbsH6LAVRfjY92v44FJMaCqPYldcWqY2MvbBlNQ7Douul4dniL7y8RNurjH2A60mLg== X-Received: by 2002:a17:90a:1617:: with SMTP id n23mr14581628pja.75.1570752773811; Thu, 10 Oct 2019 17:12:53 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id w10sm5837436pjq.3.2019.10.10.17.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:12:52 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 25/29] xtensa: Move EXCEPTION_TABLE to RO_DATA segment Date: Thu, 10 Oct 2019 17:06:05 -0700 Message-Id: <20191011000609.29728-26-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Since the EXCEPTION_TABLE is read-only, collapse it into RO_DATA. Signed-off-by: Kees Cook Acked-by: Max Filippov --- arch/xtensa/kernel/vmlinux.lds.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S index bdbd7c4056c1..0043d5858f14 100644 --- a/arch/xtensa/kernel/vmlinux.lds.S +++ b/arch/xtensa/kernel/vmlinux.lds.S @@ -14,6 +14,8 @@ * Joe Taylor */ +#define RO_EXCEPTION_TABLE_ALIGN 16 + #include #include #include @@ -130,7 +132,6 @@ SECTIONS .fixup : { *(.fixup) } - EXCEPTION_TABLE(16) /* Data section */ _sdata = .; From patchwork Fri Oct 11 00:06:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174910 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 46q8tf0YYnz9sN1 for ; Fri, 11 Oct 2019 12:07:06 +1100 (AEDT) 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="fp0EZsT2"; 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 46q8td6gtBzDqSy for ; Fri, 11 Oct 2019 12:07:05 +1100 (AEDT) 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::444; helo=mail-pf1-x444.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="fp0EZsT2"; dkim-atps=neutral Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) (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 46q7hJ5RYMzDqJQ for ; Fri, 11 Oct 2019 11:13:04 +1100 (AEDT) Received: by mail-pf1-x444.google.com with SMTP id y22so4955556pfr.3 for ; Thu, 10 Oct 2019 17:13:04 -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=8/x+eaVk+ss1aFRFRC2BuuTBFLP58LLEcIBPNJoL2cs=; b=fp0EZsT2tyBJy4pMM0BrQdWNH3jIqPiiR0OFuPR3KKp9NlEmrHQgmL/ZBNM1hxDEVj gMnsWemWjREXcL9c9lek/rM89s9e/l7HiEkBH/KqKwR6byArefKYaaiKWxjJgqllWaPD 6nPt+boxm7/SK9xvW9TYHnHh28YvJaU9w+77g= 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=8/x+eaVk+ss1aFRFRC2BuuTBFLP58LLEcIBPNJoL2cs=; b=YBzPPYNe9PD/PaurMkgPHVnPXHv60jICkomEsFX5pk1/YrMCYvI8TndtT25kc9VXXf riRJieN6O4F07karJVZp3GBdmMVGCzmeQjKANE6ouZsFZfOCkCY1GBxarmtJFdDgZnYi ghq2DT5Mb7RdrkJoAB8kFSe6fkKSdURfsZyj/tGByi6CbJ6iXoDXaqI3ZTLYbqdkcIKt STti10q+tJlmkw44QIwBGdA1w6vHeTCcKt5JRFdg8J6wRJBR0Q2Vlxg5gfrVj3XcVrbg hw3+lJat4xw1YTBtJ7hqsaO8ioOAr9n9QapK6u1OTUSUKXzInwIRAzNTGbl7i0R4DAZb gudQ== X-Gm-Message-State: APjAAAWG75YEoalIQ7tSV8Azlrmuf/kheE/3u/KH/JdrzlruhRzxwjn9 kSFxMM9/3TMsywcR2mcmpNTERg== X-Google-Smtp-Source: APXvYqzYV7Ta2O1ssdo06WBxZ2tymf8EVzlYCRiZUZ2NeL/vJyas9bBJT97ICY4x4F39C1qUjsxcog== X-Received: by 2002:a63:2350:: with SMTP id u16mr1550233pgm.103.1570752782606; Thu, 10 Oct 2019 17:13:02 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id q36sm7238812pgb.34.2019.10.10.17.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:12:56 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 26/29] x86/mm: Remove redundant &s on addresses Date: Thu, 10 Oct 2019 17:06:06 -0700 Message-Id: <20191011000609.29728-27-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The &s on addresses are redundant. Remove them to match all the other similar functions. Signed-off-by: Kees Cook --- arch/x86/mm/init_64.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 26299e9ce6da..e67ddca8b7a8 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -1300,9 +1300,9 @@ void mark_rodata_ro(void) { unsigned long start = PFN_ALIGN(_text); unsigned long rodata_start = PFN_ALIGN(__start_rodata); - unsigned long end = (unsigned long) &__end_rodata_hpage_align; - unsigned long text_end = PFN_ALIGN(&_etext); - unsigned long rodata_end = PFN_ALIGN(&__end_rodata); + unsigned long end = (unsigned long)__end_rodata_hpage_align; + unsigned long text_end = PFN_ALIGN(_etext); + unsigned long rodata_end = PFN_ALIGN(__end_rodata); unsigned long all_end; printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", From patchwork Fri Oct 11 00:06:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174908 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 46q8pP1RdSz9sN1 for ; Fri, 11 Oct 2019 12:03:25 +1100 (AEDT) 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="Lj7QNKSF"; 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 46q8pN0mSHzDqXC for ; Fri, 11 Oct 2019 12:03:24 +1100 (AEDT) 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::543; helo=mail-pg1-x543.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="Lj7QNKSF"; dkim-atps=neutral Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (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 46q7hJ15n8zDqLt for ; Fri, 11 Oct 2019 11:13:04 +1100 (AEDT) Received: by mail-pg1-x543.google.com with SMTP id e1so4703242pgj.6 for ; Thu, 10 Oct 2019 17:13:04 -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=CyoXOdP2RSQBzcYa2ar7sJXCOKRhNFJ5bhxtCWldzm0=; b=Lj7QNKSFAWUpBfpzOt7+g6iG1nZwQWiy2Yx2COX4rHzLDwe7zAeBtuvEmbHCBjMdVS f7OItuAMoBx4ANIxisnsIuIzLX/n/2wSchdTwd5gBy79nJpGqvgOWz8QIjj/yjSDeyUu Nk/yU3k7rraRoC3ReBbUSn8UR29/tNR/sk7J8= 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=CyoXOdP2RSQBzcYa2ar7sJXCOKRhNFJ5bhxtCWldzm0=; b=j5T82DAPxKyheS+FENrusQ/fJUGnj0oO8KrYbLrYDRR+7H/ZvsGQuDYQy0H9jWy7zx aRfeT5kmWfnrJ4fWfnD+TM1RMqmTBQROMLKaimpPA5Uc60mZ3OC6ujGg5eLXMeEwWxvy 02slJ86vwJv0SdBG0Rek2VO3gTjikgYcCUSyWepvoIy3OMPtXzbXQ3m4nHS/PWB2ND8v zio4aew8GrE7k2AORd5FRPEoeqp73iadBMtLGKRqaP8RvN5/2IsNF2QHB27RoK1t1hny k/AVz3ta8l1mnKP4EnVdGDqAw3A5g4gdg+Na67kuS72hc44Cw920FBozigPBSXxXS+Sp ELDQ== X-Gm-Message-State: APjAAAVkXSEkRpxN/vHPb59OmzYjJJ5qfLGd0D8Vz7Z/0pmmCiime7bA itlmp6jzMwLreR/7IVdyqNkayg== X-Google-Smtp-Source: APXvYqzvlppGYfKVE9ugq/bM5vvDAuSQD7dhWwgiw+2wssyvKHG8+r3B0+BR11AxbHRgVxFlF3OFFg== X-Received: by 2002:aa7:9907:: with SMTP id z7mr13951279pff.192.1570752781298; Thu, 10 Oct 2019 17:13:01 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id t12sm5458788pjq.18.2019.10.10.17.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:12:56 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 27/29] x86/mm: Report which part of kernel image is freed Date: Thu, 10 Oct 2019 17:06:07 -0700 Message-Id: <20191011000609.29728-28-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The memory freeing report wasn't very useful for figuring out which parts of the kernel image were being freed. Add the details for clearer reporting in dmesg. Before: [ 2.150450] Freeing unused kernel image memory: 1348K [ 2.154574] Write protecting the kernel read-only data: 20480k [ 2.157641] Freeing unused kernel image memory: 2040K [ 2.158827] Freeing unused kernel image memory: 172K After: [ 2.329678] Freeing unused kernel image (initmem) memory: 1348K [ 2.331953] Write protecting the kernel read-only data: 20480k [ 2.335361] Freeing unused kernel image (text/rodata gap) memory: 2040K [ 2.336927] Freeing unused kernel image (rodata/data gap) memory: 172K Signed-off-by: Kees Cook --- arch/x86/include/asm/processor.h | 2 +- arch/x86/mm/init.c | 8 ++++---- arch/x86/mm/init_64.c | 6 ++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 6e0a3b43d027..790f250d39a8 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -958,7 +958,7 @@ static inline uint32_t hypervisor_cpuid_base(const char *sig, uint32_t leaves) extern unsigned long arch_align_stack(unsigned long sp); void free_init_pages(const char *what, unsigned long begin, unsigned long end); -extern void free_kernel_image_pages(void *begin, void *end); +extern void free_kernel_image_pages(const char *what, void *begin, void *end); void default_idle(void); #ifdef CONFIG_XEN diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index fd10d91a6115..e7bb483557c9 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -829,14 +829,13 @@ void free_init_pages(const char *what, unsigned long begin, unsigned long end) * used for the kernel image only. free_init_pages() will do the * right thing for either kind of address. */ -void free_kernel_image_pages(void *begin, void *end) +void free_kernel_image_pages(const char *what, void *begin, void *end) { unsigned long begin_ul = (unsigned long)begin; unsigned long end_ul = (unsigned long)end; unsigned long len_pages = (end_ul - begin_ul) >> PAGE_SHIFT; - - free_init_pages("unused kernel image", begin_ul, end_ul); + free_init_pages(what, begin_ul, end_ul); /* * PTI maps some of the kernel into userspace. For performance, @@ -865,7 +864,8 @@ void __ref free_initmem(void) mem_encrypt_free_decrypted_mem(); - free_kernel_image_pages(&__init_begin, &__init_end); + free_kernel_image_pages("unused kernel image (initmem)", + &__init_begin, &__init_end); } #ifdef CONFIG_BLK_DEV_INITRD diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index e67ddca8b7a8..dcb9bc961b39 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -1334,8 +1334,10 @@ void mark_rodata_ro(void) set_memory_ro(start, (end-start) >> PAGE_SHIFT); #endif - free_kernel_image_pages((void *)text_end, (void *)rodata_start); - free_kernel_image_pages((void *)rodata_end, (void *)_sdata); + free_kernel_image_pages("unused kernel image (text/rodata gap)", + (void *)text_end, (void *)rodata_start); + free_kernel_image_pages("unused kernel image (rodata/data gap)", + (void *)rodata_end, (void *)_sdata); debug_checkwx(); } From patchwork Fri Oct 11 00:06:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174897 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 46q8MM4mcDz9s7T for ; Fri, 11 Oct 2019 11:43:27 +1100 (AEDT) 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="V5SSXiOU"; 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 46q8MM3yBzzDqSW for ; Fri, 11 Oct 2019 11:43:27 +1100 (AEDT) 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::443; helo=mail-pf1-x443.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="V5SSXiOU"; dkim-atps=neutral Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) (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 46q7Xw17XWzDqRx for ; Fri, 11 Oct 2019 11:06:39 +1100 (AEDT) Received: by mail-pf1-x443.google.com with SMTP id q7so4935295pfh.8 for ; Thu, 10 Oct 2019 17:06:39 -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=ZBHIZP91az7zFwublbVFIxiUPIvhqcpifj2fGv96nM4=; b=V5SSXiOU/2LqW+YWMWv2g8oE+O+8OqaVciMsltfBT6XAT+UmV5TNibrJhEtO410tXb /OnY7p2PJHhLZDVx/eoiV5CS19ovJ8wYT+GUzFT433OArvUWowNhqhNxhPEcl3xsRkLc lb2h6DldDdTdhb4T8VOEQWN9DqKeDub1PenXs= 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=ZBHIZP91az7zFwublbVFIxiUPIvhqcpifj2fGv96nM4=; b=Od5DKUTaerqgQnfQaDhrxm/Qp/IqgR2yfnlFmaSNvBOKvAZk1TeGqgED0UihLRjRGW N1+9uzWW4VfzuQao1ilFX3kOlggbkG+8jha/m9AfvEEVN869IVbzmGzwOuoX7e/IR6tG zfQLnIHuK9XtbtkpVxj1yoY0YCzPm9AtJN8s6mMyn4GAbBD9AduR+MxVxs7XLPT1uAqY 9FOaQW03PypogqeQjTpMQQ6xQ9ZykyJ4ERyL53DdoDSyHA+o21SZMDOx5fPhLK5gfNGD bNPoV9sTCNYH+kpLbFcC7xReYOo6Odju7Y1QPtxNMoq2DsALQFGKdoeQQJ7Hefrv1+XF bLrQ== X-Gm-Message-State: APjAAAVeaDTRC5zgumimcgQ/EKPJrSaionAAiftFqWrt/2aRaSAxIX71 4+PpftP+rJyRwK+YVd5v3JOkVw== X-Google-Smtp-Source: APXvYqxIURRErEoWhZaXwUViGgbdz47KTCDz+s6x66JTdawkgAKVzwgCcLp2sAcohHOnlA3CSEfhcA== X-Received: by 2002:aa7:9157:: with SMTP id 23mr13458255pfi.73.1570752397032; Thu, 10 Oct 2019 17:06:37 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id n15sm5864975pjt.13.2019.10.10.17.06.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:06:35 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 28/29] x86/mm: Report actual image regions in /proc/iomem Date: Thu, 10 Oct 2019 17:06:08 -0700 Message-Id: <20191011000609.29728-29-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The resource reservations in /proc/iomem made for the kernel image did not reflect the gaps between text, rodata, and data. Add the "rodata" resource and update the start/end calculations to match the respective calls to free_kernel_image_pages(). Before (booted with "nokaslr" for easier comparison): 00100000-bffd9fff : System RAM 01000000-01e011d0 : Kernel code 01e011d1-025619bf : Kernel data 02a95000-035fffff : Kernel bss After: 00100000-bffd9fff : System RAM 01000000-01e011d0 : Kernel code 02000000-023d4fff : Kernel rodata 02400000-025619ff : Kernel data 02a95000-035fffff : Kernel bss Signed-off-by: Kees Cook --- arch/x86/kernel/setup.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 77ea96b794bd..591e885a852e 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -143,6 +143,13 @@ struct boot_params boot_params; /* * Machine setup.. */ +static struct resource rodata_resource = { + .name = "Kernel rodata", + .start = 0, + .end = 0, + .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM +}; + static struct resource data_resource = { .name = "Kernel data", .start = 0, @@ -951,7 +958,9 @@ void __init setup_arch(char **cmdline_p) code_resource.start = __pa_symbol(_text); code_resource.end = __pa_symbol(_etext)-1; - data_resource.start = __pa_symbol(_etext); + rodata_resource.start = __pa_symbol(__start_rodata); + rodata_resource.end = __pa_symbol(__end_rodata)-1; + data_resource.start = __pa_symbol(_sdata); data_resource.end = __pa_symbol(_edata)-1; bss_resource.start = __pa_symbol(__bss_start); bss_resource.end = __pa_symbol(__bss_stop)-1; @@ -1040,6 +1049,7 @@ void __init setup_arch(char **cmdline_p) /* after parse_early_param, so could debug it */ insert_resource(&iomem_resource, &code_resource); + insert_resource(&iomem_resource, &rodata_resource); insert_resource(&iomem_resource, &data_resource); insert_resource(&iomem_resource, &bss_resource); From patchwork Fri Oct 11 00:06:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 1174907 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 46q8lZ3Gbwz9s7T for ; Fri, 11 Oct 2019 12:00:58 +1100 (AEDT) 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="TKF/H7IX"; 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 46q8lX2QW5zDqWp for ; Fri, 11 Oct 2019 12:00:56 +1100 (AEDT) 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::444; helo=mail-pf1-x444.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="TKF/H7IX"; dkim-atps=neutral Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) (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 46q7hH3wcjzDqJQ for ; Fri, 11 Oct 2019 11:13:03 +1100 (AEDT) Received: by mail-pf1-x444.google.com with SMTP id y72so4932142pfb.12 for ; Thu, 10 Oct 2019 17:13:03 -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=Wn91QvvOWXGcdAukdBFPOsAS+V9wjbJFfxE/dszqFsM=; b=TKF/H7IXE7UJDzb3rMUleub9owN4KR+Kc5MridCe/6j0nlzZqoEI/zttKy0QHihDrJ 2ZeHmtUNHexo6bQLRtT0gDvTipRD0K5TGW8Q7FVWpvhcmLBUGnPT1TySO+nYDUITKTZu 3WNoDW0bVMFt0uCMT6eBCSnH00RkY54ViUTLk= 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=Wn91QvvOWXGcdAukdBFPOsAS+V9wjbJFfxE/dszqFsM=; b=JUD2ujzhcIOJYMrUgJ6DhxDXcSMoDmd/nu5BSD8/TAsBCx62FY+IqXZ3gHodpyCHG1 r6DKP7B23JrM3FnZQqHJKyfEzjA46LBLcZMXsjD9G3l5vKu3WWdXRvZ+r7N21PAum1ID 5xLolN0/LtXHv02IOL2g3eBILaQJS7x2wj84xf4sjoUZNmfBTcFOx9WH5LkkzsCYUW/W ziLX7cbczMNuLFe3JlXsl1i95W6WiCTORrkK+uvcXM6ZNF/saKYaLVvoj6O9gedGxi0x P8H0rJ0tnkHoUmmnH9+72iOe4fnbEW4bDxove9Up+w7dKK97C5mpgr50s6KQRrDCVoI+ nBdw== X-Gm-Message-State: APjAAAX4nDdg5DuNUyT45RvnHZYRgulhrjN34sZQVkFmDl/mEkl0RBhj x0rUOPnSQAOXX/ZRvS04IAOWpw== X-Google-Smtp-Source: APXvYqwhzx8QmNWMryCruzS69inQpCD817u3s0gzfMeJwk1Bb2iOQgca7Hto534MUkNuyGvUJAkyfA== X-Received: by 2002:a17:90a:ff0f:: with SMTP id ce15mr14913883pjb.14.1570752780484; Thu, 10 Oct 2019 17:13:00 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id y144sm7993803pfb.188.2019.10.10.17.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 17:12:56 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v2 29/29] x86: Use INT3 instead of NOP for linker fill bytes Date: Thu, 10 Oct 2019 17:06:09 -0700 Message-Id: <20191011000609.29728-30-keescook@chromium.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011000609.29728-1-keescook@chromium.org> References: <20191011000609.29728-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 , x86@kernel.org, linux-ia64@vger.kernel.org, Kees Cook , Arnd Bergmann , linux-xtensa@linux-xtensa.org, Dave Hansen , Heiko Carstens , linuxppc-dev@lists.ozlabs.org, Yoshinori Sato , linux-parisc@vger.kernel.org, Andy Lutomirski , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, Rick Edgecombe , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Instead of using 0x90 (NOP) to fill bytes between functions, which makes it easier to sloppily target functions in function pointer overwrite attacks, fill with 0xCC (INT3) to force a trap. Also drop the space between "=" and the value to better match the binutils documentation https://sourceware.org/binutils/docs/ld/Output-Section-Fill.html#Output-Section-Fill Example "objdump -d" before: ... ffffffff810001e0 : ffffffff810001e0: 48 8b 25 e1 b1 51 01 mov 0x151b1e1(%rip),%rsp # ffffffff8251b3c8 ffffffff810001e7: e9 d5 fe ff ff jmpq ffffffff810000c1 ffffffff810001ec: 90 nop ffffffff810001ed: 90 nop ffffffff810001ee: 90 nop ffffffff810001ef: 90 nop ffffffff810001f0 <__startup_64>: ... After: ... ffffffff810001e0 : ffffffff810001e0: 48 8b 25 41 79 53 01 mov 0x1537941(%rip),%rsp # ffffffff82537b28 ffffffff810001e7: e9 d5 fe ff ff jmpq ffffffff810000c1 ffffffff810001ec: cc int3 ffffffff810001ed: cc int3 ffffffff810001ee: cc int3 ffffffff810001ef: cc int3 ffffffff810001f0 <__startup_64>: ... Signed-off-by: Kees Cook --- arch/x86/kernel/vmlinux.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index b06d6e1188de..3a1a819da137 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -144,7 +144,7 @@ SECTIONS *(.text.__x86.indirect_thunk) __indirect_thunk_end = .; #endif - } :text = 0x9090 + } :text =0xcccc /* End of text section, which should occupy whole number of pages */ _etext = .;