motiejus/zig

fork of https://codeberg.org/ziglang/zig
git clone https://git.jakstys.lt/motiejus/zig.git
Log | Tree | Refs | README | LICENSE

commit f845fa04a0dce3104efe129c73a6ad792b1712b6 (tree)
parent a5d4ad17b716508c2e1a2c1c0cf0b32bed08e26f
Author: Alex Rønne Petersen <alex@alexrp.com>
Date:   Tue, 12 Nov 2024 16:59:22 +0100

std.debug: Gracefully handle process_vm_readv() EPERM in MemoryAccessor.read().

Closes #21815.

Diffstat:
Mlib/std/debug/MemoryAccessor.zig | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/std/debug/MemoryAccessor.zig b/lib/std/debug/MemoryAccessor.zig @@ -48,7 +48,8 @@ fn read(ma: *MemoryAccessor, address: usize, buf: []u8) bool { switch (linux.E.init(bytes_read)) { .SUCCESS => return bytes_read == buf.len, .FAULT => return false, - .INVAL, .PERM, .SRCH => unreachable, // own pid is always valid + .INVAL, .SRCH => unreachable, // own pid is always valid + .PERM => {}, // Known to happen in containers. .NOMEM => {}, .NOSYS => {}, // QEMU is known not to implement this syscall. else => unreachable, // unexpected