Subject: [next 20210607] Link failed due to unresolved symbol should_fail_alloc_page

From: Hyeonggon Yoo <[email-masked]>
Date: Mon, 7 Jun 2021 22:15:40 +0900

I tried to compile today's linux-next (20210607).
All file was compiled well, but linking failed.

the config I tried was syzbot's kmsan config.
(attached)

this is some part of output (compiled with clang 11)

  GEN     .version
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  AR      init/built-in.a
  LD      vmlinux.o
  MODPOST vmlinux.symvers
  MODINFO modules.builtin.modinfo
  GEN     modules.builtin
  LD      .tmp_vmlinux.btf
  BTF     .btf.vmlinux.bin.o
  LD      .tmp_vmlinux.kallsyms1
  KSYMS   .tmp_vmlinux.kallsyms1.S
  AS      .tmp_vmlinux.kallsyms1.S
  LD      .tmp_vmlinux.kallsyms2
  KSYMS   .tmp_vmlinux.kallsyms2.S
  AS      .tmp_vmlinux.kallsyms2.S
  LD      vmlinux
  BTFIDS  vmlinux
FAILED unresolved symbol should_fail_alloc_page
make: *** [Makefile:1252: vmlinux] Error 255
make: *** Deleting file 'vmlinux'

It seems that should_fail_alloc_page was changed to static by commit
below., and should_fail_alloc_page is referenced in
kernel/bpf/verifier.c:12981

is something not merged yet?

commit b476823732c94289cc2ad5ff8742125132e366db
Author: Mel Gorman <[email-masked]>
Date:   Fri Jun 4 14:20:29 2021 +1000

    mm/vmalloc: include header for prototype of set_iounmap_nonlazy

    make W=1 generates the following warning for mm/vmalloc.c

:
    mm/page_alloc: make should_fail_alloc_page() static

    make W=1 generates the following warning for mm/page_alloc.c

      mm/page_alloc.c:3651:15: warning: no previous prototype for `should_fail_alloc_page' [-Wmissing-prototypes]
       noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
                     ^~~~~~~~~~~~~~~~~~~~~~

    This function is deliberately split out for BPF to allow errors to be
    injected.  The function is not used anywhere else so it is local to the
    file.  Make it static which should still allow error injection to be used
    similar to how block/blk-core.c:should_fail_bio() works.

    Link: https://lkml.kernel.org/r/[email-masked]
    Signed-off-by: Mel Gorman <[email-masked]>
    Reviewed-by: Yang Shi <[email-masked]>
    Acked-by: Vlastimil Babka <[email-masked]>
    Cc: Dan Streetman <[email-masked]>
    Cc: David Hildenbrand <[email-masked]>
    Cc: Michal Hocko <[email-masked]>
    Signed-off-by: Andrew Morton <[email-masked]>
    Signed-off-by: Stephen Rothwell <[email-masked]>