cvs commit: src/sys/kern kern_descrip.c
Robert Watson
rwatson at FreeBSD.org
Thu May 29 07:56:48 UTC 2008
On Wed, 28 May 2008, Ed Schouten wrote:
> Remove redundant checks from fcntl()'s F_DUPFD.
>
> Right now we perform some of the checks inside the fcntl()'s F_DUPFD
> operation twice. We first validate the `fd' argument. When finished,
> we validate the `arg' argument. These checks are also performed inside
> do_dup().
>
> The reason we need to do this, is because fcntl() should return different
> errno's when the `arg' argument is out of bounds (EINVAL instead of
> EBADF). To prevent the redundant locking of the PROC_LOCK and
> FILEDESC_SLOCK, patch do_dup() to support the error semantics required
> by fcntl().
This sounds like a good candidate for a regression test -- do we have a
dup/dup2/F_DUPFD/F_DUP2FD test? If not, perhaps we should, in light of the
opportunity for further bugs and regressions.
Robert N M Watson
Computer Laboratory
University of Cambridge
More information about the cvs-src
mailing list