Skip to contentSkip to conversation

security/dirtyc0w_shmem: Two fixes

PATCH In review David Hildenbrand 3 participants 7 messages Nov 25, 2022

lore
Share & tools
lore
#0 lore raw

cover security/dirtyc0w_shmem: Two fixes

Reworking compile-time absence of UFFD_FEATURE_MINOR_SHMEM and looking into using fuzzy sync library takes more time. So two patches separately upfront.

Cc Martin Doucha <[email protected]>
Cc Cyril Hrubis <[email protected]>
Cc Petr Vorel <[email protected]>

David Hildenbrand (2):
security/dirtyc0w_shmem: Fix runtime absence of
UFFD_FEATURE_MINOR_SHMEM
security/dirtyc0w_shmem: Drop useless needs_tmpdir tag

 testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem.c     | 1 -
 .../kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c     | 4 ++++
 2 files changed, 4 insertions(+), 1 deletion(-)
Signature · 5 lines
2.38.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

PATCH 1/2 security/dirtyc0w_shmem: Fix runtime absence of UFFD_FEATURE_MINOR_SHMEM

We have to test if UFFD_FEATURE_MINOR_SHMEM is really returned by the UFFD_API ioctl: if the kernel knows about the feature but doesn't support it, it will be masked off.

---
 .../kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c     | 4 ++++
 1 file changed, 4 insertions(+)
testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c +4 -0
index cb2e9df0c..45cc0ee76 100644
@@ -162,6 +162,10 @@ retry:
 			"Could not create userfault file descriptor");
 	}
 
+	if (!(uffdio_api.features & UFFD_FEATURE_MINOR_SHMEM))
+		tst_brk(TCONF,
+			"System does not have userfaultfd minor fault support for shmem");
+
 	uffdio_register.range.start = (unsigned long) map;
 	uffdio_register.range.len = page_size;
 	uffdio_register.mode = UFFDIO_REGISTER_MODE_MINOR;
Signature · 5 lines
2.38.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/2
#2 lore raw

Re: [LTP] [PATCH v1 1/2] security/dirtyc0w_shmem: Fix runtime absence of UFFD_FEATURE_MINOR_SHMEM

Hi all,

Fixes a46f8956f ("security/dirtyc0w_shmem: Add new test for CVE-2022-2590")

Waiting little bit for Martin's input (not required) before merging.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

PATCH 2/2 security/dirtyc0w_shmem: Drop useless needs_tmpdir tag

In reply to David Hildenbrand

Compilation points out that:
testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem.c: useless tag:
needs_tmpdir

needs_tmpdir is implied by needs_checkpoints, so we can drop it.

---
 testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem.c | 1 -
 1 file changed, 1 deletion(-)
testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem.c +0 -1
index 1e3b194e7..14b8f8317 100644
@@ -109,7 +109,6 @@ static struct tst_test test = {
 	.needs_checkpoints = 1,
 	.forks_child = 1,
 	.needs_root = 1,
-	.needs_tmpdir = 1,
 	.max_runtime = 120,
 	.setup = setup,
 	.cleanup = cleanup,
Signature · 5 lines
2.38.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 2/2
#4 lore raw

Re: [LTP] [PATCH v1 2/2] security/dirtyc0w_shmem: Drop useless needs_tmpdir tag

Hi all,

Fixes a46f8956f ("security/dirtyc0w_shmem: Add new test for CVE-2022-2590")

Waiting little bit for Martin's input (not required) before merging.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 2/2
#5 lore raw

Re: [LTP] [PATCH v1 2/2] security/dirtyc0w_shmem: Drop useless needs_tmpdir tag

In reply to David Hildenbrand

Hi,
both patches look good.

Quoted 23 lines · David Hildenbrand

Compilation points out that:
testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem.c: useless tag:
needs_tmpdir

needs_tmpdir is implied by needs_checkpoints, so we can drop it.

---
  testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem.c | 1 -
  1 file changed, 1 deletion(-)
testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem.c +0 -1
index 1e3b194e7..14b8f8317 100644
@@ -109,7 +109,6 @@ static struct tst_test test = {
  	.needs_checkpoints = 1,
  	.forks_child = 1,
  	.needs_root = 1,
-	.needs_tmpdir = 1,
  	.max_runtime = 120,
  	.setup = setup,
  	.cleanup = cleanup,
Signature · 11 lines
Martin Doucha   [email protected]
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw

Re: [LTP] [PATCH v1 2/2] security/dirtyc0w_shmem: Drop useless needs_tmpdir tag

Hi Martin, David,

Quoted 2 lines

Hi,
both patches look good.

Thanks, merged!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp