linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: John Hubbard <jhubbard@nvidia.com>
To: David Hildenbrand <david@redhat.com>,
	Muhammad Usama Anjum <Usama.Anjum@collabora.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Shuah Khan" <shuah@kernel.org>, Peter Xu <peterx@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	"Kim Phillips" <kim.phillips@arm.com>
Cc: <kernel@collabora.com>, <linux-mm@kvack.org>,
	<linux-kselftest@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [Bug Report] Wrong value of __NR_userfaultfd in asm-generic/unistd.h
Date: Mon, 21 Oct 2024 13:22:27 -0700	[thread overview]
Message-ID: <b57c415b-752f-4e83-a8df-b5efe9b0b29a@nvidia.com> (raw)
In-Reply-To: <4a775fd6-cb07-46eb-aa15-026e61317c16@redhat.com>

On 10/21/24 2:33 AM, David Hildenbrand wrote:
> Am 21.10.24 um 08:48 schrieb Muhammad Usama Anjum:
...
> But now comes the tricky part: an architecture defines whether it wants to
> 
> (a) Use the asm-generic unistd.h
> (b) Use a custom one
> 
> E.g.,
> 
> $ cat include/uapi/linux/unistd.h
> /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> #ifndef _LINUX_UNISTD_H_
> #define _LINUX_UNISTD_H_
> 
> /*
>   * Include machine specific syscall numbers
>   */
> #include <asm/unistd.h>
> 
> #endif /* _LINUX_UNISTD_H_ */
> 
> 
> For example on riscv arch/riscv/include/asm/unistd.h  will include arch/riscv/include/uapi/asm/unistd.h which will include "asm-generic/unistd.h".
> 
> If you follow the flow on x86, you'll find that it will not include that asm-generic one as default.
> 
> So the asm-generic variant only applies if an arch wants to do it in the generic way.
> 
> $ find tools -name unistd.h
> tools/arch/x86/include/uapi/asm/unistd.h
> tools/arch/arc/include/uapi/asm/unistd.h
> tools/arch/riscv/include/uapi/asm/unistd.h
> tools/arch/hexagon/include/uapi/asm/unistd.h
> tools/arch/arm64/include/uapi/asm/unistd.h
> tools/arch/loongarch/include/uapi/asm/unistd.h
> tools/include/uapi/asm-generic/unistd.h
> tools/include/nolibc/unistd.h
> 
> Consequently, the asm-generic one should never be used directly.

ohhh, I think I may have inadvertently started this problem! Via a few
commits such as:

     a5c6bc590094 ("selftests/mm: remove local __NR_* definitions")

, which did things like this:

-#include <unistd.h>
+#include <asm-generic/unistd.h>

So it seems that it should have been:

-#include <unistd.h>
+#include <asm/unistd.h>

...and each arch's unistd.h needs to be checked to ensure that it is
up to date with all the symbols that kselftests need.

thanks,
-- 
John Hubbard



      reply	other threads:[~2024-10-21 20:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21  6:48 Muhammad Usama Anjum
2024-10-21  9:33 ` David Hildenbrand
2024-10-21 20:22   ` John Hubbard [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=b57c415b-752f-4e83-a8df-b5efe9b0b29a@nvidia.com \
    --to=jhubbard@nvidia.com \
    --cc=Usama.Anjum@collabora.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=dgilbert@redhat.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