aboutsummaryrefslogtreecommitdiff
path: root/atf-c++/detail/(public-mirror)
diff options
context:
space:
mode:
authorHayzam Sherif <hayzam@alchemilla.io>2026-11-09 03:06:11 +0000
committerKyle Evans <kevans@FreeBSD.org>2026-11-09 03:06:11 +0000
commitec6629628cbed2816f27aed8a6d5f9eb3521c1c1 (patch)
treee37ac9d70c04967d50eea9b4a0bf69fc9919fe9e /atf-c++/detail/(public-mirror)
parentedaa6ba7be8666d4f543317845899e1a1b684bbf (diff)
linux: Bound native getdents and getdents64 batchesHEADmain
linux_getdents() and linux_getdents64() round their native read size up to DEV_BSIZE before converting entries. For an unaligned caller buffer, the native batch can contain more entries than fit in the Linux buffer. Conversion then returns EINVAL even after copying complete entries, and the native read has already advanced the directory position. For counts of at least DEV_BSIZE, use min(args->count, MAXBSIZE) instead. A 768-byte request, such as rustix's initial directory read, now uses a 768-byte native buffer rather than 1024. The converted Linux dirent and dirent64 records are no larger than their native counterparts, so the whole translated batch fits. Returning a short batch is allowed, and consuming the whole native batch avoids needing to rewind the directory position. Keep the existing sizing for counts below DEV_BSIZE. This fixes the oversized-batch case in both getdents interfaces, including legacy getdents for 32-bit and 64-bit callers. The remaining small-buffer, copyout-failure and old single-entry readdir problems are outside the scope of this change. Fixes: 110f2567cb51 ("linux_file.c: Fix handling of NFS [...]") MFC after: 3 days Sponsored by: Alchemilla Ventures Private Limited Reviewed by: kevans, markj Differential Revision: https://reviews.freebsd.org/D60760
Diffstat (limited to 'atf-c++/detail/(public-mirror)')
0 files changed, 0 insertions, 0 deletions