lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b1338345-42a5-4695-a033-c0de1c203594@collabora.com>
Date: Wed, 18 Sep 2024 10:46:47 +0500
From: Muhammad Usama Anjum <Usama.Anjum@...labora.com>
To: Shuah Khan <skhan@...uxfoundation.org>,
 Andrew Morton <akpm@...ux-foundation.org>, Shuah Khan <shuah@...nel.org>,
 David Hildenbrand <david@...hat.com>, Peter Xu <peterx@...hat.com>
Cc: Usama.Anjum@...labora.com, kernel@...labora.com, linux-mm@...ck.org,
 linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
 John Hubbard <jhubbard@...dia.com>
Subject: Re: [PATCH 1/2] kselftests: mm: Fix wrong __NR_userfaultfd value

On 9/18/24 10:46 AM, Muhammad Usama Anjum wrote:
> On 9/17/24 6:56 AM, Shuah Khan wrote:
>> On 9/16/24 00:32, Muhammad Usama Anjum wrote:
>>> 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.
>>>
>>
>> Okay - how do you know this is wrong? can you provide more details.
>>
>> git grep _NR_userfaultfd
>> include/uapi/asm-generic/unistd.h:#define __NR_userfaultfd 282
>> include/uapi/asm-generic/unistd.h:__SYSCALL(__NR_userfaultfd,
>> sys_userfaultfd)
>> tools/include/uapi/asm-generic/unistd.h:#define __NR_userfaultfd 282
>>
>>> The fix is simple. Add the correct header which has _NR_userfaultfd =
>>> 323.
> 
> grep -rnIF "#define __NR_userfaultfd"
> tools/include/uapi/asm-generic/unistd.h:681:#define __NR_userfaultfd 282
> arch/x86/include/generated/uapi/asm/unistd_32.h:374:#define
> __NR_userfaultfd 374
> arch/x86/include/generated/uapi/asm/unistd_64.h:327:#define
> __NR_userfaultfd 323
> arch/x86/include/generated/uapi/asm/unistd_x32.h:282:#define
> __NR_userfaultfd (__X32_SYSCALL_BIT + 323)
> arch/arm/include/generated/uapi/asm/unistd-eabi.h:347:#define
> __NR_userfaultfd (__NR_SYSCALL_BASE + 388)
> arch/arm/include/generated/uapi/asm/unistd-oabi.h:359:#define
> __NR_userfaultfd (__NR_SYSCALL_BASE + 388)
> include/uapi/asm-generic/unistd.h:681:#define __NR_userfaultfd 282
> 
> The number is dependent on the architecture. The above data shows that:
> x86	374
> x86_64	323
> 
> I'm unable to find the history of why it is set to 282 in unistd.h and
> when this problem happened.
Does anybody has understanding of this?

> 
>>
>> I need more details on this number.
>>
>> thanks,
>> -- Shuah
> 

-- 
BR,
Muhammad Usama Anjum


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ