From patchwork Fri Mar 27 06:48:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11461759 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8607C13A4 for ; Fri, 27 Mar 2020 06:48:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 63F2220714 for ; Fri, 27 Mar 2020 06:48:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sway2hZi"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="QNhpPzdq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 63F2220714 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nrDLXRQ/e71NRVPdZJY46WYis6nRvLjEsTGB3J9T6P8=; b=sway2hZiZJPyfP MWwvRGSQR0yNbAzZ2Jcq/wrf0bShANiUO+qhAZDL4G1lnv96ImwOUlfVAQl6/zMB7GlUNfMn9PpRa WRAy22JiGFtKVxZ3SOdhTKPWnoCvST3u9hJqW1dh78N3TzRNtdYs8kEkfS9imuDXLO0tTuCX9ub8/ yA+3KWffqldv80kpmgy5IsxH7+w4HuXHbvoI9gX29+dVkBEgLIC/uCx/8fA3/rU1npvFFUW0P04ax HdE5e5h8N9v82S6UZTm8FaTBFRpjyPgJCGM0Hc/nBTi2lRGqGo3+xH/INLbrvXluwSEXFPMWl7k3f GNniTvKuN4/6LXaFP02A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jHin6-00013s-Nd; Fri, 27 Mar 2020 06:48:28 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jHin3-00012U-FL for linux-arm-kernel@lists.infradead.org; Fri, 27 Mar 2020 06:48:26 +0000 Received: by mail-pf1-x442.google.com with SMTP id j1so4069054pfe.0 for ; Thu, 26 Mar 2020 23:48: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 :mime-version:content-transfer-encoding; bh=RpYBuJfY08WhjaxaukJkaddMj0LXmdHxotG0jM4ptqg=; b=QNhpPzdqJpCei279jTF+h/ObhmvlR6FTP7G9SeLHFQQYYYl/hOo7K7A4ahYZW9rBTi CxTyqKu7s/VDnh0YhGgfs7LNY7Bn+lOco0Y3SE1ZH7MyzXiWqcevIJXEgNfXB9RcIubp WtzpdKV9R1aShxwRNBzHJ6OLnP2DSIhS0HLyA= 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:mime-version:content-transfer-encoding; bh=RpYBuJfY08WhjaxaukJkaddMj0LXmdHxotG0jM4ptqg=; b=cHcHKBd/bGYay+L7isD/QFaUmBTF//woYDwuSioInvjE/c5YlsN9mnhK9WC6p3jVUE ZVMbmcx3NG6YRfyILNFrR959Q5QF4+P3ZFxHajG9yLP9gDdT51xxvwh/QuogkaLJsr4M WlUZXn5C2IS089OuV/JmFBoSwMOlNNZXE+AS9MTiNVHbyFIXfG1LnT8gP7ZQFwxVaDWt gIV8vHz9CquVpfbGjLJhEp9EgFELm0Nzf0jh/yj5QPwQNkDN/13l2gxKRxN7Q3/wMRnc g1aH36pE9l7J7rwGGedcPRmiOXN1xX6ryatpqabcDht4kn9z78CA9V42a7JdbRSP1mWN oJhg== X-Gm-Message-State: ANhLgQ0jeQCw9Uvp2dFUNjizQjwJYiqv+YdlWBCkPkUWYeajtwDZYcTR fmxjQ3ej+09ehyJw2eaubJcr+A== X-Google-Smtp-Source: ADFU+vsCyDBR9n7viFoDu0Ekx+5WslhiT7XTciFmLxv2z4EAe6/t7zwz9Rj+ofshsa0IFDSE5S7sOw== X-Received: by 2002:a62:75d0:: with SMTP id q199mr13127618pfc.72.1585291704670; Thu, 26 Mar 2020 23:48:24 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id g14sm3227306pfb.131.2020.03.26.23.48.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Mar 2020 23:48:23 -0700 (PDT) From: Kees Cook To: Borislav Petkov Subject: [PATCH v5 3/6] x86/elf: Disable automatic READ_IMPLIES_EXEC for 64-bit address spaces Date: Thu, 26 Mar 2020 23:48:17 -0700 Message-Id: <20200327064820.12602-4-keescook@chromium.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200327064820.12602-1-keescook@chromium.org> References: <20200327064820.12602-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200326_234825_538402_16FB512F X-CRM114-Status: GOOD ( 11.02 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:442 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kees Cook , Jann Horn , Catalin Marinas , x86@kernel.org, Hector Marco-Gisbert , Russell King , linux-kernel@vger.kernel.org, Jason Gunthorpe , Jason Gunthorpe , kernel-hardening@lists.openwall.com, Will Deacon , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org With modern x86 64-bit environments, there should never be a need for automatic READ_IMPLIES_EXEC, as the architecture is intended to always be execute-bit aware (as in, the default memory protection should be NX unless a region explicitly requests to be executable). There were very old x86_64 systems that lacked the NX bit, but for those, the NX bit is, obviously, unenforceable, so these changes should have no impact on them. Suggested-by: Hector Marco-Gisbert Signed-off-by: Kees Cook Reviewed-by: Jason Gunthorpe --- arch/x86/include/asm/elf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h index 397a1c74433e..452beed7892b 100644 --- a/arch/x86/include/asm/elf.h +++ b/arch/x86/include/asm/elf.h @@ -287,7 +287,7 @@ extern u32 elf_hwcap2; *              CPU: | lacks NX*  | has NX, ia32     | has NX, x86_64 | * ELF:              |            |                  |                | * ---------------------|------------|------------------|----------------| - * missing PT_GNU_STACK | exec-all   | exec-all         | exec-all       | + * missing PT_GNU_STACK | exec-all   | exec-all         | exec-none      | * PT_GNU_STACK == RWX  | exec-stack | exec-stack       | exec-stack     | * PT_GNU_STACK == RW   | exec-none  | exec-none        | exec-none      | * @@ -303,7 +303,7 @@ extern u32 elf_hwcap2; * */ #define elf_read_implies_exec(ex, executable_stack) \ - (executable_stack == EXSTACK_DEFAULT) + (mmap_is_ia32() && executable_stack == EXSTACK_DEFAULT) struct task_struct;