Linux Test Project
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1] security/dirtyc0w_shmem: Fix remaining cases where UFFD_FEATURE_MINOR_SHMEM is absent
Date: Fri, 25 Nov 2022 12:16:29 +0100	[thread overview]
Message-ID: <6184eaf7-aee4-669c-aa20-0485c1474e47@redhat.com> (raw)
In-Reply-To: <Y4CjI7S/MHnQa7ex@pevik>

On 25.11.22 12:12, Petr Vorel wrote:
> Hi David,
> 
>> When UFFD_FEATURE_MINOR_SHMEM is not defined, we still have to make the
>> checkpoint happy, otherwise our parent process will run into a timeout.
>> Further, 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>
>> Cc: Petr Vorel <pvorel@suse.cz>
>> Cc: Cyril Hrubis <chrubis@suse.cz>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>> ---
>>   .../dirtyc0w_shmem/dirtyc0w_shmem_child.c        | 16 ++++++++++++----
>>   1 file changed, 12 insertions(+), 4 deletions(-)
> 
>> diff --git a/testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c b/testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c
>> index cb2e9df0c..c117c6f39 100644
>> --- a/testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c
>> +++ b/testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem_child.c
>> @@ -24,12 +24,12 @@
>>   #include <linux/userfaultfd.h>
>>   #endif
> 
>> -#ifdef UFFD_FEATURE_MINOR_SHMEM
> Shouldn't be the check and TST_TEST_TCONF() actually be in dirtyc0w_shmem.c?
> I overlooked that, but IMHO test does not make sense at all if
> UFFD_FEATURE_MINOR_SHMEM not defined, right?
> 
> Also Martin noted that ("The parent process should not even fork() when
> UFFD_FEATURE_MINOR_SHMEM is not defined in config.h.").
> 

I tried that first, but then we can still run into the runtime absence 
of UFFD_FEATURE_MINOR_SHMEM. Checking that also in the parent resulted 
in some IMHO unpleasant code while I worked on that.

This is certainly the easiest approach, because we still have to make 
the child program compile either way.

Anyhow, I'll do whatever you decide, because I want to cross this off my 
list. So any guidance on how to complete this would be appreciated.

-- 
Thanks,

David / dhildenb


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

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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 10:52 [LTP] [PATCH v1] security/dirtyc0w_shmem: Fix remaining cases where UFFD_FEATURE_MINOR_SHMEM is absent David Hildenbrand
2022-11-25 11:12 ` Petr Vorel
2022-11-25 11:16   ` David Hildenbrand [this message]
2022-11-25 12:34     ` Petr Vorel
2022-11-25 11:20 ` Martin Doucha
2022-11-25 12:19   ` David Hildenbrand

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=6184eaf7-aee4-669c-aa20-0485c1474e47@redhat.com \
    --to=david@redhat.com \
    --cc=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    /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