diff mbox series

bsd-user: freebsd/os-stat: fix getdents(2)

Message ID CABnABob99XZCBwsWYQKKjT3aMWzodAzmTMM6AB7utVz_un_9gQ@mail.gmail.com (mailing list archive)
State New
Headers show
Series bsd-user: freebsd/os-stat: fix getdents(2) | expand

Commit Message

Meowthink Feb. 13, 2025, 12:12 p.m. UTC
Syscall getdents(2) has been historically mistaken the pointer in the
loop. This influences aarch64 python3.12 built by cosmopolitan
/superconfigure thus been found out.

Signed-off-by: Meowthink <meowthink@googlemail.com>
---
 bsd-user/freebsd/os-stat.h | 1 +
 1 file changed, 1 insertion(+)


base-commit: de278e54aefed143526174335f8286f7437d20be
--
2.42.0

Comments

Meowthink Feb. 27, 2025, 1:18 p.m. UTC | #1
Ping for this patch:
https://patchew.org/QEMU/CABnABob99XZCBwsWYQKKjT3aMWzodAzmTMM6AB7utVz._5Fun._5F9gQ@mail.gmail.com/

Though not used by recent(__FreeBSD_version >= 1200000) base libc,
this syscall is used by concurrent (like the newest v4.0.2)
cosmopolitan libc. Wrong emulation leads to things like python in
superconfigure broken.
diff mbox series

Patch

diff --git a/bsd-user/freebsd/os-stat.h b/bsd-user/freebsd/os-stat.h
index 3bdc66aa98..5e14331e0b 100644
--- a/bsd-user/freebsd/os-stat.h
+++ b/bsd-user/freebsd/os-stat.h
@@ -475,6 +475,7 @@  static inline abi_long do_freebsd11_getdents(abi_long arg1,
             de->d_reclen = tswap16(reclen);
             de->d_fileno = tswap32(de->d_fileno);
             len -= reclen;
+            de = (struct freebsd11_dirent *)((void *)de + reclen);
         }
     }
     return ret;