fix(kernel): finish Posix -1/errno for file ops and open EACCES (#567)

Map UnauthorizedAccess on open to PERMISSION_DENIED and route Posix
lseek/pread/pwrite/rename/etc failures through PosixFailure so libc-style
callers get RAX=-1 plus TLS errno, matching open/read/write.
This commit is contained in:
Radu Ursache
2026-07-23 15:32:56 +03:00
committed by GitHub
parent d7bd814fb9
commit 956da769a3
3 changed files with 185 additions and 13 deletions
@@ -1558,7 +1558,7 @@ public static partial class KernelMemoryCompatExports
{
LogOpenTrace($"_open fail path='{guestPath}' host='{hostPath}' flags=0x{flags:X8} ex={ex.GetType().Name}: {ex.Message}");
return ex is UnauthorizedAccessException
? (int)OrbisGen2Result.ORBIS_GEN2_ERROR_INVALID_ARGUMENT
? (int)OrbisGen2Result.ORBIS_GEN2_ERROR_PERMISSION_DENIED
: (int)OrbisGen2Result.ORBIS_GEN2_ERROR_NOT_FOUND;
}
}
@@ -2228,8 +2228,7 @@ public static partial class KernelMemoryCompatExports
if (result != OrbisGen2Result.ORBIS_GEN2_OK)
{
ctx[CpuRegister.Rax] = ulong.MaxValue;
return (int)OrbisGen2Result.ORBIS_GEN2_OK;
return PosixFailure(ctx, (int)result, notFoundErrno: Ebadf);
}
ctx[CpuRegister.Rax] = unchecked((ulong)position);