linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <Usama.Anjum@collabora.com>
To: Shuah Khan <skhan@linuxfoundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Shuah Khan <shuah@kernel.org>,
	David Hildenbrand <david@redhat.com>,
	Peter Xu <peterx@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Kim Phillips <kim.phillips@arm.com>
Cc: Usama.Anjum@collabora.com, kernel@collabora.com,
	linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, John Hubbard <jhubbard@nvidia.com>
Subject: Re: [PATCH 1/2] kselftests: mm: Fix wrong __NR_userfaultfd value
Date: Tue, 24 Sep 2024 11:21:36 +0500	[thread overview]
Message-ID: <109a9f01-0c5c-49f3-b956-91bc789a1c44@collabora.com> (raw)
In-Reply-To: <db8b758e-9051-4ee0-b0e7-3b54eda0c71b@linuxfoundation.org>

On 9/23/24 9:02 PM, Shuah Khan wrote:
> On 9/22/24 23:35, Muhammad Usama Anjum wrote:
>> ...
>>
>>>> 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
>>>
>>> Correct and the generated header files do the right thing and it is
>>> good to
>>> include them as this patch does.
>>>
>>> This is a good find and fix. I wish you explained this in your
>>> changelog.
>>> Please add more details when you send v2.
>> I'm sending v2
>>
>>>
>>> There could be other issues lurking based on what I found.
>>>
>>> The other two files are the problem where they hard code it to 282
>>> without
>>> taking the __NR_SYSCALL_BASE for the arch into consideration:
>>>
>>> tools/include/uapi/asm-generic/unistd.h:681:#define __NR_userfaultfd 282
>>> include/uapi/asm-generic/unistd.h:681:#define __NR_userfaultfd 282
>>>
>>>>
>>>> I'm unable to find the history of why it is set to 282 in unistd.h and
>>>> when this problem happened.
>>>
>>> According to git history it is added in the following commit to
>>> include/uapi/asm-generic/unistd.h:
>>>
>>> 09f7298100ea9767324298ab0c7979f6d7463183
>>> Subject: [PATCH] userfaultfd: register uapi generic syscall (aarch64)
>>>
>>> and it is added in the following commit to
>>> tools/include/uapi/asm-generic/unistd.h
>>> 34b009cfde2b8ce20a69c7bfd6bad4ce0e7cd970
>>> Subject: [PATCH] tools include: Grab copies of arm64 dependent unistd.h
>>> files
>>>
>>> I think, the above defines from include/uapi/asm-generic/unistd.h and
>>> tools/include/uapi/asm-generic/unistd.h should be removed.
>>>
>>> Maybe others familiar with userfaultfd can determine the best course of
>>> action.
>>> We might have other NR_ defines in these two files that are causing
>>> problems
>>> for tests and tools that we haven't uncovered yet.
>> Added authors of these patches.
>>
> 
> Thank you. Would you be able top follow up on this and send patches
> to remove these defines if it deemed to be the correct solution?
Yeah, sure. I'll follow up and fix the issue.

> 
> thanks,
> -- Shuah
> 
> 

-- 
BR,
Muhammad Usama Anjum



      reply	other threads:[~2024-09-24  6:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-12 10:31 Muhammad Usama Anjum
2024-09-12 10:31 ` [PATCH 2/2] kselftests: mm: Fail the test if userfaultfd syscall isn't found Muhammad Usama Anjum
2024-09-12 16:10   ` Shuah Khan
2024-09-12 17:28     ` Shuah Khan
2024-09-16  6:33       ` Muhammad Usama Anjum
2024-09-12 15:44 ` [PATCH 1/2] kselftests: mm: Fix wrong __NR_userfaultfd value Shuah Khan
2024-09-16  6:32   ` Muhammad Usama Anjum
2024-09-17  1:56     ` Shuah Khan
2024-09-18  5:46       ` Muhammad Usama Anjum
2024-09-18  5:46         ` Muhammad Usama Anjum
2024-09-20 14:59         ` Shuah Khan
2024-09-23  5:35           ` Muhammad Usama Anjum
2024-09-23 16:02             ` Shuah Khan
2024-09-24  6:21               ` Muhammad Usama Anjum [this message]

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=109a9f01-0c5c-49f3-b956-91bc789a1c44@collabora.com \
    --to=usama.anjum@collabora.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=jhubbard@nvidia.com \
    --cc=kernel@collabora.com \
    --cc=kim.phillips@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=peterx@redhat.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    /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