Re: [Bug Report] Wrong value of __NR_userfaultfd in asm-generic/unistd.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux