From owner-cvs-all@FreeBSD.ORG Thu May 29 07:56:48 2008 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC2621065677; Thu, 29 May 2008 07:56:48 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.freebsd.org (Postfix) with ESMTP id 97B648FC13; Thu, 29 May 2008 07:56:48 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 25D4446C2B; Thu, 29 May 2008 03:56:48 -0400 (EDT) Date: Thu, 29 May 2008 08:56:47 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Ed Schouten In-Reply-To: <200805282025.m4SKPJgY097901@repoman.freebsd.org> Message-ID: <20080529085549.J39873@fledge.watson.org> References: <200805282025.m4SKPJgY097901@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern kern_descrip.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 May 2008 07:56:48 -0000 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