Skip to content

Failure to build hid-fuzzer #595

Open

Description

@scheperdion

I am experimenting with different fuzzing research using LKL so far so good. During one of these experiments I experienced a linker error related to KASAN/ASAN and wanted to retrace my steps and see what I did wrong. But I ended up with this new linker error.

These are the commands I executed on my Ubuntu 24.04.2 LTS x86 host:

git clone https://github.com/lkl/linux.git
cd linux
make -C tools/lkl LKL_FUZZING=1 -j12 fuzzers

The following linker error is an excerpt of the full compiler output, liblkl builds succesfully as far as I can tell.

  LD      /home/user/projects/lkl/linux/tools/lkl/lib/liblkl-in.o
  AR      /home/user/projects/lkl/linux/tools/lkl/liblkl.a
  LINK    /home/user/projects/lkl/linux/tools/lkl/fuzzers/hid/hid-fuzzer
ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'system_state'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by main.c:125 (/home/user/projects/lkl/linux/init/main.c:125)
>>>               lkl.o:(.export_symbol+0x8) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'static_key_initialized'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by main.c:165 (/home/user/projects/lkl/linux/init/main.c:165)
>>>               lkl.o:(.export_symbol+0x18) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'reset_devices'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by main.c:177 (/home/user/projects/lkl/linux/init/main.c:177)
>>>               lkl.o:(.export_symbol+0x28) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'loops_per_jiffy'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by main.c:225 (/home/user/projects/lkl/linux/init/main.c:225)
>>>               lkl.o:(.export_symbol+0x38) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'init_uts_ns'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by version-timestamp.c:10 (init/version-timestamp.c:10)
>>>               lkl.o:(.export_symbol+0x48) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'init_task'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by init_task.c:64 (/home/user/projects/lkl/linux/init/init_task.c:64)
>>>               lkl.o:(.export_symbol+0x58) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'memcpy'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by xarray.c
>>>               lkl.o:(.export_symbol+0x68) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'memset'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by xarray.c
>>>               lkl.o:(.export_symbol+0x78) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'memmove'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by xarray.c
>>>               lkl.o:(.export_symbol+0x88) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'free_task'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by xarray.c
>>>               lkl.o:(.export_symbol+0x98) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol '__mmdrop'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by xarray.c
>>>               lkl.o:(.export_symbol+0xA8) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol '__put_task_struct'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by xarray.c
>>>               lkl.o:(.export_symbol+0xB8) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol '__put_task_struct_rcu_cb'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by xarray.c
>>>               lkl.o:(.export_symbol+0xC8) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'mmput'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by xarray.c
>>>               lkl.o:(.export_symbol+0xD8) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'get_task_mm'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by xarray.c
>>>               lkl.o:(.export_symbol+0xE8) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'panic_timeout'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by panic.c:66 (/home/user/projects/lkl/linux/kernel/panic.c:66)
>>>               lkl.o:(.export_symbol+0xF8) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'panic_notifier_list'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by panic.c:78 (/home/user/projects/lkl/linux/kernel/panic.c:78)
>>>               lkl.o:(.export_symbol+0x108) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'panic_blink'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by panic.c:138 (/home/user/projects/lkl/linux/kernel/panic.c:138)
>>>               lkl.o:(.export_symbol+0x118) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'nmi_panic'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by xarray.c
>>>               lkl.o:(.export_symbol+0x128) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: relocation R_X86_64_64 cannot be used against symbol 'panic'; recompile with -fPIC
>>> defined in /home/user/projects/lkl/linux/tools/lkl/liblkl.a(lkl.o)
>>> referenced by xarray.c
>>>               lkl.o:(.export_symbol+0x138) in archive /home/user/projects/lkl/linux/tools/lkl/liblkl.a

ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I can not remember that I have seen this one before while experimenting. Does someone here know where this is coming from? I am curious if this is reproducible for anyone or maybe obvious for someone that either my setup is incorrect or that that there is something missing?

Activity

  1. scheperdion commented on Apr 24, 2025

    @scheperdion
    Author

    #584 has the same issue, again Ubuntu 24.04.

  2. scheperdion commented on Apr 24, 2025

    @scheperdion
    Author

    When I redo my steps for commit 74da3bd then I get a successful built, at least for liblkl on 24.04. This is the commit I have been working from since january.

  3. Bariskizilkaya commented on Aug 16, 2025

    @Bariskizilkaya

    It is failed during the linking process

    make -C tools/lkl LKL_FUZZING=1 MMU=1 clean-conf fuzzers -j12
    
     LINK    /home/asd/Documents/fuzzing/LKL/linux/tools/lkl/fuzzers/hid/hid-fuzzer
    /usr/bin/ld: /home/asd/Documents/fuzzing/LKL/linux/tools/lkl/liblkl.a(lkl.o): warning: relocation in read-only section `.export_symbol'
    /usr/bin/ld: /home/asd/Documents/fuzzing/LKL/linux/tools/lkl/liblkl.a(lkl.o): in function `HIST_count_parallel_wksp':
    /home/asd/Documents/fuzzing/LKL/linux/lib/zstd/compress/hist.c:130:(.text+0x63b42c): undefined reference to `__asan_memmove'
    /usr/bin/ld: /home/asd/Documents/fuzzing/LKL/linux/tools/lkl/liblkl.a(lkl.o): in function `ZSTD_copyRawBlock':
    /home/asd/Documents/fuzzing/LKL/linux/lib/zstd/decompress/zstd_decompress.c:801:(.text+0x6fa459): undefined reference to `__asan_memmove'
    /usr/bin/ld: /home/asd/Documents/fuzzing/LKL/linux/lib/zstd/decompress/zstd_decompress.c:801:(.text+0x6fb715): undefined reference to `__asan_memmove'
    /usr/bin/ld: /home/asd/Documents/fuzzing/LKL/linux/tools/lkl/liblkl.a(lkl.o): in function `ZSTD_execSequenceEndSplitLitBuffer':
    /home/asd/Documents/fuzzing/LKL/linux/lib/zstd/decompress/zstd_decompress_block.c:942:(.text+0x6fee0d): undefined reference to `__asan_memmove'
    /usr/bin/ld: /home/asd/Documents/fuzzing/LKL/linux/lib/zstd/decompress/zstd_decompress_block.c:937:(.text+0x6fee97): undefined reference to `__asan_memmove'
    /usr/bin/ld: /home/asd/Documents/fuzzing/LKL/linux/tools/lkl/liblkl.a(lkl.o):/home/asd/Documents/fuzzing/LKL/linux/lib/zstd/decompress/zstd_decompress_block.c:894: more undefined references to `__asan_memmove' follow
    /usr/bin/ld: warning: creating DT_TEXTREL in a PIE
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [Makefile:100: /home/asd/Documents/fuzzing/LKL/linux/tools/lkl/fuzzers/hid/hid-fuzzer] Error 1
    make: Leaving directory '/home/asd/Documents/fuzzing/LKL/linux/tools/lkl'
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions