]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Replace Linuxulator implementation of readdir(), getdents() and
authordchagin <dchagin@FreeBSD.org>
Tue, 14 Feb 2017 19:13:27 +0000 (19:13 +0000)
committerdchagin <dchagin@FreeBSD.org>
Tue, 14 Feb 2017 19:13:27 +0000 (19:13 +0000)
commitbe921ed759376f17b28bc75e4ff910823ae124cb
treecb5e1bc9521490eefb390136e37300f2e6fb0afb
parent2ac5467a736e251972fb7e682c44cd5a0e823b00
Replace Linuxulator implementation of readdir(), getdents() and
getdents64() with wrapper over kern_getdirentries().

The patch was originally written by emaste@ and then adapted by trasz@
and me.

Note:
1. I divided linux_getdents() and linux_readdir() as in case when the
getdents() called with count = 1 (readdir() case) it can overwrite
user stack (by writing to user buffer pointer more than 1 byte).

2. Linux returns EINVAL in case when user supplied buffer is not enough
to contain fetched dirent.

3. Linux returns ENOTDIR in case when fd points to not a directory.

Reviewed by: trasz@
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D2210
sys/compat/linux/linux_file.c