Fix pledge rpath support for old getdents syscall (#804)

The rpath pledge as currently implemented in cosmopolitan does not
allow for usage of the old getdents syscall (0x4e), which is different
from the newer getdents syscall (0xd9) solely in that it does not
support 64-bit filesystems.

This means that, for example, old statically linked binaries cannot
use `readdir` and other such functions which use this syscall instead
of the more modern one, even though there is no threat in allowing
that syscall alongside the more modern one (except that the binary may
have issues with 64-bit filesystems, but that's a separate problem).

This patch fixes this.
This commit is contained in:
Gabriel Ravier 2023-04-18 01:15:01 +02:00 committed by GitHub
parent 6758c3f400
commit f7bccf5513
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View file

@ -292,6 +292,7 @@ static const struct thatispacked SyscallName {
{__NR_linux_epoll_wait, "epoll_wait"}, //
{__NR_linux_epoll_ctl, "epoll_ctl"}, //
{__NR_linux_getdents, "getdents"}, //
{__NR_linux_oldgetdents, "oldgetdents"}, //
{__NR_linux_set_tid_address, "set_tid_address"}, //
{__NR_linux_restart_syscall, "restart_syscall"}, //
{__NR_linux_semtimedop, "semtimedop"}, //
@ -582,6 +583,7 @@ static const uint16_t kPledgeRpath[] = {
__NR_linux_statfs, //
__NR_linux_fstatfs, //
__NR_linux_getdents, //
__NR_linux_oldgetdents, //
};
static const uint16_t kPledgeWpath[] = {