Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 May 2008 08:56:47 +0100 (BST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Ed Schouten <ed@FreeBSD.org>
Cc:        cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/kern kern_descrip.c
Message-ID:  <20080529085549.J39873@fledge.watson.org>
In-Reply-To: <200805282025.m4SKPJgY097901@repoman.freebsd.org>
References:  <200805282025.m4SKPJgY097901@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080529085549.J39873>