public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: ltp@lists.linux.it
Cc: David Hildenbrand <david@redhat.com>
Subject: [LTP] [PATCH v1 1/2] security/dirtyc0w_shmem: Fix runtime absence of UFFD_FEATURE_MINOR_SHMEM
Date: Fri, 25 Nov 2022 13:31:28 +0100	[thread overview]
Message-ID: <20221125123129.102360-2-david@redhat.com> (raw)
In-Reply-To: <20221125123129.102360-1-david@redhat.com>

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.

Reported-by: Martin Doucha <mdoucha@suse.cz>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 .../kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c     | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c b/testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c
index cb2e9df0c..45cc0ee76 100644
--- a/testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c
+++ b/testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c
@@ -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;
-- 
2.38.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-11-25 12:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 12:31 [LTP] [PATCH v1 0/2] security/dirtyc0w_shmem: Two fixes David Hildenbrand
2022-11-25 12:31 ` David Hildenbrand [this message]
2022-11-25 12:37   ` [LTP] [PATCH v1 1/2] security/dirtyc0w_shmem: Fix runtime absence of UFFD_FEATURE_MINOR_SHMEM Petr Vorel
2022-11-25 12:31 ` [LTP] [PATCH v1 2/2] security/dirtyc0w_shmem: Drop useless needs_tmpdir tag David Hildenbrand
2022-11-25 12:36   ` Petr Vorel
2022-11-25 13:32   ` Martin Doucha
2022-11-25 14:02     ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221125123129.102360-2-david@redhat.com \
    --to=david@redhat.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox