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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 073E4C6FA9D for ; Wed, 1 Mar 2023 16:37:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:In-Reply-To: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DTUuLuAt4DcK+rw/C3eo9P1+goMIHQtjLqGmKxalYdI=; b=waw0SW3VdU1TVO3XueyGH1ELWD 0c49nRoqFh8FiZjcXO2zA6sr32YDjML14pU7WqON4R5o/G7Uifxp/2r08bDue0WQ2LTqe09j7An4b nkEVT9uAUshR7hmD+BEpYs9yqWNrNN20l3C9CISBwOxWmAW3EfC8RBIzXXKNRP5gwRIqKUUHb1i4s 8YVzCQNTWfbKJCOjas/onbQj90B663ibI4uwTt1jxrhzZuWDYo1DkVtQU1T/v1vVjY4Ydf33oBYwL YfJdJ+JTVOFHblsF/vk6FdTA/BO5H+eQqzyyL4pUqHr1T5K3LsHa0FWxpopEPiiDNoK0rmmOPwis9 VVPS7wSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pXPR6-00GqoW-GZ; Wed, 01 Mar 2023 16:36:12 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pXPR3-00Gqkw-04 for linux-arm-kernel@lists.infradead.org; Wed, 01 Mar 2023 16:36:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677688561; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BmFrL1c4Km34O7ZeENxkp+Gs1wwGRzXM7cGLVLqZHJk=; b=Q5+f4ebbXPuRvIF3MfXEMUDbSjSdBWgPiXq8nf0BwDz48k0fGclekswaf0225iWeFQS1Ry 6Cr9e55vDS/8ZCoCXJgBu7gmFL8qUrejoo82xgDD77Dv8nvr6SOrv26VrGBBLXQbxirJUF aQJmBs48QJWe/6pdwBF9z5kaQ65RtA8= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-113-Zb7Pg_QFNBOWBU7TWgA5gQ-1; Wed, 01 Mar 2023 11:36:00 -0500 X-MC-Unique: Zb7Pg_QFNBOWBU7TWgA5gQ-1 Received: by mail-qt1-f198.google.com with SMTP id r3-20020ac84243000000b003b9a3ab9153so6819400qtm.8 for ; Wed, 01 Mar 2023 08:36:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677688559; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=FkL7Uhy+cPKcXOPgtSYv7QM09B2YNOq91Gba4VHb6zU=; b=dxlJlkdkVHwJJ3CJ+9SLqr9KambQdlfoohOcjLJoKgPJgK55uyAZqLhjarRDyRg0KP E/CqZnNFtWFjaFujR1xOOC0Z0pkAO8WDBOlZ0AUPcBIa0iBZ2ewY93LuiX0DUQC/cQ4A IyFhocKRgYwcvvhZoPDGZoakbfWiSpvbsh3FqWYqd9kj8SxGz9z/rMZ+p6NFoNV54gqG uNoI/+yuq4/Gn/iw0vu3MkO26BDgWZ4QYZyOjpqRGYXXjtVZu8Kz7XzTEfzRzVWXiMTJ 30mNsc2+wfOIXDPpF3ucQLMwjuLvD1NG8V8EcNdkteRl9PGFkDa8jeSAvksI3yahEVJ4 /8kg== X-Gm-Message-State: AO0yUKVAXzOZwkvNW6uUlwcinzTJNAfTHB3maDPIZkV8bK5cbfpWu8ij yxBuWDHz5lMytYJlkJLKi8L/Jr0os9x+9H7yrFYKkzcC6ya9TqegpSIRkeYarZZtjRH7GdtbQyd hE5gGNr25crq4bJlZS40lPR48UXpMJTyPOhI= X-Received: by 2002:a05:622a:1993:b0:3bf:be4b:8094 with SMTP id u19-20020a05622a199300b003bfbe4b8094mr14665377qtc.0.1677688559666; Wed, 01 Mar 2023 08:35:59 -0800 (PST) X-Google-Smtp-Source: AK7set8Cwi0eHdFAagaPGBeMs1+so6LN11xdXVXyv7QqXkjJci2aBg5qckwzm3APFdKOk2Zt7BkRJA== X-Received: by 2002:a05:622a:1993:b0:3bf:be4b:8094 with SMTP id u19-20020a05622a199300b003bfbe4b8094mr14665328qtc.0.1677688559357; Wed, 01 Mar 2023 08:35:59 -0800 (PST) Received: from x1n (bras-base-aurron9127w-grc-56-70-30-145-63.dsl.bell.ca. [70.30.145.63]) by smtp.gmail.com with ESMTPSA id o26-20020ac8429a000000b003b64f1b1f40sm8613002qtl.40.2023.03.01.08.35.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 08:35:58 -0800 (PST) Date: Wed, 1 Mar 2023 11:35:56 -0500 From: Peter Xu To: Joey Gouly Cc: Catalin Marinas , Andrew Morton , Lennart Poettering , Zbigniew =?utf-8?Q?J=C4=99drzejewski-Szmek?= , Alexander Viro , Kees Cook , Szabolcs Nagy , Mark Brown , Jeremy Linton , Topi Miettinen , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-abi-devel@lists.sourceforge.net, nd@arm.com, shuah@kernel.org Subject: Re: [PATCH v2 2/2] kselftest: vm: add tests for memory-deny-write-execute Message-ID: References: <20230119160344.54358-1-joey.gouly@arm.com> <20230119160344.54358-3-joey.gouly@arm.com> MIME-Version: 1.0 In-Reply-To: <20230119160344.54358-3-joey.gouly@arm.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="+HtziZPaMlI7+HbK" Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230301_083609_141394_09AFBB7D X-CRM114-Status: GOOD ( 20.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --+HtziZPaMlI7+HbK Content-Type: text/plain; charset=utf-8 Content-Disposition: inline On Thu, Jan 19, 2023 at 04:03:44PM +0000, Joey Gouly wrote: > From: Kees Cook > > Add some tests to cover the new PR_SET_MDWE prctl. > > Co-developed-by: Joey Gouly > Signed-off-by: Joey Gouly > Signed-off-by: Kees Cook > Cc: Shuah Khan May need to sync prctl.h into tools/include/uapi? Otherwise selftests/mm build fails here. There's also one compiler report. A fixup attached which works for me. Thanks, -- Peter Xu --+HtziZPaMlI7+HbK Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="0001-fixup-kselftest-vm-add-tests-for-memory-deny-write-e.patch" >From ce8e17c244fcc743c7006316dd431c5650480756 Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Wed, 1 Mar 2023 11:33:34 -0500 Subject: [PATCH] fixup! kselftest: vm: add tests for memory-deny-write-execute Signed-off-by: Peter Xu --- tools/include/uapi/linux/prctl.h | 6 ++++++ tools/testing/selftests/mm/mdwe_test.c | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/include/uapi/linux/prctl.h b/tools/include/uapi/linux/prctl.h index e4c629c1f1b0..759b3f53e53f 100644 --- a/tools/include/uapi/linux/prctl.h +++ b/tools/include/uapi/linux/prctl.h @@ -281,6 +281,12 @@ struct prctl_mm_map { # define PR_SME_VL_LEN_MASK 0xffff # define PR_SME_VL_INHERIT (1 << 17) /* inherit across exec */ +/* Memory deny write / execute */ +#define PR_SET_MDWE 65 +# define PR_MDWE_REFUSE_EXEC_GAIN 1 + +#define PR_GET_MDWE 66 + #define PR_SET_VMA 0x53564d41 # define PR_SET_VMA_ANON_NAME 0 diff --git a/tools/testing/selftests/mm/mdwe_test.c b/tools/testing/selftests/mm/mdwe_test.c index f466a099f1bf..bc91bef5d254 100644 --- a/tools/testing/selftests/mm/mdwe_test.c +++ b/tools/testing/selftests/mm/mdwe_test.c @@ -163,9 +163,8 @@ TEST_F(mdwe, mprotect_WRITE_EXEC) TEST_F(mdwe, mmap_FIXED) { - void *p, *p2; + void *p; - p2 = mmap(NULL, self->size, PROT_READ | PROT_EXEC, self->flags, 0, 0); self->p = mmap(NULL, self->size, PROT_READ, self->flags, 0, 0); ASSERT_NE(self->p, MAP_FAILED); -- 2.39.1 --+HtziZPaMlI7+HbK Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --+HtziZPaMlI7+HbK--