diff mbox series

[1/2] kselftests: mm: Fix wrong __NR_userfaultfd value

Message ID 20240912103151.1520254-1-usama.anjum@collabora.com
State New
Headers show
Series [1/2] kselftests: mm: Fix wrong __NR_userfaultfd value | expand

Commit Message

Muhammad Usama Anjum Sept. 12, 2024, 10:31 a.m. UTC
The value of __NR_userfaultfd was changed to 282 when
asm-generic/unistd.h was included. It makes the test to fail every time
as the correct number of this syscall on x86_64 is 323. Fix the header
to asm/unistd.h.

Fixes: a5c6bc590094 ("selftests/mm: remove local __NR_* definitions")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
 tools/testing/selftests/mm/pagemap_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Muhammad Usama Anjum Sept. 16, 2024, 6:32 a.m. UTC | #1
On 9/12/24 8:44 PM, Shuah Khan wrote:
> On 9/12/24 04:31, Muhammad Usama Anjum wrote:
>> The value of __NR_userfaultfd was changed to 282 when
>> asm-generic/unistd.h was included. It makes the test to fail every time
>> as the correct number of this syscall on x86_64 is 323. Fix the header
>> to asm/unistd.h.
>>
> 
> "please elaborate every time" - I just built on my x86_64 and built
> just fine.
The build isn't broken.

> I am not saying this isn't a problem, it is good to
> understand why and how it is failing before making the change.
I mean to say that the test is failing at run time because the correct
userfaultfd syscall isn't being found with __NR_userfaultfd = 282.
_NR_userfaultfd's value depends on the header. When asm-generic/unistd.h
is included, its value (282) is wrong. I've tested on x86_64.

The fix is simple. Add the correct header which has _NR_userfaultfd = 323.

> 
>> Fixes: a5c6bc590094 ("selftests/mm: remove local __NR_* definitions")
>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>> ---
>>   tools/testing/selftests/mm/pagemap_ioctl.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/mm/pagemap_ioctl.c
>> b/tools/testing/selftests/mm/pagemap_ioctl.c
>> index fc90af2a97b80..bcc73b4e805c6 100644
>> --- a/tools/testing/selftests/mm/pagemap_ioctl.c
>> +++ b/tools/testing/selftests/mm/pagemap_ioctl.c
>> @@ -15,7 +15,7 @@
>>   #include <sys/ioctl.h>
>>   #include <sys/stat.h>
>>   #include <math.h>
>> -#include <asm-generic/unistd.h>
>> +#include <asm/unistd.h>
>>   #include <pthread.h>
>>   #include <sys/resource.h>
>>   #include <assert.h>
> 
> Also please generate a series with these two patches with cover-letter.
> 
> thanks,
> -- Shuah
diff mbox series

Patch

diff --git a/tools/testing/selftests/mm/pagemap_ioctl.c b/tools/testing/selftests/mm/pagemap_ioctl.c
index fc90af2a97b80..bcc73b4e805c6 100644
--- a/tools/testing/selftests/mm/pagemap_ioctl.c
+++ b/tools/testing/selftests/mm/pagemap_ioctl.c
@@ -15,7 +15,7 @@ 
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <math.h>
-#include <asm-generic/unistd.h>
+#include <asm/unistd.h>
 #include <pthread.h>
 #include <sys/resource.h>
 #include <assert.h>