Uploaded image for project: 'Funtoo From Scratch'
  1. Funtoo From Scratch
  2. FFS-25

util-linux-2.39 fails in FFS

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • None
    • blocks util-linux ffs build.

      Actual build failure is:
      /usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: misc-utils/waitpid-waitpid.o: in function `main':
      waitpid.c.text.startup+0x298): undefined reference to `pidfd_open'
      collect2: error: ld returned 1 exit status
      libtool: link: (cd ".libs" && rm -f "libblkid.so" && ln -s "libblkid.so.1.1.0" "libblkid.so")
      make[2]: *** [Makefile:9353: waitpid] Error 1
      make[2]: *** Waiting for unfinished jobs....

      To reproduce, simply run ffs build ( gnu x86-64bit )

      update to util-linux-2.39 that is building with ffs stage1 step would fail due to newly introduced command `waitpid`.
      https://lore.kernel.org/util-linux/20230517-mahnmal-setzen-37937c35cf78@brauner/T/#t
      this new binary build of util-linux failing due to undefined function: pidfd_open()
      Check of this function is in build system is set unconditional
      https://github.com/util-linux/util-linux/blob/v2.39/include/pidfd-utils.h#L10
      pifd_open() function is added in glibc >=2.36 and it using pidfd_open syscall from kernel.
      In case of absence of mentioned function, util-linux has it's own local function definition:
      https://github.com/util-linux/util-linux/blob/v2.39/include/pidfd-utils.h#L24-L29
      this function calls syscall(SYS_pidfd_open, pid, flags) either from glibc ( >=2.36 ) or from kernel's syscall ( https://man7.org/linux/man-pages/man2/pidfd_open.2.html )
      util-linux has no fallback when neither one is found, glibc one or kernel. definition of syscalls are added in linux-headers >=5.3:
      /usr/include/asm/unistd_32.h:#define __NR_pidfd_open 434
      /usr/include/asm/unistd_x32.h:#define _NR_pidfd_open (_X32_SYSCALL_BIT + 434)
      /usr/include/asm/unistd_64.h:#define __NR_pidfd_open 434
      /usr/include/asm-generic/unistd.h:#define __NR_pidfd_open 434
      /usr/include/asm-generic/unistd.h:_SYSCALL(_NR_pidfd_open, sys_pidfd_open)
      /usr/include/linux/pidfd.h:/* Flags for pidfd_open(). */
      but FFS using is quite outdated linux-headers-4.19. this is a reason of failure.
      There is 3 possible solutions:
      a) update to glibc-2.36 9 ( highly discouraged. )
      b) update linux-headers to relatelively new from 5.x version
      c) make waitpid command optional in util-linux
      I have tested b) and have patch for c)
      I think b) is safest of all as linux-headers of version 5 might be good. The host i already running debian-sources-6.1.20, so it will probably eliminate such subtle bugs in future

            Unassigned Unassigned
            oleg oleg
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: