authorgravatar for 98892516+bilaliscarioth@users.noreply.github.combilaliscarioth <98892516+bilaliscarioth@users.noreply.github.com> 2024-08-23 16:28:00+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-08-23 14:28:00+00:00
logdf6907f6019ec178735f06e1b55cef6a90234201
tree8914376f5f96b03c058369886a716ef4b2a2785f
parent206e5e4d7d879d006c130aa8dbd3b769da356c11
signaturebadge-check Signed by PGP key B5690EEEBB952194

openbsd: adding EPERM for msync() against hitting a immutable region page (#18701)


1 files changed, 3 insertions(+), 0 deletions(-)

lib/std/posix.zig+3
......@@ -4746,11 +4746,13 @@ pub fn munmap(memory: []align(mem.page_size) const u8) void {
47464746
47474747pub const MSyncError = error{
47484748 UnmappedMemory,
4749 PermissionDenied,
47494750} || UnexpectedError;
47504751
47514752pub fn msync(memory: []align(mem.page_size) u8, flags: i32) MSyncError!void {
47524753 switch (errno(system.msync(memory.ptr, memory.len, flags))) {
47534754 .SUCCESS => return,
4755 .PERM => return error.PermissionDenied,
47544756 .NOMEM => return error.UnmappedMemory, // Unsuccessful, provided pointer does not point mapped memory
47554757 .INVAL => unreachable, // Invalid parameters.
47564758 else => unreachable,
......@@ -7106,6 +7108,7 @@ pub const MadviseError = error{
71067108pub fn madvise(ptr: [*]align(mem.page_size) u8, length: usize, advice: u32) MadviseError!void {
71077109 switch (errno(system.madvise(ptr, length, advice))) {
71087110 .SUCCESS => return,
7111 .PERM => return error.PermissionDenied,
71097112 .ACCES => return error.AccessDenied,
71107113 .AGAIN => return error.SystemResources,
71117114 .BADF => unreachable, // The map exists, but the area maps something that isn't a file.