From owner-svn-src-all@FreeBSD.ORG Mon Apr 13 11:56:20 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D45B3106564A; Mon, 13 Apr 2009 11:56:20 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id AEC3D8FC18; Mon, 13 Apr 2009 11:56:20 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 5469C46B09; Mon, 13 Apr 2009 07:56:20 -0400 (EDT) Date: Mon, 13 Apr 2009 12:56:20 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org In-Reply-To: <200904131154.n3DBsMI2071073@svn.freebsd.org> Message-ID: References: <200904131154.n3DBsMI2071073@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Subject: Re: svn commit: r190997 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2009 11:56:21 -0000 On Mon, 13 Apr 2009, Robert Watson wrote: > Author: rwatson > Date: Mon Apr 13 11:54:22 2009 > New Revision: 190997 > URL: http://svn.freebsd.org/changeset/base/190997 > > Log: > Merge r190996 from head to stable/7: Due to a clerical error, this is not the right revision number. The actual merged revision is r189708. Robert N M Watson Computer Laboratory University of Cambridge > > When writing out updated pollfd records when returning from > poll(), only copy out the revents field, not the whole pollfd > structure. Otherwise, if the events field is updated > concurrently by another thread, that update may be lost. > > This issue apparently causes problems for the JDK on FreeBSD, > which expects the Linux behavior of not updating all fields > (somewhat oddly, Solaris does not implement the required > behavior, but presumably our adaptation of the JDK is based > on the Linux port?). > > MFC after: 2 weeks > PR: kern/130924 > Submitted by: Kurt Miller > Discussed with: kib > > Approved by: re (kib) > > Modified: > stable/7/sys/ (props changed) > stable/7/sys/contrib/pf/ (props changed) > stable/7/sys/dev/ath/ath_hal/ (props changed) > stable/7/sys/dev/cxgb/ (props changed) > stable/7/sys/kern/sys_generic.c > > Modified: stable/7/sys/kern/sys_generic.c > ============================================================================== > --- stable/7/sys/kern/sys_generic.c Mon Apr 13 10:41:41 2009 (r190996) > +++ stable/7/sys/kern/sys_generic.c Mon Apr 13 11:54:22 2009 (r190997) > @@ -73,6 +73,7 @@ static MALLOC_DEFINE(M_IOCTLOPS, "ioctlo > static MALLOC_DEFINE(M_SELECT, "select", "select() buffer"); > MALLOC_DEFINE(M_IOV, "iov", "large iov's"); > > +static int pollout(struct pollfd *, struct pollfd *, u_int); > static int pollscan(struct thread *, struct pollfd *, u_int); > static int selscan(struct thread *, fd_mask **, fd_mask **, int); > static int dofileread(struct thread *, int, struct file *, struct uio *, > @@ -992,7 +993,7 @@ done_nosellock: > if (error == EWOULDBLOCK) > error = 0; > if (error == 0) { > - error = copyout(bits, uap->fds, ni); > + error = pollout(bits, uap->fds, nfds); > if (error) > goto out; > } > @@ -1004,6 +1005,26 @@ done2: > } > > static int > +pollout(fds, ufds, nfd) > + struct pollfd *fds; > + struct pollfd *ufds; > + u_int nfd; > +{ > + int error = 0; > + u_int i = 0; > + > + for (i = 0; i < nfd; i++) { > + error = copyout(&fds->revents, &ufds->revents, > + sizeof(ufds->revents)); > + if (error) > + return (error); > + fds++; > + ufds++; > + } > + return (0); > +} > + > +static int > pollscan(td, fds, nfd) > struct thread *td; > struct pollfd *fds; >