[LTP] [PATCH v1] security/dirtyc0w_shmem: Fix remaining cases where UFFD_FEATURE_MINOR_SHMEM is absent
David Hildenbrand
david@redhat.com
Fri Nov 25 12:16:29 CET 2022
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
More information about the ltp
mailing list