Skip to content

llvm-readelf "invalid PT_DYNAMIC size" for RISC-V after getrandom() vDSO implementation #2093

@nathanchance

Description

@nathanchance

After commit 89079520cef6 ("RISC-V: vDSO: Wire up getrandom() vDSO implementation") in -next, I see a warning from llvm-readelf with ARCH=riscv allmodconfig. As of next-20250527, a tangential fix is needed for LLVM=1 to work.

$ make -skj"$(nproc)" ARCH=riscv LLVM=1 mrproper allmodconfig arch/riscv/kernel/vdso/
llvm-readelf: warning: 'arch/riscv/kernel/vdso/vdso.so.dbg': invalid PT_DYNAMIC size (0xb8)
llvm-readelf: warning: 'arch/riscv/kernel/vdso/vdso.so.dbg': PT_DYNAMIC dynamic table is invalid: SHT_DYNAMIC will be used

I was able to narrow this down to CONFIG_INIT_STACK_ALL_PATTERN (which enables -ftrivial-auto-var-init=pattern) on top of defconfig, which is different from the default of CONFIG_INIT_STACK_ALL_ZERO:

$ printf 'CONFIG_%s\n' INIT_STACK_ALL_{PATTERN=y,ZERO=n} >kernel/configs/init_stack_pattern.config

$ make -skj"$(nproc)" ARCH=riscv LLVM=1 clean defconfig init_stack_pattern.config arch/riscv/kernel/vdso/
llvm-readelf: warning: 'arch/riscv/kernel/vdso/vdso.so.dbg': invalid PT_DYNAMIC size (0xb8)
llvm-readelf: warning: 'arch/riscv/kernel/vdso/vdso.so.dbg': PT_DYNAMIC dynamic table is invalid: SHT_DYNAMIC will be used

@MaskRay have you ever seen anything like this? There are a few times this warning has shown up before but I have never seen it until this point. Are there any recommendations for debugging this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    [ARCH] risc-vThis bug impacts ARCH=riscv[BUG] linuxA bug that should be fixed in the mainline kernel.[FIXED][LINUX] 6.16This bug was fixed in Linux 6.16[TOOL] llvm-readelfThe issue is relevant to LLVM readelf

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions