Skip to content

integer cast truncated bits in Dwarf.zig in kernel mode #23925

@Khitiara

Description

@Khitiara

Zig Version

0.14.0

Steps to Reproduce and Observed Behavior

When using eh_frame for stack traces in a kernel-mode binary, https://github.com/ziglang/zig/blob/0.14.0/lib/std/debug/Dwarf.zig#L2088 tries to cast a kernel-mode address (a usize with the top bit set) to an i64, which cannot represent the full data. This issue is unfortunately really hard to debug, as it affects debugging itself including the necessary stack traces, but running zig build qemu -Doptimize=ReleaseSafe on the agony branch of my imaginarium project after a recursive clone is enough to demonstrate.

Expected Behavior

No panic to be generated and the addition to proceed normally. I think using i65 instead of i64 may be sufficient in this case and will test but Im uncertain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions