From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8D54C3B186 for ; Wed, 12 Feb 2020 09:27:56 +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 AC25F21569 for ; Wed, 12 Feb 2020 09:27:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="h3jiRQr7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AC25F21569 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.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:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4Cm25TBg+J0dOGN8sJ+XymlKS7xtKA9TZ2K+0tCOhrs=; b=h3jiRQr7R/s+v6 yTP1dL3fgcWM+BcCn61Fvx5KSjgqSwcdoSGZjGv/cz6RK0BZFa6rpxRuGXymlB0ZFyzR+zgJvTpnL meD+Q/+rhidgC1JhkTCOwR8WvvBeXDoxu1QjcUBzlMHGiNONn1+jUFg5o2ZqxgWJq5xGcKeLIjAJz K6CwfkWan2AEzNbSUc8g9GxsDfMorewPwpkX/P6DBDZx+nisoNwEfm0VAG1oQ7dfC8vqwwyCQSXAo dmnfMUN80SU/olazgsy0y6Z/z9KKHOMJEy0zeKm81tN/7ohA8BNoWAn2f8lRx3eV0+wgRAGunBc8r ExKshntDRRlAeom050Hw==; 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 1j1oJC-0000wb-78; Wed, 12 Feb 2020 09:27:50 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j1oJ6-0000ta-Gu for linux-arm-kernel@lists.infradead.org; Wed, 12 Feb 2020 09:27:46 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 67DBF30E; Wed, 12 Feb 2020 01:27:43 -0800 (PST) Received: from arrakis.emea.arm.com (arrakis.cambridge.arm.com [10.1.196.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D0CF43F6CF; Wed, 12 Feb 2020 01:27:41 -0800 (PST) Date: Wed, 12 Feb 2020 09:27:39 +0000 From: Catalin Marinas To: Kees Cook Subject: Re: [PATCH v3 5/7] arm32/64, elf: Split READ_IMPLIES_EXEC from executable GNU_STACK Message-ID: <20200212092739.GC488264@arrakis.emea.arm.com> References: <20200210193049.64362-1-keescook@chromium.org> <20200210193049.64362-6-keescook@chromium.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200210193049.64362-6-keescook@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200212_012744_629234_CA4BD0E5 X-CRM114-Status: GOOD ( 13.44 ) 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: Jann Horn , Hector Marco-Gisbert , x86@kernel.org, Will Deacon , Russell King , linux-kernel@vger.kernel.org, Jason Gunthorpe , linux-kselftest@vger.kernel.org, kernel-hardening@lists.openwall.com, Ingo Molnar , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Feb 10, 2020 at 11:30:47AM -0800, Kees Cook wrote: > The READ_IMPLIES_EXEC work-around was designed for old toolchains that > lacked the ELF PT_GNU_STACK marking under the assumption that toolchains > that couldn't specify executable permission flags for the stack may not > know how to do it correctly for any memory region. > > This logic is sensible for having ancient binaries coexist in a system > with possibly NX memory, but was implemented in a way that equated having > a PT_GNU_STACK marked executable as being as "broken" as lacking the > PT_GNU_STACK marking entirely. Things like unmarked assembly and stack > trampolines may cause PT_GNU_STACK to need an executable bit, but they > do not imply all mappings must be executable. > > This confusion has led to situations where modern programs with explicitly > marked executable stack are forced into the READ_IMPLIES_EXEC state when > no such thing is needed. (And leads to unexpected failures when mmap()ing > regions of device driver memory that wish to disallow VM_EXEC[1].) > > In looking for other reasons for the READ_IMPLIES_EXEC behavior, Jann > Horn noted that glibc thread stacks have always been marked RWX (until > 2003 when they started tracking the PT_GNU_STACK flag instead[2]). And > musl doesn't support executable stacks at all[3]. As such, no breakage > for multithreaded applications is expected from this change. > > This changes arm32 and arm64 compat together, to keep behavior the same. > > [1] https://lkml.kernel.org/r/20190418055759.GA3155@mellanox.com > [2] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=54ee14b3882 > [3] https://lkml.kernel.org/r/20190423192534.GN23599@brightrain.aerifal.cx > > Suggested-by: Hector Marco-Gisbert > Signed-off-by: Kees Cook Reviewed-by: Catalin Marinas _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel