Hi David!
On 9/29/26 1:30 PM, David Hildenbrand (Arm) wrote:
> On 9/24/26 07:00, Sarthak Sharma wrote:
>> The userfaultfd syscall can return ENOSYS even when __NR_userfaultfd is
>> defined by the architecture headers, for example when the kernel is
>> built without CONFIG_USERFAULTFD. The test currently skips for EPERM
>> when the caller lacks permission to use userfaultfd but treats
>> ENOSYS as a failure.
>>
>> Handle ENOSYS like EPERM and skip the mremap_move_multi_invalid_vmas()
>> test when userfaultfd syscall is not implemented.
>>
>> Fixes: 742d3663a577 ("selftests/mm: add test for invalid multi VMA
>> operations")
>> Signed-off-by: Sarthak Sharma <[email protected]>
>> ---
>> tools/testing/selftests/mm/mremap_test.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/mm/mremap_test.c
>> b/tools/testing/selftests/mm/mremap_test.c
>> index 5532d3151ed0..a5813a5e8f5b 100644
>> --- a/tools/testing/selftests/mm/mremap_test.c
>> +++ b/tools/testing/selftests/mm/mremap_test.c
>> @@ -721,7 +721,7 @@ static void mremap_move_multi_invalid_vmas(FILE *maps_fp,
>> if (uffd == -1) {
>> err = errno;
>> ksft_perror("userfaultfd");
>
> Should we rather move that below the if? Doesn't quite make sense to print the
> error if we are skipping and printing a proper message.
Yes, I'll put it below the if block.
>
> Maybe that should go into the previous patch?
Yes, will include in the ksft conversion patch.
>
>> - if (err == EPERM) {
>> + if (err == EPERM || err == ENOSYS) {
>> ksft_test_result_skip("%s - missing uffd\n", test_name);
>> return;
>> }
>
> Apart from that LGTM.
>
> Acked-by: David Hildenbrand (Arm) <[email protected]>
Thanks!