[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b57c415b-752f-4e83-a8df-b5efe9b0b29a@nvidia.com>
Date: Mon, 21 Oct 2024 13:22:27 -0700
From: John Hubbard <jhubbard@...dia.com>
To: David Hildenbrand <david@...hat.com>, Muhammad Usama Anjum
<Usama.Anjum@...labora.com>, Andrew Morton <akpm@...ux-foundation.org>,
"Shuah Khan" <shuah@...nel.org>, Peter Xu <peterx@...hat.com>, "Dr. David
Alan Gilbert" <dgilbert@...hat.com>, Andrea Arcangeli <aarcange@...hat.com>,
"Kim Phillips" <kim.phillips@....com>
CC: <kernel@...labora.com>, <linux-mm@...ck.org>,
<linux-kselftest@...r.kernel.org>, <linux-kernel@...r.kernel.org>, Shuah Khan
<skhan@...uxfoundation.org>
Subject: Re: [Bug Report] Wrong value of __NR_userfaultfd in
asm-generic/unistd.h
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
Powered by blists - more mailing lists