Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1652487rbb; Mon, 26 Feb 2024 17:36:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXgKoTGjhLCXU4eY3QyhX5DC3OdlupsgOT7myucR5o5VQu4mK/m3eXHrE2t3BKqDg8Xiu3F+oCjyWdn9OJTPMreTtZtajwjLK4DodAKVw== X-Google-Smtp-Source: AGHT+IH/Ub9VbF+9uh7fyMU19FVb8MGuQMm7JkE3JoKioYvVcCcmKH89aaYZjLhFFN+Y/8rAwEYL X-Received: by 2002:a17:906:1398:b0:a42:f194:f794 with SMTP id f24-20020a170906139800b00a42f194f794mr4950443ejc.54.1708997777875; Mon, 26 Feb 2024 17:36:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708997777; cv=pass; d=google.com; s=arc-20160816; b=ldbIT+5d4wI4GTMbcZt7Wn17OojdxF1RTVRoQ4K/hfebvfBUlxeY5qggn2jA0dVK3K E2SSFDroCwpaVnCfmwDEQLX2tfsangF4c9s8ZE0dR4ZTi36/EeLy7NYMTRy3DnpAglut 4DNJxfm2wSul5+g41JI4AAI044CJB76PDOMkkqPUU4abQxa9QzHYiAmEVKwo6cp24k8o sNzXp4U8vLoJZnOACBzW322ME8AOPCSa0Cjf5wkld5G2J90BT+jUyGaDvRHSEk5fGDAf XHPdC0A27kKPrj8xZlKA8mTbxi8Ehle1DWGlzbSbuPmpDwg2DaZTTubnubPreo5BMjkL STHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=BpkbZoKcb/ElcmyFvuLHFS6Mz0ozyOSKWVwGl1poh1I=; fh=Q7vCzlRPJqbijdGCMcfQJMqFdj4BSllMtbPRSmFCmYI=; b=tT51KaN7Lb97Nf0LlO1dZo1b1klquSndA36JtKzW0Yeh3+DopAUcWUpMbVqVpYup69 XxDVYHG/pc5qbBQRtoXl0HPqIBV7eIXKxihvJ+bVOQs23JEVlaKvN54WJERi9hVDLHXs grWDHJEdjfGolIIoHscB0kPzj5PI8djvy8KuNBRC52QseLowtgn4oiyv7j54WQErtxTP DDNxr2h6B4Fa8ObBhD8k1ZTD9+5gxo6IWfDEiJHYhS5GNNIAHHbMJwjHb/qt8r1iGvX6 920kZNd7EabIlkHBkikX9ZBuVNfwNTAV8JzmeCwLDUqiWxSxUrbeUDUVle+XPuYWqfbU nTxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bewilderbeest.net header.s=thorn header.b=i8pi9UQD; arc=pass (i=1 spf=pass spfdomain=bewilderbeest.net dkim=pass dkdomain=bewilderbeest.net dmarc=pass fromdomain=bewilderbeest.net); spf=pass (google.com: domain of linux-kernel+bounces-82539-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82539-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=bewilderbeest.net Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d2-20020a1709061f4200b00a434997c89fsi259728ejk.211.2024.02.26.17.36.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 17:36:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82539-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bewilderbeest.net header.s=thorn header.b=i8pi9UQD; arc=pass (i=1 spf=pass spfdomain=bewilderbeest.net dkim=pass dkdomain=bewilderbeest.net dmarc=pass fromdomain=bewilderbeest.net); spf=pass (google.com: domain of linux-kernel+bounces-82539-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82539-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=bewilderbeest.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A15861F25147 for ; Tue, 27 Feb 2024 01:36:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E525BFBE1; Tue, 27 Feb 2024 01:35:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=bewilderbeest.net header.i=@bewilderbeest.net header.b="i8pi9UQD" Received: from thorn.bewilderbeest.net (thorn.bewilderbeest.net [71.19.156.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA2925695; Tue, 27 Feb 2024 01:35:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=71.19.156.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708997758; cv=none; b=vFDkcYPNklW9ccbNTSrXJe28VF6NUqtWbylXL36VsnisLHF1EW4jfkYrPmNlu+3g1PDbifNybmnnXkjEOIFnXBewmcR9Fz1EGPmQgo6fZE0F5eTtdMxaSxR44UMvywnilji9lsboFJb0V7/Y40toT6sli9801Bvk+lJS30b37Xk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708997758; c=relaxed/simple; bh=UfJ5aIrJuflIizXwpp3hAJQHhiJ7bqa/sOMnF4kfdBs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IDyNqTiKWqu+EVrZOaP7MIUCcRr7DYdoSSiHgxrwn/Lc0Q/0175HB70l7NjMeMEjxdzagbGXBa5O8uJqjW0LwCiTMmYNPYsii+SzWp5Oue1g+Bufbr0LN7jl6DH5Li4yOZ97WzYGb0RzS0+V8nO77MAlU96vXFo39HwNouzevXk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bewilderbeest.net; spf=pass smtp.mailfrom=bewilderbeest.net; dkim=pass (1024-bit key) header.d=bewilderbeest.net header.i=@bewilderbeest.net header.b=i8pi9UQD; arc=none smtp.client-ip=71.19.156.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bewilderbeest.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bewilderbeest.net Received: from hatter.bewilderbeest.net (unknown [IPv6:2602:61:712b:6300::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) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id 70FAB42C7; Mon, 26 Feb 2024 17:35:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1708997756; bh=BpkbZoKcb/ElcmyFvuLHFS6Mz0ozyOSKWVwGl1poh1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i8pi9UQDl+FTEkyoh7hOS5J5lRGjMIL8a3rV/L92/Ad3dZCdBxJOWKlDIP2Mxec0c LnnIgq4N20v+KoqvA71dCi7nzTaFMc4gZN0pNNwiND5AEDG/ShB0ouziEmHKwtYsxD cZIMb7RFbVGdMffzTaUtGY0JwePwtrzZORnDBQKc= From: Zev Weiss To: Russell King , linux-parisc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Helge Deller , Florent Revest Cc: Zev Weiss , "James E.J. Bottomley" , "Borislav Petkov (AMD)" , Yin Fengwei , "Mike Rapoport (IBM)" , Andrew Morton , Kees Cook , Yang Shi , Rick Edgecombe , Oleg Nesterov , David Hildenbrand , Stefan Roesch , Josh Triplett , Ondrej Mosnacek , Miguel Ojeda , linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, Sam James , stable@vger.kernel.org Subject: [PATCH RESEND 2/2] ARM: prctl: Reject PR_SET_MDWE on pre-ARMv6 Date: Mon, 26 Feb 2024 17:35:42 -0800 Message-ID: <20240227013546.15769-6-zev@bewilderbeest.net> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240227013546.15769-4-zev@bewilderbeest.net> References: <20240227013546.15769-4-zev@bewilderbeest.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On v5 and lower CPUs we can't provide MDWE protection, so ensure we fail any attempt to enable it via prctl(PR_SET_MDWE). Previously such an attempt would misleadingly succeed, leading to any subsequent mmap(PROT_READ|PROT_WRITE) or execve() failing unconditionally (the latter somewhat violently via force_fatal_sig(SIGSEGV) due to READ_IMPLIES_EXEC). Signed-off-by: Zev Weiss Cc: # v6.3+ --- arch/arm/include/asm/mman.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 arch/arm/include/asm/mman.h diff --git a/arch/arm/include/asm/mman.h b/arch/arm/include/asm/mman.h new file mode 100644 index 000000000000..2189e507c8e0 --- /dev/null +++ b/arch/arm/include/asm/mman.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_MMAN_H__ +#define __ASM_MMAN_H__ + +#include +#include + +static inline bool arch_memory_deny_write_exec_supported(void) +{ + return cpu_architecture() >= CPU_ARCH_ARMv6; +} +#define arch_memory_deny_write_exec_supported arch_memory_deny_write_exec_supported + +#endif /* __ASM_MMAN_H__ */ -- 2.43.2