authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-11-12 16:59:22+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-11-20 23:07:46+01:00
logf845fa04a0dce3104efe129c73a6ad792b1712b6
tree0b9437ada093d4a84e8450b97caf72cb3c658855
parenta5d4ad17b716508c2e1a2c1c0cf0b32bed08e26f

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

Closes #21815.

1 files changed, 2 insertions(+), 1 deletions(-)

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