linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/4] Fixes for MDWE prctl
@ 2023-03-08 19:04 Joey Gouly
  2023-03-08 19:04 ` [PATCH v1 3/4] kselftest: vm: fix unused variable warning Joey Gouly
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Joey Gouly @ 2023-03-08 19:04 UTC (permalink / raw)
  To: Andrew Morton
  Cc: nd, acme, catalin.marinas, izbyshev, joey.gouly, peterx,
	linux-mm, linux-kernel, Shuah Khan, Kees Cook

Hi all,

These are four small fixes for the recent memory-write-deny-execute prctl patches [1].
Two reported by Alexey about error handling and two tooling fixes by Peter.

Thanks,
Joey

[1] https://lore.kernel.org/linux-arm-kernel/20230119160344.54358-1-joey.gouly@arm.com/

Joey Gouly (2):
  mm: deduplicate error handling for map_deny_write_exec
  mm: fix error handling for map_deny_write_exec

Peter Xu (2):
  kselftest: vm: fix unused variable warning
  tools headers UAPI: Sync linux/prctl.h with the kernel sources

 mm/mmap.c                              | 7 +------
 mm/mprotect.c                          | 2 +-
 tools/include/uapi/linux/prctl.h       | 6 ++++++
 tools/testing/selftests/mm/mdwe_test.c | 3 +--
 4 files changed, 9 insertions(+), 9 deletions(-)

--
2.17.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 3/4] kselftest: vm: fix unused variable warning
  2023-03-08 19:04 [PATCH v1 0/4] Fixes for MDWE prctl Joey Gouly
@ 2023-03-08 19:04 ` Joey Gouly
  2023-03-13 14:12   ` Catalin Marinas
  2023-03-08 19:04 ` [PATCH v1 4/4] tools headers UAPI: Sync linux/prctl.h with the kernel sources Joey Gouly
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Joey Gouly @ 2023-03-08 19:04 UTC (permalink / raw)
  To: Andrew Morton
  Cc: nd, acme, catalin.marinas, izbyshev, joey.gouly, peterx,
	linux-mm, linux-kernel, Shuah Khan, Kees Cook

From: Peter Xu <peterx@redhat.com>

Remove unused variable from the MDWE test.

Fixes: 4cf1fe34fd18 ("kselftest: vm: add tests for memory-deny-write-execute")
Signed-off-by: Peter Xu <peterx@redhat.com>
[joey: added commit message]
Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 tools/testing/selftests/mm/mdwe_test.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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.17.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 4/4] tools headers UAPI: Sync linux/prctl.h with the kernel sources
  2023-03-08 19:04 [PATCH v1 0/4] Fixes for MDWE prctl Joey Gouly
  2023-03-08 19:04 ` [PATCH v1 3/4] kselftest: vm: fix unused variable warning Joey Gouly
@ 2023-03-08 19:04 ` Joey Gouly
  2023-03-13 14:13   ` Catalin Marinas
       [not found] ` <20230308190423.46491-2-joey.gouly@arm.com>
       [not found] ` <20230308190423.46491-3-joey.gouly@arm.com>
  3 siblings, 1 reply; 7+ messages in thread
From: Joey Gouly @ 2023-03-08 19:04 UTC (permalink / raw)
  To: Andrew Morton
  Cc: nd, acme, catalin.marinas, izbyshev, joey.gouly, peterx,
	linux-mm, linux-kernel, Shuah Khan, Kees Cook

From: Peter Xu <peterx@redhat.com>

Sync prctl.h after the changes in b507808ebce ("mm: implement memory-deny-write-execute as a prctl")

Fixes: 4cf1fe34fd18 ("kselftest: vm: add tests for memory-deny-write-execute")
Signed-off-by: Peter Xu <peterx@redhat.com>
[joey: added commit message]
Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/include/uapi/linux/prctl.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/include/uapi/linux/prctl.h b/tools/include/uapi/linux/prctl.h
index a5e06dcbba13..1312a137f7fb 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
 
-- 
2.17.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 1/4] mm: deduplicate error handling for map_deny_write_exec
       [not found] ` <20230308190423.46491-2-joey.gouly@arm.com>
@ 2023-03-13 14:11   ` Catalin Marinas
  0 siblings, 0 replies; 7+ messages in thread
From: Catalin Marinas @ 2023-03-13 14:11 UTC (permalink / raw)
  To: Joey Gouly
  Cc: Andrew Morton, nd, acme, izbyshev, peterx, linux-mm,
	linux-kernel, Shuah Khan, Kees Cook

On Wed, Mar 08, 2023 at 07:04:20PM +0000, Joey Gouly wrote:
> Commit cc8d1b097de7 ("mmap: clean up mmap_region() unrolling") deduplicated
> the error handling, do the same for the return value of `map_deny_write_exec`.
> 
> Fixes: b507808ebce2 ("mm: implement memory-deny-write-execute as a prctl")
> Reported-by: Alexey Izbyshev <izbyshev@ispras.ru>
> Link: https://lore.kernel.org/linux-arm-kernel/8408d8901e9d7ee6b78db4c6cba04b78@ispras.ru/
> Signed-off-by: Joey Gouly <joey.gouly@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 2/4] mm: fix error handling for map_deny_write_exec
       [not found] ` <20230308190423.46491-3-joey.gouly@arm.com>
@ 2023-03-13 14:11   ` Catalin Marinas
  0 siblings, 0 replies; 7+ messages in thread
From: Catalin Marinas @ 2023-03-13 14:11 UTC (permalink / raw)
  To: Joey Gouly
  Cc: Andrew Morton, nd, acme, izbyshev, peterx, linux-mm,
	linux-kernel, Shuah Khan, Kees Cook

On Wed, Mar 08, 2023 at 07:04:21PM +0000, Joey Gouly wrote:
> Commit 4a18419f71cd ("mm/mprotect: use mmu_gather") changed 'goto out;'
> to 'break' in the loop.
> This wasn't noticed while rebasing the MDWE patches, so fix it now.
> 
> Fixes: b507808ebce2 ("mm: implement memory-deny-write-execute as a prctl")
> Reported-by: Alexey Izbyshev <izbyshev@ispras.ru>
> Link: https://lore.kernel.org/linux-arm-kernel/8408d8901e9d7ee6b78db4c6cba04b78@ispras.ru/
> Signed-off-by: Joey Gouly <joey.gouly@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 3/4] kselftest: vm: fix unused variable warning
  2023-03-08 19:04 ` [PATCH v1 3/4] kselftest: vm: fix unused variable warning Joey Gouly
@ 2023-03-13 14:12   ` Catalin Marinas
  0 siblings, 0 replies; 7+ messages in thread
From: Catalin Marinas @ 2023-03-13 14:12 UTC (permalink / raw)
  To: Joey Gouly
  Cc: Andrew Morton, nd, acme, izbyshev, peterx, linux-mm,
	linux-kernel, Shuah Khan, Kees Cook

On Wed, Mar 08, 2023 at 07:04:22PM +0000, Joey Gouly wrote:
> From: Peter Xu <peterx@redhat.com>
> 
> Remove unused variable from the MDWE test.
> 
> Fixes: 4cf1fe34fd18 ("kselftest: vm: add tests for memory-deny-write-execute")
> Signed-off-by: Peter Xu <peterx@redhat.com>
> [joey: added commit message]
> Signed-off-by: Joey Gouly <joey.gouly@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 4/4] tools headers UAPI: Sync linux/prctl.h with the kernel sources
  2023-03-08 19:04 ` [PATCH v1 4/4] tools headers UAPI: Sync linux/prctl.h with the kernel sources Joey Gouly
@ 2023-03-13 14:13   ` Catalin Marinas
  0 siblings, 0 replies; 7+ messages in thread
From: Catalin Marinas @ 2023-03-13 14:13 UTC (permalink / raw)
  To: Joey Gouly
  Cc: Andrew Morton, nd, acme, izbyshev, peterx, linux-mm,
	linux-kernel, Shuah Khan, Kees Cook

On Wed, Mar 08, 2023 at 07:04:23PM +0000, Joey Gouly wrote:
> From: Peter Xu <peterx@redhat.com>
> 
> Sync prctl.h after the changes in b507808ebce ("mm: implement memory-deny-write-execute as a prctl")
> 
> Fixes: 4cf1fe34fd18 ("kselftest: vm: add tests for memory-deny-write-execute")
> Signed-off-by: Peter Xu <peterx@redhat.com>
> [joey: added commit message]
> Signed-off-by: Joey Gouly <joey.gouly@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-03-13 14:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 19:04 [PATCH v1 0/4] Fixes for MDWE prctl Joey Gouly
2023-03-08 19:04 ` [PATCH v1 3/4] kselftest: vm: fix unused variable warning Joey Gouly
2023-03-13 14:12   ` Catalin Marinas
2023-03-08 19:04 ` [PATCH v1 4/4] tools headers UAPI: Sync linux/prctl.h with the kernel sources Joey Gouly
2023-03-13 14:13   ` Catalin Marinas
     [not found] ` <20230308190423.46491-2-joey.gouly@arm.com>
2023-03-13 14:11   ` [PATCH v1 1/4] mm: deduplicate error handling for map_deny_write_exec Catalin Marinas
     [not found] ` <20230308190423.46491-3-joey.gouly@arm.com>
2023-03-13 14:11   ` [PATCH v1 2/4] mm: fix " Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox