From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 00:17:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 15BEA1D1; Sun, 26 Oct 2014 00:17:10 +0000 (UTC) Received: from mail-wi0-x230.google.com (mail-wi0-x230.google.com [IPv6:2a00:1450:400c:c05::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 094D0D7A; Sun, 26 Oct 2014 00:17:08 +0000 (UTC) Received: by mail-wi0-f176.google.com with SMTP id n3so3729377wiv.9 for ; Sat, 25 Oct 2014 17:17:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=IiK53L133t+gOtcIE+Q0teG2KjkOPayAi53a3xSN3cY=; b=aLVHkjF/HlGwcT3so+DhZkF2/LsQji1shDl/9SzLzUB6TCxoAbecNxl545XIPWQGoF +7f86V95fPRXGL2IyxGTwYts09Dp/Lfu9lH+Dd1Rc8FEjU86SIhw73uwGAaD8ioc/n5S wb95xfraUF2cHpa8sv8dzLvjobx12TdrG4UtgAITPOlLBi6pDXdB+irfF7wAcvTrZ7eK J9dDEYvbrW69WtcqdC+ei8Djpy1MP0t4C56APrhukKNEYqaUQbMdAK3X/5lzm3J/Mguo Va5A37gI0CxHSD2nEgjlGJR5/Adv2emImdnCk2BQ/WUfZZ/1SQulY90a3KrQzOJrJFMw GQ3Q== X-Received: by 10.180.90.34 with SMTP id bt2mr12793652wib.58.1414282627321; Sat, 25 Oct 2014 17:17:07 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by mx.google.com with ESMTPSA id ex6sm10226788wjb.20.2014.10.25.17.17.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Oct 2014 17:17:06 -0700 (PDT) Sender: Baptiste Daroussin Date: Sun, 26 Oct 2014 02:17:04 +0200 From: Baptiste Daroussin To: Andrey Chernov Subject: Re: svn commit: r273601 - head/lib/libc/gen Message-ID: <20141026001704.GA55021@ivaldir.etoilebsd.net> References: <201410241955.s9OJtnbm014234@svn.freebsd.org> <544B0930.8010004@freebsd.org> <544B1C34.1020204@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EeQfGwPcQSOJBaQU" Content-Disposition: inline In-Reply-To: <544B1C34.1020204@freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 00:17:10 -0000 --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Oct 25, 2014 at 07:42:44AM +0400, Andrey Chernov wrote: > On 25.10.2014 6:21, Andrey Chernov wrote: > > On 24.10.2014 23:55, John Baldwin wrote: > >> Author: jhb > >> Date: Fri Oct 24 19:55:49 2014 > >> New Revision: 273601 > >> URL: https://svnweb.freebsd.org/changeset/base/273601 > >> > >> Log: > >> Don't reference sem(4) from the POSIX semaphore pages. POSIX semaph= ores > >> were reimplemented using umtx in FreeBSD 9 and no longer use sem(4). > >=20 > > sem kernel module referenced in sem(4) uses the same uipc_sem.c file as > > kernel's P1003_1B_SEMAPHORES option, so they both use the same code and > > better be cross-linked since sem(4) explains how to turn it on. > >=20 >=20 > From the first glance I can't determine, is libc implementation better > than kernel one or not. BTW, firefox port still recommends sem_load=3D"YE= S" >=20 Firefox still recommands sem_load because we still support FreeBSD 8. regards, Bapt --EeQfGwPcQSOJBaQU Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlRMPYAACgkQ8kTtMUmk6ExlpACfVPHv8Kx17HEBlHneJsP+Pv23 a2gAnR7AzWndDB1FISugoPBgyE4i9U9S =WtYy -----END PGP SIGNATURE----- --EeQfGwPcQSOJBaQU-- From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 01:41:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5FB14DAD; Sun, 26 Oct 2014 01:41:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3222D780; Sun, 26 Oct 2014 01:41:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9Q1ftaI057853; Sun, 26 Oct 2014 01:41:55 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9Q1ft59057852; Sun, 26 Oct 2014 01:41:55 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410260141.s9Q1ft59057852@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sun, 26 Oct 2014 01:41:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273653 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 01:41:55 -0000 Author: gjb Date: Sun Oct 26 01:41:54 2014 New Revision: 273653 URL: https://svnweb.freebsd.org/changeset/base/273653 Log: Fix a few issues with creating VOLUME_LABEL for the installation ISOs: - TYPE, BRANCH, and REVISION are only defined if OSRELEASE is not defined, so in situations where one might set OSRELEASE for an in-house ISO build, VOLUME_LABEL would be empty. - makefs(8) limits the volume label to 32 characters, which for the powerpc64 case, OSRELEASE expands to FreeBSD-11.0-CURRENT-powerpc-powerpc64. Even with removing the prefixing 'FreeBSD-', the string is 30 characters long, leaving zero room for suffixing the type of ISO media (BO for bootonly, CD for cdrom, and DVD for dvdrom). Resolve these by defining VOLUME_LABEL when defining OSRELEASE if unset. If OSRELEASE is defined by the builder, use the OSRELEASE from that definition as the VOLUME_LABEL. In addition, for cases where both TARGET and TARGET_ARCH are used for the VOLUME_LABEL, use TARGET_ARCH if it differs from TARGET. There are probably a few sharp edges here yet, but these problems are going to affect the powerpc/powerpc64 builds for 10.1-RELEASE, so the immediate concern is fixing the underlying problem at hand quickly, and less so about the elegance of the fix. MFC after: 3 days X-MFC-10.1: yes, asap Sponsored by: The FreeBSD Foundation Modified: head/release/Makefile Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Sun Oct 26 01:30:46 2014 (r273652) +++ head/release/Makefile Sun Oct 26 01:41:54 2014 (r273653) @@ -56,13 +56,17 @@ ${_V}!= eval $$(awk '/^${_V}=/{print}' $ .for _V in ${TARGET_ARCH} .if !empty(TARGET:M${_V}) OSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET} +VOLUME_LABEL= ${REVISION:C/\./_/g:}_${BRANCH}_${TARGET} .else OSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET}-${TARGET_ARCH} +VOLUME_LABEL= ${REVISION:C/\./_/g:}_${BRANCH}_${TARGET_ARCH} .endif .endfor .endif -VOLUME_LABEL= ${OSRELEASE:C/[-\.]/_/g:S/^$${TYPE}_//} +.if !defined(VOLUME_LABEL) || empty(VOLUME_LABEL) +VOLUME_LABEL= FreeBSD_Install +.endif .if !exists(${DOCDIR}) NODOC= true From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 01:47:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 188A6F6A; Sun, 26 Oct 2014 01:47:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0497279D; Sun, 26 Oct 2014 01:47:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9Q1ltj1059419; Sun, 26 Oct 2014 01:47:55 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9Q1ltCW059418; Sun, 26 Oct 2014 01:47:55 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410260147.s9Q1ltCW059418@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 26 Oct 2014 01:47:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273654 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 01:47:56 -0000 Author: mjg Date: Sun Oct 26 01:47:55 2014 New Revision: 273654 URL: https://svnweb.freebsd.org/changeset/base/273654 Log: Now that sysctl_root is only called with sysctl lock in shared mode, update its assertion to require that. Update comment missed in r273400: sysctl_xlock/unlock -> sysctl_xlock/xunlock Noted by: jhb Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Sun Oct 26 01:41:54 2014 (r273653) +++ head/sys/kern/kern_sysctl.c Sun Oct 26 01:47:55 2014 (r273654) @@ -77,7 +77,7 @@ static MALLOC_DEFINE(M_SYSCTLTMP, "sysct * The sysctllock protects the MIB tree. It also protects sysctl * contexts used with dynamic sysctls. The sysctl_register_oid() and * sysctl_unregister_oid() routines require the sysctllock to already - * be held, so the sysctl_lock() and sysctl_unlock() routines are + * be held, so the sysctl_xlock() and sysctl_xunlock() routines are * provided for the few places in the kernel which need to use that * API rather than using the dynamic API. Use of the dynamic API is * strongly encouraged for most code. @@ -96,6 +96,7 @@ static struct sx sysctlmemlock; #define SYSCTL_XLOCKED() sx_xlocked(&sysctllock) #define SYSCTL_ASSERT_LOCKED() sx_assert(&sysctllock, SA_LOCKED) #define SYSCTL_ASSERT_XLOCKED() sx_assert(&sysctllock, SA_XLOCKED) +#define SYSCTL_ASSERT_SLOCKED() sx_assert(&sysctllock, SA_SLOCKED) #define SYSCTL_INIT() sx_init(&sysctllock, "sysctl lock") #define SYSCTL_SLEEP(ch, wmesg, timo) \ sx_sleep(ch, &sysctllock, 0, wmesg, timo) @@ -1572,7 +1573,7 @@ sysctl_root(SYSCTL_HANDLER_ARGS) struct sysctl_oid *oid; int error, indx, lvl; - SYSCTL_ASSERT_LOCKED(); + SYSCTL_ASSERT_SLOCKED(); error = sysctl_find_oid(arg1, arg2, &oid, &indx, req); if (error) From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 01:57:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8E5D918D; Sun, 26 Oct 2014 01:57:49 +0000 (UTC) Received: from mail-wi0-x229.google.com (mail-wi0-x229.google.com [IPv6:2a00:1450:400c:c05::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 88EC085B; Sun, 26 Oct 2014 01:57:48 +0000 (UTC) Received: by mail-wi0-f169.google.com with SMTP id q5so3640091wiv.4 for ; Sat, 25 Oct 2014 18:57:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=gX7VvKB62yHOXwxNN+qbvMdM7Z6HvpOFLbPRtRhjAno=; b=kW+AqYZMXvKr9us1mzEYaVJpi4s6hU0tDiBa+00jJMC7RI0ycDQSpkkHih2oh8tCkv 5AD3JhBFirWVOvw4qAT1TjYrvjoOof0XNs3ho5rZsqIIVnAw+VrbP/iFsujQwhu1LPUD BtDow/V7RgA62RHrx1vWFyjLpFeCPQgtFEDRihp3Qd53/Ce+9030iZuarrFrfcQG71Bg NazCDLr+YY5jUEkSwZ0tFnnoZuCdEOjtFn3YIuTrwvCtXyz+9R+jswcKB+rV1nytcABs lrNa6H5bqor3F4UenIz4cYjdmrPmre0irPaHxCyzGXdu/lsa5BYUUFcMYRxuG7JM00bG NtrQ== X-Received: by 10.194.81.6 with SMTP id v6mr13863769wjx.39.1414288666905; Sat, 25 Oct 2014 18:57:46 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id ic4sm6723470wid.19.2014.10.25.18.57.45 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 25 Oct 2014 18:57:45 -0700 (PDT) Date: Sun, 26 Oct 2014 02:57:43 +0100 From: Mateusz Guzik To: John Baldwin Subject: Re: svn commit: r273401 - head/sys/kern Message-ID: <20141026015743.GE19066@dft-labs.eu> References: <201410211905.s9LJ5jDb032492@svn.freebsd.org> <201410231214.04027.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201410231214.04027.jhb@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 01:57:49 -0000 On Thu, Oct 23, 2014 at 12:14:03PM -0400, John Baldwin wrote: > On Tuesday, October 21, 2014 3:05:45 pm Mateusz Guzik wrote: > > Author: mjg > > Date: Tue Oct 21 19:05:44 2014 > > New Revision: 273401 > > URL: https://svnweb.freebsd.org/changeset/base/273401 > > > > Log: > > Implement shared locking for sysctl. > > A bit more detail in this message was warranted. We had some shared locking > in the past (r192125) but it was subsequently reverted (r216060). > > In particular, explaining how you fixed the part of 216060 that caused the > shared locking to be reverted would have answered Bjoern's earlier question as > well. It's important that log messages not only explain what they are doing, > but why they are doing so. (For exmaple, it would have been nice if 216060 > had explained why it was reverting the shared locking in its log message, but > it didn't. :( ) > > I think that you fixed the issues by a combination of using sysctl_lock/unlock > to handle shared vs exclusive locking for the caller and you used atomic ops > on the running count (previously the xlock allowed use of non-atomic ops on > the running count). > I agree that commit message is quite lacking in detail, in retrospect I should have written a thing or two. So yes, in short mutual exclusion between threads disabling sysctls and ones going through them is retained. And accuracy of the counter is ensured with the use of atomic ops. > sysctl_root() is now only called with a shared lock held, so you should change > its assertion accordingly. sysctl_register_oid() is still called with the > xlock held, so you can't remove the sysctl_lock() stuff from > sysctl_root_handler_locked() entirely. OTOH, there is a stale comment in > kern_sysctl.c about having a public sysctl_lock/unlock API that you can just > remove. Also, given that sysctl_lock/unlock are only used in > sysctl_root_handler_locked(), I would probably remove them and just inline > them in the one place they are needed. I addressed stuff in https://svnweb.freebsd.org/changeset/base/273654 , although the comment needed altering and not removing. I specifically added sysctl_lock/unlock so that next folk with similar usecse will not have to. So I'm not going to remove it, but if you really don't like it feel free to do it. > > Finally, getting pre-commit review is fairly easy these days with phabricator > and would allow you to have had all these things noted and addressed before it > went into the tree. > yeah, I actually do ask for review more often than not. :) -- Mateusz Guzik From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 03:03:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 752B34F3; Sun, 26 Oct 2014 03:03:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48A39E2A; Sun, 26 Oct 2014 03:03:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9Q33gwa008647; Sun, 26 Oct 2014 03:03:42 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9Q33gmX008646; Sun, 26 Oct 2014 03:03:42 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201410260303.s9Q33gmX008646@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Sun, 26 Oct 2014 03:03:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273666 - head/sys/amd64/vmm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 03:03:42 -0000 Author: neel Date: Sun Oct 26 03:03:41 2014 New Revision: 273666 URL: https://svnweb.freebsd.org/changeset/base/273666 Log: Don't pass the 'error' return from an I/O port handler directly to vm_run(). Most I/O port handlers return -1 to signal an error. If this value is returned without modification to vm_run() then it leads to incorrect behavior because '-1' is interpreted as ERESTART at the system call level. Fix this by always returning EIO to signal an error from an I/O port handler. MFC after: 1 week Modified: head/sys/amd64/vmm/vmm_ioport.c Modified: head/sys/amd64/vmm/vmm_ioport.c ============================================================================== --- head/sys/amd64/vmm/vmm_ioport.c Sun Oct 26 02:53:23 2014 (r273665) +++ head/sys/amd64/vmm/vmm_ioport.c Sun Oct 26 03:03:41 2014 (r273666) @@ -106,15 +106,14 @@ emulate_inout_port(struct vm *vm, int vc uint32_t mask, val; int error; - error = 0; - *retu = true; - - if (vmexit->u.inout.port >= MAX_IOPORTS) - goto done; - - handler = ioport_handler[vmexit->u.inout.port]; - if (handler == NULL) - goto done; + /* + * If there is no handler for the I/O port then punt to userspace. + */ + if (vmexit->u.inout.port >= MAX_IOPORTS || + (handler = ioport_handler[vmexit->u.inout.port]) == NULL) { + *retu = true; + return (0); + } mask = vie_size2mask(vmexit->u.inout.bytes); @@ -124,20 +123,27 @@ emulate_inout_port(struct vm *vm, int vc error = (*handler)(vm, vcpuid, vmexit->u.inout.in, vmexit->u.inout.port, vmexit->u.inout.bytes, &val); + if (error) { + /* + * The value returned by this function is also the return value + * of vm_run(). This needs to be a positive number otherwise it + * can be interpreted as a "pseudo-error" like ERESTART. + * + * Enforce this by mapping all errors to EIO. + */ + return (EIO); + } - if (!error) { - *retu = false; - if (vmexit->u.inout.in) { - vmexit->u.inout.eax &= ~mask; - vmexit->u.inout.eax |= val & mask; - error = vm_set_register(vm, vcpuid, - VM_REG_GUEST_RAX, vmexit->u.inout.eax); - KASSERT(error == 0, ("emulate_ioport: error %d " - "setting guest rax register", error)); - } + if (vmexit->u.inout.in) { + vmexit->u.inout.eax &= ~mask; + vmexit->u.inout.eax |= val & mask; + error = vm_set_register(vm, vcpuid, VM_REG_GUEST_RAX, + vmexit->u.inout.eax); + KASSERT(error == 0, ("emulate_ioport: error %d setting guest " + "rax register", error)); } -done: - return (error); + *retu = false; + return (0); } static int From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 04:21:15 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E52FDC9; Sun, 26 Oct 2014 04:21:14 +0000 (UTC) Received: from smtp1.multiplay.co.uk (smtp1.multiplay.co.uk [85.236.96.35]) by mx1.freebsd.org (Postfix) with ESMTP id ACB1974F; Sun, 26 Oct 2014 04:21:14 +0000 (UTC) Received: by smtp1.multiplay.co.uk (Postfix, from userid 65534) id 35AD320E7088C; Sun, 26 Oct 2014 04:21:07 +0000 (UTC) Received: from [10.10.1.68] (82-69-141-170.dsl.in-addr.zen.co.uk [82.69.141.170]) by smtp1.multiplay.co.uk (Postfix) with ESMTP id 1DB5A20E70886; Sun, 26 Oct 2014 04:21:06 +0000 (UTC) Message-ID: <544C7722.1080201@freebsd.org> Date: Sun, 26 Oct 2014 04:22:58 +0000 From: Steven Hartland User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Garrett Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r273630 - head/tools/regression/zfs/zpool/add References: <201410250610.s9P6A2GP001878@svn.freebsd.org> In-Reply-To: <201410250610.s9P6A2GP001878@svn.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 04:21:15 -0000 Its not clear from this why you elected to disable the test and hide the issue instead of fixing the panic cause, could you clarify please? On 25/10/2014 07:10, Garrett Cooper wrote: > Author: ngie > Date: Sat Oct 25 06:10:01 2014 > New Revision: 273630 > URL: https://svnweb.freebsd.org/changeset/base/273630 > > Log: > Bail out of the script on FreeBSD due to deterministic panic issue > > PR: 191573 > Sponsored by: EMC / Isilon Storage Division > > Modified: > head/tools/regression/zfs/zpool/add/files.t > > Modified: head/tools/regression/zfs/zpool/add/files.t > ============================================================================== > --- head/tools/regression/zfs/zpool/add/files.t Sat Oct 25 05:56:21 2014 (r273629) > +++ head/tools/regression/zfs/zpool/add/files.t Sat Oct 25 06:10:01 2014 (r273630) > @@ -4,6 +4,8 @@ > dir=`dirname $0` > . ${dir}/../../misc.sh > > +[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 191573" > + > echo "1..54" > > files_create 8 > > > From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 04:44:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 77B6F33B; Sun, 26 Oct 2014 04:44:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 623738CB; Sun, 26 Oct 2014 04:44:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9Q4iVub058059; Sun, 26 Oct 2014 04:44:31 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9Q4iT53058052; Sun, 26 Oct 2014 04:44:29 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201410260444.s9Q4iT53058052@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Sun, 26 Oct 2014 04:44:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273683 - in head: sys/amd64/include sys/amd64/vmm sys/amd64/vmm/io sys/modules/vmm usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 04:44:31 -0000 Author: neel Date: Sun Oct 26 04:44:28 2014 New Revision: 273683 URL: https://svnweb.freebsd.org/changeset/base/273683 Log: Move the ACPI PM timer emulation into vmm.ko. This reduces variability during timer calibration by keeping the emulation "close" to the guest. Additionally having all timer emulations in the kernel will ease the transition to a per-VM clock source (as opposed to using the host's uptime keep track of time). Discussed with: grehan Added: head/sys/amd64/vmm/io/vpmtmr.c (contents, props changed) head/sys/amd64/vmm/io/vpmtmr.h (contents, props changed) Deleted: head/usr.sbin/bhyve/pmtmr.c Modified: head/sys/amd64/include/vmm.h head/sys/amd64/vmm/vmm.c head/sys/amd64/vmm/vmm_ioport.c head/sys/modules/vmm/Makefile head/usr.sbin/bhyve/Makefile Modified: head/sys/amd64/include/vmm.h ============================================================================== --- head/sys/amd64/include/vmm.h Sun Oct 26 04:17:20 2014 (r273682) +++ head/sys/amd64/include/vmm.h Sun Oct 26 04:44:28 2014 (r273683) @@ -285,6 +285,7 @@ int vm_assign_pptdev(struct vm *vm, int int vm_unassign_pptdev(struct vm *vm, int bus, int slot, int func); struct vatpic *vm_atpic(struct vm *vm); struct vatpit *vm_atpit(struct vm *vm); +struct vpmtmr *vm_pmtmr(struct vm *vm); /* * Inject exception 'vme' into the guest vcpu. This function returns 0 on Added: head/sys/amd64/vmm/io/vpmtmr.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/vmm/io/vpmtmr.c Sun Oct 26 04:44:28 2014 (r273683) @@ -0,0 +1,104 @@ +/*- + * Copyright (c) 2014, Neel Natu (neel@freebsd.org) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include + +#include "vpmtmr.h" + +/* + * The ACPI Power Management timer is a free-running 24- or 32-bit + * timer with a frequency of 3.579545MHz + * + * This implementation will be 32-bits + */ + +#define PMTMR_FREQ 3579545 /* 3.579545MHz */ + +struct vpmtmr { + sbintime_t freq_sbt; + sbintime_t baseuptime; + uint32_t baseval; +}; + +static MALLOC_DEFINE(M_VPMTMR, "vpmtmr", "bhyve virtual acpi timer"); + +struct vpmtmr * +vpmtmr_init(struct vm *vm) +{ + struct vpmtmr *vpmtmr; + struct bintime bt; + + vpmtmr = malloc(sizeof(struct vpmtmr), M_VPMTMR, M_WAITOK | M_ZERO); + vpmtmr->baseuptime = sbinuptime(); + vpmtmr->baseval = 0; + + FREQ2BT(PMTMR_FREQ, &bt); + vpmtmr->freq_sbt = bttosbt(bt); + + return (vpmtmr); +} + +void +vpmtmr_cleanup(struct vpmtmr *vpmtmr) +{ + + free(vpmtmr, M_VPMTMR); +} + +int +vpmtmr_handler(void *vm, int vcpuid, bool in, int port, int bytes, + uint32_t *val) +{ + struct vpmtmr *vpmtmr; + sbintime_t now, delta; + + if (!in || bytes != 4) + return (-1); + + vpmtmr = vm_pmtmr(vm); + + /* + * No locking needed because 'baseuptime' and 'baseval' are + * written only during initialization. + */ + now = sbinuptime(); + delta = now - vpmtmr->baseuptime; + KASSERT(delta >= 0, ("vpmtmr_handler: uptime went backwards: " + "%#lx to %#lx", vpmtmr->baseuptime, now)); + *val = vpmtmr->baseval + delta / vpmtmr->freq_sbt; + + return (0); +} Added: head/sys/amd64/vmm/io/vpmtmr.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/vmm/io/vpmtmr.h Sun Oct 26 04:44:28 2014 (r273683) @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2014 Neel Natu (neel@freebsd.org) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _VPMTMR_H_ +#define _VPMTMR_H_ + +#define IO_PMTMR 0x408 + +struct vpmtmr; + +struct vpmtmr *vpmtmr_init(struct vm *vm); +void vpmtmr_cleanup(struct vpmtmr *pmtmr); + +int vpmtmr_handler(void *vm, int vcpuid, bool in, int port, int bytes, + uint32_t *val); + +#endif Modified: head/sys/amd64/vmm/vmm.c ============================================================================== --- head/sys/amd64/vmm/vmm.c Sun Oct 26 04:17:20 2014 (r273682) +++ head/sys/amd64/vmm/vmm.c Sun Oct 26 04:44:28 2014 (r273683) @@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$"); #include "vhpet.h" #include "vioapic.h" #include "vlapic.h" +#include "vpmtmr.h" #include "vmm_ipi.h" #include "vmm_stat.h" #include "vmm_lapic.h" @@ -134,6 +135,7 @@ struct vm { struct vioapic *vioapic; /* (i) virtual ioapic */ struct vatpic *vatpic; /* (i) virtual atpic */ struct vatpit *vatpit; /* (i) virtual atpit */ + struct vpmtmr *vpmtmr; /* (i) virtual ACPI PM timer */ volatile cpuset_t active_cpus; /* (i) active vcpus */ int suspend; /* (i) stop VM execution */ volatile cpuset_t suspended_cpus; /* (i) suspended vcpus */ @@ -360,6 +362,7 @@ vm_init(struct vm *vm, bool create) vm->vhpet = vhpet_init(vm); vm->vatpic = vatpic_init(vm); vm->vatpit = vatpit_init(vm); + vm->vpmtmr = vpmtmr_init(vm); CPU_ZERO(&vm->active_cpus); @@ -422,6 +425,7 @@ vm_cleanup(struct vm *vm, bool destroy) if (vm->iommu != NULL) iommu_destroy_domain(vm->iommu); + vpmtmr_cleanup(vm->vpmtmr); vatpit_cleanup(vm->vatpit); vhpet_cleanup(vm->vhpet); vatpic_cleanup(vm->vatpic); @@ -2199,6 +2203,13 @@ vm_atpit(struct vm *vm) return (vm->vatpit); } +struct vpmtmr * +vm_pmtmr(struct vm *vm) +{ + + return (vm->vpmtmr); +} + enum vm_reg_name vm_segment_name(int seg) { Modified: head/sys/amd64/vmm/vmm_ioport.c ============================================================================== --- head/sys/amd64/vmm/vmm_ioport.c Sun Oct 26 04:17:20 2014 (r273682) +++ head/sys/amd64/vmm/vmm_ioport.c Sun Oct 26 04:44:28 2014 (r273683) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include "vatpic.h" #include "vatpit.h" +#include "vpmtmr.h" #include "vmm_ioport.h" #include "vmm_ktr.h" @@ -58,6 +59,7 @@ ioport_handler_func_t ioport_handler[MAX [IO_ICU2 + ICU_IMR_OFFSET] = vatpic_slave_handler, [IO_ELCR1] = vatpic_elc_handler, [IO_ELCR2] = vatpic_elc_handler, + [IO_PMTMR] = vpmtmr_handler, }; #ifdef KTR Modified: head/sys/modules/vmm/Makefile ============================================================================== --- head/sys/modules/vmm/Makefile Sun Oct 26 04:17:20 2014 (r273682) +++ head/sys/modules/vmm/Makefile Sun Oct 26 04:44:28 2014 (r273683) @@ -33,7 +33,8 @@ SRCS+= iommu.c \ vatpit.c \ vhpet.c \ vioapic.c \ - vlapic.c + vlapic.c \ + vpmtmr.c # intel-specific files .PATH: ${.CURDIR}/../../amd64/vmm/intel Modified: head/usr.sbin/bhyve/Makefile ============================================================================== --- head/usr.sbin/bhyve/Makefile Sun Oct 26 04:17:20 2014 (r273682) +++ head/usr.sbin/bhyve/Makefile Sun Oct 26 04:44:28 2014 (r273683) @@ -31,7 +31,6 @@ SRCS= \ pci_virtio_rnd.c \ pci_uart.c \ pm.c \ - pmtmr.c \ post.c \ rtc.c \ smbiostbl.c \ From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 05:39:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D645C60C; Sun, 26 Oct 2014 05:39:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C328FC3C; Sun, 26 Oct 2014 05:39:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9Q5dgGr081656; Sun, 26 Oct 2014 05:39:42 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9Q5dgQH081655; Sun, 26 Oct 2014 05:39:42 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410260539.s9Q5dgQH081655@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 26 Oct 2014 05:39:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273684 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 05:39:42 -0000 Author: mjg Date: Sun Oct 26 05:39:42 2014 New Revision: 273684 URL: https://svnweb.freebsd.org/changeset/base/273684 Log: Use a temporary buffer in sys_setgroups for requests with <= XU_NGROUPS groups. Submitted by: Tiwei Bie X-Additional: JuniorJobs project MFC after: 2 weeks Modified: head/sys/kern/kern_prot.c Modified: head/sys/kern/kern_prot.c ============================================================================== --- head/sys/kern/kern_prot.c Sun Oct 26 04:44:28 2014 (r273683) +++ head/sys/kern/kern_prot.c Sun Oct 26 05:39:42 2014 (r273684) @@ -806,17 +806,24 @@ int sys_setgroups(struct thread *td, struct setgroups_args *uap) { gid_t *groups = NULL; + gid_t smallgroups[XU_NGROUPS]; + u_int gidsetsize; int error; - if (uap->gidsetsize > ngroups_max + 1) + gidsetsize = uap->gidsetsize; + if (gidsetsize > ngroups_max + 1) return (EINVAL); - groups = malloc(uap->gidsetsize * sizeof(gid_t), M_TEMP, M_WAITOK); - error = copyin(uap->gidset, groups, uap->gidsetsize * sizeof(gid_t)); + if (gidsetsize > XU_NGROUPS) + groups = malloc(gidsetsize * sizeof(gid_t), M_TEMP, M_WAITOK); + else + groups = smallgroups; + error = copyin(uap->gidset, groups, gidsetsize * sizeof(gid_t)); if (error) goto out; - error = kern_setgroups(td, uap->gidsetsize, groups); + error = kern_setgroups(td, gidsetsize, groups); out: - free(groups, M_TEMP); + if (gidsetsize > XU_NGROUPS) + free(groups, M_TEMP); return (error); } From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 05:41:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D4477770; Sun, 26 Oct 2014 05:41:51 +0000 (UTC) Received: from mail-lb0-x22c.google.com (mail-lb0-x22c.google.com [IPv6:2a00:1450:4010:c04::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9F0C1CD8; Sun, 26 Oct 2014 05:41:50 +0000 (UTC) Received: by mail-lb0-f172.google.com with SMTP id n15so418578lbi.31 for ; Sat, 25 Oct 2014 22:41:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=eqLMvO1IGVX16jwCdbIERTdxWd9XNph5Pz+egGDCgX4=; b=Bi5F2PGNuXbxlytaAF01gwLurm0rYddQ8j9Qqqp6Sr2CUgzUX3+kTPqFqKP0jzBmKu pQfK271iAsJ+WKlsexpa63dpl2XsJ7M6I3SPJA7jhqXll4+ZhYwI7iwqEPMa2zPKlDad TA3QzxoVLK60LaW/CoYJlgMfwVdXkP4D9DE4GV49NxUCj4V/IVwGi0Nk+qF9iaJy/cTU aYv4KKW3OYkxJurQNrfJHZ+r5jNiFdluJjaL3jwP+y3VUse7hgVoabJrzIHLLDKQtAZZ iNNT0Zyw1oS8JnIPLGquBCnprGQ6PbGGKyW5zK7fLy7wx3fo3i1Li6bSnd5HUtM1qO3y acvQ== MIME-Version: 1.0 X-Received: by 10.152.27.38 with SMTP id q6mr323632lag.92.1414302108329; Sat, 25 Oct 2014 22:41:48 -0700 (PDT) Sender: crodr001@gmail.com Received: by 10.112.84.197 with HTTP; Sat, 25 Oct 2014 22:41:48 -0700 (PDT) In-Reply-To: <544C7722.1080201@freebsd.org> References: <201410250610.s9P6A2GP001878@svn.freebsd.org> <544C7722.1080201@freebsd.org> Date: Sat, 25 Oct 2014 22:41:48 -0700 X-Google-Sender-Auth: jwHy_pFfxC9W9qDEdtmx6iPzzT4 Message-ID: Subject: Re: svn commit: r273630 - head/tools/regression/zfs/zpool/add From: Craig Rodrigues To: Steven Hartland Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Garrett Cooper X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 05:41:52 -0000 On Sat, Oct 25, 2014 at 9:22 PM, Steven Hartland wrote: > Its not clear from this why you elected to disable the test and hide the > issue instead of fixing the panic cause, could you clarify please? See: https://lists.freebsd.org/pipermail/freebsd-testing/2014-October/000584.html https://lists.freebsd.org/pipermail/freebsd-testing/2014-October/000585.html -- Craig From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 06:04:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DD4F5AF9; Sun, 26 Oct 2014 06:04:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B00B8E60; Sun, 26 Oct 2014 06:04:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9Q64AlJ094751; Sun, 26 Oct 2014 06:04:10 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9Q64A4x094750; Sun, 26 Oct 2014 06:04:10 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410260604.s9Q64A4x094750@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 26 Oct 2014 06:04:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273685 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 06:04:11 -0000 Author: mjg Date: Sun Oct 26 06:04:09 2014 New Revision: 273685 URL: https://svnweb.freebsd.org/changeset/base/273685 Log: Tidy up sys_setgroups and kern_setgroups. - 'groups' initialization to NULL is always ovewrwriten before use, so plug it - get rid of 'goto out' - kern_setgroups's callers already validate ngrp, so only assert the condition - ngrp is an u_int, so 'ngrp < 1' is more readable as 'ngrp == 0' No functional changes. Modified: head/sys/kern/kern_prot.c Modified: head/sys/kern/kern_prot.c ============================================================================== --- head/sys/kern/kern_prot.c Sun Oct 26 05:39:42 2014 (r273684) +++ head/sys/kern/kern_prot.c Sun Oct 26 06:04:09 2014 (r273685) @@ -805,23 +805,24 @@ struct setgroups_args { int sys_setgroups(struct thread *td, struct setgroups_args *uap) { - gid_t *groups = NULL; gid_t smallgroups[XU_NGROUPS]; + gid_t *groups; u_int gidsetsize; int error; gidsetsize = uap->gidsetsize; if (gidsetsize > ngroups_max + 1) return (EINVAL); + if (gidsetsize > XU_NGROUPS) groups = malloc(gidsetsize * sizeof(gid_t), M_TEMP, M_WAITOK); else groups = smallgroups; + error = copyin(uap->gidset, groups, gidsetsize * sizeof(gid_t)); - if (error) - goto out; - error = kern_setgroups(td, gidsetsize, groups); -out: + if (error == 0) + error = kern_setgroups(td, gidsetsize, groups); + if (gidsetsize > XU_NGROUPS) free(groups, M_TEMP); return (error); @@ -834,8 +835,7 @@ kern_setgroups(struct thread *td, u_int struct ucred *newcred, *oldcred; int error; - if (ngrp > ngroups_max + 1) - return (EINVAL); + MPASS(ngrp <= ngroups_max); AUDIT_ARG_GROUPSET(groups, ngrp); newcred = crget(); crextend(newcred, ngrp); @@ -852,7 +852,7 @@ kern_setgroups(struct thread *td, u_int if (error) goto fail; - if (ngrp < 1) { + if (ngrp == 0) { /* * setgroups(0, NULL) is a legitimate way of clearing the * groups vector on non-BSD systems (which generally do not From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 07:09:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1F95B3C8; Sun, 26 Oct 2014 07:09:00 +0000 (UTC) Received: from st11p02mm-asmtp001.mac.com (st11p02mm-asmtp001.mac.com [17.172.220.236]) (using TLSv1 with cipher DES-CBC3-SHA (112/168 bits)) (Client CN "smtp.me.com", Issuer "VeriSign Class 3 Extended Validation SSL SGC CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E7025375; Sun, 26 Oct 2014 07:08:59 +0000 (UTC) Received: from fukuyama.hsd1.ca.comcast.net (unknown [73.162.13.215]) by st11p02mm-asmtp001.mac.com (Oracle Communications Messaging Server 7u4-27.10(7.0.4.27.9) 64bit (built Jun 6 2014)) with ESMTPSA id <0NE1009NUII5QZ50@st11p02mm-asmtp001.mac.com>; Sun, 26 Oct 2014 07:08:32 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.12.52,1.0.28,0.0.0000 definitions=2014-10-26_01:2014-10-24,2014-10-25,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1408290000 definitions=main-1410260078 Content-type: text/plain; charset=us-ascii MIME-version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) Subject: Re: svn commit: r273647 - head/sys/dev/acpica From: Rui Paulo In-reply-to: <201410252101.s9PL1pnm022006@svn.freebsd.org> Date: Sun, 26 Oct 2014 00:08:29 -0700 Content-transfer-encoding: quoted-printable Message-id: <4880436F-59EF-4792-8C52-9E3F03215EA8@me.com> References: <201410252101.s9PL1pnm022006@svn.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.1990.1) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 07:09:00 -0000 On Oct 25, 2014, at 14:01, Konstantin Belousov wrote: >=20 > Author: kib > Date: Sat Oct 25 21:01:50 2014 > New Revision: 273647 > URL: https://svnweb.freebsd.org/changeset/base/273647 >=20 > Log: > Set the caching mode for the usermode mapping of the HPET registers > page to uncached. >=20 > Reviewed by: rpaulo > Sponsored by: The FreeBSD Foundation > MFC after: 1 week >=20 > Modified: > head/sys/dev/acpica/acpi_hpet.c >=20 > Modified: head/sys/dev/acpica/acpi_hpet.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/acpica/acpi_hpet.c Sat Oct 25 20:42:47 2014 = (r273646) > +++ head/sys/dev/acpica/acpi_hpet.c Sat Oct 25 21:01:50 2014 = (r273647) > @@ -356,6 +356,7 @@ hpet_mmap(struct cdev *cdev, vm_ooffset_ > if (!sc->mmap_allow_write && (nprot & PROT_WRITE)) > return (EPERM); > *paddr =3D rman_get_start(sc->mem_res) + offset; > + *memattr =3D VM_MEMATTR_UNCACHEABLE; >=20 > return (0); > } Thanks! -- Rui Paulo From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 07:40:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0B0D877C; Sun, 26 Oct 2014 07:40:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF7127E2; Sun, 26 Oct 2014 07:40:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9Q7ecs9038275; Sun, 26 Oct 2014 07:40:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9Q7ecUK038273; Sun, 26 Oct 2014 07:40:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410260740.s9Q7ecUK038273@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 26 Oct 2014 07:40:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273687 - in head: sys/cam/ctl usr.sbin/ctladm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 07:40:39 -0000 Author: mav Date: Sun Oct 26 07:40:37 2014 New Revision: 273687 URL: https://svnweb.freebsd.org/changeset/base/273687 Log: Add "rpm" and "formfactor" LUN options to match istgt functionality. MFC after: 1 week Modified: head/sys/cam/ctl/ctl.c head/usr.sbin/ctladm/ctladm.8 Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sun Oct 26 07:07:54 2014 (r273686) +++ head/sys/cam/ctl/ctl.c Sun Oct 26 07:40:37 2014 (r273687) @@ -10207,6 +10207,8 @@ ctl_inquiry_evpd_bdc(struct ctl_scsiio * { struct scsi_vpd_block_device_characteristics *bdc_ptr; struct ctl_lun *lun; + const char *value; + u_int i; lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; @@ -10239,7 +10241,18 @@ ctl_inquiry_evpd_bdc(struct ctl_scsiio * bdc_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT; bdc_ptr->page_code = SVPD_BDC; scsi_ulto2b(sizeof(*bdc_ptr) - 4, bdc_ptr->page_length); - scsi_ulto2b(SVPD_NON_ROTATING, bdc_ptr->medium_rotation_rate); + if (lun != NULL && + (value = ctl_get_opt(&lun->be_lun->options, "rpm")) != NULL) + i = strtol(value, NULL, 0); + else + i = SVPD_NON_ROTATING; + scsi_ulto2b(i, bdc_ptr->medium_rotation_rate); + if (lun != NULL && + (value = ctl_get_opt(&lun->be_lun->options, "formfactor")) != NULL) + i = strtol(value, NULL, 0); + else + i = 0; + bdc_ptr->wab_wac_ff = (i & 0x0f); bdc_ptr->flags = SVPD_FUAB | SVPD_VBULS; ctsio->scsi_status = SCSI_STATUS_OK; Modified: head/usr.sbin/ctladm/ctladm.8 ============================================================================== --- head/usr.sbin/ctladm/ctladm.8 Sun Oct 26 07:07:54 2014 (r273686) +++ head/usr.sbin/ctladm/ctladm.8 Sun Oct 26 07:40:37 2014 (r273687) @@ -34,7 +34,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $ .\" $FreeBSD$ .\" -.Dd October 12, 2014 +.Dd October 26, 2014 .Dt CTLADM 8 .Os .Sh NAME @@ -995,6 +995,12 @@ command sequence order shall be explicit client through the selection of appropriate commands and task attributes. The default value is "restricted". It improves data integrity, but may introduce some additional delays. +.It Va rpm +Specifies medium rotation rate of the device: 0 -- not reported, +1 -- non-rotating (SSD), >1024 -- value in revolutions per minute. +.It Va formfactor +Specifies nominal form factor of the device: 0 -- not reported, 1 -- 5.25", +2 -- 3.5", 3 -- 2.5", 4 -- 1.8", 5 -- less then 1.8". .It Va unmap Set to "on", enables UNMAP support for the LUN, if supported by the backend. .It Va writecache From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 09:29:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DEDD2443; Sun, 26 Oct 2014 09:29:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9E7CED; Sun, 26 Oct 2014 09:29:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9Q9TC5o088367; Sun, 26 Oct 2014 09:29:12 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9Q9TCcu088366; Sun, 26 Oct 2014 09:29:12 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410260929.s9Q9TCcu088366@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 26 Oct 2014 09:29:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273689 - head/contrib/file/magic/Magdir X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 09:29:13 -0000 Author: delphij Date: Sun Oct 26 09:29:12 2014 New Revision: 273689 URL: https://svnweb.freebsd.org/changeset/base/273689 Log: MFV r273688: Update filesystems magic. This fixes a regression introduced by libmagic 5.19 which prevents file(1) to show more verbose information about a MBR. Submitted by: madpilot MFC after: 2 weeks Modified: head/contrib/file/magic/Magdir/filesystems Directory Properties: head/contrib/file/ (props changed) Modified: head/contrib/file/magic/Magdir/filesystems ============================================================================== --- head/contrib/file/magic/Magdir/filesystems Sun Oct 26 09:24:32 2014 (r273688) +++ head/contrib/file/magic/Magdir/filesystems Sun Oct 26 09:29:12 2014 (r273689) @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: filesystems,v 1.95 2014/06/03 19:17:27 christos Exp $ +# $File: filesystems,v 1.106 2014/10/23 17:17:09 christos Exp $ # filesystems: file(1) magic for different filesystems # 0 name partid @@ -254,19 +254,13 @@ 30 search/481 \x55\xAA # to display DOS/MBR boot sector (40) before old one (strength=50+21),Syslinux bootloader (71),SYSLINUX MBR (37+36),NetBSD mbr (110),AdvanceMAME mbr (111) # DOS BPB information (70) and after DOS floppy (120) like in previous file version -!:strength +72 +!:strength +65 # for sector sizes < 512 Bytes >11 uleshort <512 >>(11.s-2) uleshort 0xAA55 DOS/MBR boot sector # for sector sizes with 512 or more Bytes >0x1FE leshort 0xAA55 DOS/MBR boot sector -# keep old DOS/MBR boot sector as dummy for mbr and bootloader displaying -# only for sector sizes with 512 or more Bytes -0x1FE leshort 0xAA55 -# -# to display information (50) before DOS BPB (strength=70) and after DOS floppy (120) like in old file version -!:strength +21 ->2 string OSBS \b, OS/BS MBR +>2 string OSBS OS/BS MBR # added by Joerg Jenderek at Feb 2013 according to http://thestarman.pcministry.com/asm/mbr/ # and http://en.wikipedia.org/wiki/Master_Boot_Record # test for nearly all MS-DOS Master Boot Record initial program loader (IPL) is now done by @@ -538,6 +532,8 @@ >>>514 string !HdrS # not BeOS >>>>422 string !Be\ Boot\ Loader +>>>>>32769 string CD001 +>>>>>>0 use cdrom # jump over BPB instruction implies DOS bootsector or AdvanceMAME mbr >>>>>0 ubelong&0xFD000000 =0xE9000000 # AdvanceMAME mbr @@ -1043,7 +1039,7 @@ >>>>>>466 ubyte <0x10 >>>>>>>466 ubyte 0x05 \b, extended partition table >>>>>>>466 ubyte 0x0F \b, extended partition table (LBA) ->>>>>>>466 ubyte 0x0 \b, extended partition table (last) +>>>>>>>466 ubyte 0x0 \b, extended partition table (last) # DOS x86 sector separated and moved from "DOS/MBR boot sector" by Joerg Jenderek at May 2011 @@ -1236,6 +1232,7 @@ >>>>>181 search/166 Error\ \0 # "a: disk" , "Fn: diskn" or "NetBSD MBR boot" >>>>>>&3 string x \b,"%s" +>>>446 use partition-table # Andrea Mazzoleni AdvanceCD mbr loader of http://advancemame.sourceforge.net/boot-readme.html # added by Joerg Jenderek at Nov 2012 for versions 1.3 - 1.4 # assembler instructions: jmp short 0x58;nop;ASCII @@ -1353,18 +1350,19 @@ # minimal short forward jump found 0x29 for bootloaders or 0x0 # maximal short forward jump is 0x7f # OEM-ID is empty or contain readable bytes -0 ulelong&0x804000E9 0x000000E9 +0 ulelong&0x804000E9 0x000000E9 +!:strength +60 # mtools-3.9.8/msdos.h # usual values are marked with comments to get only informations of strange FAT systems # valid sectorsize must be a power of 2 from 32 to 32768 ->11 uleshort&0xf001f 0 +>11 uleshort&0x001f 0 >>11 uleshort <32769 >>>11 uleshort >31 >>>>21 ubyte&0xf0 0xF0 ->>>>>0 ubyte 0xEB +>>>>>0 ubyte 0xEB DOS/MBR boot sector >>>>>>1 ubyte x \b, code offset 0x%x+2 >>>>>0 ubyte 0xE9 ->>>>>>1 uleshort x \b, code offset 0x%x+2 +>>>>>>1 uleshort x \b, code offset 0x%x+3 >>>>>3 string >\0 \b, OEM-ID "%-.8s" #http://mirror.href.com/thestarman/asm/debug/debug2.htm#IHC >>>>>>8 string IHC \b cached by Windows 9M @@ -1373,10 +1371,11 @@ >>>>>11 uleshort <512 \b, Bytes/sector %u >>>>>13 ubyte >1 \b, sectors/cluster %u #>>>>>13 ubyte =1 \b, sectors/cluster %u (usual on Floppies) ->>>>>82 string FAT32 +# for lazy FAT32 implementation like Transcend digital photo frame PF830 +>>>>>82 string/c fat32 >>>>>>14 uleshort !32 \b, reserved sectors %u #>>>>>>14 uleshort =32 \b, reserved sectors %u (usual Fat32) ->>>>>82 string !FAT32 +>>>>>82 string/c !fat32 >>>>>>14 uleshort >1 \b, reserved sectors %u #>>>>>>14 uleshort =1 \b, reserved sectors %u (usual FAT12,FAT16) #>>>>>>14 uleshort 0 \b, reserved sectors %u (usual NTFS) @@ -1399,24 +1398,29 @@ >>>>>26 ubyte =1 \b, heads %u # valid only for sector sizes with more then 32 Bytes >>>>>11 uleshort >32 -# skip for Digital Research DOS (version 3.41) 1440 kB Bootdisk ->>>>>>38 ubyte !0x70 +# http://en.wikipedia.org/wiki/Design_of_the_FAT_file_system#Extended_BIOS_Parameter_Block +# skip for values 2,2Ah,70h,73h,DFh +# and continue for extended boot signature values 0,28h,29h,80h +>>>>>>38 ubyte&0x56 =0 >>>>>>>28 ulelong >0 \b, hidden sectors %u #>>>>>>>28 ulelong =0 \b, hidden sectors %u (usual floppy) >>>>>>>32 ulelong >0 \b, sectors %u (volumes > 32 MB) #>>>>>>>32 ulelong =0 \b, sectors %u (volumes > 32 MB) # FAT<32 bit specific ->>>>>>>82 string !FAT32 +>>>>>>>82 string/c !fat32 #>>>>>>>>36 ubyte 0x80 \b, physical drive 0x%x=0x80 (usual harddisk) #>>>>>>>>36 ubyte 0 \b, physical drive 0x%x=0 (usual floppy) >>>>>>>>36 ubyte !0x80 >>>>>>>>>36 ubyte !0 \b, physical drive 0x%x +# VGA-copy CRC or +# in Windows NT bit 0 is a dirty flag to request chkdsk at boot time. bit 1 requests surface scan too >>>>>>>>37 ubyte >0 \b, reserved 0x%x #>>>>>>>>37 ubyte =0 \b, reserved 0x%x -# value is 0x80 for NTFS +# extended boot signatur value is 0x80 for NTFS, 0x28 or 0x29 for others >>>>>>>>38 ubyte !0x29 \b, dos < 4.0 BootSector (0x%x) ->>>>>>>>38 ubyte =0x29 +>>>>>>>>38 ubyte&0xFE =0x28 >>>>>>>>>39 ulelong x \b, serial number 0x%x +>>>>>>>>38 ubyte =0x29 >>>>>>>>>43 string >>>>>>>>43 string >NO\ NAME \b, label: "%11.11s" >>>>>>>>>43 string =NO\ NAME \b, unlabeled @@ -1426,11 +1430,35 @@ # if it is small enough FAT is 12 bit, if it is too big enough FAT is 32 bit, # otherwise FAT is 16 bit. # http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-fat-widths.html ->>>>>>54 string FAT \b, FAT ->>>>>>>54 string FAT12 \b (12 bit) ->>>>>>>54 string FAT16 \b (16 bit) +>>>>>82 string/c !fat32 +>>>>>>54 string FAT12 \b, FAT (12 bit) +>>>>>>54 string FAT16 \b, FAT (16 bit) +>>>>>>54 default x +# determinate FAT bit size by media descriptor +# small floppies implies FAT12 +>>>>>>>21 ubyte <0xF0 \b, FAT (12 bit by descriptor) +# with media descriptor F0h floppy or maybe superfloppy with FAT16 +>>>>>>>21 ubyte =0xF0 +# superfloppy (many sectors) implies FAT16 +>>>>>>>>32 ulelong >0xFFFF \b, FAT (16 bit by descriptor+sectors) +# no superfloppy with media descriptor F0h implies FAT12 +>>>>>>>>32 default x \b, FAT (12 bit by descriptor+sectors) +# with media descriptor F8h floppy or hard disc with FAT12 or FAT16 +>>>>>>>21 ubyte =0xF8 +# 360 KiB with media descriptor F8h, 9 sectors per track ,single sided floppy implies FAT12 +>>>>>>>>19 ubequad 0xd002f80300090001 \b, FAT (12 bit by descriptor+geometry) +# hard disc with FAT12 or FAT16 +>>>>>>>>19 default x \b, FAT (1Y bit by descriptor) +# with media descriptor FAh floppy, RAM disc with FAT12 or FAT16 or Tandy hard disc +>>>>>>>21 ubyte =0xFA +# 320 KiB with media descriptor FAh, 8 sectors per track ,single sided floppy implies FAT12 +>>>>>>>>19 ubequad 0x8002fa0200080001 \b, FAT (12 bit by descriptor+geometry) +# RAM disc with FAT12 or FAT16 or Tandy hard disc +>>>>>>>>19 default x \b, FAT (1Y bit by descriptor) +# others are floppy +>>>>>>>21 default x \b, FAT (12 bit by descriptor) # FAT32 bit specific ->>>>>82 string FAT32 \b, FAT (32 bit) +>>>>>82 string/c fat32 \b, FAT (32 bit) >>>>>>36 ulelong x \b, sectors/FAT %u # http://technet.microsoft.com/en-us/library/cc977221.aspx >>>>>>40 uleshort >0 \b, extension flags 0x%x @@ -1443,9 +1471,12 @@ >>>>>>48 uleshort >1 \b, infoSector %u #>>>>>>48 uleshort =1 \b, infoSector %u (usual) >>>>>>48 uleshort <1 \b, infoSector %u ->>>>>>50 uleshort >6 \b, Backup boot sector %u +# 0 or 0xFFFF instead of usual 6 means no backup sector +>>>>>>50 uleshort =0xFFFF \b, no Backup boot sector +>>>>>>50 uleshort =0 \b, no Backup boot sector #>>>>>>50 uleshort =6 \b, Backup boot sector %u (usual) ->>>>>>50 uleshort <6 \b, Backup boot sector %u +>>>>>>50 default x +>>>>>>>50 uleshort x \b, Backup boot sector %u # corrected by Joerg Jenderek at Feb 2011 according to http://thestarman.pcministry.com/asm/mbr/MSWIN41.htm#FSINFO >>>>>>52 ulelong >0 \b, reserved1 0x%x >>>>>>56 ulelong >0 \b, reserved2 0x%x @@ -1880,12 +1911,11 @@ # defect IO.SYS+MSDOS.SYS ? #>>>>>0x162 use 2xDOS-filename -# CDROM Filesystems -# Modified for UDF by gerardo.cacciari@gmail.com -32769 string CD001 # -!:mime application/x-iso9660-image +0 name cdrom >38913 string !NSR0 ISO 9660 CD-ROM filesystem data +!:mime application/x-iso9660-image >38913 string NSR0 UDF filesystem data +!:mime application/x-iso9660-image >>38917 string 1 (version 1.0) >>38917 string 2 (version 1.5) >>38917 string 3 (version 2.0) @@ -1898,6 +1928,18 @@ !:mime application/x-iso9660-image 32777 string CDROM High Sierra CD-ROM filesystem data +# CDROM Filesystems +# https://en.wikipedia.org/wiki/ISO_9660 +# Modified for UDF by gerardo.cacciari@gmail.com +32769 string CD001 +# mime line at that position does not work +# to display CD-ROM (70=81-11) after MBR (113=40+72+1), partition-table (71=50+21) and before Apple Driver Map (51) +!:strength -11 +# to display CD-ROM (114=81+33) before MBR (113=40+72+1), partition-table (71=50+21) and Apple Driver Map (51) +# does not work +#!:strength +33 +>0 use cdrom + # .cso files 0 string CISO Compressed ISO CD image @@ -2131,7 +2173,6 @@ # which is mapped to VBN 2 of [000000]INDEXF.SYS;1 - gerardo.cacciari@gmail.com # 1008 string DECFILE11 Files-11 On-Disk Structure ->525 byte x Level %d >525 byte x (ODS-%d); >1017 string A RSX-11, VAX/VMS or OpenVMS VAX file system; >1017 string B @@ -2266,14 +2307,31 @@ # UBIfs # Linux kernel sources: fs/ubifs/ubifs-media.h -0 belong 0x31181006 ->0x16 short 0 UBIfs image ->0x08 lequad x \b, sequence number %llu ->0x10 leshort x \b, length %u ->0x04 lelong x \b, CRC 0x%08x - -0 belong 0x55424923 ->0x04 short <2 ->0x05 string \0\0\0 ->0x1c string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 ->0x04 short x UBI image, version %u +0 lelong 0x06101831 +>0x16 leshort 0 UBIfs image +>0x08 lequad x \b, sequence number %llu +>0x10 leshort x \b, length %u +>0x04 lelong x \b, CRC 0x%08x + +0 lelong 0x23494255 +>0x04 leshort <2 +>0x05 string \0\0\0 +>0x1c string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 +>0x04 leshort x UBI image, version %u + +# NEC PC-88 2D disk image +# From Fabio R. Schmidlin +0x20 ulelong&0xFFFFFEFF 0x2A0 +>0x10 string \0\0\0\0\0\0\0\0\0\0 +>>0x280 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 +>>>0x1A ubyte&0xEF 0 +>>>>0x1B ubyte&0x8F 0 +>>>>>0x1B ubyte&70 <0x40 +>>>>>>0x1C ulelong >0x21 +>>>>>>>0 regex [[:print:]]* NEC PC-88 disk image, name=%s +>>>>>>>>0x1B ubyte 0 \b, media=2D +>>>>>>>>0x1B ubyte 0x10 \b, media=2DD +>>>>>>>>0x1B ubyte 0x20 \b, media=2HD +>>>>>>>>0x1B ubyte 0x30 \b, media=1D +>>>>>>>>0x1B ubyte 0x40 \b, media=1DD +>>>>>>>>0x1A ubyte 0x10 \b, write-protected From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 13:30:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0CC47C6A; Sun, 26 Oct 2014 13:30:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ECF78994; Sun, 26 Oct 2014 13:30:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9QDUr09000737; Sun, 26 Oct 2014 13:30:53 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9QDUrJa000736; Sun, 26 Oct 2014 13:30:53 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410261330.s9QDUrJa000736@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 26 Oct 2014 13:30:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273690 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 13:30:54 -0000 Author: trasz Date: Sun Oct 26 13:30:53 2014 New Revision: 273690 URL: https://svnweb.freebsd.org/changeset/base/273690 Log: Mention VAAI and ODX in ctl(4). Reviewed by: mav@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/share/man/man4/ctl.4 Modified: head/share/man/man4/ctl.4 ============================================================================== --- head/share/man/man4/ctl.4 Sun Oct 26 09:29:12 2014 (r273689) +++ head/share/man/man4/ctl.4 Sun Oct 26 13:30:53 2014 (r273690) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd April 2, 2013 +.Dd October 23, 2014 .Dt CTL 4 .Os .Sh NAME @@ -57,7 +57,7 @@ Tagged queueing .It SCSI task attribute support (ordered, head of queue, simple tags) .It -SCSI implicit command ordering support. +SCSI implicit command ordering support .It Full task management support (abort, LUN reset, target reset, etc.) .It @@ -67,6 +67,12 @@ Support for multiple simultaneous initia .It Support for multiple simultaneous backing stores .It +Support for VMWare VAAI: COMPARE AND WRITE, XCOPY, WRITE SAME, +and UNMAP commands +.It +Support for Microsoft ODX: POPULATE TOKEN/WRITE USING TOKEN, +WRITE SAME, and UNMAP commands +.It Persistent reservation support .It Mode sense/select support From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 14:25:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F246150D; Sun, 26 Oct 2014 14:25:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DEDE7D76; Sun, 26 Oct 2014 14:25:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9QEPgCA026796; Sun, 26 Oct 2014 14:25:42 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9QEPggh026795; Sun, 26 Oct 2014 14:25:42 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410261425.s9QEPggh026795@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 26 Oct 2014 14:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273691 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 14:25:43 -0000 Author: mjg Date: Sun Oct 26 14:25:42 2014 New Revision: 273691 URL: https://svnweb.freebsd.org/changeset/base/273691 Log: Fix up an assertion in kern_setgroups, it should compare with ngroups_max + 1 Bug introdued in r273685. Noted by: Tiwei Bie Modified: head/sys/kern/kern_prot.c Modified: head/sys/kern/kern_prot.c ============================================================================== --- head/sys/kern/kern_prot.c Sun Oct 26 13:30:53 2014 (r273690) +++ head/sys/kern/kern_prot.c Sun Oct 26 14:25:42 2014 (r273691) @@ -835,7 +835,7 @@ kern_setgroups(struct thread *td, u_int struct ucred *newcred, *oldcred; int error; - MPASS(ngrp <= ngroups_max); + MPASS(ngrp <= ngroups_max + 1); AUDIT_ARG_GROUPSET(groups, ngrp); newcred = crget(); crextend(newcred, ngrp); From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 15:28:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4B450302; Sun, 26 Oct 2014 15:28:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14C2D2E4; Sun, 26 Oct 2014 15:28:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9QFS8dT055579; Sun, 26 Oct 2014 15:28:08 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9QFS8Wa055577; Sun, 26 Oct 2014 15:28:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410261528.s9QFS8Wa055577@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 26 Oct 2014 15:28:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273693 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 15:28:09 -0000 Author: mav Date: Sun Oct 26 15:28:07 2014 New Revision: 273693 URL: https://svnweb.freebsd.org/changeset/base/273693 Log: Fix printing non-terminated strings in devlist XML. MFC after: 1 week Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sun Oct 26 14:43:02 2014 (r273692) +++ head/sys/cam/ctl/ctl.c Sun Oct 26 15:28:07 2014 (r273693) @@ -2200,13 +2200,14 @@ ctl_copyout_args(int num_args, struct ct * Escape characters that are illegal or not recommended in XML. */ int -ctl_sbuf_printf_esc(struct sbuf *sb, char *str) +ctl_sbuf_printf_esc(struct sbuf *sb, char *str, int size) { + char *end = str + size; int retval; retval = 0; - for (; *str; str++) { + for (; *str && str < end; str++) { switch (*str) { case '&': retval = sbuf_printf(sb, "&"); @@ -3198,7 +3199,8 @@ ctl_ioctl(struct cdev *dev, u_long cmd, break; retval = ctl_sbuf_printf_esc(sb, - lun->be_lun->serial_num); + lun->be_lun->serial_num, + sizeof(lun->be_lun->serial_num)); if (retval != 0) break; @@ -3213,7 +3215,9 @@ ctl_ioctl(struct cdev *dev, u_long cmd, if (retval != 0) break; - retval = ctl_sbuf_printf_esc(sb,lun->be_lun->device_id); + retval = ctl_sbuf_printf_esc(sb, + lun->be_lun->device_id, + sizeof(lun->be_lun->device_id)); if (retval != 0) break; Modified: head/sys/cam/ctl/ctl.h ============================================================================== --- head/sys/cam/ctl/ctl.h Sun Oct 26 14:43:02 2014 (r273692) +++ head/sys/cam/ctl/ctl.h Sun Oct 26 15:28:07 2014 (r273693) @@ -156,7 +156,7 @@ int ctl_port_list(struct ctl_port_entry * Put a string into an sbuf, escaping characters that are illegal or not * recommended in XML. Note this doesn't escape everything, just > < and &. */ -int ctl_sbuf_printf_esc(struct sbuf *sb, char *str); +int ctl_sbuf_printf_esc(struct sbuf *sb, char *str, int size); int ctl_ffz(uint32_t *mask, uint32_t size); int ctl_set_mask(uint32_t *mask, uint32_t bit); From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 17:50:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A4A34301; Sun, 26 Oct 2014 17:50:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 902C9155; Sun, 26 Oct 2014 17:50:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9QHoZV5024233; Sun, 26 Oct 2014 17:50:35 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9QHoYag024224; Sun, 26 Oct 2014 17:50:34 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201410261750.s9QHoYag024224@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 26 Oct 2014 17:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273700 - in head/bin/sh: . tests/builtins X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 17:50:35 -0000 Author: jilles Date: Sun Oct 26 17:50:33 2014 New Revision: 273700 URL: https://svnweb.freebsd.org/changeset/base/273700 Log: sh: Make getopts memory-safe if with changing arguments. POSIX does not permit to continuing a getopts loop with different arguments. For parsing the positional parameters, we handle this case by resetting the getopts state when the positional parameters are changed in any way (and the getopts state is local to a function). However, in the syntax getopts , changes could lead to invalid memory access. In the syntax getopts , store a copy of the arguments and continue to use them until getopts is reset. Added: head/bin/sh/tests/builtins/getopts9.0 (contents, props changed) head/bin/sh/tests/builtins/getopts9.0.stdout (contents, props changed) Modified: head/bin/sh/eval.c head/bin/sh/options.c head/bin/sh/options.h Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sun Oct 26 17:17:08 2014 (r273699) +++ head/bin/sh/eval.c Sun Oct 26 17:50:33 2014 (r273700) @@ -1039,6 +1039,7 @@ evalcommand(union node *cmd, int flags, shellparam.reset = 1; shellparam.nparam = argc - 1; shellparam.p = argv + 1; + shellparam.optp = NULL; shellparam.optnext = NULL; INTOFF; savelocalvars = localvars; Modified: head/bin/sh/options.c ============================================================================== --- head/bin/sh/options.c Sun Oct 26 17:17:08 2014 (r273699) +++ head/bin/sh/options.c Sun Oct 26 17:50:33 2014 (r273700) @@ -325,6 +325,7 @@ setparam(char **argv) shellparam.malloc = 1; shellparam.nparam = nparam; shellparam.p = newparam; + shellparam.optp = NULL; shellparam.reset = 1; shellparam.optnext = NULL; } @@ -344,6 +345,11 @@ freeparam(struct shparam *param) ckfree(*ap); ckfree(param->p); } + if (param->optp) { + for (ap = param->optp ; *ap ; ap++) + ckfree(*ap); + ckfree(param->optp); + } } @@ -417,20 +423,33 @@ getoptsreset(const char *value) int getoptscmd(int argc, char **argv) { - char **optbase = NULL; + char **optbase = NULL, **ap; + int i; if (argc < 3) error("usage: getopts optstring var [arg]"); - else if (argc == 3) - optbase = shellparam.p; - else - optbase = &argv[3]; if (shellparam.reset == 1) { + INTOFF; + if (shellparam.optp) { + for (ap = shellparam.optp ; *ap ; ap++) + ckfree(*ap); + ckfree(shellparam.optp); + shellparam.optp = NULL; + } + if (argc > 3) { + shellparam.optp = ckmalloc((argc - 2) * sizeof *ap); + memset(shellparam.optp, '\0', (argc - 2) * sizeof *ap); + for (i = 0; i < argc - 3; i++) + shellparam.optp[i] = savestr(argv[i + 3]); + } + INTON; + optbase = argc == 3 ? shellparam.p : shellparam.optp; shellparam.optnext = optbase; shellparam.optptr = NULL; shellparam.reset = 0; - } + } else + optbase = shellparam.optp ? shellparam.optp : shellparam.p; return getopts(argv[1], argv[2], optbase, &shellparam.optnext, &shellparam.optptr); Modified: head/bin/sh/options.h ============================================================================== --- head/bin/sh/options.h Sun Oct 26 17:17:08 2014 (r273699) +++ head/bin/sh/options.h Sun Oct 26 17:50:33 2014 (r273700) @@ -38,6 +38,7 @@ struct shparam { unsigned char malloc; /* if parameter list dynamically allocated */ unsigned char reset; /* if getopts has been reset */ char **p; /* parameter list */ + char **optp; /* parameter list for getopts */ char **optnext; /* next parameter to be processed by getopts */ char *optptr; /* used by getopts */ }; Added: head/bin/sh/tests/builtins/getopts9.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/builtins/getopts9.0 Sun Oct 26 17:50:33 2014 (r273700) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +args='-ab' +getopts ab opt $args +echo $?:$opt:$OPTARG +for dummy in dummy1 dummy2; do + getopts ab opt $args + echo $?:$opt:$OPTARG +done Added: head/bin/sh/tests/builtins/getopts9.0.stdout ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/builtins/getopts9.0.stdout Sun Oct 26 17:50:33 2014 (r273700) @@ -0,0 +1,3 @@ +0:a: +0:b: +1:?: From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 17:56:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 61E964C6; Sun, 26 Oct 2014 17:56:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 42B9422C; Sun, 26 Oct 2014 17:56:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9QHunQi027929; Sun, 26 Oct 2014 17:56:49 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9QHumF4027924; Sun, 26 Oct 2014 17:56:48 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201410261756.s9QHumF4027924@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 26 Oct 2014 17:56:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273701 - in head/sys: amd64/amd64 arm/arm i386/i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 17:56:49 -0000 Author: alc Date: Sun Oct 26 17:56:47 2014 New Revision: 273701 URL: https://svnweb.freebsd.org/changeset/base/273701 Log: By the time that pmap_init() runs, vm_phys_segs[] has been initialized. Obtaining the end of memory address from vm_phys_segs[] is a little easier than obtaining it from phys_avail[]. Discussed with: Svatopluk Kraus Modified: head/sys/amd64/amd64/pmap.c head/sys/arm/arm/pmap-v6.c head/sys/i386/i386/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sun Oct 26 17:50:33 2014 (r273700) +++ head/sys/amd64/amd64/pmap.c Sun Oct 26 17:56:47 2014 (r273701) @@ -131,6 +131,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1056,8 +1057,7 @@ pmap_init(void) /* * Calculate the size of the pv head table for superpages. */ - for (i = 0; phys_avail[i + 1]; i += 2); - pv_npg = round_2mpage(phys_avail[(i - 2) + 1]) / NBPDR; + pv_npg = howmany(vm_phys_segs[vm_phys_nsegs - 1].end, NBPDR); /* * Allocate memory for the pv head table for superpages. Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Sun Oct 26 17:50:33 2014 (r273700) +++ head/sys/arm/arm/pmap-v6.c Sun Oct 26 17:56:47 2014 (r273701) @@ -172,6 +172,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1342,9 +1343,10 @@ pmap_init(void) /* * Calculate the size of the pv head table for superpages. + * Handle the possibility that "vm_phys_segs[...].end" is zero. */ - for (i = 0; phys_avail[i + 1]; i += 2); - pv_npg = round_1mpage(phys_avail[(i - 2) + 1]) / NBPDR; + pv_npg = trunc_1mpage(vm_phys_segs[vm_phys_nsegs - 1].end - + PAGE_SIZE) / NBPDR + 1; /* * Allocate memory for the pv head table for superpages. Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sun Oct 26 17:50:33 2014 (r273700) +++ head/sys/i386/i386/pmap.c Sun Oct 26 17:56:47 2014 (r273701) @@ -133,6 +133,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -778,9 +779,10 @@ pmap_init(void) /* * Calculate the size of the pv head table for superpages. + * Handle the possibility that "vm_phys_segs[...].end" is zero. */ - for (i = 0; phys_avail[i + 1]; i += 2); - pv_npg = round_4mpage(phys_avail[(i - 2) + 1]) / NBPDR; + pv_npg = trunc_4mpage(vm_phys_segs[vm_phys_nsegs - 1].end - + PAGE_SIZE) / NBPDR + 1; /* * Allocate memory for the pv head table for superpages. From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 17:56:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D2AC85FE; Sun, 26 Oct 2014 17:56:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE81722D; Sun, 26 Oct 2014 17:56:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9QHuwM8027992; Sun, 26 Oct 2014 17:56:58 GMT (envelope-from stefanf@FreeBSD.org) Received: (from stefanf@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9QHuwup027991; Sun, 26 Oct 2014 17:56:58 GMT (envelope-from stefanf@FreeBSD.org) Message-Id: <201410261756.s9QHuwup027991@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: stefanf set sender to stefanf@FreeBSD.org using -f From: Stefan Farfeleder Date: Sun, 26 Oct 2014 17:56:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273702 - head/tools/regression/lib/libc/nss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 17:56:58 -0000 Author: stefanf Date: Sun Oct 26 17:56:58 2014 New Revision: 273702 URL: https://svnweb.freebsd.org/changeset/base/273702 Log: Remove incorrect semicolon. Modified: head/tools/regression/lib/libc/nss/test-gethostby.c Modified: head/tools/regression/lib/libc/nss/test-gethostby.c ============================================================================== --- head/tools/regression/lib/libc/nss/test-gethostby.c Sun Oct 26 17:56:47 2014 (r273701) +++ head/tools/regression/lib/libc/nss/test-gethostby.c Sun Oct 26 17:56:58 2014 (r273702) @@ -109,7 +109,7 @@ __gethostbyname2(const char *name, int a else { error = 0; he = getipnodebyname(name, af, ipnode_flags, &error); - if (he == NULL); + if (he == NULL) errno = error; } From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 18:30:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B6A94831; Sun, 26 Oct 2014 18:30:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 889A8855; Sun, 26 Oct 2014 18:30:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9QIUaT6046511; Sun, 26 Oct 2014 18:30:36 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9QIUZvQ046506; Sun, 26 Oct 2014 18:30:35 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410261830.s9QIUZvQ046506@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 26 Oct 2014 18:30:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273703 - in head/sys: arm/arm arm/at91 conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 18:30:36 -0000 Author: ian Date: Sun Oct 26 18:30:35 2014 New Revision: 273703 URL: https://svnweb.freebsd.org/changeset/base/273703 Log: Remove the ARM_DEVICE_MULTIPASS option and make its effect be the default. Multipass device attachment was tested on many arm platforms by users and only success was reported on the arm@ mailing list. This is just the long-delayed followup of making it the default. Multipass attachment is necessary when using vendor-supplied FDT data, because our devices may need to be attached in a different order than they are described in the FDT data. Modified: head/sys/arm/arm/nexus.c head/sys/arm/at91/std.atmel head/sys/conf/options.arm Modified: head/sys/arm/arm/nexus.c ============================================================================== --- head/sys/arm/arm/nexus.c Sun Oct 26 17:56:58 2014 (r273702) +++ head/sys/arm/arm/nexus.c Sun Oct 26 18:30:35 2014 (r273703) @@ -128,12 +128,8 @@ static driver_t nexus_driver = { nexus_methods, 1 /* no softc */ }; -#ifdef ARM_DEVICE_MULTIPASS EARLY_DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_EARLY); -#else -DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0); -#endif static int nexus_probe(device_t dev) Modified: head/sys/arm/at91/std.atmel ============================================================================== --- head/sys/arm/at91/std.atmel Sun Oct 26 17:56:58 2014 (r273702) +++ head/sys/arm/at91/std.atmel Sun Oct 26 18:30:35 2014 (r273703) @@ -12,4 +12,3 @@ device at91sam9x5 # bring in the sam specific timers and such device at91sam9 -options ARM_DEVICE_MULTIPASS Modified: head/sys/conf/options.arm ============================================================================== --- head/sys/conf/options.arm Sun Oct 26 17:56:58 2014 (r273702) +++ head/sys/conf/options.arm Sun Oct 26 18:30:35 2014 (r273703) @@ -1,7 +1,6 @@ #$FreeBSD$ ARM9_CACHE_WRITE_THROUGH opt_global.h ARM_CACHE_LOCK_ENABLE opt_global.h -ARM_DEVICE_MULTIPASS opt_global.h ARM_KERN_DIRECTMAP opt_vm.h ARM_L2_PIPT opt_global.h ARM_MANY_BOARD opt_global.h From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 18:41:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 02813B4C; Sun, 26 Oct 2014 18:41:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA3328B1; Sun, 26 Oct 2014 18:41:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9QIf1fY052340; Sun, 26 Oct 2014 18:41:01 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9QIf1AQ052339; Sun, 26 Oct 2014 18:41:01 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201410261841.s9QIf1AQ052339@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Sun, 26 Oct 2014 18:41:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273704 - head/sys/cam/ata X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 18:41:02 -0000 Author: smh Date: Sun Oct 26 18:41:01 2014 New Revision: 273704 URL: https://svnweb.freebsd.org/changeset/base/273704 Log: Fix CF ERASE breakage caused by 268205. This prevents BIO_DELETE requests getting stuck in the TRIM queue which results in a panic on shutdown due to outstanding requests. PR: 194606 Reported by: Guido Falsi Reviewed by: mav MFC after: 3 days Sponsored by: Multiplay Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Sun Oct 26 18:30:35 2014 (r273703) +++ head/sys/cam/ata/ata_da.c Sun Oct 26 18:41:01 2014 (r273704) @@ -1483,9 +1483,15 @@ ada_dsmtrim(struct ada_softc *softc, str static void ada_cfaerase(struct ada_softc *softc, struct bio *bp, struct ccb_ataio *ataio) { + struct trim_request *req = &softc->trim_req; uint64_t lba = bp->bio_pblkno; uint16_t count = bp->bio_bcount / softc->params.secsize; + bzero(req, sizeof(*req)); + TAILQ_INIT(&req->bps); + bioq_remove(&softc->trim_queue, bp); + TAILQ_INSERT_TAIL(&req->bps, bp, bio_queue); + cam_fill_ataio(ataio, ada_retry_count, adadone, From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 19:03:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 70392F8D; Sun, 26 Oct 2014 19:03:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5138AB17; Sun, 26 Oct 2014 19:03:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9QJ39At062801; Sun, 26 Oct 2014 19:03:09 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9QJ37OX062792; Sun, 26 Oct 2014 19:03:07 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201410261903.s9QJ37OX062792@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Sun, 26 Oct 2014 19:03:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273706 - in head/sys/amd64/vmm: . io X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 19:03:09 -0000 Author: neel Date: Sun Oct 26 19:03:06 2014 New Revision: 273706 URL: https://svnweb.freebsd.org/changeset/base/273706 Log: Change the type of the first argument to the I/O emulation handlers to 'struct vm *'. Previously it used to be a 'void *' but there is no reason to hide the actual type from the handler. Discussed with: tychon MFC after: 1 week Modified: head/sys/amd64/vmm/io/vatpic.c head/sys/amd64/vmm/io/vatpic.h head/sys/amd64/vmm/io/vatpit.c head/sys/amd64/vmm/io/vatpit.h head/sys/amd64/vmm/io/vpmtmr.c head/sys/amd64/vmm/io/vpmtmr.h head/sys/amd64/vmm/vmm_ioport.h Modified: head/sys/amd64/vmm/io/vatpic.c ============================================================================== --- head/sys/amd64/vmm/io/vatpic.c Sun Oct 26 18:46:03 2014 (r273705) +++ head/sys/amd64/vmm/io/vatpic.c Sun Oct 26 19:03:06 2014 (r273706) @@ -641,7 +641,7 @@ vatpic_write(struct vatpic *vatpic, stru } int -vatpic_master_handler(void *vm, int vcpuid, bool in, int port, int bytes, +vatpic_master_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes, uint32_t *eax) { struct vatpic *vatpic; @@ -661,7 +661,7 @@ vatpic_master_handler(void *vm, int vcpu } int -vatpic_slave_handler(void *vm, int vcpuid, bool in, int port, int bytes, +vatpic_slave_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes, uint32_t *eax) { struct vatpic *vatpic; @@ -681,7 +681,7 @@ vatpic_slave_handler(void *vm, int vcpui } int -vatpic_elc_handler(void *vm, int vcpuid, bool in, int port, int bytes, +vatpic_elc_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes, uint32_t *eax) { struct vatpic *vatpic; Modified: head/sys/amd64/vmm/io/vatpic.h ============================================================================== --- head/sys/amd64/vmm/io/vatpic.h Sun Oct 26 18:46:03 2014 (r273705) +++ head/sys/amd64/vmm/io/vatpic.h Sun Oct 26 19:03:06 2014 (r273706) @@ -39,11 +39,11 @@ struct vatpic *vatpic_init(struct vm *vm); void vatpic_cleanup(struct vatpic *vatpic); -int vatpic_master_handler(void *vm, int vcpuid, bool in, int port, int bytes, - uint32_t *eax); -int vatpic_slave_handler(void *vm, int vcpuid, bool in, int port, int bytes, - uint32_t *eax); -int vatpic_elc_handler(void *vm, int vcpuid, bool in, int port, int bytes, +int vatpic_master_handler(struct vm *vm, int vcpuid, bool in, int port, + int bytes, uint32_t *eax); +int vatpic_slave_handler(struct vm *vm, int vcpuid, bool in, int port, + int bytes, uint32_t *eax); +int vatpic_elc_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes, uint32_t *eax); int vatpic_assert_irq(struct vm *vm, int irq); Modified: head/sys/amd64/vmm/io/vatpit.c ============================================================================== --- head/sys/amd64/vmm/io/vatpit.c Sun Oct 26 18:46:03 2014 (r273705) +++ head/sys/amd64/vmm/io/vatpit.c Sun Oct 26 19:03:06 2014 (r273706) @@ -317,7 +317,7 @@ vatpit_update_mode(struct vatpit *vatpit } int -vatpit_handler(void *vm, int vcpuid, bool in, int port, int bytes, +vatpit_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes, uint32_t *eax) { struct vatpit *vatpit; @@ -400,7 +400,7 @@ vatpit_handler(void *vm, int vcpuid, boo } int -vatpit_nmisc_handler(void *vm, int vcpuid, bool in, int port, int bytes, +vatpit_nmisc_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes, uint32_t *eax) { struct vatpit *vatpit; Modified: head/sys/amd64/vmm/io/vatpit.h ============================================================================== --- head/sys/amd64/vmm/io/vatpit.h Sun Oct 26 18:46:03 2014 (r273705) +++ head/sys/amd64/vmm/io/vatpit.h Sun Oct 26 19:03:06 2014 (r273706) @@ -37,9 +37,9 @@ struct vatpit *vatpit_init(struct vm *vm); void vatpit_cleanup(struct vatpit *vatpit); -int vatpit_handler(void *vm, int vcpuid, bool in, int port, int bytes, - uint32_t *eax); -int vatpit_nmisc_handler(void *vm, int vcpuid, bool in, int port, int bytes, +int vatpit_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes, uint32_t *eax); +int vatpit_nmisc_handler(struct vm *vm, int vcpuid, bool in, int port, + int bytes, uint32_t *eax); #endif /* _VATPIT_H_ */ Modified: head/sys/amd64/vmm/io/vpmtmr.c ============================================================================== --- head/sys/amd64/vmm/io/vpmtmr.c Sun Oct 26 18:46:03 2014 (r273705) +++ head/sys/amd64/vmm/io/vpmtmr.c Sun Oct 26 19:03:06 2014 (r273706) @@ -79,7 +79,7 @@ vpmtmr_cleanup(struct vpmtmr *vpmtmr) } int -vpmtmr_handler(void *vm, int vcpuid, bool in, int port, int bytes, +vpmtmr_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes, uint32_t *val) { struct vpmtmr *vpmtmr; Modified: head/sys/amd64/vmm/io/vpmtmr.h ============================================================================== --- head/sys/amd64/vmm/io/vpmtmr.h Sun Oct 26 18:46:03 2014 (r273705) +++ head/sys/amd64/vmm/io/vpmtmr.h Sun Oct 26 19:03:06 2014 (r273706) @@ -36,7 +36,7 @@ struct vpmtmr; struct vpmtmr *vpmtmr_init(struct vm *vm); void vpmtmr_cleanup(struct vpmtmr *pmtmr); -int vpmtmr_handler(void *vm, int vcpuid, bool in, int port, int bytes, +int vpmtmr_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes, uint32_t *val); #endif Modified: head/sys/amd64/vmm/vmm_ioport.h ============================================================================== --- head/sys/amd64/vmm/vmm_ioport.h Sun Oct 26 18:46:03 2014 (r273705) +++ head/sys/amd64/vmm/vmm_ioport.h Sun Oct 26 19:03:06 2014 (r273706) @@ -29,7 +29,7 @@ #ifndef _VMM_IOPORT_H_ #define _VMM_IOPORT_H_ -typedef int (*ioport_handler_func_t)(void *vm, int vcpuid, +typedef int (*ioport_handler_func_t)(struct vm *vm, int vcpuid, bool in, int port, int bytes, uint32_t *val); int vm_handle_inout(struct vm *vm, int vcpuid, struct vm_exit *vme, bool *retu); From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 19:42:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CF3844E7; Sun, 26 Oct 2014 19:42:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0487E25; Sun, 26 Oct 2014 19:42:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9QJgmpA081647; Sun, 26 Oct 2014 19:42:48 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9QJgjch081623; Sun, 26 Oct 2014 19:42:45 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410261942.s9QJgjch081623@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 26 Oct 2014 19:42:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273707 - in head/sys: compat/freebsd32 kern kgssapi netinet nfs nlm sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 19:42:48 -0000 Author: mjg Date: Sun Oct 26 19:42:44 2014 New Revision: 273707 URL: https://svnweb.freebsd.org/changeset/base/273707 Log: Avoid dynamic syscall overhead for statically compiled modules. The kernel tracks syscall users so that modules can safely unregister them. But if the module is not unloadable or was compiled into the kernel, there is no need to do this. Achieve this by adding SY_THR_STATIC_KLD macro which expands to SY_THR_STATIC during kernel build and 0 otherwise. Reviewed by: kib (previous version) MFC after: 2 weeks Modified: head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/freebsd32_util.h head/sys/kern/kern_syscalls.c head/sys/kern/sysv_msg.c head/sys/kern/sysv_sem.c head/sys/kern/sysv_shm.c head/sys/kern/uipc_mqueue.c head/sys/kern/uipc_sem.c head/sys/kern/vfs_aio.c head/sys/kgssapi/gss_impl.c head/sys/netinet/sctp_syscalls.c head/sys/nfs/nfs_nfssvc.c head/sys/nlm/nlm_prot_impl.c head/sys/sys/sysent.h Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Sun Oct 26 19:03:06 2014 (r273706) +++ head/sys/compat/freebsd32/freebsd32_misc.c Sun Oct 26 19:42:44 2014 (r273707) @@ -2628,8 +2628,12 @@ freebsd32_xxx(struct thread *td, struct int syscall32_register(int *offset, struct sysent *new_sysent, - struct sysent *old_sysent) + struct sysent *old_sysent, int flags) { + + if ((flags & ~SY_THR_STATIC) != 0) + return (EINVAL); + if (*offset == NO_SYSCALL) { int i; @@ -2648,16 +2652,19 @@ syscall32_register(int *offset, struct s *old_sysent = freebsd32_sysent[*offset]; freebsd32_sysent[*offset] = *new_sysent; - return 0; + atomic_store_rel_32(&freebsd32_sysent[*offset].sy_thrcnt, flags); + return (0); } int syscall32_deregister(int *offset, struct sysent *old_sysent) { - if (*offset) - freebsd32_sysent[*offset] = *old_sysent; - return 0; + if (*offset == 0) + return (0); + + freebsd32_sysent[*offset] = *old_sysent; + return (0); } int @@ -2670,7 +2677,7 @@ syscall32_module_handler(struct module * switch (what) { case MOD_LOAD: error = syscall32_register(data->offset, data->new_sysent, - &data->old_sysent); + &data->old_sysent, SY_THR_STATIC_KLD); if (error) { /* Leave a mark so we know to safely unload below. */ data->offset = NULL; @@ -2707,14 +2714,14 @@ syscall32_module_handler(struct module * } int -syscall32_helper_register(struct syscall_helper_data *sd) +syscall32_helper_register(struct syscall_helper_data *sd, int flags) { struct syscall_helper_data *sd1; int error; for (sd1 = sd; sd1->syscall_no != NO_SYSCALL; sd1++) { error = syscall32_register(&sd1->syscall_no, &sd1->new_sysent, - &sd1->old_sysent); + &sd1->old_sysent, flags); if (error != 0) { syscall32_helper_unregister(sd); return (error); Modified: head/sys/compat/freebsd32/freebsd32_util.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_util.h Sun Oct 26 19:03:06 2014 (r273706) +++ head/sys/compat/freebsd32/freebsd32_util.h Sun Oct 26 19:42:44 2014 (r273707) @@ -98,10 +98,10 @@ SYSCALL32_MODULE(syscallname, } int syscall32_register(int *offset, struct sysent *new_sysent, - struct sysent *old_sysent); + struct sysent *old_sysent, int flags); int syscall32_deregister(int *offset, struct sysent *old_sysent); int syscall32_module_handler(struct module *mod, int what, void *arg); -int syscall32_helper_register(struct syscall_helper_data *sd); +int syscall32_helper_register(struct syscall_helper_data *sd, int flags); int syscall32_helper_unregister(struct syscall_helper_data *sd); struct iovec32; Modified: head/sys/kern/kern_syscalls.c ============================================================================== --- head/sys/kern/kern_syscalls.c Sun Oct 26 19:03:06 2014 (r273706) +++ head/sys/kern/kern_syscalls.c Sun Oct 26 19:42:44 2014 (r273707) @@ -105,10 +105,13 @@ syscall_thread_exit(struct thread *td, s int syscall_register(int *offset, struct sysent *new_sysent, - struct sysent *old_sysent) + struct sysent *old_sysent, int flags) { int i; + if ((flags & ~SY_THR_STATIC) != 0) + return (EINVAL); + if (*offset == NO_SYSCALL) { for (i = 1; i < SYS_MAXSYSCALL; ++i) if (sysent[i].sy_call == (sy_call_t *)lkmnosys) @@ -127,18 +130,23 @@ syscall_register(int *offset, struct sys *old_sysent = sysent[*offset]; new_sysent->sy_thrcnt = SY_THR_ABSENT; sysent[*offset] = *new_sysent; - atomic_store_rel_32(&sysent[*offset].sy_thrcnt, 0); + atomic_store_rel_32(&sysent[*offset].sy_thrcnt, flags); return (0); } int syscall_deregister(int *offset, struct sysent *old_sysent) { + struct sysent *se; - if (*offset) { - syscall_thread_drain(&sysent[*offset]); - sysent[*offset] = *old_sysent; - } + if (*offset == 0) + return (0); /* XXX? */ + + se = &sysent[*offset]; + if ((se->sy_thrcnt & SY_THR_STATIC) != 0) + return (EINVAL); + syscall_thread_drain(se); + sysent[*offset] = *old_sysent; return (0); } @@ -152,7 +160,7 @@ syscall_module_handler(struct module *mo switch (what) { case MOD_LOAD: error = syscall_register(data->offset, data->new_sysent, - &data->old_sysent); + &data->old_sysent, SY_THR_STATIC_KLD); if (error) { /* Leave a mark so we know to safely unload below. */ data->offset = NULL; @@ -190,14 +198,14 @@ syscall_module_handler(struct module *mo } int -syscall_helper_register(struct syscall_helper_data *sd) +syscall_helper_register(struct syscall_helper_data *sd, int flags) { struct syscall_helper_data *sd1; int error; for (sd1 = sd; sd1->syscall_no != NO_SYSCALL; sd1++) { error = syscall_register(&sd1->syscall_no, &sd1->new_sysent, - &sd1->old_sysent); + &sd1->old_sysent, flags); if (error != 0) { syscall_helper_unregister(sd); return (error); Modified: head/sys/kern/sysv_msg.c ============================================================================== --- head/sys/kern/sysv_msg.c Sun Oct 26 19:03:06 2014 (r273706) +++ head/sys/kern/sysv_msg.c Sun Oct 26 19:42:44 2014 (r273707) @@ -252,11 +252,11 @@ msginit() } mtx_init(&msq_mtx, "msq", NULL, MTX_DEF); - error = syscall_helper_register(msg_syscalls); + error = syscall_helper_register(msg_syscalls, SY_THR_STATIC_KLD); if (error != 0) return (error); #ifdef COMPAT_FREEBSD32 - error = syscall32_helper_register(msg32_syscalls); + error = syscall32_helper_register(msg32_syscalls, SY_THR_STATIC_KLD); if (error != 0) return (error); #endif Modified: head/sys/kern/sysv_sem.c ============================================================================== --- head/sys/kern/sysv_sem.c Sun Oct 26 19:03:06 2014 (r273706) +++ head/sys/kern/sysv_sem.c Sun Oct 26 19:42:44 2014 (r273707) @@ -278,11 +278,11 @@ seminit(void) semexit_tag = EVENTHANDLER_REGISTER(process_exit, semexit_myhook, NULL, EVENTHANDLER_PRI_ANY); - error = syscall_helper_register(sem_syscalls); + error = syscall_helper_register(sem_syscalls, SY_THR_STATIC_KLD); if (error != 0) return (error); #ifdef COMPAT_FREEBSD32 - error = syscall32_helper_register(sem32_syscalls); + error = syscall32_helper_register(sem32_syscalls, SY_THR_STATIC_KLD); if (error != 0) return (error); #endif Modified: head/sys/kern/sysv_shm.c ============================================================================== --- head/sys/kern/sysv_shm.c Sun Oct 26 19:03:06 2014 (r273706) +++ head/sys/kern/sysv_shm.c Sun Oct 26 19:42:44 2014 (r273707) @@ -910,11 +910,11 @@ shminit() shmexit_hook = &shmexit_myhook; shmfork_hook = &shmfork_myhook; - error = syscall_helper_register(shm_syscalls); + error = syscall_helper_register(shm_syscalls, SY_THR_STATIC_KLD); if (error != 0) return (error); #ifdef COMPAT_FREEBSD32 - error = syscall32_helper_register(shm32_syscalls); + error = syscall32_helper_register(shm32_syscalls, SY_THR_STATIC_KLD); if (error != 0) return (error); #endif Modified: head/sys/kern/uipc_mqueue.c ============================================================================== --- head/sys/kern/uipc_mqueue.c Sun Oct 26 19:03:06 2014 (r273706) +++ head/sys/kern/uipc_mqueue.c Sun Oct 26 19:42:44 2014 (r273707) @@ -2809,11 +2809,11 @@ mqinit(void) { int error; - error = syscall_helper_register(mq_syscalls); + error = syscall_helper_register(mq_syscalls, SY_THR_STATIC_KLD); if (error != 0) return (error); #ifdef COMPAT_FREEBSD32 - error = syscall32_helper_register(mq32_syscalls); + error = syscall32_helper_register(mq32_syscalls, SY_THR_STATIC_KLD); if (error != 0) return (error); #endif Modified: head/sys/kern/uipc_sem.c ============================================================================== --- head/sys/kern/uipc_sem.c Sun Oct 26 19:03:06 2014 (r273706) +++ head/sys/kern/uipc_sem.c Sun Oct 26 19:42:44 2014 (r273707) @@ -993,11 +993,11 @@ ksem_module_init(void) p31b_setcfg(CTL_P1003_1B_SEM_NSEMS_MAX, SEM_MAX); p31b_setcfg(CTL_P1003_1B_SEM_VALUE_MAX, SEM_VALUE_MAX); - error = syscall_helper_register(ksem_syscalls); + error = syscall_helper_register(ksem_syscalls, SY_THR_STATIC_KLD); if (error) return (error); #ifdef COMPAT_FREEBSD32 - error = syscall32_helper_register(ksem32_syscalls); + error = syscall32_helper_register(ksem32_syscalls, SY_THR_STATIC_KLD); if (error) return (error); #endif Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Sun Oct 26 19:03:06 2014 (r273706) +++ head/sys/kern/vfs_aio.c Sun Oct 26 19:42:44 2014 (r273707) @@ -511,11 +511,11 @@ aio_onceonly(void) p31b_setcfg(CTL_P1003_1B_AIO_MAX, MAX_AIO_QUEUE); p31b_setcfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, 0); - error = syscall_helper_register(aio_syscalls); + error = syscall_helper_register(aio_syscalls, SY_THR_STATIC_KLD); if (error) return (error); #ifdef COMPAT_FREEBSD32 - error = syscall32_helper_register(aio32_syscalls); + error = syscall32_helper_register(aio32_syscalls, SY_THR_STATIC_KLD); if (error) return (error); #endif Modified: head/sys/kgssapi/gss_impl.c ============================================================================== --- head/sys/kgssapi/gss_impl.c Sun Oct 26 19:03:06 2014 (r273706) +++ head/sys/kgssapi/gss_impl.c Sun Oct 26 19:42:44 2014 (r273707) @@ -70,7 +70,7 @@ kgss_init(void *dummy) LIST_INIT(&kgss_mechs); error = syscall_register(&gssd_syscall_offset, &gssd_syscall_sysent, - &gssd_syscall_prev_sysent); + &gssd_syscall_prev_sysent, SY_THR_STATIC_KLD); if (error) printf("Can't register GSSD syscall\n"); else Modified: head/sys/netinet/sctp_syscalls.c ============================================================================== --- head/sys/netinet/sctp_syscalls.c Sun Oct 26 19:03:06 2014 (r273706) +++ head/sys/netinet/sctp_syscalls.c Sun Oct 26 19:42:44 2014 (r273707) @@ -94,11 +94,11 @@ sctp_syscalls_init(void *unused __unused { int error; - error = syscall_helper_register(sctp_syscalls); + error = syscall_helper_register(sctp_syscalls, SY_THR_STATIC); KASSERT((error == 0), ("%s: syscall_helper_register failed for sctp syscalls", __func__)); #ifdef COMPAT_FREEBSD32 - error = syscall32_helper_register(sctp_syscalls); + error = syscall32_helper_register(sctp_syscalls, SY_THR_STATIC); KASSERT((error == 0), ("%s: syscall32_helper_register failed for sctp syscalls", __func__)); Modified: head/sys/nfs/nfs_nfssvc.c ============================================================================== --- head/sys/nfs/nfs_nfssvc.c Sun Oct 26 19:03:06 2014 (r273706) +++ head/sys/nfs/nfs_nfssvc.c Sun Oct 26 19:42:44 2014 (r273707) @@ -123,7 +123,7 @@ nfssvc_modevent(module_t mod, int type, switch (type) { case MOD_LOAD: error = syscall_register(&nfssvc_offset, &nfssvc_sysent, - &nfssvc_prev_sysent); + &nfssvc_prev_sysent, SY_THR_STATIC_KLD); if (error) break; registered = 1; Modified: head/sys/nlm/nlm_prot_impl.c ============================================================================== --- head/sys/nlm/nlm_prot_impl.c Sun Oct 26 19:03:06 2014 (r273706) +++ head/sys/nlm/nlm_prot_impl.c Sun Oct 26 19:42:44 2014 (r273707) @@ -295,7 +295,7 @@ nlm_init(void *dummy) TAILQ_INIT(&nlm_hosts); error = syscall_register(&nlm_syscall_offset, &nlm_syscall_sysent, - &nlm_syscall_prev_sysent); + &nlm_syscall_prev_sysent, SY_THR_STATIC_KLD); if (error) NLM_ERR("Can't register NLM syscall\n"); else Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Sun Oct 26 19:03:06 2014 (r273706) +++ head/sys/sys/sysent.h Sun Oct 26 19:42:44 2014 (r273707) @@ -76,6 +76,12 @@ struct sysent { /* system call table * #define SY_THR_ABSENT 0x4 #define SY_THR_INCR 0x8 +#ifdef KLD_MODULE +#define SY_THR_STATIC_KLD 0 +#else +#define SY_THR_STATIC_KLD SY_THR_STATIC +#endif + struct image_params; struct __sigset; struct syscall_args; @@ -242,10 +248,10 @@ struct syscall_helper_data { } int syscall_register(int *offset, struct sysent *new_sysent, - struct sysent *old_sysent); + struct sysent *old_sysent, int flags); int syscall_deregister(int *offset, struct sysent *old_sysent); int syscall_module_handler(struct module *mod, int what, void *arg); -int syscall_helper_register(struct syscall_helper_data *sd); +int syscall_helper_register(struct syscall_helper_data *sd, int flags); int syscall_helper_unregister(struct syscall_helper_data *sd); struct proc; From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 20:13:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AB015868; Sun, 26 Oct 2014 20:13:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97E0211B; Sun, 26 Oct 2014 20:13:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9QKDkeX096075; Sun, 26 Oct 2014 20:13:46 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9QKDkLl096074; Sun, 26 Oct 2014 20:13:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410262013.s9QKDkLl096074@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 26 Oct 2014 20:13:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273708 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 20:13:46 -0000 Author: mav Date: Sun Oct 26 20:13:46 2014 New Revision: 273708 URL: https://svnweb.freebsd.org/changeset/base/273708 Log: Fix support for LUN flat space addressing. MFC after: 1 week Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sun Oct 26 19:42:44 2014 (r273707) +++ head/sys/cam/ctl/ctl.c Sun Oct 26 20:13:46 2014 (r273708) @@ -9403,17 +9403,18 @@ ctl_report_luns(struct ctl_scsiio *ctsio * Flat addressing method. */ lun_data->luns[num_filled].lundata[0] = - RPL_LUNDATA_ATYP_FLAT | - (targ_lun_id & RPL_LUNDATA_FLAT_LUN_MASK); -#ifdef OLDCTLHEADERS - (SRLD_ADDR_FLAT << SRLD_ADDR_SHIFT) | - (targ_lun_id & SRLD_BUS_LUN_MASK); -#endif + RPL_LUNDATA_ATYP_FLAT | (targ_lun_id >> 8); lun_data->luns[num_filled].lundata[1] = -#ifdef OLDCTLHEADERS - targ_lun_id >> SRLD_BUS_LUN_BITS; -#endif - targ_lun_id >> RPL_LUNDATA_FLAT_LUN_BITS; + (targ_lun_id & 0xff); + num_filled++; + } else if (targ_lun_id <= 0xffffff) { + /* + * Extended flat addressing method. + */ + lun_data->luns[num_filled].lundata[0] = + RPL_LUNDATA_ATYP_EXTLUN | 0x12; + scsi_ulto3b(targ_lun_id, + &lun_data->luns[num_filled].lundata[1]); num_filled++; } else { printf("ctl_report_luns: bogus LUN number %jd, " From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 20:48:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 722E3D5E; Sun, 26 Oct 2014 20:48:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5ECC93C7; Sun, 26 Oct 2014 20:48:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9QKmRvu010856; Sun, 26 Oct 2014 20:48:27 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9QKmRxr010855; Sun, 26 Oct 2014 20:48:27 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201410262048.s9QKmRxr010855@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sun, 26 Oct 2014 20:48:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273709 - head/usr.bin/vmstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 20:48:27 -0000 Author: mckusick Date: Sun Oct 26 20:48:26 2014 New Revision: 273709 URL: https://svnweb.freebsd.org/changeset/base/273709 Log: Replace update from -r271410 accidentally lost in -r273575. Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Sun Oct 26 20:13:46 2014 (r273708) +++ head/usr.bin/vmstat/vmstat.c Sun Oct 26 20:48:26 2014 (r273709) @@ -828,7 +828,7 @@ dovmstat(unsigned int interval, int reps } static void -printhdr(int ncpus, u_long cpumask) +printhdr(int maxid, u_long cpumask) { int i, num_shown; @@ -844,7 +844,7 @@ printhdr(int ncpus, u_long cpumask) (void)printf(" disk"); (void)printf(" faults "); if (Pflag) { - for (i = 0; i < ncpus; i++) { + for (i = 0; i <= maxid; i++) { if (cpumask & (1ul << i)) printf(" cpu%d ", i); } @@ -864,7 +864,7 @@ printhdr(int ncpus, u_long cpumask) dev_select[i].unit_number); (void)printf(" in sy cs"); if (Pflag) { - for (i = 0; i < ncpus; i++) { + for (i = 0; i <= maxid; i++) { if (cpumask & (1ul << i)) printf(" us sy id"); } From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 21:17:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2FDA5509; Sun, 26 Oct 2014 21:17:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CC848FE; Sun, 26 Oct 2014 21:17:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9QLHiBc025121; Sun, 26 Oct 2014 21:17:44 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9QLHi2b025120; Sun, 26 Oct 2014 21:17:44 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201410262117.s9QLHi2b025120@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Sun, 26 Oct 2014 21:17:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273710 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 21:17:45 -0000 Author: neel Date: Sun Oct 26 21:17:44 2014 New Revision: 273710 URL: https://svnweb.freebsd.org/changeset/base/273710 Log: Add a comment explaining the intent behind the I/O reservation [0x72-0x77]. Modified: head/usr.sbin/bhyve/rtc.c Modified: head/usr.sbin/bhyve/rtc.c ============================================================================== --- head/usr.sbin/bhyve/rtc.c Sun Oct 26 20:48:26 2014 (r273709) +++ head/usr.sbin/bhyve/rtc.c Sun Oct 26 21:17:44 2014 (r273710) @@ -375,4 +375,8 @@ rtc_dsdt(void) } LPC_DSDT(rtc_dsdt); +/* + * Reserve the extended RTC I/O ports although they are not emulated at this + * time. + */ SYSRES_IO(0x72, 6); From owner-svn-src-head@FreeBSD.ORG Sun Oct 26 23:25:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DF4199D6; Sun, 26 Oct 2014 23:25:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB9BB400; Sun, 26 Oct 2014 23:25:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9QNPh3D089179; Sun, 26 Oct 2014 23:25:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9QNPhae089172; Sun, 26 Oct 2014 23:25:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410262325.s9QNPhae089172@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 26 Oct 2014 23:25:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273711 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 23:25:44 -0000 Author: mav Date: Sun Oct 26 23:25:42 2014 New Revision: 273711 URL: https://svnweb.freebsd.org/changeset/base/273711 Log: Allocate buffer for READ BUFFER/WRITE BUFFER commands on demand. These commands are rare, but consume additional 256KB RAM per LUN. MFC after: 1 week Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_private.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sun Oct 26 21:17:44 2014 (r273710) +++ head/sys/cam/ctl/ctl.c Sun Oct 26 23:25:42 2014 (r273711) @@ -4735,6 +4735,7 @@ ctl_free_lun(struct ctl_lun *lun) ctl_tpc_lun_shutdown(lun); mtx_destroy(&lun->lun_lock); free(lun->lun_devid, M_CTL); + free(lun->write_buffer, M_CTL); if (lun->flags & CTL_LUN_MALLOCED) free(lun, M_CTL); @@ -5726,7 +5727,7 @@ ctl_read_buffer(struct ctl_scsiio *ctsio len = scsi_3btoul(cdb->length); buffer_offset = scsi_3btoul(cdb->offset); - if (buffer_offset + len > sizeof(lun->write_buffer)) { + if (buffer_offset + len > CTL_WRITE_BUFFER_SIZE) { ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 1, @@ -5739,14 +5740,19 @@ ctl_read_buffer(struct ctl_scsiio *ctsio if ((cdb->byte2 & RWB_MODE) == RWB_MODE_DESCR) { descr[0] = 0; - scsi_ulto3b(sizeof(lun->write_buffer), &descr[1]); + scsi_ulto3b(CTL_WRITE_BUFFER_SIZE, &descr[1]); ctsio->kern_data_ptr = descr; len = min(len, sizeof(descr)); } else if ((cdb->byte2 & RWB_MODE) == RWB_MODE_ECHO_DESCR) { ctsio->kern_data_ptr = echo_descr; len = min(len, sizeof(echo_descr)); - } else + } else { + if (lun->write_buffer == NULL) { + lun->write_buffer = malloc(CTL_WRITE_BUFFER_SIZE, + M_CTL, M_WAITOK); + } ctsio->kern_data_ptr = lun->write_buffer + buffer_offset; + } ctsio->kern_data_len = len; ctsio->kern_total_len = len; ctsio->kern_data_resid = 0; @@ -5784,7 +5790,7 @@ ctl_write_buffer(struct ctl_scsiio *ctsi len = scsi_3btoul(cdb->length); buffer_offset = scsi_3btoul(cdb->offset); - if (buffer_offset + len > sizeof(lun->write_buffer)) { + if (buffer_offset + len > CTL_WRITE_BUFFER_SIZE) { ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 1, @@ -5800,6 +5806,10 @@ ctl_write_buffer(struct ctl_scsiio *ctsi * malloc it and tell the caller the data buffer is here. */ if ((ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) { + if (lun->write_buffer == NULL) { + lun->write_buffer = malloc(CTL_WRITE_BUFFER_SIZE, + M_CTL, M_WAITOK); + } ctsio->kern_data_ptr = lun->write_buffer + buffer_offset; ctsio->kern_data_len = len; ctsio->kern_total_len = len; Modified: head/sys/cam/ctl/ctl_private.h ============================================================================== --- head/sys/cam/ctl/ctl_private.h Sun Oct 26 21:17:44 2014 (r273710) +++ head/sys/cam/ctl/ctl_private.h Sun Oct 26 23:25:42 2014 (r273711) @@ -384,6 +384,8 @@ struct ctl_devid { */ #define NUM_TARGET_PORT_GROUPS 2 +#define CTL_WRITE_BUFFER_SIZE 262144 + struct tpc_list; struct ctl_lun { struct mtx lun_lock; @@ -417,7 +419,7 @@ struct ctl_lun { int pr_key_count; uint32_t pr_res_idx; uint8_t res_type; - uint8_t write_buffer[262144]; + uint8_t *write_buffer; struct ctl_devid *lun_devid; TAILQ_HEAD(tpc_lists, tpc_list) tpc_lists; }; From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 01:10:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BA28AEB3; Mon, 27 Oct 2014 01:10:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A65C6EA1; Mon, 27 Oct 2014 01:10:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9R1AfSY038667; Mon, 27 Oct 2014 01:10:41 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9R1AfHX038666; Mon, 27 Oct 2014 01:10:41 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201410270110.s9R1AfHX038666@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Mon, 27 Oct 2014 01:10:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273716 - head/sys/sparc64/sparc64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 01:10:41 -0000 Author: alc Date: Mon Oct 27 01:10:40 2014 New Revision: 273716 URL: https://svnweb.freebsd.org/changeset/base/273716 Log: Simplify memrw(). MFC after: 10 days Modified: head/sys/sparc64/sparc64/mem.c Modified: head/sys/sparc64/sparc64/mem.c ============================================================================== --- head/sys/sparc64/sparc64/mem.c Mon Oct 27 00:47:55 2014 (r273715) +++ head/sys/sparc64/sparc64/mem.c Mon Oct 27 01:10:40 2014 (r273716) @@ -65,13 +65,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include #include -#include #include #include @@ -92,7 +92,6 @@ memrw(struct cdev *dev, struct uio *uio, vm_size_t cnt; vm_page_t m; int error; - int i; uint32_t colors; cnt = 0; @@ -124,15 +123,7 @@ memrw(struct cdev *dev, struct uio *uio, cnt = ulmin(cnt, PAGE_SIZE - off); cnt = ulmin(cnt, iov->iov_len); - m = NULL; - for (i = 0; phys_avail[i] != 0; i += 2) { - if (pa >= phys_avail[i] && - pa < phys_avail[i + 1]) { - m = PHYS_TO_VM_PAGE(pa); - break; - } - } - + m = vm_phys_paddr_to_vm_page(pa); if (m != NULL) { if (ova == 0) { if (dcache_color_ignore == 0) From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 02:51:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9198AA17; Mon, 27 Oct 2014 02:51:08 +0000 (UTC) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id 5627DA41; Mon, 27 Oct 2014 02:51:08 +0000 (UTC) Received: from lgwl-lstewart2.corp.netflix.com (c110-22-7-57.eburwd3.vic.optusnet.com.au [110.22.7.57]) by lauren.room52.net (Postfix) with ESMTPSA id A713B7E824; Mon, 27 Oct 2014 13:43:32 +1100 (EST) Message-ID: <544DB140.7070807@freebsd.org> Date: Mon, 27 Oct 2014 13:43:12 +1100 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Hiroki Sato , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r272386 - in head: sbin/ifconfig share/man/man4 sys/net References: <201410012137.s91LbXL4025967@svn.freebsd.org> In-Reply-To: <201410012137.s91LbXL4025967@svn.freebsd.org> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lauren.room52.net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 02:51:08 -0000 Hi Hiroki-san, On 10/02/14 07:37, Hiroki Sato wrote: > Author: hrs > Date: Wed Oct 1 21:37:32 2014 > New Revision: 272386 > URL: https://svnweb.freebsd.org/changeset/base/272386 > > Log: > Virtualize lagg(4) cloner. This change fixes a panic when tearing down > if_lagg(4) interfaces which were cloned in a vnet jail. > > Sysctl nodes which are dynamically generated for each cloned interface > (net.link.lagg.N.*) have been removed, and use_flowid and flowid_shift > ifconfig(8) parameters have been added instead. Flags and per-interface > statistics counters are displayed in "ifconfig -v". > > CR: D842 > > Modified: > head/sbin/ifconfig/ifconfig.8 > head/sbin/ifconfig/iflagg.c > head/share/man/man4/lagg.4 > head/sys/net/ieee8023ad_lacp.c > head/sys/net/if_lagg.c > head/sys/net/if_lagg.h What was the reasoning for removing the net.link.lagg.* sysctls? We use them at Netflix and the new way of obtaining the information via ifconfig -v is less structured and significantly higher overhead by comparison. Would be good to have the sysctls back or an equivalent low overhead way of obtaining the previously available information. Cheers, Lawrence From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 04:09:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E18E33F9; Mon, 27 Oct 2014 04:09:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CD95F1A3; Mon, 27 Oct 2014 04:09:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9R49OaD023320; Mon, 27 Oct 2014 04:09:24 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9R49Ola023318; Mon, 27 Oct 2014 04:09:24 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410270409.s9R49Ola023318@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 27 Oct 2014 04:09:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273717 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 04:09:25 -0000 Author: markj Date: Mon Oct 27 04:09:23 2014 New Revision: 273717 URL: https://svnweb.freebsd.org/changeset/base/273717 Log: getgrouplist(3) was reimplemented in terms of getgrent_r(3) in r174547, so this bug is no longer valid. MFC after: 3 days Modified: head/lib/libc/gen/getgrouplist.3 head/lib/libc/gen/initgroups.3 Modified: head/lib/libc/gen/getgrouplist.3 ============================================================================== --- head/lib/libc/gen/getgrouplist.3 Mon Oct 27 01:10:40 2014 (r273716) +++ head/lib/libc/gen/getgrouplist.3 Mon Oct 27 04:09:23 2014 (r273717) @@ -28,7 +28,7 @@ .\" @(#)getgrouplist.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd February 20, 2012 +.Dd October 26, 2014 .Dt GETGROUPLIST 3 .Os .Sh NAME @@ -80,13 +80,3 @@ The .Fn getgrouplist function first appeared in .Bx 4.4 . -.Sh BUGS -The -.Fn getgrouplist -function -uses the routines based on -.Xr getgrent 3 . -If the invoking program uses any of these routines, -the group structure will -be overwritten in the call to -.Fn getgrouplist . Modified: head/lib/libc/gen/initgroups.3 ============================================================================== --- head/lib/libc/gen/initgroups.3 Mon Oct 27 01:10:40 2014 (r273716) +++ head/lib/libc/gen/initgroups.3 Mon Oct 27 04:09:23 2014 (r273717) @@ -28,7 +28,7 @@ .\" @(#)initgroups.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd October 26, 2014 .Dt INITGROUPS 3 .Os .Sh NAME @@ -80,14 +80,3 @@ The .Fn initgroups function appeared in .Bx 4.2 . -.Sh BUGS -The -.Fn getgrouplist -function called by -.Fn initgroups -uses the routines based on -.Xr getgrent 3 . -If the invoking program uses any of these routines, -the group structure will -be overwritten in the call to -.Fn initgroups . From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 05:50:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8FCF3E92; Mon, 27 Oct 2014 05:50:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7AD81C36; Mon, 27 Oct 2014 05:50:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9R5o32j068996; Mon, 27 Oct 2014 05:50:03 GMT (envelope-from edwin@FreeBSD.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9R5o2J1068989; Mon, 27 Oct 2014 05:50:02 GMT (envelope-from edwin@FreeBSD.org) Message-Id: <201410270550.s9R5o2J1068989@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: edwin set sender to edwin@FreeBSD.org using -f From: Edwin Groothuis Date: Mon, 27 Oct 2014 05:50:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273718 - head/contrib/tzdata X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 05:50:03 -0000 Author: edwin Date: Mon Oct 27 05:50:02 2014 New Revision: 273718 URL: https://svnweb.freebsd.org/changeset/base/273718 Log: Merge of 273518, tzdata2014i Upgrade to 2014i Lots of historical data Pacific/Fiji will go into DST from 2014-11-02 to 2015-01-18 Pacific/Bougainville will go from UTC+10 to UTC+11. Europe/Minsk will go from FET to MSK. Modified: head/contrib/tzdata/africa head/contrib/tzdata/antarctica head/contrib/tzdata/asia head/contrib/tzdata/australasia head/contrib/tzdata/backward head/contrib/tzdata/europe head/contrib/tzdata/northamerica head/contrib/tzdata/southamerica head/contrib/tzdata/zone.tab head/contrib/tzdata/zone1970.tab Directory Properties: head/contrib/tzdata/ (props changed) Modified: head/contrib/tzdata/africa ============================================================================== --- head/contrib/tzdata/africa Mon Oct 27 04:09:23 2014 (r273717) +++ head/contrib/tzdata/africa Mon Oct 27 05:50:02 2014 (r273718) @@ -1,9 +1,10 @@ # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. -# This data is by no means authoritative; if you think you know better, +# This file is by no means authoritative; if you think you know better, # go ahead and edit the file (and please send any changes to -# tz@iana.org for general use in the future). +# tz@iana.org for general use in the future). For more, please see +# the file CONTRIBUTING in the tz distribution. # From Paul Eggert (2013-02-21): # @@ -25,8 +26,8 @@ # I found in the UCLA library. # # For data circa 1899, a common source is: -# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94 -# . +# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94. +# http://www.jstor.org/stable/1774359 # # A reliable and entertaining source about time zones is # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997). @@ -93,9 +94,9 @@ Rule Algeria 1980 only - Oct 31 2:00 0 # Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's # more precise 0:09:21. # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Algiers 0:12:12 - LMT 1891 Mar 15 0:01 - 0:09:21 - PMT 1911 Mar 11 # Paris Mean Time - 0:00 Algeria WE%sT 1940 Feb 25 2:00 +Zone Africa/Algiers 0:12:12 - LMT 1891 Mar 15 0:01 + 0:09:21 - PMT 1911 Mar 11 # Paris Mean Time + 0:00 Algeria WE%sT 1940 Feb 25 2:00 1:00 Algeria CE%sT 1946 Oct 7 0:00 - WET 1956 Jan 29 1:00 - CET 1963 Apr 14 @@ -105,82 +106,57 @@ Zone Africa/Algiers 0:12:12 - LMT 1891 M 1:00 - CET # Angola -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Luanda 0:52:56 - LMT 1892 - 0:52:04 - AOT 1911 May 26 # Angola Time - 1:00 - WAT - # Benin -# Whitman says they switched to 1:00 in 1946, not 1934; -# go with Shanks & Pottenger. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Porto-Novo 0:10:28 - LMT 1912 - 0:00 - GMT 1934 Feb 26 - 1:00 - WAT +# See Africa/Lagos. # Botswana -# From Paul Eggert (2013-02-21): -# Milne says they were regulated by the Cape Town Signal in 1899; -# assume they switched to 2:00 when Cape Town did. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Gaborone 1:43:40 - LMT 1885 - 1:30 - SAST 1903 Mar - 2:00 - CAT 1943 Sep 19 2:00 - 2:00 1:00 CAST 1944 Mar 19 2:00 - 2:00 - CAT +# See Africa/Maputo. # Burkina Faso # See Africa/Abidjan. # Burundi -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Bujumbura 1:57:28 - LMT 1890 - 2:00 - CAT +# See Africa/Maputo. # Cameroon -# Whitman says they switched to 1:00 in 1920; go with Shanks & Pottenger. -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Douala 0:38:48 - LMT 1912 - 1:00 - WAT +# See Africa/Lagos. # Cape Verde +# +# Shanks gives 1907 for the transition to CVT. +# Perhaps the 1911-05-26 Portuguese decree +# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf +# merely made it official? +# # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Atlantic/Cape_Verde -1:34:04 - LMT 1907 # Praia +Zone Atlantic/Cape_Verde -1:34:04 - LMT 1907 # Praia -2:00 - CVT 1942 Sep -2:00 1:00 CVST 1945 Oct 15 - -2:00 - CVT 1975 Nov 25 2:00 + -2:00 - CVT 1975 Nov 25 2:00 -1:00 - CVT # Central African Republic -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Bangui 1:14:20 - LMT 1912 - 1:00 - WAT +# See Africa/Lagos. # Chad # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Ndjamena 1:00:12 - LMT 1912 # N'Djamena +Zone Africa/Ndjamena 1:00:12 - LMT 1912 # N'Djamena 1:00 - WAT 1979 Oct 14 1:00 1:00 WAST 1980 Mar 8 1:00 - WAT # Comoros # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Comoro 2:53:04 - LMT 1911 Jul # Moroni, Gran Comoro +Zone Indian/Comoro 2:53:04 - LMT 1911 Jul # Moroni, Gran Comoro 3:00 - EAT -# Democratic Republic of Congo -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Kinshasa 1:01:12 - LMT 1897 Nov 9 - 1:00 - WAT -Zone Africa/Lubumbashi 1:49:52 - LMT 1897 Nov 9 - 2:00 - CAT +# Democratic Republic of the Congo +# See Africa/Lagos for the western part and Africa/Maputo for the eastern. # Republic of the Congo -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Brazzaville 1:01:08 - LMT 1912 - 1:00 - WAT +# See Africa/Lagos. -# Côte D'Ivoire / Ivory Coast +# Côte d'Ivoire / Ivory Coast # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Abidjan -0:16:08 - LMT 1912 0:00 - GMT @@ -327,7 +303,7 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 # Egypt is to change back to Daylight system on May 15 # http://english.ahram.org.eg/NewsContent/1/64/100735/Egypt/Politics-/Egypts-government-to-reapply-daylight-saving-time-.aspx -# From Gunther Vermier (2015-05-13): +# From Gunther Vermier (2014-05-13): # our Egypt office confirms that the change will be at 15 May "midnight" (24:00) # From Imed Chihi (2014-06-04): @@ -408,16 +384,13 @@ Zone Africa/Cairo 2:05:09 - LMT 1900 Oct 2:00 Egypt EE%sT # Equatorial Guinea -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Malabo 0:35:08 - LMT 1912 - 0:00 - GMT 1963 Dec 15 - 1:00 - WAT +# See Africa/Lagos. # Eritrea # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Asmara 2:35:32 - LMT 1870 - 2:35:32 - AMT 1890 # Asmara Mean Time - 2:35:20 - ADMT 1936 May 5 # Adis Dera MT + 2:35:32 - AMT 1890 # Asmara Mean Time + 2:35:20 - ADMT 1936 May 5 # Adis Dera MT 3:00 - EAT # Ethiopia @@ -429,16 +402,15 @@ Zone Africa/Asmara 2:35:32 - LMT 1870 # Shanks & Pottenger write that Ethiopia had six narrowly-spaced time # zones between 1870 and 1890, that they merged to 38E50 (2:35:20) in # 1890, and that they switched to 3:00 on 1936-05-05. Perhaps 38E50 -# was for Adis Dera. Quite likely the Shanks data are wrong anyway. +# was for Adis Dera. Quite likely the Shanks data entries are wrong +# anyway. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Addis_Ababa 2:34:48 - LMT 1870 - 2:35:20 - ADMT 1936 May 5 # Adis Dera MT + 2:35:20 - ADMT 1936 May 5 # Adis Dera MT 3:00 - EAT # Gabon -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Libreville 0:37:48 - LMT 1912 - 1:00 - WAT +# See Africa/Lagos. # Gambia # See Africa/Abidjan. @@ -461,8 +433,14 @@ Zone Africa/Accra -0:00:52 - LMT 1918 # See Africa/Abidjan. # Guinea-Bissau +# +# Shanks gives 1911-05-26 for the transition to WAT, +# evidently confusing the date of the Portuguese decree +# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf +# with the date that it took effect, namely 1912-01-01. +# # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Bissau -1:02:20 - LMT 1911 May 26 +Zone Africa/Bissau -1:02:20 - LMT 1912 Jan 1 -1:00 - WAT 1975 0:00 - GMT @@ -475,11 +453,7 @@ Zone Africa/Nairobi 2:27:16 - LMT 1928 J 3:00 - EAT # Lesotho -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Maseru 1:50:00 - LMT 1903 Mar - 2:00 - SAST 1943 Sep 19 2:00 - 2:00 1:00 SAST 1944 Mar 19 2:00 - 2:00 - SAST +# See Africa/Johannesburg. # Liberia # From Paul Eggert (2006-03-22): @@ -546,11 +520,11 @@ Zone Africa/Tripoli 0:52:44 - LMT 1920 2:00 - EET 1982 1:00 Libya CE%sT 1990 May 4 # The 1996 and 1997 entries are from Shanks & Pottenger; -# the IATA SSIM data contain some obvious errors. +# the IATA SSIM data entries contain some obvious errors. 2:00 - EET 1996 Sep 30 1:00 Libya CE%sT 1997 Oct 4 - 2:00 - EET 2012 Nov 10 2:00 - 1:00 Libya CE%sT 2013 Oct 25 2:00 + 2:00 - EET 2012 Nov 10 2:00 + 1:00 Libya CE%sT 2013 Oct 25 2:00 2:00 - EET # Madagascar @@ -561,9 +535,7 @@ Zone Indian/Antananarivo 3:10:04 - LMT 1 3:00 - EAT # Malawi -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Blantyre 2:20:00 - LMT 1903 Mar - 2:00 - CAT +# See Africa/Maputo. # Mali # Mauritania @@ -606,7 +578,7 @@ Zone Africa/Blantyre 2:20:00 - LMT 1903 # From Alex Krivenyshev (2008-07-11): # Seems that English language article "The revival of daylight saving -# time: Energy conservation?"-# No. 16578 (07/11/2008) was originally +# time: Energy conservation?"-# No. 16578 (07/11/2008) was originally # published on Monday, June 30, 2008... # # I guess that article in French "Le gouvernement avance l'introduction @@ -657,14 +629,14 @@ Rule Mauritius 1983 only - Mar 21 0:00 0 Rule Mauritius 2008 only - Oct lastSun 2:00 1:00 S Rule Mauritius 2009 only - Mar lastSun 2:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis +Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis 4:00 Mauritius MU%sT # Mauritius Time # Agalega Is, Rodriguez # no information; probably like Indian/Mauritius # Mayotte # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou +Zone Indian/Mayotte 3:00:56 - LMT 1911 Jul # Mamoutzou 3:00 - EAT # Morocco @@ -682,7 +654,8 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 J # http://en.afrik.com/news11892.html # From Alex Krivenyshev (2008-05-09): -# The Morocco time change can be confirmed on Morocco web site Maghreb Arabe Presse: +# The Morocco time change can be confirmed on Morocco web site Maghreb Arabe +# Presse: # http://www.map.ma/eng/sections/box3/morocco_shifts_to_da/view # # Morocco shifts to daylight time on June 1st through September 27, Govt. @@ -760,8 +733,8 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 J # From Dan Abitol (2011-03-30): # ...Rules for Africa/Casablanca are the following (24h format) -# The 3rd april 2011 at 00:00:00, [it] will be 3rd april 1:00:00 -# The 31th july 2011 at 00:59:59, [it] will be 31th July 00:00:00 +# The 3rd April 2011 at 00:00:00, [it] will be 3rd April 01:00:00 +# The 31st July 2011 at 00:59:59, [it] will be 31st July 00:00:00 # ...Official links of change in morocco # The change was broadcast on the FM Radio # I ve called ANRT (telecom regulations in Morocco) at @@ -831,7 +804,7 @@ Zone Indian/Mayotte 3:00:56 - LMT 1911 J # announced a bit in advance. On 2012-07-11 the Moroccan government # announced that year's Ramadan daylight-saving transitions would be # 2012-07-20 and 2012-08-20; see -# . +# http://www.mmsp.gov.ma/fr/actualites.aspx?id=288 # From Andrew Paprocki (2013-07-02): # Morocco announced that the year's Ramadan daylight-savings @@ -963,16 +936,29 @@ Zone Africa/El_Aaiun -0:52:48 - LMT 1934 0:00 Morocco WE%sT # Mozambique +# +# Shanks gives 1903-03-01 for the transition to CAT. +# Perhaps the 1911-05-26 Portuguese decree +# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf +# merely made it official? +# # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Maputo 2:10:20 - LMT 1903 Mar 2:00 - CAT +Link Africa/Maputo Africa/Blantyre # Malawi +Link Africa/Maputo Africa/Bujumbura # Burundi +Link Africa/Maputo Africa/Gaborone # Botswana +Link Africa/Maputo Africa/Harare # Zimbabwe +Link Africa/Maputo Africa/Kigali # Rwanda +Link Africa/Maputo Africa/Lubumbashi # E Dem. Rep. of Congo +Link Africa/Maputo Africa/Lusaka # Zambia # Namibia # The 1994-04-03 transition is from Shanks & Pottenger. # Shanks & Pottenger report no DST after 1998-04; go with IATA. -# From Petronella Sibeene (2007-03-30) in -# : +# From Petronella Sibeene (2007-03-30): +# http://allafrica.com/stories/200703300178.html # While the entire country changes its time, Katima Mulilo and other # settlements in Caprivi unofficially will not because the sun there # rises and sets earlier compared to other regions. Chief of @@ -989,28 +975,33 @@ Rule Namibia 1994 max - Sep Sun>=1 2:00 Rule Namibia 1995 max - Apr Sun>=1 2:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Windhoek 1:08:24 - LMT 1892 Feb 8 - 1:30 - SWAT 1903 Mar # SW Africa Time - 2:00 - SAST 1942 Sep 20 2:00 - 2:00 1:00 SAST 1943 Mar 21 2:00 + 1:30 - SWAT 1903 Mar # SW Africa Time + 2:00 - SAST 1942 Sep 20 2:00 + 2:00 1:00 SAST 1943 Mar 21 2:00 2:00 - SAST 1990 Mar 21 # independence 2:00 - CAT 1994 Apr 3 1:00 Namibia WA%sT # Niger -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Niamey 0:08:28 - LMT 1912 - -1:00 - WAT 1934 Feb 26 - 0:00 - GMT 1960 - 1:00 - WAT +# See Africa/Lagos. # Nigeria # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Lagos 0:13:36 - LMT 1919 Sep 1:00 - WAT +Link Africa/Lagos Africa/Bangui # Central African Republic +Link Africa/Lagos Africa/Brazzaville # Rep. of the Congo +Link Africa/Lagos Africa/Douala # Cameroon +Link Africa/Lagos Africa/Kinshasa # Dem. Rep. of the Congo (west) +Link Africa/Lagos Africa/Libreville # Gabon +Link Africa/Lagos Africa/Luanda # Angola +Link Africa/Lagos Africa/Malabo # Equatorial Guinea +Link Africa/Lagos Africa/Niamey # Niger +Link Africa/Lagos Africa/Porto-Novo # Benin # Réunion # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Denis +Zone Indian/Reunion 3:41:52 - LMT 1911 Jun # Saint-Denis 4:00 - RET # Réunion Time # # Crozet Islands also observes Réunion time; see the 'antarctica' file. @@ -1028,9 +1019,7 @@ Zone Indian/Reunion 3:41:52 - LMT 1911 J # Tromelin - inhabited until at least 1958 # Rwanda -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Kigali 2:00:16 - LMT 1935 Jun - 2:00 - CAT +# See Africa/Maputo. # St Helena # See Africa/Abidjan. @@ -1047,7 +1036,7 @@ Zone Africa/Kigali 2:00:16 - LMT 1935 Ju # Seychelles # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Mahe 3:41:48 - LMT 1906 Jun # Victoria +Zone Indian/Mahe 3:41:48 - LMT 1906 Jun # Victoria 4:00 - SCT # Seychelles Time # From Paul Eggert (2001-05-30): # Aldabra, Farquhar, and Desroches, originally dependencies of the @@ -1074,6 +1063,9 @@ Rule SA 1943 1944 - Mar Sun>=15 2:00 0 - Zone Africa/Johannesburg 1:52:00 - LMT 1892 Feb 8 1:30 - SAST 1903 Mar 2:00 SA SAST +Link Africa/Johannesburg Africa/Maseru # Lesotho +Link Africa/Johannesburg Africa/Mbabane # Swaziland +# # Marion and Prince Edward Is # scientific station since 1947 # no information @@ -1101,9 +1093,7 @@ Zone Africa/Khartoum 2:10:08 - LMT 1931 Link Africa/Khartoum Africa/Juba # Swaziland -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Mbabane 2:04:24 - LMT 1903 Mar - 2:00 - SAST +# See Africa/Johannesburg. # Tanzania # Zone NAME GMTOFF RULES FORMAT [UNTIL] @@ -1128,7 +1118,7 @@ Zone Africa/Dar_es_Salaam 2:37:08 - LMT # # From Oscar van Vlijmen (2005-05-02): # La Presse, the first national daily newspaper ... -# +# http://www.lapresse.tn/archives/archives280405/actualites/lheure.html # ... DST for 2005: on: Sun May 1 0h standard time, off: Fri Sept. 30, # 1h standard time. # @@ -1212,7 +1202,7 @@ Rule Tunisia 2006 2008 - Oct lastSun 2: # Shanks & Pottenger say the 1911 switch was on Mar 9; go with Howse's Mar 11. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Tunis 0:40:44 - LMT 1881 May 12 - 0:09:21 - PMT 1911 Mar 11 # Paris Mean Time + 0:09:21 - PMT 1911 Mar 11 # Paris Mean Time 1:00 Tunisia CE%sT # Uganda @@ -1224,11 +1214,5 @@ Zone Africa/Kampala 2:09:40 - LMT 1928 J 3:00 - EAT # Zambia -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Lusaka 1:53:08 - LMT 1903 Mar - 2:00 - CAT - # Zimbabwe -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Africa/Harare 2:04:12 - LMT 1903 Mar - 2:00 - CAT +# See Africa/Maputo. Modified: head/contrib/tzdata/antarctica ============================================================================== --- head/contrib/tzdata/antarctica Mon Oct 27 04:09:23 2014 (r273717) +++ head/contrib/tzdata/antarctica Mon Oct 27 05:50:02 2014 (r273718) @@ -4,10 +4,10 @@ # From Paul Eggert (1999-11-15): # To keep things manageable, we list only locations occupied year-round; see # COMNAP - Stations and Bases -# +# http://www.comnap.aq/comnap/comnap.nsf/P/Stations/ # and # Summary of the Peri-Antarctic Islands (1998-07-23) -# +# http://www.spri.cam.ac.uk/bob/periant.htm # for information. # Unless otherwise specified, we have no time zone information. # @@ -63,7 +63,7 @@ Rule ChileAQ 2012 max - Sep Sun>=2 4:00u # Heard Island, McDonald Islands (uninhabited) # previously sealers and scientific personnel wintered # Margaret Turner reports -# +# http://web.archive.org/web/20021204222245/http://www.dstc.qut.edu.au/DST/marg/daylight.html # (1999-09-30) that they're UTC+5, with no DST; # presumably this is when they have visitors. # @@ -103,32 +103,30 @@ Rule ChileAQ 2012 max - Sep Sun>=2 4:00u # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Antarctica/Casey 0 - zzz 1969 - 8:00 - AWST 2009 Oct 18 2:00 + 8:00 - AWST 2009 Oct 18 2:00 # Australian Western Std Time - 11:00 - CAST 2010 Mar 5 2:00 - # Casey Time - 8:00 - AWST 2011 Oct 28 2:00 + 11:00 - CAST 2010 Mar 5 2:00 # Casey Time + 8:00 - AWST 2011 Oct 28 2:00 11:00 - CAST 2012 Feb 21 17:00u 8:00 - AWST Zone Antarctica/Davis 0 - zzz 1957 Jan 13 - 7:00 - DAVT 1964 Nov # Davis Time + 7:00 - DAVT 1964 Nov # Davis Time 0 - zzz 1969 Feb - 7:00 - DAVT 2009 Oct 18 2:00 + 7:00 - DAVT 2009 Oct 18 2:00 5:00 - DAVT 2010 Mar 10 20:00u - 7:00 - DAVT 2011 Oct 28 2:00 + 7:00 - DAVT 2011 Oct 28 2:00 5:00 - DAVT 2012 Feb 21 20:00u 7:00 - DAVT Zone Antarctica/Mawson 0 - zzz 1954 Feb 13 - 6:00 - MAWT 2009 Oct 18 2:00 - # Mawson Time + 6:00 - MAWT 2009 Oct 18 2:00 # Mawson Time 5:00 - MAWT # References: # Casey Weather (1998-02-26) -# +# http://www.antdiv.gov.au/aad/exop/sfo/casey/casey_aws.html # Davis Station, Antarctica (1998-02-26) -# +# http://www.antdiv.gov.au/aad/exop/sfo/davis/video.html # Mawson Station, Antarctica (1998-02-25) -# +# http://www.antdiv.gov.au/aad/exop/sfo/mawson/video.html # Belgium - year-round base # Princess Elisabeth, Queen Maud Land, -713412+0231200, since 2007 @@ -154,7 +152,7 @@ Zone Antarctica/Mawson 0 - zzz 1954 Feb # France - year-round bases (also see "France & Italy") # # From Antoine Leca (1997-01-20): -# Time data are from Nicole Pailleau at the IFRTP +# Time data entries are from Nicole Pailleau at the IFRTP # (French Institute for Polar Research and Technology). # She confirms that French Southern Territories and Terre Adélie bases # don't observe daylight saving time, even if Terre Adélie supplies came @@ -174,7 +172,7 @@ Zone Antarctica/Mawson 0 - zzz 1954 Feb # fishing stations operated variously 1819/1931 # # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Kerguelen 0 - zzz 1950 # Port-aux-Français +Zone Indian/Kerguelen 0 - zzz 1950 # Port-aux-Français 5:00 - TFT # ISO code TF Time # # year-round base in the main continent @@ -217,7 +215,7 @@ Zone Antarctica/Syowa 0 - zzz 1957 Jan 2 3:00 - SYOT # Syowa Time # See: # NIPR Antarctic Research Activities (1999-08-17) -# +# http://www.nipr.ac.jp/english/ara01.html # S Korea - year-round base # Jang Bogo, Terra Nova Bay, -743700+1641205 since 2014 @@ -264,7 +262,7 @@ Rule Troll 2005 max - Mar lastSun 1:00u Rule Troll 2004 max - Oct lastSun 1:00u 0:00 UTC # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Antarctica/Troll 0 - zzz 2005 Feb 12 - 0:00 Troll %s + 0:00 Troll %s # Poland - year-round base # Arctowski, King George Island, -620945-0582745, since 1977 @@ -281,8 +279,8 @@ Zone Antarctica/Troll 0 - zzz 2005 Feb 1 # year-round from 1960/61 to 1992 # Vostok, since 1957-12-16, temporarily closed 1994-02/1994-11 -# From Craig Mundell (1994-12-15) -# : +# From Craig Mundell (1994-12-15): +# http://quest.arc.nasa.gov/antarctica/QA/computers/Directions,Time,ZIP # Vostok, which is one of the Russian stations, is set on the same # time as Moscow, Russia. # Modified: head/contrib/tzdata/asia ============================================================================== --- head/contrib/tzdata/asia Mon Oct 27 04:09:23 2014 (r273717) +++ head/contrib/tzdata/asia Mon Oct 27 05:50:02 2014 (r273718) @@ -1,9 +1,10 @@ # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. -# This data is by no means authoritative; if you think you know better, +# This file is by no means authoritative; if you think you know better, # go ahead and edit the file (and please send any changes to -# tz@iana.org for general use in the future). +# tz@iana.org for general use in the future). For more, please see +# the file CONTRIBUTING in the tz distribution. # From Paul Eggert (2013-08-11): # @@ -25,8 +26,12 @@ # I found in the UCLA library. # # For data circa 1899, a common source is: -# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94 -# . +# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94. +# http://www.jstor.org/stable/1774359 +# +# For Russian data circa 1919, a source is: +# Byalokoz EL. New Counting of Time in Russia since July 1, 1919. +# (See the 'europe' file for a fuller citation.) # # A reliable and entertaining source about time zones is # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997). @@ -42,10 +47,11 @@ # 3:30 IRST IRDT Iran # 4:00 GST Gulf* # 5:30 IST India -# 7:00 ICT Indochina* +# 7:00 ICT Indochina, most times and locations* # 7:00 WIB west Indonesia (Waktu Indonesia Barat) # 8:00 WITA central Indonesia (Waktu Indonesia Tengah) # 8:00 CST China +# 8:00 IDT Indochina, 1943-45, 1947-55, 1960-75 (some locations)* # 8:00 JWST Western Standard Time (Japan, 1896/1937)* # 9:00 JCST Central Standard Time (Japan, 1896/1937) # 9:00 WIT east Indonesia (Waktu Indonesia Timur) @@ -115,11 +121,11 @@ Zone Asia/Kabul 4:36:48 - LMT 1890 # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Yerevan 2:58:00 - LMT 1924 May 2 3:00 - YERT 1957 Mar # Yerevan Time - 4:00 RussiaAsia YER%sT 1991 Mar 31 2:00s + 4:00 RussiaAsia YER%sT 1991 Mar 31 2:00s 3:00 1:00 YERST 1991 Sep 23 # independence - 3:00 RussiaAsia AM%sT 1995 Sep 24 2:00s + 3:00 RussiaAsia AM%sT 1995 Sep 24 2:00s 4:00 - AMT 1997 - 4:00 RussiaAsia AM%sT 2012 Mar 25 2:00s + 4:00 RussiaAsia AM%sT 2012 Mar 25 2:00s 4:00 - AMT # Azerbaijan @@ -132,16 +138,16 @@ Rule Azer 1997 max - Oct lastSun 5:00 0 # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Baku 3:19:24 - LMT 1924 May 2 3:00 - BAKT 1957 Mar # Baku Time - 4:00 RussiaAsia BAK%sT 1991 Mar 31 2:00s + 4:00 RussiaAsia BAK%sT 1991 Mar 31 2:00s 3:00 1:00 BAKST 1991 Aug 30 # independence 3:00 RussiaAsia AZ%sT 1992 Sep lastSat 23:00 - 4:00 - AZT 1996 # Azerbaijan time + 4:00 - AZT 1996 # Azerbaijan Time 4:00 EUAsia AZ%sT 1997 4:00 Azer AZ%sT # Bahrain # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Bahrain 3:22:20 - LMT 1920 # Manamah +Zone Asia/Bahrain 3:22:20 - LMT 1920 # Manamah 4:00 - GST 1972 Jun 3:00 - AST @@ -219,7 +225,7 @@ Zone Asia/Bahrain 3:22:20 - LMT 1920 # # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Dhaka 2009 only - Jun 19 23:00 1:00 S -Rule Dhaka 2009 only - Dec 31 23:59 0 - +Rule Dhaka 2009 only - Dec 31 24:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Dhaka 6:01:40 - LMT 1890 @@ -250,7 +256,7 @@ Zone Indian/Chagos 4:49:40 - LMT 1907 # Brunei # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Brunei 7:39:40 - LMT 1926 Mar # Bandar Seri Begawan +Zone Asia/Brunei 7:39:40 - LMT 1926 Mar # Bandar Seri Begawan 7:30 - BNT 1933 8:00 - BNT @@ -259,19 +265,15 @@ Zone Asia/Brunei 7:39:40 - LMT 1926 Mar # Milne says 6:24:40 was the meridian of the time ball observatory at Rangoon. # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Rangoon 6:24:40 - LMT 1880 # or Yangon - 6:24:40 - RMT 1920 # Rangoon Mean Time? - 6:30 - BURT 1942 May # Burma Time - 9:00 - JST 1945 May 3 - 6:30 - MMT # Myanmar Time +Zone Asia/Rangoon 6:24:40 - LMT 1880 # or Yangon + 6:24:40 - RMT 1920 # Rangoon Mean Time? + 6:30 - BURT 1942 May # Burma Time + 9:00 - JST 1945 May 3 + 6:30 - MMT # Myanmar Time # Cambodia -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Phnom_Penh 6:59:40 - LMT 1906 Jun 9 - 7:06:20 - SMT 1911 Mar 11 0:01 # Saigon MT? - 7:00 - ICT 1912 May - 8:00 - ICT 1931 May - 7:00 - ICT +# See Asia/Bangkok. + # China @@ -356,8 +358,8 @@ Rule PRC 1987 1991 - Apr Sun>=10 0:00 1: # * The Republic of China instituted Beijing mean solar time effective # the official calendar book of 1914. # * The French Concession in Shanghai set up signal stations in -# French docks in the 1890s, controled by Xujiahui (Zikawei) -# Obervatory and set to local mean time. +# French docks in the 1890s, controlled by Xujiahui (Zikawei) +# Observatory and set to local mean time. # * "From the end of the 19th century" it changed to UT+8. # * Chinese Customs (by then reduced to a tool of foreign powers) # eventually standardized on this time for all ports, and it @@ -381,7 +383,7 @@ Rule PRC 1987 1991 - Apr Sun>=10 0:00 1: # Xujiahui Observatory was under French control and stuck with UT+8. # # In earlier versions of this file, China had many separate Zone entries, but -# this was based on what was apparently incorrect data in Shanks & Pottenger. +# this was based on what were apparently incorrect data in Shanks & Pottenger. # This has now been simplified to the two entries Asia/Shanghai and # Asia/Urumqi, with the others being links for backward compatibility. # Proposed in 1918 and theoretically in effect until 1949 (although in practice @@ -501,7 +503,7 @@ Rule PRC 1987 1991 - Apr Sun>=10 0:00 1: # "The Working-Calendar for The Xinjiang Uygur Autonomous Region Government" # (2014-04-22). # Unfortunately, we have no good records of time in Xinjiang before 1986. -# During the 20th century parts of Xinjiang were ruled by the Qing dyansty, +# During the 20th century parts of Xinjiang were ruled by the Qing dynasty, # the Republic of China, various warlords, the First and Second East Turkestan # Republics, the Soviet Union, the Kuomintang, and the People's Republic of # China, and tracking down all these organizations' timekeeping rules would be @@ -698,19 +700,19 @@ Zone Asia/Hong_Kong 7:36:42 - LMT 1904 O # Central Weather Bureau website was not correct. # # Original Bulletin: -# -# (cont.) +# http://subtpg.tpg.gov.tw/og/image2.asp?f=03502F0AKM1AF +# http://subtpg.tpg.gov.tw/og/image2.asp?f=0350300AKM1B0 (cont.) # # In 1947, DST in Taiwan was expanded to Oct 31. There is a backup of that # telegram announcement from Taiwan Province Government: # -# +# http://subtpg.tpg.gov.tw/og/image2.asp?f=0360310AKZ431 # # Here is a brief translation: # # The Summer Time this year is adopted from midnight Apr 15 until Sep 20 # midnight. To save (energy?) consumption, we're expanding Summer Time -# adption till Oct 31 midnight. +# adoption till Oct 31 midnight. # # The Central Weather Bureau website didn't mention that, however it can # be found from historical government announcement database. @@ -741,7 +743,7 @@ Rule Taiwan 1979 only - Oct 1 0:00 0 S # Taipei or Taibei or T'ai-pei Zone Asia/Taipei 8:06:00 - LMT 1896 Jan 1 8:00 - JWST 1937 Oct 1 - 9:00 - JST 1945 Sep 21 01:00 + 9:00 - JST 1945 Sep 21 1:00 8:00 Taiwan C%sT # Macau (Macao, Aomen) @@ -761,7 +763,7 @@ Rule Macau 1975 1977 - Apr Sun>=15 3:30 Rule Macau 1978 1980 - Apr Sun>=15 0:00 1:00 S Rule Macau 1978 1980 - Oct Sun>=15 0:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Macau 7:34:20 - LMT 1912 +Zone Asia/Macau 7:34:20 - LMT 1912 Jan 1 8:00 Macau MO%sT 1999 Dec 20 # return to China 8:00 PRC C%sT @@ -823,20 +825,22 @@ Link Asia/Nicosia Europe/Nicosia # I don't know what can be done, especially knowing that some years ago our # DST rules where changed THREE TIMES during one month. -# Milne says Tbilisi (Tiflis) time was 2:59:05.7; round to nearest.) +# Milne 1899 says Tbilisi (Tiflis) time was 2:59:05.7. +# Byalokoz 1919 says Georgia was 2:59:11. +# Go with Byalokoz. # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Tbilisi 2:59:06 - LMT 1880 - 2:59:06 - TBMT 1924 May 2 # Tbilisi Mean Time +Zone Asia/Tbilisi 2:59:11 - LMT 1880 + 2:59:11 - TBMT 1924 May 2 # Tbilisi Mean Time 3:00 - TBIT 1957 Mar # Tbilisi Time - 4:00 RussiaAsia TBI%sT 1991 Mar 31 2:00s + 4:00 RussiaAsia TBI%sT 1991 Mar 31 2:00s 3:00 1:00 TBIST 1991 Apr 9 # independence - 3:00 RussiaAsia GE%sT 1992 # Georgia Time + 3:00 RussiaAsia GE%sT 1992 # Georgia Time 3:00 E-EurAsia GE%sT 1994 Sep lastSun 4:00 E-EurAsia GE%sT 1996 Oct lastSun 4:00 1:00 GEST 1997 Mar lastSun 4:00 E-EurAsia GE%sT 2004 Jun 27 - 3:00 RussiaAsia GE%sT 2005 Mar lastSun 2:00 + 3:00 RussiaAsia GE%sT 2005 Mar lastSun 2:00 4:00 - GET # East Timor @@ -864,16 +868,16 @@ Zone Asia/Tbilisi 2:59:06 - LMT 1880 # midnight on Saturday, September 16. # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Dili 8:22:20 - LMT 1912 +Zone Asia/Dili 8:22:20 - LMT 1912 Jan 1 8:00 - TLT 1942 Feb 21 23:00 # E Timor Time 9:00 - JST 1945 Sep 23 9:00 - TLT 1976 May 3 - 8:00 - WITA 2000 Sep 17 00:00 + 8:00 - WITA 2000 Sep 17 0:00 9:00 - TLT # India # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Kolkata 5:53:28 - LMT 1880 # Kolkata +Zone Asia/Kolkata 5:53:28 - LMT 1880 # Kolkata 5:53:20 - HMT 1941 Oct # Howrah Mean Time? 6:30 - BURT 1942 May 15 # Burma Time 5:30 - IST 1942 Sep @@ -886,8 +890,12 @@ Zone Asia/Kolkata 5:53:28 - LMT 1880 # K # Indonesia # +# From Paul Eggert (2014-09-06): +# The 1876 Report of the Secretary of the [US] Navy, p 306 says that Batavia +# civil time was 7:07:12.5; round to even for Jakarta. +# # From Gwillim Law (2001-05-28), overriding Shanks & Pottenger: -# +# http://www.sumatera-inc.com/go_to_invest/about_indonesia.asp#standtime # says that Indonesia's time zones changed on 1988-01-01. Looking at some # time zone maps, I think that must refer to Western Borneo (Kalimantan Barat # and Kalimantan Tengah) switching from UTC+8 to UTC+7. @@ -924,7 +932,7 @@ Zone Asia/Jakarta 7:07:12 - LMT 1867 Aug # Shanks & Pottenger say the next transition was at 1924 Jan 1 0:13, # but this must be a typo. 7:07:12 - BMT 1923 Dec 31 23:47:12 # Batavia - 7:20 - JAVT 1932 Nov # Java Time + 7:20 - JAVT 1932 Nov # Java Time 7:30 - WIB 1942 Mar 23 9:00 - JST 1945 Sep 23 7:30 - WIB 1948 May @@ -1082,7 +1090,7 @@ Rule Iran 2036 2037 - Mar 21 0:00 1:00 D Rule Iran 2036 2037 - Sep 21 0:00 0 S # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Tehran 3:25:44 - LMT 1916 - 3:25:44 - TMT 1946 # Tehran Mean Time + 3:25:44 - TMT 1946 # Tehran Mean Time 3:30 - IRST 1977 Nov 4:00 Iran IR%sT 1979 3:30 Iran IR%sT @@ -1127,7 +1135,7 @@ Rule Iraq 1991 2007 - Apr 1 3:00s 1:00 Rule Iraq 1991 2007 - Oct 1 3:00s 0 S # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Baghdad 2:57:40 - LMT 1890 - 2:57:36 - BMT 1918 # Baghdad Mean Time? + 2:57:36 - BMT 1918 # Baghdad Mean Time? 3:00 - AST 1982 May 3:00 Iraq A%sT @@ -1355,7 +1363,7 @@ Rule Zion 2013 max - Oct lastSun 2:00 0 # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Jerusalem 2:20:54 - LMT 1880 - 2:20:40 - JMT 1918 # Jerusalem Mean Time? + 2:20:40 - JMT 1918 # Jerusalem Mean Time? 2:00 Zion I%sT @@ -1371,8 +1379,8 @@ Zone Asia/Jerusalem 2:20:54 - LMT 1880 # daylight saving between 1948 and 1951, but "the system was discontinued # because the public believed it would lead to longer working hours." -# From Mayumi Negishi in the 2005-08-10 Japan Times -# : +# From Mayumi Negishi in the 2005-08-10 Japan Times: +# http://www.japantimes.co.jp/cgi-bin/getarticle.pl5?nn20050810f2.htm # Occupation authorities imposed daylight-saving time on Japan on # [1948-05-01].... But lack of prior debate and the execution of # daylight-saving time just three days after the bill was passed generated @@ -1396,7 +1404,8 @@ Rule Japan 1950 1951 - May Sun>=1 2:00 1 # From Hideyuki Suzuki (1998-11-09): # 'Tokyo' usually stands for the former location of Tokyo Astronomical -# Observatory: 139 degrees 44' 40.90" E (9h 18m 58.727s), 35 degrees 39' 16.0" N. +# Observatory: 139 degrees 44' 40.90" E (9h 18m 58.727s), +# 35 degrees 39' 16.0" N. # This data is from 'Rika Nenpyou (Chronological Scientific Tables) 1996' # edited by National Astronomical Observatory of Japan.... # JST (Japan Standard Time) has been used since 1888-01-01 00:00 (JST). @@ -1586,10 +1595,10 @@ Zone Asia/Qyzylorda 4:21:52 - LMT 1924 M 6:00 - KIZT 1982 Apr 1 5:00 RussiaAsia KIZ%sT 1991 5:00 - KIZT 1991 Dec 16 # independence - 5:00 - QYZT 1992 Jan 19 2:00 + 5:00 - QYZT 1992 Jan 19 2:00 6:00 RussiaAsia QYZ%sT 2005 Mar 15 6:00 - QYZT -# Aqtobe (aka Aktobe, formerly Akt'ubinsk) +# Aqtobe (aka Aktobe, formerly Aktyubinsk) Zone Asia/Aqtobe 3:48:40 - LMT 1924 May 2 4:00 - AKTT 1930 Jun 21 # Aktyubinsk Time 5:00 - AKTT 1981 Apr 1 @@ -1609,7 +1618,7 @@ Zone Asia/Aqtau 3:21:04 - LMT 1924 May 6:00 - SHET 1982 Apr 1 5:00 RussiaAsia SHE%sT 1991 5:00 - SHET 1991 Dec 16 # independence - 5:00 RussiaAsia AQT%sT 1995 Mar lastSun 2:00 # Aqtau Time + 5:00 RussiaAsia AQT%sT 1995 Mar lastSun 2:00 # Aqtau Time 4:00 RussiaAsia AQT%sT 2005 Mar 15 5:00 - AQTT # West Kazakhstan @@ -1618,7 +1627,7 @@ Zone Asia/Oral 3:25:24 - LMT 1924 May 2 5:00 - URAT 1981 Apr 1 5:00 1:00 URAST 1981 Oct 1 6:00 - URAT 1982 Apr 1 - 5:00 RussiaAsia URA%sT 1989 Mar 26 2:00 + 5:00 RussiaAsia URA%sT 1989 Mar 26 2:00 4:00 RussiaAsia URA%sT 1991 4:00 - URAT 1991 Dec 16 # independence 4:00 RussiaAsia ORA%sT 2005 Mar 15 # Oral Time @@ -1629,7 +1638,7 @@ Zone Asia/Oral 3:25:24 - LMT 1924 May 2 # From Paul Eggert (2005-08-15): # According to an article dated today in the Kyrgyzstan Development Gateway -# +# http://eng.gateway.kg/cgi-bin/page.pl?id=1&story_name=doc9979.shtml # Kyrgyzstan is canceling the daylight saving time system. I take the article # to mean that they will leave their clocks at 6 hours ahead of UTC. # From Malik Abdugaliev (2005-09-21): @@ -1644,17 +1653,17 @@ Rule Kyrgyz 1997 2004 - Oct lastSun 2:30 # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Bishkek 4:58:24 - LMT 1924 May 2 5:00 - FRUT 1930 Jun 21 # Frunze Time - 6:00 RussiaAsia FRU%sT 1991 Mar 31 2:00s - 5:00 1:00 FRUST 1991 Aug 31 2:00 # independence - 5:00 Kyrgyz KG%sT 2005 Aug 12 # Kyrgyzstan Time + 6:00 RussiaAsia FRU%sT 1991 Mar 31 2:00s + 5:00 1:00 FRUST 1991 Aug 31 2:00 # independence + 5:00 Kyrgyz KG%sT 2005 Aug 12 # Kyrgyzstan Time 6:00 - KGT ############################################################################### # Korea (North and South) -# From Annie I. Bang (2006-07-10) in -# : +# From Annie I. Bang (2006-07-10): +# http://www.koreaherald.co.kr/SITE/data/html_dir/2006/07/10/200607100012.asp # The Ministry of Commerce, Industry and Energy has already # commissioned a research project [to reintroduce DST] and has said # the system may begin as early as 2008.... Korea ran a daylight @@ -1702,12 +1711,8 @@ Zone Asia/Kuwait 3:11:56 - LMT 1950 3:00 - AST # Laos -# Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Asia/Vientiane 6:50:24 - LMT 1906 Jun 9 # or Viangchan - 7:06:20 - SMT 1911 Mar 11 0:01 # Saigon MT? - 7:00 - ICT 1912 May - 8:00 - ICT 1931 May - 7:00 - ICT +# See Asia/Bangkok. + # Lebanon # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S @@ -1745,8 +1750,8 @@ Rule NBorneo 1935 1941 - Sep 14 0:00 0:2 Rule NBorneo 1935 1941 - Dec 14 0:00 0 - # # peninsular Malaysia -# The data here are taken from Mok Ly Yng (2003-10-30) -# . +# taken from Mok Ly Yng (2003-10-30) +# http://www.math.nus.edu.sg/aslaksen/teaching/timezone.html # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Kuala_Lumpur 6:46:46 - LMT 1901 Jan 1 6:55:25 - SMT 1905 Jun 1 # Singapore M.T. @@ -1758,12 +1763,12 @@ Zone Asia/Kuala_Lumpur 6:46:46 - LMT 190 7:30 - MALT 1982 Jan 1 8:00 - MYT # Malaysia Time # Sabah & Sarawak -# From Paul Eggert (2006-03-22): -# The data here are mostly from Shanks & Pottenger, but the 1942, 1945 and 1982 -# transition dates are from Mok Ly Yng. +# From Paul Eggert (2014-08-12): +# The data entries here are mostly from Shanks & Pottenger, but the 1942, 1945 +# and 1982 transition dates are from Mok Ly Yng. # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Asia/Kuching 7:21:20 - LMT 1926 Mar - 7:30 - BORT 1933 # Borneo Time + 7:30 - BORT 1933 # Borneo Time 8:00 NBorneo BOR%sT 1942 Feb 16 9:00 - JST 1945 Sep 12 8:00 - BORT 1982 Jan 1 @@ -1771,9 +1776,9 @@ Zone Asia/Kuching 7:21:20 - LMT 1926 Mar # Maldives # Zone NAME GMTOFF RULES FORMAT [UNTIL] -Zone Indian/Maldives 4:54:00 - LMT 1880 # Male - 4:54:00 - MMT 1960 # Male Mean Time - 5:00 - MVT # Maldives Time +Zone Indian/Maldives 4:54:00 - LMT 1880 # Male + 4:54:00 - MMT 1960 # Male Mean Time + 5:00 - MVT # Maldives Time # Mongolia @@ -1835,7 +1840,7 @@ Zone Indian/Maldives 4:54:00 - LMT 1880 # Oscar van Vlijmen (2005-05-20) reports that the Mongolian Embassy in # Washington, DC says there are two time zones, with DST observed. # He also found *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 07:47:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C9BB1C92; Mon, 27 Oct 2014 07:47:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B66BD967; Mon, 27 Oct 2014 07:47:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9R7lDPv027795; Mon, 27 Oct 2014 07:47:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9R7lD0t027794; Mon, 27 Oct 2014 07:47:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410270747.s9R7lD0t027794@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 27 Oct 2014 07:47:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273727 - head/sys/fs/nfsserver X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 07:47:13 -0000 Author: kib Date: Mon Oct 27 07:47:13 2014 New Revision: 273727 URL: https://svnweb.freebsd.org/changeset/base/273727 Log: Allow the vfs.nfsd knobs to be set from loader.conf (or using kenv(8)). This is useful when nfsd is loaded as module. Reviewed by: rmacklem Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c Modified: head/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdkrpc.c Mon Oct 27 07:21:37 2014 (r273726) +++ head/sys/fs/nfsserver/nfs_nfsdkrpc.c Mon Oct 27 07:47:13 2014 (r273727) @@ -85,16 +85,16 @@ SYSCTL_DECL(_vfs_nfsd); SVCPOOL *nfsrvd_pool; static int nfs_privport = 0; -SYSCTL_INT(_vfs_nfsd, OID_AUTO, nfs_privport, CTLFLAG_RW, +SYSCTL_INT(_vfs_nfsd, OID_AUTO, nfs_privport, CTLFLAG_RWTUN, &nfs_privport, 0, "Only allow clients using a privileged port for NFSv2 and 3"); static int nfs_minvers = NFS_VER2; -SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_min_nfsvers, CTLFLAG_RW, +SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_min_nfsvers, CTLFLAG_RWTUN, &nfs_minvers, 0, "The lowest version of NFS handled by the server"); static int nfs_maxvers = NFS_VER4; -SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_max_nfsvers, CTLFLAG_RW, +SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_max_nfsvers, CTLFLAG_RWTUN, &nfs_maxvers, 0, "The highest version of NFS handled by the server"); static int nfs_proc(struct nfsrv_descript *, u_int32_t, SVCXPRT *xprt, From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 07:51:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B1736EFE; Mon, 27 Oct 2014 07:51:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83FB1A13; Mon, 27 Oct 2014 07:51:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9R7pRHw031615; Mon, 27 Oct 2014 07:51:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9R7pR4K031613; Mon, 27 Oct 2014 07:51:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410270751.s9R7pR4K031613@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 27 Oct 2014 07:51:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273728 - head/sys/dev/iicbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 07:51:27 -0000 Author: kib Date: Mon Oct 27 07:51:26 2014 New Revision: 273728 URL: https://svnweb.freebsd.org/changeset/base/273728 Log: Add a method to iicbus to request IIC_M_NOSTOP behaviour for multibyte transfers to be default. It simplifies porting code which assumes such settings. Discussed with: avg, llos, nwhitehorn Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/dev/iicbus/iicbus.h head/sys/dev/iicbus/iiconf.c Modified: head/sys/dev/iicbus/iicbus.h ============================================================================== --- head/sys/dev/iicbus/iicbus.h Mon Oct 27 07:47:13 2014 (r273727) +++ head/sys/dev/iicbus/iicbus.h Mon Oct 27 07:51:26 2014 (r273728) @@ -49,16 +49,19 @@ struct iicbus_softc struct iicbus_ivar { uint32_t addr; + bool nostop; }; enum { - IICBUS_IVAR_ADDR /* Address or base address */ + IICBUS_IVAR_ADDR, /* Address or base address */ + IICBUS_IVAR_NOSTOP, /* nostop defaults */ }; #define IICBUS_ACCESSOR(A, B, T) \ __BUS_ACCESSOR(iicbus, A, IICBUS, B, T) IICBUS_ACCESSOR(addr, ADDR, uint32_t) +IICBUS_ACCESSOR(nostop, NOSTOP, bool) #define IICBUS_LOCK(sc) mtx_lock(&(sc)->lock) #define IICBUS_UNLOCK(sc) mtx_unlock(&(sc)->lock) Modified: head/sys/dev/iicbus/iiconf.c ============================================================================== --- head/sys/dev/iicbus/iiconf.c Mon Oct 27 07:47:13 2014 (r273727) +++ head/sys/dev/iicbus/iiconf.c Mon Oct 27 07:51:26 2014 (r273728) @@ -365,6 +365,7 @@ iicbus_transfer_gen(device_t dev, struct { int i, error, lenread, lenwrote, nkid, rpstart, addr; device_t *children, bus; + bool nostop; if ((error = device_get_children(dev, &children, &nkid)) != 0) return (error); @@ -375,6 +376,7 @@ iicbus_transfer_gen(device_t dev, struct bus = children[0]; rpstart = 0; free(children, M_TEMP); + nostop = iicbus_get_nostop(dev); for (i = 0, error = 0; i < nmsgs && error == 0; i++) { addr = msgs[i].slave; if (msgs[i].flags & IIC_M_RD) @@ -399,11 +401,12 @@ iicbus_transfer_gen(device_t dev, struct error = iicbus_write(bus, msgs[i].buf, msgs[i].len, &lenwrote, 0); - if (!(msgs[i].flags & IIC_M_NOSTOP)) { + if ((msgs[i].flags & IIC_M_NOSTOP) != 0 || + (nostop && i + 1 < nmsgs)) { + rpstart = 1; /* Next message gets repeated start */ + } else { rpstart = 0; iicbus_stop(bus); - } else { - rpstart = 1; /* Next message gets repeated start */ } } return (error); From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 09:26:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D546CCE; Mon, 27 Oct 2014 09:26:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C19A23DE; Mon, 27 Oct 2014 09:26:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9R9QPtH081900; Mon, 27 Oct 2014 09:26:25 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9R9QPJr081897; Mon, 27 Oct 2014 09:26:25 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410270926.s9R9QPJr081897@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 27 Oct 2014 09:26:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273730 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 09:26:25 -0000 Author: mav Date: Mon Oct 27 09:26:24 2014 New Revision: 273730 URL: https://svnweb.freebsd.org/changeset/base/273730 Log: Reduce code duplication around Write Exclusive persistent reservation. While there, allow some more commands to pass persistent reservation. MFC after: 1 week Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_cmd_table.c head/sys/cam/ctl/ctl_private.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Mon Oct 27 09:07:30 2014 (r273729) +++ head/sys/cam/ctl/ctl.c Mon Oct 27 09:26:24 2014 (r273730) @@ -5341,8 +5341,7 @@ ctl_scsi_reserve(struct ctl_scsiio *ctsi mtx_lock(&lun->lun_lock); if ((lun->flags & CTL_LUN_RESERVED) && (lun->res_idx != residx)) { - ctsio->scsi_status = SCSI_STATUS_RESERV_CONFLICT; - ctsio->io_hdr.status = CTL_SCSI_ERROR; + ctl_set_reservation_conflict(ctsio); goto bailout; } @@ -5693,24 +5692,6 @@ ctl_read_buffer(struct ctl_scsiio *ctsio lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_read_buffer *)ctsio->cdb; - if (lun->flags & CTL_LUN_PR_RESERVED) { - uint32_t residx; - - /* - * XXX KDM need a lock here. - */ - residx = ctl_get_resindex(&ctsio->io_hdr.nexus); - if ((lun->res_type == SPR_TYPE_EX_AC - && residx != lun->pr_res_idx) - || ((lun->res_type == SPR_TYPE_EX_AC_RO - || lun->res_type == SPR_TYPE_EX_AC_AR) - && lun->pr_keys[residx] == 0)) { - ctl_set_reservation_conflict(ctsio); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } - } - if ((cdb->byte2 & RWB_MODE) != RWB_MODE_DATA && (cdb->byte2 & RWB_MODE) != RWB_MODE_ECHO_DESCR && (cdb->byte2 & RWB_MODE) != RWB_MODE_DESCR) { @@ -6642,24 +6623,6 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) else control_dev = 0; - if (lun->flags & CTL_LUN_PR_RESERVED) { - uint32_t residx; - - /* - * XXX KDM need a lock here. - */ - residx = ctl_get_resindex(&ctsio->io_hdr.nexus); - if ((lun->res_type == SPR_TYPE_EX_AC - && residx != lun->pr_res_idx) - || ((lun->res_type == SPR_TYPE_EX_AC_RO - || lun->res_type == SPR_TYPE_EX_AC_AR) - && lun->pr_keys[residx] == 0)) { - ctl_set_reservation_conflict(ctsio); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } - } - switch (ctsio->cdb[0]) { case MODE_SENSE_6: { struct scsi_mode_sense_6 *cdb; @@ -7196,23 +7159,6 @@ ctl_read_defect(struct ctl_scsiio *ctsio CTL_DEBUG_PRINT(("ctl_read_defect\n")); lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - if (lun->flags & CTL_LUN_PR_RESERVED) { - uint32_t residx; - - /* - * XXX KDM need a lock here. - */ - residx = ctl_get_resindex(&ctsio->io_hdr.nexus); - if ((lun->res_type == SPR_TYPE_EX_AC - && residx != lun->pr_res_idx) - || ((lun->res_type == SPR_TYPE_EX_AC_RO - || lun->res_type == SPR_TYPE_EX_AC_AR) - && lun->pr_keys[residx] == 0)) { - ctl_set_reservation_conflict(ctsio); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } - } if (ctsio->cdb[0] == READ_DEFECT_DATA_10) { ccb10 = (struct scsi_read_defect_data_10 *)&ctsio->cdb; @@ -8906,24 +8852,6 @@ ctl_read_write(struct ctl_scsiio *ctsio) isread = ctsio->cdb[0] == READ_6 || ctsio->cdb[0] == READ_10 || ctsio->cdb[0] == READ_12 || ctsio->cdb[0] == READ_16; - if (lun->flags & CTL_LUN_PR_RESERVED && isread) { - uint32_t residx; - - /* - * XXX KDM need a lock here. - */ - residx = ctl_get_resindex(&ctsio->io_hdr.nexus); - if ((lun->res_type == SPR_TYPE_EX_AC - && residx != lun->pr_res_idx) - || ((lun->res_type == SPR_TYPE_EX_AC_RO - || lun->res_type == SPR_TYPE_EX_AC_AR) - && lun->pr_keys[residx] == 0)) { - ctl_set_reservation_conflict(ctsio); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } - } - switch (ctsio->cdb[0]) { case READ_6: case WRITE_6: { @@ -11225,15 +11153,21 @@ ctl_scsiio_lun_check(struct ctl_softc *c if ((lun->flags & CTL_LUN_RESERVED) && ((entry->flags & CTL_CMD_FLAG_ALLOW_ON_RESV) == 0)) { if (lun->res_idx != residx) { - ctsio->scsi_status = SCSI_STATUS_RESERV_CONFLICT; - ctsio->io_hdr.status = CTL_SCSI_ERROR; + ctl_set_reservation_conflict(ctsio); retval = 1; goto bailout; } } - if ((lun->flags & CTL_LUN_PR_RESERVED) - && ((entry->flags & CTL_CMD_FLAG_ALLOW_ON_PR_RESV) == 0)) { + if ((lun->flags & CTL_LUN_PR_RESERVED) == 0 || + (entry->flags & CTL_CMD_FLAG_ALLOW_ON_PR_RESV)) { + /* No reservation or command is allowed. */; + } else if ((entry->flags & CTL_CMD_FLAG_ALLOW_ON_PR_WRESV) && + (lun->res_type == SPR_TYPE_WR_EX || + lun->res_type == SPR_TYPE_WR_EX_RO || + lun->res_type == SPR_TYPE_WR_EX_AR)) { + /* The command is allowed for Write Exclusive resv. */; + } else { /* * if we aren't registered or it's a res holder type * reservation and this isn't the res holder then set a @@ -11244,8 +11178,7 @@ ctl_scsiio_lun_check(struct ctl_softc *c */ if (lun->pr_keys[residx] == 0 || (residx != lun->pr_res_idx && lun->res_type < 4)) { - ctsio->scsi_status = SCSI_STATUS_RESERV_CONFLICT; - ctsio->io_hdr.status = CTL_SCSI_ERROR; + ctl_set_reservation_conflict(ctsio); retval = 1; goto bailout; } Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Mon Oct 27 09:07:30 2014 (r273729) +++ head/sys/cam/ctl/ctl_cmd_table.c Mon Oct 27 09:26:24 2014 (r273730) @@ -259,7 +259,8 @@ const struct ctl_cmd_entry ctl_cmd_table /* 10 POPULATE TOKEN */ {ctl_populate_token, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_SLUN | - CTL_FLAG_DATA_OUT, + CTL_FLAG_DATA_OUT | + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_NONE, 16, { 0x10, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, @@ -347,7 +348,8 @@ const struct ctl_cmd_entry ctl_cmd_table /* 05 RECEIVE COPY STATUS (LID4) */ {ctl_receive_copy_status_lid4, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_FLAG_DATA_IN, + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, 16, {0x05, 0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, @@ -357,14 +359,16 @@ const struct ctl_cmd_entry ctl_cmd_table /* 07 RECEIVE ROD TOKEN INFORMATION */ {ctl_receive_rod_token_information, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_FLAG_DATA_IN, + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, 16, {0x07, 0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* 08 REPORT ALL ROD TOKENS */ {ctl_report_all_rod_tokens, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_FLAG_DATA_IN, + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, 16, {0x08, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, }; @@ -472,7 +476,8 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_IN, + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, 12, {0x0a, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, @@ -510,7 +515,8 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | - CTL_FLAG_DATA_IN, + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, 12, {0x0f, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, @@ -561,7 +567,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 08 READ(6) */ {ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_IN | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, 6, {0x1f, 0xff, 0xff, 0xff, 0x07}}, /* 09 */ @@ -653,7 +659,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_NONE, 6, {0x08, 0xff, 0xff, 0xff, 0x07}}, /* 1B START STOP UNIT */ @@ -710,7 +716,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 28 READ(10) */ {ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_IN | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, 10, {0x1a, 0xff, 0xff, 0xff, 0xff, 0, 0xff, 0xff, 0x07}}, @@ -739,7 +745,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 2F VERIFY(10) */ {ctl_verify, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_OUT | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, 10, {0x16, 0xff, 0xff, 0xff, 0xff, 0, 0xff, 0xff, 0x07}}, @@ -770,7 +776,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 37 READ DEFECT DATA(10) */ {ctl_read_defect, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_IN | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_NONE, 10, {0, 0x1f, 0, 0, 0, 0, 0xff, 0xff, 0x07}}, @@ -792,7 +798,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 3C READ BUFFER */ {ctl_read_buffer, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_BOTH | CTL_FLAG_DATA_IN | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_NONE, 10, {0x1f, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07}}, @@ -918,7 +924,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_NONE, 10, {0x18, 0xff, 0xff, 0, 0, 0, 0xff, 0xff, 0x07} }, /* 5B CLOSE TRACK/SESSION */ @@ -1062,7 +1068,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 88 READ(16) */ {ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_IN | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, 16, {0x1a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, @@ -1097,7 +1103,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 8F VERIFY(16) */ {ctl_verify, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_OUT | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, 16, {0x16, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, @@ -1199,7 +1205,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* A8 READ(12) */ {ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_IN | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, 12, {0x1a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, @@ -1228,7 +1234,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* AF VERIFY(12) */ {ctl_verify, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_OUT | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, 12, {0x16, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, @@ -1256,7 +1262,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* B7 READ DEFECT DATA(12) */ {ctl_read_defect, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_SLUN | CTL_FLAG_DATA_IN | - CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_NONE, 12, {0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, Modified: head/sys/cam/ctl/ctl_private.h ============================================================================== --- head/sys/cam/ctl/ctl_private.h Mon Oct 27 09:07:30 2014 (r273729) +++ head/sys/cam/ctl/ctl_private.h Mon Oct 27 09:26:24 2014 (r273730) @@ -144,6 +144,7 @@ typedef enum { CTL_CMD_FLAG_NO_SENSE = 0x0010, CTL_CMD_FLAG_OK_ON_ALL_LUNS = 0x0020, CTL_CMD_FLAG_ALLOW_ON_RESV = 0x0040, + CTL_CMD_FLAG_ALLOW_ON_PR_WRESV = 0x0080, CTL_CMD_FLAG_OK_ON_PROC = 0x0100, CTL_CMD_FLAG_OK_ON_SLUN = 0x0200, CTL_CMD_FLAG_OK_ON_BOTH = 0x0300, From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 09:30:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B273F4EB; Mon, 27 Oct 2014 09:30:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F48860D; Mon, 27 Oct 2014 09:30:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9R9UwOc083603; Mon, 27 Oct 2014 09:30:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9R9Uwce083602; Mon, 27 Oct 2014 09:30:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410270930.s9R9Uwce083602@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 27 Oct 2014 09:30:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273731 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 09:30:58 -0000 Author: mav Date: Mon Oct 27 09:30:57 2014 New Revision: 273731 URL: https://svnweb.freebsd.org/changeset/base/273731 Log: Remove comment obsoleted by r273730. MFC after: 1 week Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Mon Oct 27 09:26:24 2014 (r273730) +++ head/sys/cam/ctl/ctl.c Mon Oct 27 09:30:57 2014 (r273731) @@ -11172,9 +11172,6 @@ ctl_scsiio_lun_check(struct ctl_softc *c * if we aren't registered or it's a res holder type * reservation and this isn't the res holder then set a * conflict. - * NOTE: Commands which might be allowed on write exclusive - * type reservations are checked in the particular command - * for a conflict. Read and SSU are the only ones. */ if (lun->pr_keys[residx] == 0 || (residx != lun->pr_res_idx && lun->res_type < 4)) { From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 10:34:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 70F82E8D; Mon, 27 Oct 2014 10:34:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D827EBD; Mon, 27 Oct 2014 10:34:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RAYAxc026041; Mon, 27 Oct 2014 10:34:10 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RAY9Ib026035; Mon, 27 Oct 2014 10:34:09 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410271034.s9RAY9Ib026035@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 27 Oct 2014 10:34:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273732 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 10:34:10 -0000 Author: ae Date: Mon Oct 27 10:34:09 2014 New Revision: 273732 URL: https://svnweb.freebsd.org/changeset/base/273732 Log: Remove unused function. Sponsored by: Yandex LLC Modified: head/sys/netinet6/in6.c head/sys/netinet6/in6_var.h Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Mon Oct 27 09:30:57 2014 (r273731) +++ head/sys/netinet6/in6.c Mon Oct 27 10:34:09 2014 (r273732) @@ -1584,20 +1584,6 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st ifa_free(&ia->ia_ifa); /* in6_ifaddrhead */ } -void -in6_purgeif(struct ifnet *ifp) -{ - struct ifaddr *ifa, *nifa; - - TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, nifa) { - if (ifa->ifa_addr->sa_family != AF_INET6) - continue; - in6_purgeaddr(ifa); - } - - in6_ifdetach(ifp); -} - /* * Notifies other other subsystems about address change/arrival: * 1) Notifies device handler on first IPv6 address assignment Modified: head/sys/netinet6/in6_var.h ============================================================================== --- head/sys/netinet6/in6_var.h Mon Oct 27 09:30:57 2014 (r273731) +++ head/sys/netinet6/in6_var.h Mon Oct 27 10:34:09 2014 (r273732) @@ -804,7 +804,6 @@ void in6_prepare_ifra(struct in6_aliasre const struct in6_addr *); void in6_purgeaddr(struct ifaddr *); int in6if_do_dad(struct ifnet *); -void in6_purgeif(struct ifnet *); void in6_savemkludge(struct in6_ifaddr *); void *in6_domifattach(struct ifnet *); void in6_domifdetach(struct ifnet *, void *); From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 11:21:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9D38D195; Mon, 27 Oct 2014 11:21:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 897206EC; Mon, 27 Oct 2014 11:21:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RBLmLo095540; Mon, 27 Oct 2014 11:21:48 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RBLmOv095539; Mon, 27 Oct 2014 11:21:48 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410271121.s9RBLmOv095539@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 27 Oct 2014 11:21:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273733 - head/sys/netinet/cc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 11:21:48 -0000 Author: hselasky Date: Mon Oct 27 11:21:47 2014 New Revision: 273733 URL: https://svnweb.freebsd.org/changeset/base/273733 Log: Make assignments to "net.inet.tcp.cc.algorithm" work by fixing a bad string comparison. MFC after: 3 days Reported by: Jukka Ukkonen Sponsored by: Mellanox Technologies Modified: head/sys/netinet/cc/cc.c Modified: head/sys/netinet/cc/cc.c ============================================================================== --- head/sys/netinet/cc/cc.c Mon Oct 27 10:34:09 2014 (r273732) +++ head/sys/netinet/cc/cc.c Mon Oct 27 11:21:47 2014 (r273733) @@ -106,11 +106,13 @@ cc_default_algo(SYSCTL_HANDLER_ARGS) /* Find algo with specified name and set it to default. */ CC_LIST_RLOCK(); STAILQ_FOREACH(funcs, &cc_list, entries) { - if (strncmp((char *)req->newptr, funcs->name, - TCP_CA_NAME_MAX) == 0) { - found = 1; - V_default_cc_ptr = funcs; - } + /* NOTE: "newptr" is not zero terminated */ + if (req->newlen != strlen(funcs->name)) + continue; + if (bcmp(req->newptr, funcs->name, req->newlen)) + continue; + found = 1; + V_default_cc_ptr = funcs; } CC_LIST_RUNLOCK(); From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 11:38:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 33E70A25; Mon, 27 Oct 2014 11:38:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14EC0920; Mon, 27 Oct 2014 11:38:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RBcIkE002455; Mon, 27 Oct 2014 11:38:18 GMT (envelope-from pi@FreeBSD.org) Received: (from pi@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RBcHrA002447; Mon, 27 Oct 2014 11:38:17 GMT (envelope-from pi@FreeBSD.org) Message-Id: <201410271138.s9RBcHrA002447@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pi set sender to pi@FreeBSD.org using -f From: Kurt Jaeger Date: Mon, 27 Oct 2014 11:38:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273734 - head/bin/dd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 11:38:19 -0000 Author: pi (ports committer) Date: Mon Oct 27 11:38:17 2014 New Revision: 273734 URL: https://svnweb.freebsd.org/changeset/base/273734 Log: bin/dd: Fix incorrect casting of arguments dd(1) casts many of its numeric arguments from uintmax_t to intmax_t and back again to detect whether or not the original arguments were negative. This caused wrong behaviour in some boundary cases: $ dd if=/dev/zero of=/dev/null count=18446744073709551615 dd: count cannot be negative After the fix: $ dd if=/dev/zero of=/dev/null count=18446744073709551615 dd: count: Result too large PR: 191263 Submitted by: will@worrbase.com Approved by: cognet@ Modified: head/bin/dd/args.c head/bin/dd/conv.c head/bin/dd/dd.c head/bin/dd/dd.h head/bin/dd/position.c Modified: head/bin/dd/args.c ============================================================================== --- head/bin/dd/args.c Mon Oct 27 11:21:47 2014 (r273733) +++ head/bin/dd/args.c Mon Oct 27 11:38:17 2014 (r273734) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -171,8 +172,7 @@ jcl(char **argv) */ if (in.offset > OFF_MAX / (ssize_t)in.dbsz || out.offset > OFF_MAX / (ssize_t)out.dbsz) - errx(1, "seek offsets cannot be larger than %jd", - (intmax_t)OFF_MAX); + errx(1, "seek offsets cannot be larger than %jd", OFF_MAX); } static int @@ -186,37 +186,30 @@ c_arg(const void *a, const void *b) static void f_bs(char *arg) { - uintmax_t res; - res = get_num(arg); - if (res < 1 || res > SSIZE_MAX) - errx(1, "bs must be between 1 and %jd", (intmax_t)SSIZE_MAX); - in.dbsz = out.dbsz = (size_t)res; + in.dbsz = out.dbsz = get_num(arg); + if (out.dbsz < 1 || out.dbsz > SSIZE_MAX) + errx(1, "bs must be between 1 and %jd", SSIZE_MAX); } static void f_cbs(char *arg) { - uintmax_t res; - res = get_num(arg); - if (res < 1 || res > SSIZE_MAX) - errx(1, "cbs must be between 1 and %jd", (intmax_t)SSIZE_MAX); - cbsz = (size_t)res; + cbsz = get_num(arg); + if (cbsz < 1 || cbsz > SSIZE_MAX) + errx(1, "cbs must be between 1 and %jd", SSIZE_MAX); } static void f_count(char *arg) { - intmax_t res; - res = (intmax_t)get_num(arg); - if (res < 0) - errx(1, "count cannot be negative"); - if (res == 0) - cpy_cnt = (uintmax_t)-1; - else - cpy_cnt = (uintmax_t)res; + cpy_cnt = get_num(arg); + if (cpy_cnt == SIZE_MAX) + errc(1, ERANGE, "%s", oper); + if (cpy_cnt == 0) + cpy_cnt = -1; } static void @@ -225,7 +218,7 @@ f_files(char *arg) files_cnt = get_num(arg); if (files_cnt < 1) - errx(1, "files must be between 1 and %jd", (uintmax_t)-1); + errx(1, "files must be between 1 and %ju", SIZE_MAX); } static void @@ -241,14 +234,11 @@ f_fillchar(char *arg) static void f_ibs(char *arg) { - uintmax_t res; if (!(ddflags & C_BS)) { - res = get_num(arg); - if (res < 1 || res > SSIZE_MAX) - errx(1, "ibs must be between 1 and %jd", - (intmax_t)SSIZE_MAX); - in.dbsz = (size_t)res; + in.dbsz = get_num(arg); + if (in.dbsz < 1 || in.dbsz > SSIZE_MAX) + errx(1, "ibs must be between 1 and %ju", SSIZE_MAX); } } @@ -262,14 +252,11 @@ f_if(char *arg) static void f_obs(char *arg) { - uintmax_t res; if (!(ddflags & C_BS)) { - res = get_num(arg); - if (res < 1 || res > SSIZE_MAX) - errx(1, "obs must be between 1 and %jd", - (intmax_t)SSIZE_MAX); - out.dbsz = (size_t)res; + out.dbsz = get_num(arg); + if (out.dbsz < 1 || out.dbsz > SSIZE_MAX) + errx(1, "obs must be between 1 and %jd", SSIZE_MAX); } } @@ -378,11 +365,17 @@ get_num(const char *val) uintmax_t num, mult, prevnum; char *expr; + while (isspace(val[0])) + val++; + + if (val[0] == '-') + errx(1, "%s: cannot be negative", oper); + errno = 0; - num = strtouq(val, &expr, 0); + num = strtoull(val, &expr, 0); if (errno != 0) /* Overflow or underflow. */ err(1, "%s", oper); - + if (expr == val) /* No valid digits. */ errx(1, "%s: illegal numeric value", oper); Modified: head/bin/dd/conv.c ============================================================================== --- head/bin/dd/conv.c Mon Oct 27 11:21:47 2014 (r273733) +++ head/bin/dd/conv.c Mon Oct 27 11:38:17 2014 (r273734) @@ -133,7 +133,7 @@ block(void) */ ch = 0; for (inp = in.dbp - in.dbcnt, outp = out.dbp; in.dbcnt;) { - maxlen = MIN(cbsz, in.dbcnt); + maxlen = MIN(cbsz, (size_t)in.dbcnt); if ((t = ctab) != NULL) for (cnt = 0; cnt < maxlen && (ch = *inp++) != '\n'; ++cnt) @@ -146,7 +146,7 @@ block(void) * Check for short record without a newline. Reassemble the * input block. */ - if (ch != '\n' && in.dbcnt < cbsz) { + if (ch != '\n' && (size_t)in.dbcnt < cbsz) { (void)memmove(in.db, in.dbp - in.dbcnt, in.dbcnt); break; } @@ -228,7 +228,7 @@ unblock(void) * translation has to already be done or we might not recognize the * spaces. */ - for (inp = in.db; in.dbcnt >= cbsz; inp += cbsz, in.dbcnt -= cbsz) { + for (inp = in.db; (size_t)in.dbcnt >= cbsz; inp += cbsz, in.dbcnt -= cbsz) { for (t = inp + cbsz - 1; t >= inp && *t == ' '; --t) ; if (t >= inp) { Modified: head/bin/dd/dd.c ============================================================================== --- head/bin/dd/dd.c Mon Oct 27 11:21:47 2014 (r273733) +++ head/bin/dd/dd.c Mon Oct 27 11:38:17 2014 (r273734) @@ -168,10 +168,10 @@ setup(void) * record oriented I/O, only need a single buffer. */ if (!(ddflags & (C_BLOCK | C_UNBLOCK))) { - if ((in.db = malloc(out.dbsz + in.dbsz - 1)) == NULL) + if ((in.db = malloc((size_t)out.dbsz + in.dbsz - 1)) == NULL) err(1, "input buffer"); out.db = in.db; - } else if ((in.db = malloc(MAX(in.dbsz, cbsz) + cbsz)) == NULL || + } else if ((in.db = malloc(MAX((size_t)in.dbsz, cbsz) + cbsz)) == NULL || (out.db = malloc(out.dbsz + cbsz)) == NULL) err(1, "output buffer"); @@ -343,7 +343,7 @@ dd_in(void) ++st.in_full; /* Handle full input blocks. */ - } else if ((size_t)n == in.dbsz) { + } else if ((size_t)n == (size_t)in.dbsz) { in.dbcnt += in.dbrcnt = n; ++st.in_full; @@ -493,7 +493,7 @@ dd_out(int force) outp += nw; st.bytes += nw; - if ((size_t)nw == n && n == out.dbsz) + if ((size_t)nw == n && n == (size_t)out.dbsz) ++st.out_full; else ++st.out_part; Modified: head/bin/dd/dd.h ============================================================================== --- head/bin/dd/dd.h Mon Oct 27 11:21:47 2014 (r273733) +++ head/bin/dd/dd.h Mon Oct 27 11:38:17 2014 (r273734) @@ -38,10 +38,9 @@ typedef struct { u_char *db; /* buffer address */ u_char *dbp; /* current buffer I/O address */ - /* XXX ssize_t? */ - size_t dbcnt; /* current buffer byte count */ - size_t dbrcnt; /* last read byte count */ - size_t dbsz; /* block size */ + ssize_t dbcnt; /* current buffer byte count */ + ssize_t dbrcnt; /* last read byte count */ + ssize_t dbsz; /* block size */ #define ISCHR 0x01 /* character device (warn on short) */ #define ISPIPE 0x02 /* pipe-like (see position.c) */ @@ -57,13 +56,13 @@ typedef struct { } IO; typedef struct { - uintmax_t in_full; /* # of full input blocks */ - uintmax_t in_part; /* # of partial input blocks */ - uintmax_t out_full; /* # of full output blocks */ - uintmax_t out_part; /* # of partial output blocks */ - uintmax_t trunc; /* # of truncated records */ - uintmax_t swab; /* # of odd-length swab blocks */ - uintmax_t bytes; /* # of bytes written */ + size_t in_full; /* # of full input blocks */ + size_t in_part; /* # of partial input blocks */ + size_t out_full; /* # of full output blocks */ + size_t out_part; /* # of partial output blocks */ + size_t trunc; /* # of truncated records */ + size_t swab; /* # of odd-length swab blocks */ + size_t bytes; /* # of bytes written */ struct timespec start; /* start time of dd */ } STAT; Modified: head/bin/dd/position.c ============================================================================== --- head/bin/dd/position.c Mon Oct 27 11:21:47 2014 (r273733) +++ head/bin/dd/position.c Mon Oct 27 11:38:17 2014 (r273734) @@ -178,7 +178,7 @@ pos_out(void) n = write(out.fd, out.db, out.dbsz); if (n == -1) err(1, "%s", out.name); - if ((size_t)n != out.dbsz) + if (n != out.dbsz) errx(1, "%s: write failure", out.name); } break; From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 15:33:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E22A65A4; Mon, 27 Oct 2014 15:33:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDD8C836; Mon, 27 Oct 2014 15:33:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RFXiDj031297; Mon, 27 Oct 2014 15:33:44 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RFXims031296; Mon, 27 Oct 2014 15:33:44 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410271533.s9RFXims031296@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 27 Oct 2014 15:33:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273737 - head/usr.sbin/pmcstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 15:33:45 -0000 Author: bapt Date: Mon Oct 27 15:33:44 2014 New Revision: 273737 URL: https://svnweb.freebsd.org/changeset/base/273737 Log: Clarify the documentation of pmcstat: the -d argument should be passed before -p, -s, -P or -S to be taken in account Differential Revision: https://reviews.freebsd.org/D1011 Reviewed by: adrian, gnn MFC after: 1 week Modified: head/usr.sbin/pmcstat/pmcstat.8 Modified: head/usr.sbin/pmcstat/pmcstat.8 ============================================================================== --- head/usr.sbin/pmcstat/pmcstat.8 Mon Oct 27 14:38:00 2014 (r273736) +++ head/usr.sbin/pmcstat/pmcstat.8 Mon Oct 27 15:33:44 2014 (r273737) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 16, 2014 +.Dd Oct 27, 2014 .Dt PMCSTAT 8 .Os .Sh NAME @@ -254,6 +254,13 @@ Toggle between process mode PMCs measuri process' current and future children or only measuring events for the target process. The default is to measure events for the target process alone. +(it has to be passed in the command line prior to +.Fl p , +.Fl s , +.Fl P , +or +.Fl S +). .It Fl f Ar pluginopt Pass option string to the active plugin. .br From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 15:40:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A15A486D; Mon, 27 Oct 2014 15:40:03 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E27D89D; Mon, 27 Oct 2014 15:40:03 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9RFdvsk015082 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 27 Oct 2014 17:39:57 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9RFdvsk015082 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9RFdvnP015081; Mon, 27 Oct 2014 17:39:57 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 27 Oct 2014 17:39:57 +0200 From: Konstantin Belousov To: Kurt Jaeger Subject: Re: svn commit: r273734 - head/bin/dd Message-ID: <20141027153957.GZ1877@kib.kiev.ua> References: <201410271138.s9RBcHrA002447@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410271138.s9RBcHrA002447@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 15:40:03 -0000 On Mon, Oct 27, 2014 at 11:38:17AM +0000, Kurt Jaeger wrote: > Author: pi (ports committer) > Date: Mon Oct 27 11:38:17 2014 > New Revision: 273734 > URL: https://svnweb.freebsd.org/changeset/base/273734 > > Log: > bin/dd: Fix incorrect casting of arguments This causes non-trivial amount of errors like cc1: warnings being treated as errors /scratch/tmp/kib/src/bin/dd/args.c: In function 'f_bs': /scratch/tmp/kib/src/bin/dd/args.c:192: warning: format '%jd' expects type 'intm ax_t', but argument 3 has type 'int' (this is on arm). From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 15:45:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7A7BAB21; Mon, 27 Oct 2014 15:45:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 665E596C; Mon, 27 Oct 2014 15:45:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RFjcdF036374; Mon, 27 Oct 2014 15:45:38 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RFjcem036373; Mon, 27 Oct 2014 15:45:38 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410271545.s9RFjcem036373@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 27 Oct 2014 15:45:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273738 - head/share/man/man3 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 15:45:38 -0000 Author: jhb Date: Mon Oct 27 15:45:37 2014 New Revision: 273738 URL: https://svnweb.freebsd.org/changeset/base/273738 Log: Correct a typo: this is the manpage for pthread_cleanup_pop, not push. Submitted by: ian Modified: head/share/man/man3/pthread_cleanup_pop.3 Modified: head/share/man/man3/pthread_cleanup_pop.3 ============================================================================== --- head/share/man/man3/pthread_cleanup_pop.3 Mon Oct 27 15:33:44 2014 (r273737) +++ head/share/man/man3/pthread_cleanup_pop.3 Mon Oct 27 15:45:37 2014 (r273738) @@ -52,7 +52,7 @@ then does nothing. .Pp The -.Fn pthread_cleanup_push +.Fn pthread_cleanup_pop function is implemented as a macro that closes a block. Invocations of this function must appear as standalone statements that are paired with an earlier call of From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 15:46:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 34035C91; Mon, 27 Oct 2014 15:46:03 +0000 (UTC) Received: from vps.hungerhost.com (vps.hungerhost.com [216.38.53.176]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B9DF97A; Mon, 27 Oct 2014 15:46:02 +0000 (UTC) Received: from [209.211.73.8] (port=39658 helo=[172.16.19.1]) by vps.hungerhost.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82) (envelope-from ) id 1XimUX-0001eM-IQ; Mon, 27 Oct 2014 11:45:59 -0400 From: "George Neville-Neil" To: "Hans Petter Selasky" Subject: Re: svn commit: r273733 - head/sys/netinet/cc Date: Mon, 27 Oct 2014 11:45:46 -0400 Message-ID: <4CE45B86-9B99-439D-B4BF-1AC61F4B78BB@neville-neil.com> In-Reply-To: <201410271121.s9RBLmOv095539@svn.freebsd.org> References: <201410271121.s9RBLmOv095539@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Mailer: MailMate (1.8r4576) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.hungerhost.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - neville-neil.com X-Get-Message-Sender-Via: vps.hungerhost.com: authenticated_id: gnn@neville-neil.com Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 15:46:03 -0000 Can you modify this to preserve the limitation of TCP_CA_NAME_MAX ? Best, George On 27 Oct 2014, at 7:21, Hans Petter Selasky wrote: > Author: hselasky > Date: Mon Oct 27 11:21:47 2014 > New Revision: 273733 > URL: https://svnweb.freebsd.org/changeset/base/273733 > > Log: > Make assignments to "net.inet.tcp.cc.algorithm" work by fixing a bad > string comparison. > > MFC after: 3 days > Reported by: Jukka Ukkonen > Sponsored by: Mellanox Technologies > > Modified: > head/sys/netinet/cc/cc.c > > Modified: head/sys/netinet/cc/cc.c > ============================================================================== > --- head/sys/netinet/cc/cc.c Mon Oct 27 10:34:09 2014 (r273732) > +++ head/sys/netinet/cc/cc.c Mon Oct 27 11:21:47 2014 (r273733) > @@ -106,11 +106,13 @@ cc_default_algo(SYSCTL_HANDLER_ARGS) > /* Find algo with specified name and set it to default. */ > CC_LIST_RLOCK(); > STAILQ_FOREACH(funcs, &cc_list, entries) { > - if (strncmp((char *)req->newptr, funcs->name, > - TCP_CA_NAME_MAX) == 0) { > - found = 1; > - V_default_cc_ptr = funcs; > - } > + /* NOTE: "newptr" is not zero terminated */ > + if (req->newlen != strlen(funcs->name)) > + continue; > + if (bcmp(req->newptr, funcs->name, req->newlen)) > + continue; > + found = 1; > + V_default_cc_ptr = funcs; > } > CC_LIST_RUNLOCK(); From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 15:50:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D45CAD6; Mon, 27 Oct 2014 15:50:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C074A9B9; Mon, 27 Oct 2014 15:50:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RFol0Q038487; Mon, 27 Oct 2014 15:50:47 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RFolnI038486; Mon, 27 Oct 2014 15:50:47 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410271550.s9RFolnI038486@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 27 Oct 2014 15:50:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273739 - head/usr.sbin/pmcstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 15:50:47 -0000 Author: bapt Date: Mon Oct 27 15:50:47 2014 New Revision: 273739 URL: https://svnweb.freebsd.org/changeset/base/273739 Log: Fix rendering Submitted by: brueffer Modified: head/usr.sbin/pmcstat/pmcstat.8 Modified: head/usr.sbin/pmcstat/pmcstat.8 ============================================================================== --- head/usr.sbin/pmcstat/pmcstat.8 Mon Oct 27 15:45:37 2014 (r273738) +++ head/usr.sbin/pmcstat/pmcstat.8 Mon Oct 27 15:50:47 2014 (r273739) @@ -259,8 +259,7 @@ The default is to measure events for the .Fl s , .Fl P , or -.Fl S -). +.Fl S ) . .It Fl f Ar pluginopt Pass option string to the active plugin. .br From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 15:54:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E46622AB; Mon, 27 Oct 2014 15:54:33 +0000 (UTC) Received: from f10.opsec.eu (f10.opsec.eu [IPv6:2001:14f8:200:4::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9EF0DA75; Mon, 27 Oct 2014 15:54:33 +0000 (UTC) Received: from pi by f10.opsec.eu with local (Exim 4.84 (FreeBSD)) (envelope-from ) id 1Ximcl-0003nG-N9; Mon, 27 Oct 2014 16:54:27 +0100 Date: Mon, 27 Oct 2014 16:54:27 +0100 From: Kurt Jaeger To: Konstantin Belousov Subject: Re: svn commit: r273734 - head/bin/dd Message-ID: <20141027155427.GM1492@f10.opsec.eu> References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141027153957.GZ1877@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141027153957.GZ1877@kib.kiev.ua> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Kurt Jaeger X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 15:54:34 -0000 > On Mon, Oct 27, 2014 at 11:38:17AM +0000, Kurt Jaeger wrote: > > Author: pi (ports committer) > > Date: Mon Oct 27 11:38:17 2014 > > New Revision: 273734 > > URL: https://svnweb.freebsd.org/changeset/base/273734 > > > > Log: > > bin/dd: Fix incorrect casting of arguments > This causes non-trivial amount of errors like > > cc1: warnings being treated as errors > /scratch/tmp/kib/src/bin/dd/args.c: In function 'f_bs': > /scratch/tmp/kib/src/bin/dd/args.c:192: warning: format '%jd' expects type 'intm > ax_t', but argument 3 has type 'int' > > (this is on arm). Thanks for the pointer. I'll take it up with the submitter. I do not have a working arm setup right now. -- pi@FreeBSD.org +49 171 3101372 6 years to go ! From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 16:03:59 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C0ED67A3; Mon, 27 Oct 2014 16:03:59 +0000 (UTC) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 820B7BBC; Mon, 27 Oct 2014 16:03:59 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id DA5CD1043210; Tue, 28 Oct 2014 03:03:57 +1100 (AEDT) Date: Tue, 28 Oct 2014 03:03:57 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov Subject: Re: svn commit: r273734 - head/bin/dd In-Reply-To: <20141027153957.GZ1877@kib.kiev.ua> Message-ID: <20141028024954.L2501@besplex.bde.org> References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141027153957.GZ1877@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=dMCfxopb c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=RjzIgjlDYm5_AU5-cgkA:9 a=vx3u5fnQNF83gsCp:21 a=_J6P8AWba1TwnPjU:21 a=CjuIK1q_8ugA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Kurt Jaeger X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 16:03:59 -0000 On Mon, 27 Oct 2014, Konstantin Belousov wrote: > On Mon, Oct 27, 2014 at 11:38:17AM +0000, Kurt Jaeger wrote: >> Log: >> bin/dd: Fix incorrect casting of arguments > This causes non-trivial amount of errors like > > cc1: warnings being treated as errors > /scratch/tmp/kib/src/bin/dd/args.c: In function 'f_bs': > /scratch/tmp/kib/src/bin/dd/args.c:192: warning: format '%jd' expects type 'intm > ax_t', but argument 3 has type 'int' > > (this is on arm). Sigh. I noticed that half the changes were to break correct casting, but thought that the errors were not detected on any supported arch (since the patch wouldn't have passed review if they were). Actually, they are detected on all 32-bit arches (since 32-bit SSIZE_MAX is incompatible with 64-bit intmax_t). Further examination of the history: in green's big patch that fixed most of the arg checking, or at least in its MFC, there is this breakage: % Index: args.c % =================================================================== % RCS file: /home/ncvs/src/bin/dd/args.c,v % retrieving revision 1.13.2.2 % retrieving revision 1.13.2.3 % diff -u -2 -r1.13.2.2 -r1.13.2.3 % --- args.c 29 Aug 1999 14:12:07 -0000 1.13.2.2 % +++ args.c 12 Dec 1999 01:54:03 -0000 1.13.2.3 % ... % @@ -207,7 +208,9 @@ % { % % - cpy_cnt = (u_int)get_bsz(arg); % - if (!cpy_cnt) % - terminate(0); % + cpy_cnt = get_num(arg); % + if (cpy_cnt < 0) % + errx(1, "count cannot be negative"); % + if (cpy_cnt == 0) % + cpy_cnt = -1; % } % % @@ -217,5 +220,7 @@ % { % % - files_cnt = (int)get_bsz(arg); % + files_cnt = get_num(arg); % + if (files_cnt < 1) % + errx(1, "files must be between 1 and %qd", QUAD_MAX); % } % The magic -1 wasn't in previous versions. It is just some hack to recover the previous behaviour. My version doesn't have it, but uses essentially the old code with no range checking but the type expanded to uintmax_t. All uintmax_t values are valid counts. The correct range checking is already in get_num(). I also removed the special case for cpuy_cnt = 0. I think it means no limit in my version. This is more useful than immediate termination. Bruce From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 16:06:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 123AA93B; Mon, 27 Oct 2014 16:06:53 +0000 (UTC) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 87D79BE6; Mon, 27 Oct 2014 16:06:52 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 3358BD433DE; Tue, 28 Oct 2014 02:45:12 +1100 (AEDT) Date: Tue, 28 Oct 2014 02:45:04 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Kurt Jaeger Subject: Re: svn commit: r273734 - head/bin/dd In-Reply-To: <201410271138.s9RBcHrA002447@svn.freebsd.org> Message-ID: <20141028005225.S2013@besplex.bde.org> References: <201410271138.s9RBcHrA002447@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=dMCfxopb c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=qKvkKEtZAAAA:8 a=CyJx2C2pdSMWXbW4vZwA:9 a=irJhU9xJ9eRPbFF4:21 a=CSi6hEsHd1jE7GJe:21 a=-0KXm9qgDs5jN3Rh:21 a=CjuIK1q_8ugA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 16:06:53 -0000 On Mon, 27 Oct 2014, Kurt Jaeger wrote: > Log: > bin/dd: Fix incorrect casting of arguments > > dd(1) casts many of its numeric arguments from uintmax_t to intmax_t > and back again to detect whether or not the original arguments were > negative. This caused wrong behaviour in some boundary cases: > > $ dd if=/dev/zero of=/dev/null count=18446744073709551615 > dd: count cannot be negative > > After the fix: > > $ dd if=/dev/zero of=/dev/null count=18446744073709551615 > dd: count: Result too large Both of these work correctly in my version (with a relatively small patch and no breakage of other cases). (I actually typed large values as -1 and 11111111111111111111111111. -1 means (uintmax_t)-1 although this is undocumented and now broken). > > PR: 191263 > Submitted by: will@worrbase.com > Approved by: cognet@ I couldn't review the PR since I bugzilla doesn't accept mail responses. I didn't fear it was so bad. > Modified: head/bin/dd/args.c > ============================================================================== > --- head/bin/dd/args.c Mon Oct 27 11:21:47 2014 (r273733) > +++ head/bin/dd/args.c Mon Oct 27 11:38:17 2014 (r273734) > @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); > > #include > > +#include > #include > #include > #include > @@ -171,8 +172,7 @@ jcl(char **argv) > */ > if (in.offset > OFF_MAX / (ssize_t)in.dbsz || > out.offset > OFF_MAX / (ssize_t)out.dbsz) > - errx(1, "seek offsets cannot be larger than %jd", > - (intmax_t)OFF_MAX); > + errx(1, "seek offsets cannot be larger than %jd", OFF_MAX); > } This used to be correct. Now it assumes that off_t == intmax_t. Both just happen to be int64_t. This will break when intmax_t is expanded (off_t is unlikely to be expanded). The bug would be detected at compile time now if the type of intmax_t had maximal rank (long long) but int64_t and off_t remain as long on 64-bit arches. C99 doesn't seem to require intmax_t to have maximal rank. This seems to be a bug in C99, but FreeBSD exploits it to avoid using the long long abomination on 6 4-bit arches. > > static int > @@ -186,37 +186,30 @@ c_arg(const void *a, const void *b) > static void > f_bs(char *arg) > { > - uintmax_t res; > > - res = get_num(arg); This used to be correct. Though I don't like unsigned types, the API of read() and write() encourages use of size_t instead of ssize_t for buffer sizes. That was done, but a limit of SSIZE_MAX was applied, partly to avoid problems detecting errors from read() and write() and partly to distinguish overflowing cases. get_num() returns an unsigned type (uintmax_t), so it is suitable for handling the size_t args here. It was used. However, size_t might be smaller than uintmax_t, so it cannot always hold the result of get_num(). So a temporary variable was used to hold the value before checking it. > - if (res < 1 || res > SSIZE_MAX) > - errx(1, "bs must be between 1 and %jd", (intmax_t)SSIZE_MAX); get_num() returns UINTMAX_MAX if the result is too large. This may or may not be an error. But in all arches, UINTMAX_MAX exceeds SSIZE_MAX, so the overflowing case gives the same error as a non-overflowing but too large value. > - in.dbsz = out.dbsz = (size_t)res; > + in.dbsz = out.dbsz = get_num(arg); This breaks the error checking. Blind assignment may corrupt the value before it can be checked. > + if (out.dbsz < 1 || out.dbsz > SSIZE_MAX) > + errx(1, "bs must be between 1 and %jd", SSIZE_MAX); > } Printf format error, as above. > > static void > f_cbs(char *arg) > { > - uintmax_t res; > > - res = get_num(arg); > - if (res < 1 || res > SSIZE_MAX) > - errx(1, "cbs must be between 1 and %jd", (intmax_t)SSIZE_MAX); > - cbsz = (size_t)res; > + cbsz = get_num(arg); > + if (cbsz < 1 || cbsz > SSIZE_MAX) > + errx(1, "cbs must be between 1 and %jd", SSIZE_MAX); > } This just breaks the range checking and the printf format, as above. > > static void > f_count(char *arg) > { > - intmax_t res; > > - res = (intmax_t)get_num(arg); > - if (res < 0) > - errx(1, "count cannot be negative"); This was correct too. Though get_num() returns an unsigned type, it is based on strtoul() which handles negative values as correctly as possible. (The multipliers in get_num() don't handle negative values as correctly as possible.) dd also has a get_off_t() function. This is supposed to handle negative values more carefully, but is so badly implemented that it has many more bugs than blindly casting get_num() to off_t. The above cast is safer since it converts to the signed type corresponding to the return type. In 2's complement, the result is predictable and correct except in unrepresentable cases. E.g., an arg of -1 is returned as UINTMAX_MAX and casting it gives -1 again. My version implements get_off_t() using get_num(). Of course it doesn't blindly convert to an off_t. If does range checking on the uintmax_t before converting: @ static off_t @ get_off_t(const char *val) @ { @ uintmax_t num; @ @ num = get_num(val); @ if (num != (uintmax_t)(off_t)num) @ errx(1, "%s: offset too large", oper); @ return ((off_t)num); @ } > - if (res == 0) > - cpy_cnt = (uintmax_t)-1; > - else > - cpy_cnt = (uintmax_t)res; This function doesn't want an off_t variable, so get_off_t() is unuable for it. Though I don't like unsigned types, it is natural for this one to use one, and this helps avoid proliferation of conversion functions. So I changed the variable type to uintmax_t so that get_num() can be used directly. I also removed the magic -1 case and fixed the broken count = 0 case. A count of 0 should mean 0. Actually, the variable type was already uintmax_t, so using intmax_t and -1 here is more garbage magic than might first appear. I use the following patches for bogus counting (relative to an old version, and possibly not all enclosed here): @diff -u2 args.c~ args.c @--- args.c~ Wed Apr 7 20:20:58 2004 @+++ args.c Wed Apr 7 20:20:59 2004 @@@ -204,13 +206,10 @@ @ f_count(char *arg) @ { @- intmax_t res; @ @- res = (intmax_t)get_num(arg); @- if (res < 0) @- errx(1, "count cannot be negative"); @- if (res == 0) @- cpy_cnt = (uintmax_t)-1; @- else @- cpy_cnt = (uintmax_t)res; @+ cpy_cnt = get_num(arg); @+#if 0 @+ if (cpy_cnt == 0) @+ terminate(0); @+#endif @ } @ @@@ -220,6 +219,4 @@ @ @ files_cnt = get_num(arg); @- if (files_cnt < 1) @- errx(1, "files must be between 1 and %jd", (uintmax_t)-1); @ } @ @diff -u2 dd.c~ dd.c @--- dd.c~ Wed Apr 7 20:20:48 2004 @+++ dd.c Wed Apr 7 20:20:49 2004 @@@ -272,14 +267,6 @@ @ @ for (;;) { @- switch (cpy_cnt) { @- case -1: /* count=0 was specified */ @+ if (cpy_cnt != 0 && st.in_full + st.in_part >= cpy_cnt) @ return; @- case 0: @- break; @- default: @- if (st.in_full + st.in_part >= (uintmax_t)cpy_cnt) @- return; @- break; @- } @ @ /* > + cpy_cnt = get_num(arg); Seems to be correct. > + if (cpy_cnt == SIZE_MAX) > + errc(1, ERANGE, "%s", oper); Bogus. Counts aren't sizes, and no useful restriction on the count can prevent total counts overflowing. Only the non-useful restriction to counts of 0 and 1 prevents overflow. Counts of 2 to sizes of near the maximum to add up to almost twice the maximum. > + if (cpy_cnt == 0) > + cpy_cnt = -1; > } Bogus. -1 really means UINTMAX_MAX (at least, that is what it becomes in cpy_cnt). On 64-bit arches, SIZE_MAX has the same value and the previous check keeps that value as magic. On 32-bit arches, it doesn't even do that. > > static void > @@ -225,7 +218,7 @@ f_files(char *arg) > > files_cnt = get_num(arg); > if (files_cnt < 1) > - errx(1, "files must be between 1 and %jd", (uintmax_t)-1); > + errx(1, "files must be between 1 and %ju", SIZE_MAX); > } The usual printf format error. > > static void > @@ -241,14 +234,11 @@ f_fillchar(char *arg) > static void > f_ibs(char *arg) > { > - uintmax_t res; > > if (!(ddflags & C_BS)) { > - res = get_num(arg); > - if (res < 1 || res > SSIZE_MAX) > - errx(1, "ibs must be between 1 and %jd", > - (intmax_t)SSIZE_MAX); > - in.dbsz = (size_t)res; > + in.dbsz = get_num(arg); > + if (in.dbsz < 1 || in.dbsz > SSIZE_MAX) > + errx(1, "ibs must be between 1 and %ju", SSIZE_MAX); > } > } The usual range checking errors. More than the usual printf format error. SSIZE_MAX has a signed type, but is now printed using an unsigned format. > > @@ -262,14 +252,11 @@ f_if(char *arg) > static void > f_obs(char *arg) > { > - uintmax_t res; > > if (!(ddflags & C_BS)) { > - res = get_num(arg); > - if (res < 1 || res > SSIZE_MAX) > - errx(1, "obs must be between 1 and %jd", > - (intmax_t)SSIZE_MAX); > - out.dbsz = (size_t)res; > + out.dbsz = get_num(arg); > + if (out.dbsz < 1 || out.dbsz > SSIZE_MAX) > + errx(1, "obs must be between 1 and %jd", SSIZE_MAX); > } > } The usual range checking errors. The usual printf format error. > > @@ -378,11 +365,17 @@ get_num(const char *val) > uintmax_t num, mult, prevnum; > char *expr; > > + while (isspace(val[0])) isspace() is undefined on negative characters. > + val++; > + Style bug (extra blank line). > + if (val[0] == '-') > + errx(1, "%s: cannot be negative", oper); There is no particular reason to enforce this. It breaks using get_num() to implement get_off_t(). Any check like this should be external to the function. I don't know of any useful useful use of negative numbers in dd, but I want get_num() to be more generally useful, and used. It can easily handle negative args but either it or the caller would need a sign check like the above to determine if the unsigned result actually is just a representation of a signed result. There is only an ambiguity for signed results above INTMAX_MAX. Another interesting case is an arg of -1*-1. get_num() allowed both the -1's, but turned them into UINTMAX_MAX. The overflow checking is too careful, so -1*-1 is rejected as overflow instead of giving 1. > + More of this style bug. > errno = 0; > - num = strtouq(val, &expr, 0); > + num = strtoull(val, &expr, 0); get_num() returns uintmax_t, but still used strtouq() internally. This changes it to use a loing long abomination instead of the correct function strtoumax(). My fixes for get_num() are relatively small: patch relative to an old version: @ @@ -334,5 +331,5 @@ @ } @ @ -/* @ +/*- @ * Convert an expression of the following forms to a uintmax_t. @ * 1) A positive decimal number. @ @@ -341,6 +338,6 @@ @ * 4) A positive decimal number followed by a m (mult by 1 << 20). @ * 5) A positive decimal number followed by a g (mult by 1 << 30). @ - * 5) A positive decimal number followed by a w (mult by sizeof int). @ - * 6) Two or more positive decimal numbers (with/without [bkmgw]) @ + * 6) A positive decimal number followed by a w (mult by sizeof int). @ + * 7) Two or more positive decimal numbers (with/without [bkmgw]) @ * separated by x (also * for backwards compatibility), specifying @ * the product of the indicated values. I didn't fix the spammed error in the comment. The errors start with "positive". This function accepts negative numbers and returns them as positive numbers. Except this commit breaks that. The errors continue with "decimal". This function actually takes decimal, octal or hexadecimal numbers... @ @@ -349,13 +346,12 @@ @ get_num(const char *val) @ { @ - uintmax_t num, mult, prevnum; @ + uintmax_t mult, num, prevnum; @ char *expr; @ @ errno = 0; @ - num = strtouq(val, &expr, 0); @ - if (errno != 0) /* Overflow or underflow. */ @ + num = strtoumax(val, &expr, 0); @ + if (errno == ERANGE) /* Overflow. */ "Underflow" can only occur for FP expressions. It is not going negative. @ err(1, "%s", oper); @ - @ - if (expr == val) /* No valid digits. */ @ + if (expr == val) /* No digits. */ @ errx(1, "%s: illegal numeric value", oper); @ @ @@ -369,8 +365,8 @@ @ break; @ case 'm': @ - mult = 1 << 20; @ + mult = 1UL << 20; @ break; Don't assume 32-bit ints. @ case 'g': @ - mult = 1 << 30; @ + mult = 1UL << 30; @ break; @ case 'w': @ @@ -378,7 +374,6 @@ @ break; @ default: @ - ; @ + break; @ } @ - @ if (mult != 0) { @ prevnum = num; @ > Modified: head/bin/dd/conv.c > ============================================================================== > --- head/bin/dd/conv.c Mon Oct 27 11:21:47 2014 (r273733) > +++ head/bin/dd/conv.c Mon Oct 27 11:38:17 2014 (r273734) > @@ -133,7 +133,7 @@ block(void) > */ > ch = 0; > for (inp = in.dbp - in.dbcnt, outp = out.dbp; in.dbcnt;) { > - maxlen = MIN(cbsz, in.dbcnt); > + maxlen = MIN(cbsz, (size_t)in.dbcnt); > if ((t = ctab) != NULL) > for (cnt = 0; cnt < maxlen && (ch = *inp++) != '\n'; > ++cnt) > @@ -146,7 +146,7 @@ block(void) > * Check for short record without a newline. Reassemble the > * input block. > */ > - if (ch != '\n' && in.dbcnt < cbsz) { > + if (ch != '\n' && (size_t)in.dbcnt < cbsz) { > (void)memmove(in.db, in.dbp - in.dbcnt, in.dbcnt); > break; > } Now you need casts to recover from changing the mixture of unsigned and signed types. If some block size variables are signed, then all should be, but cbsz is still size_t. > @@ -228,7 +228,7 @@ unblock(void) > * translation has to already be done or we might not recognize the > * spaces. > */ > - for (inp = in.db; in.dbcnt >= cbsz; inp += cbsz, in.dbcnt -= cbsz) { > + for (inp = in.db; (size_t)in.dbcnt >= cbsz; inp += cbsz, in.dbcnt -= cbsz) { > for (t = inp + cbsz - 1; t >= inp && *t == ' '; --t) > ; > if (t >= inp) { > The excessive casts give 2 more style bugs here (expannsion of the line beyond 80 columns and no re-wrapping to fix this). > Modified: head/bin/dd/dd.c [More type poisoning] > ... > Modified: head/bin/dd/dd.h > ============================================================================== > --- head/bin/dd/dd.h Mon Oct 27 11:21:47 2014 (r273733) > +++ head/bin/dd/dd.h Mon Oct 27 11:38:17 2014 (r273734) > @@ -38,10 +38,9 @@ > typedef struct { > u_char *db; /* buffer address */ > u_char *dbp; /* current buffer I/O address */ > - /* XXX ssize_t? */ ISTR asking the author of this comment to clean up some sign-related bugs. I didn't like the results. They including changing minor sign hacks to broken overflow handling in get_off_t(). > - size_t dbcnt; /* current buffer byte count */ > - size_t dbrcnt; /* last read byte count */ > - size_t dbsz; /* block size */ > + ssize_t dbcnt; /* current buffer byte count */ > + ssize_t dbrcnt; /* last read byte count */ > + ssize_t dbsz; /* block size */ > > #define ISCHR 0x01 /* character device (warn on short) */ > #define ISPIPE 0x02 /* pipe-like (see position.c) */ > @@ -57,13 +56,13 @@ typedef struct { > } IO; > > typedef struct { > - uintmax_t in_full; /* # of full input blocks */ > - uintmax_t in_part; /* # of partial input blocks */ > - uintmax_t out_full; /* # of full output blocks */ > - uintmax_t out_part; /* # of partial output blocks */ > - uintmax_t trunc; /* # of truncated records */ > - uintmax_t swab; /* # of odd-length swab blocks */ > - uintmax_t bytes; /* # of bytes written */ All of these were correct. Counters aren't related to sizes, and shouldn't be limited to 32 bits on 32-bit arches. Especally since they used to be 64 bits on 32-bit arches. They were only u_long in 4.4BSD, but went through several rounds of churning in 1999 to reach the above. > + size_t in_full; /* # of full input blocks */ > + size_t in_part; /* # of partial input blocks */ > + size_t out_full; /* # of full output blocks */ > + size_t out_part; /* # of partial output blocks */ > + size_t trunc; /* # of truncated records */ > + size_t swab; /* # of odd-length swab blocks */ > + size_t bytes; /* # of bytes written */ The byte count is most broken. Now it overflows on 32-bit arches after copying just 0.1% or a 4TB disk. > struct timespec start; /* start time of dd */ > } STAT; > > > Modified: head/bin/dd/position.c > ============================================================================== > --- head/bin/dd/position.c Mon Oct 27 11:21:47 2014 (r273733) > +++ head/bin/dd/position.c Mon Oct 27 11:38:17 2014 (r273734) > @@ -178,7 +178,7 @@ pos_out(void) > n = write(out.fd, out.db, out.dbsz); > if (n == -1) > err(1, "%s", out.name); > - if ((size_t)n != out.dbsz) > + if (n != out.dbsz) > errx(1, "%s: write failure", out.name); > } > break; This is about the only simplification that you get from using ssize_t for dbsz, etc. The values were restricted to SSIZE_MAX instead of to SIZE_MAX mainly so that the error checking can be simpler here (it is too simple to be correct -- dd is clueless about short i/o's). But the compiler doesn't know about the restriction, so might warn. The cast prevents that and expresses correctness of the conversion. This isn't really a simplification. Another compiler might warn about the implicit conversion of out.dbsz when passed to write() (since the compiler doesn't know that the value is >= 0). Then you would need a cast to prevent that and express the correctness of the conversion. Bruce From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 16:08:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 76613A8D; Mon, 27 Oct 2014 16:08:07 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 02F3CBF6; Mon, 27 Oct 2014 16:08:06 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9RG7xTV021729 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 27 Oct 2014 18:07:59 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9RG7xTV021729 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9RG7uJU021728; Mon, 27 Oct 2014 18:07:56 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 27 Oct 2014 18:07:56 +0200 From: Konstantin Belousov To: Kurt Jaeger Subject: Re: svn commit: r273734 - head/bin/dd Message-ID: <20141027160755.GA1877@kib.kiev.ua> References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141027153957.GZ1877@kib.kiev.ua> <20141027155427.GM1492@f10.opsec.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141027155427.GM1492@f10.opsec.eu> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 16:08:07 -0000 On Mon, Oct 27, 2014 at 04:54:27PM +0100, Kurt Jaeger wrote: > > On Mon, Oct 27, 2014 at 11:38:17AM +0000, Kurt Jaeger wrote: > > > Author: pi (ports committer) > > > Date: Mon Oct 27 11:38:17 2014 > > > New Revision: 273734 > > > URL: https://svnweb.freebsd.org/changeset/base/273734 > > > > > > Log: > > > bin/dd: Fix incorrect casting of arguments > > This causes non-trivial amount of errors like > > > > cc1: warnings being treated as errors > > /scratch/tmp/kib/src/bin/dd/args.c: In function 'f_bs': > > /scratch/tmp/kib/src/bin/dd/args.c:192: warning: format '%jd' expects type 'intm > > ax_t', but argument 3 has type 'int' > > > > (this is on arm). > > Thanks for the pointer. I'll take it up with the submitter. I do not > have a working arm setup right now. I do not have arm setup either. Errors for arm and mips (at least) are reported by make tinderbox. From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 16:08:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 594D6C06; Mon, 27 Oct 2014 16:08:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45117C05; Mon, 27 Oct 2014 16:08:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RG8g4k046742; Mon, 27 Oct 2014 16:08:42 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RG8gxm046741; Mon, 27 Oct 2014 16:08:42 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410271608.s9RG8gxm046741@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 27 Oct 2014 16:08:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273740 - head/sys/netinet/cc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 16:08:42 -0000 Author: hselasky Date: Mon Oct 27 16:08:41 2014 New Revision: 273740 URL: https://svnweb.freebsd.org/changeset/base/273740 Log: Preserve limitation of "TCP_CA_NAME_MAX" when matching the algorithm name. MFC after: 3 days Suggested by: gnn @ Modified: head/sys/netinet/cc/cc.c Modified: head/sys/netinet/cc/cc.c ============================================================================== --- head/sys/netinet/cc/cc.c Mon Oct 27 15:50:47 2014 (r273739) +++ head/sys/netinet/cc/cc.c Mon Oct 27 16:08:41 2014 (r273740) @@ -107,7 +107,8 @@ cc_default_algo(SYSCTL_HANDLER_ARGS) CC_LIST_RLOCK(); STAILQ_FOREACH(funcs, &cc_list, entries) { /* NOTE: "newptr" is not zero terminated */ - if (req->newlen != strlen(funcs->name)) + if (req->newlen != strnlen(funcs->name, + TCP_CA_NAME_MAX - 1)) continue; if (bcmp(req->newptr, funcs->name, req->newlen)) continue; From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 16:09:37 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2A378D55; Mon, 27 Oct 2014 16:09:37 +0000 (UTC) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD894C13; Mon, 27 Oct 2014 16:09:36 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 0D8321FE024; Mon, 27 Oct 2014 17:09:33 +0100 (CET) Message-ID: <544E6E46.1020606@selasky.org> Date: Mon, 27 Oct 2014 17:09:42 +0100 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: George Neville-Neil Subject: Re: svn commit: r273733 - head/sys/netinet/cc References: <201410271121.s9RBLmOv095539@svn.freebsd.org> <4CE45B86-9B99-439D-B4BF-1AC61F4B78BB@neville-neil.com> In-Reply-To: <4CE45B86-9B99-439D-B4BF-1AC61F4B78BB@neville-neil.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 16:09:37 -0000 On 10/27/14 16:45, George Neville-Neil wrote: > Can you modify this to preserve the limitation of TCP_CA_NAME_MAX ? > > Best, > George > Can you verify the following change? Subtracted one character from the limit for the terminating zero: https://svnweb.freebsd.org/changeset/base/273740 --HPS From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 16:13:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C4832EF9; Mon, 27 Oct 2014 16:13:11 +0000 (UTC) Received: from vps.hungerhost.com (vps.hungerhost.com [216.38.53.176]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B665CD6; Mon, 27 Oct 2014 16:13:11 +0000 (UTC) Received: from [209.211.73.8] (port=63642 helo=[172.16.19.1]) by vps.hungerhost.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82) (envelope-from ) id 1Ximus-0007cg-3Y; Mon, 27 Oct 2014 12:13:10 -0400 From: "George Neville-Neil" To: "Hans Petter Selasky" Subject: Re: svn commit: r273733 - head/sys/netinet/cc Date: Mon, 27 Oct 2014 12:12:59 -0400 Message-ID: <95CE0574-F804-458C-AAC4-4D168B7D7A3C@neville-neil.com> In-Reply-To: <544E6E46.1020606@selasky.org> References: <201410271121.s9RBLmOv095539@svn.freebsd.org> <4CE45B86-9B99-439D-B4BF-1AC61F4B78BB@neville-neil.com> <544E6E46.1020606@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Mailer: MailMate (1.8r4576) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.hungerhost.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - neville-neil.com X-Get-Message-Sender-Via: vps.hungerhost.com: authenticated_id: gnn@neville-neil.com Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 16:13:11 -0000 On 27 Oct 2014, at 12:09, Hans Petter Selasky wrote: > On 10/27/14 16:45, George Neville-Neil wrote: >> Can you modify this to preserve the limitation of TCP_CA_NAME_MAX ? >> >> Best, >> George >> > > Can you verify the following change? Subtracted one character from the > limit for the terminating zero: > > https://svnweb.freebsd.org/changeset/base/273740 > That looks right. Also, can you sign up for reviews.freebsd.org ? Besst, George From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 16:13:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6B274C8; Mon, 27 Oct 2014 16:13:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 56F16CDF; Mon, 27 Oct 2014 16:13:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RGDqXL051033; Mon, 27 Oct 2014 16:13:52 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RGDqrm051032; Mon, 27 Oct 2014 16:13:52 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201410271613.s9RGDqrm051032@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 27 Oct 2014 16:13:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273741 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 16:13:52 -0000 Author: glebius Date: Mon Oct 27 16:13:51 2014 New Revision: 273741 URL: https://svnweb.freebsd.org/changeset/base/273741 Log: Tiny comment fixup. Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Mon Oct 27 16:08:41 2014 (r273740) +++ head/sys/sys/mbuf.h Mon Oct 27 16:13:51 2014 (r273741) @@ -393,7 +393,7 @@ void sf_ext_free(void *, void *); * Outbound flags that are set by upper protocol layers requesting lower * layers, or ideally the hardware, to perform these offloading tasks. * For outbound packets this field and its flags can be directly tested - * against if_data.ifi_hwassist. + * against ifnet if_hwassist. */ #define CSUM_IP 0x00000001 /* IP header checksum offload */ #define CSUM_IP_UDP 0x00000002 /* UDP checksum offload */ From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 16:15:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EB7DB393; Mon, 27 Oct 2014 16:15:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC5B1D0A; Mon, 27 Oct 2014 16:15:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RGFFk3051318; Mon, 27 Oct 2014 16:15:15 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RGFF9A051317; Mon, 27 Oct 2014 16:15:15 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410271615.s9RGFF9A051317@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 27 Oct 2014 16:15:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273742 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 16:15:16 -0000 Author: ae Date: Mon Oct 27 16:15:15 2014 New Revision: 273742 URL: https://svnweb.freebsd.org/changeset/base/273742 Log: Do not automatically install routes to link-local and interface-local multicast addresses. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Mon Oct 27 16:13:51 2014 (r273741) +++ head/sys/netinet6/in6.c Mon Oct 27 16:15:15 2014 (r273742) @@ -782,27 +782,24 @@ in6_update_ifa_join_mc(struct ifnet *ifp struct in6_ifaddr *ia, int flags, struct in6_multi **in6m_sol) { char ip6buf[INET6_ADDRSTRLEN]; - struct sockaddr_in6 mltaddr, mltmask; - struct in6_addr llsol; + struct in6_addr mltaddr; struct in6_multi_mship *imm; - struct rtentry *rt; int delay, error; KASSERT(in6m_sol != NULL, ("%s: in6m_sol is NULL", __func__)); /* Join solicited multicast addr for new host id. */ - bzero(&llsol, sizeof(struct in6_addr)); - llsol.s6_addr32[0] = IPV6_ADDR_INT32_MLL; - llsol.s6_addr32[1] = 0; - llsol.s6_addr32[2] = htonl(1); - llsol.s6_addr32[3] = ifra->ifra_addr.sin6_addr.s6_addr32[3]; - llsol.s6_addr8[12] = 0xff; - if ((error = in6_setscope(&llsol, ifp, NULL)) != 0) { + bzero(&mltaddr, sizeof(struct in6_addr)); + mltaddr.s6_addr32[0] = IPV6_ADDR_INT32_MLL; + mltaddr.s6_addr32[2] = htonl(1); + mltaddr.s6_addr32[3] = ifra->ifra_addr.sin6_addr.s6_addr32[3]; + mltaddr.s6_addr8[12] = 0xff; + if ((error = in6_setscope(&mltaddr, ifp, NULL)) != 0) { /* XXX: should not happen */ log(LOG_ERR, "%s: in6_setscope failed\n", __func__); goto cleanup; } - delay = 0; + delay = error = 0; if ((flags & IN6_IFAUPDATE_DADDELAY)) { /* * We need a random delay for DAD on the address being @@ -812,62 +809,28 @@ in6_update_ifa_join_mc(struct ifnet *ifp */ delay = arc4random() % (MAX_RTR_SOLICITATION_DELAY * hz); } - imm = in6_joingroup(ifp, &llsol, &error, delay); + imm = in6_joingroup(ifp, &mltaddr, &error, delay); if (imm == NULL) { - nd6log((LOG_WARNING, "%s: addmulti failed for %s on %s " - "(errno=%d)\n", __func__, ip6_sprintf(ip6buf, &llsol), + nd6log((LOG_WARNING, "%s: in6_joingroup failed for %s on %s " + "(errno=%d)\n", __func__, ip6_sprintf(ip6buf, &mltaddr), if_name(ifp), error)); goto cleanup; } LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain); *in6m_sol = imm->i6mm_maddr; - bzero(&mltmask, sizeof(mltmask)); - mltmask.sin6_len = sizeof(struct sockaddr_in6); - mltmask.sin6_family = AF_INET6; - mltmask.sin6_addr = in6mask32; -#define MLTMASK_LEN 4 /* mltmask's masklen (=32bit=4octet) */ - /* * Join link-local all-nodes address. */ - bzero(&mltaddr, sizeof(mltaddr)); - mltaddr.sin6_len = sizeof(struct sockaddr_in6); - mltaddr.sin6_family = AF_INET6; - mltaddr.sin6_addr = in6addr_linklocal_allnodes; - if ((error = in6_setscope(&mltaddr.sin6_addr, ifp, NULL)) != 0) + mltaddr = in6addr_linklocal_allnodes; + if ((error = in6_setscope(&mltaddr, ifp, NULL)) != 0) goto cleanup; /* XXX: should not fail */ - /* - * XXX: do we really need this automatic routes? We should probably - * reconsider this stuff. Most applications actually do not need the - * routes, since they usually specify the outgoing interface. - */ - rt = in6_rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL, RT_DEFAULT_FIB); - if (rt != NULL) { - /* XXX: only works in !SCOPEDROUTING case. */ - if (memcmp(&mltaddr.sin6_addr, - &((struct sockaddr_in6 *)rt_key(rt))->sin6_addr, - MLTMASK_LEN)) { - RTFREE_LOCKED(rt); - rt = NULL; - } - } - if (rt == NULL) { - error = in6_rtrequest(RTM_ADD, (struct sockaddr *)&mltaddr, - (struct sockaddr *)&ia->ia_addr, - (struct sockaddr *)&mltmask, RTF_UP, - (struct rtentry **)0, RT_DEFAULT_FIB); - if (error) - goto cleanup; - } else - RTFREE_LOCKED(rt); - - imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error, 0); + imm = in6_joingroup(ifp, &mltaddr, &error, 0); if (imm == NULL) { - nd6log((LOG_WARNING, "%s: addmulti failed for %s on %s " - "(errno=%d)\n", __func__, ip6_sprintf(ip6buf, - &mltaddr.sin6_addr), if_name(ifp), error)); + nd6log((LOG_WARNING, "%s: in6_joingroup failed for %s on %s " + "(errno=%d)\n", __func__, ip6_sprintf(ip6buf, &mltaddr), + if_name(ifp), error)); goto cleanup; } LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain); @@ -883,24 +846,26 @@ in6_update_ifa_join_mc(struct ifnet *ifp */ delay = arc4random() % (MAX_RTR_SOLICITATION_DELAY * hz); } - if (in6_nigroup(ifp, NULL, -1, &mltaddr.sin6_addr) == 0) { + if (in6_nigroup(ifp, NULL, -1, &mltaddr) == 0) { /* XXX jinmei */ - imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error, delay); + imm = in6_joingroup(ifp, &mltaddr, &error, delay); if (imm == NULL) - nd6log((LOG_WARNING, "%s: addmulti failed for %s on %s " + nd6log((LOG_WARNING, + "%s: in6_joingroup failed for %s on %s " "(errno=%d)\n", __func__, ip6_sprintf(ip6buf, - &mltaddr.sin6_addr), if_name(ifp), error)); + &mltaddr), if_name(ifp), error)); /* XXX not very fatal, go on... */ else LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain); } - if (V_icmp6_nodeinfo_oldmcprefix && - in6_nigroup_oldmcprefix(ifp, NULL, -1, &mltaddr.sin6_addr) == 0) { - imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error, delay); + if (V_icmp6_nodeinfo_oldmcprefix && + in6_nigroup_oldmcprefix(ifp, NULL, -1, &mltaddr) == 0) { + imm = in6_joingroup(ifp, &mltaddr, &error, delay); if (imm == NULL) - nd6log((LOG_WARNING, "%s: addmulti failed for %s on %s " + nd6log((LOG_WARNING, + "%s: in6_joingroup failed for %s on %s " "(errno=%d)\n", __func__, ip6_sprintf(ip6buf, - &mltaddr.sin6_addr), if_name(ifp), error)); + &mltaddr), if_name(ifp), error)); /* XXX not very fatal, go on... */ else LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain); @@ -910,38 +875,18 @@ in6_update_ifa_join_mc(struct ifnet *ifp * Join interface-local all-nodes address. * (ff01::1%ifN, and ff01::%ifN/32) */ - mltaddr.sin6_addr = in6addr_nodelocal_allnodes; - if ((error = in6_setscope(&mltaddr.sin6_addr, ifp, NULL)) != 0) + mltaddr = in6addr_nodelocal_allnodes; + if ((error = in6_setscope(&mltaddr, ifp, NULL)) != 0) goto cleanup; /* XXX: should not fail */ - /* XXX: again, do we really need the route? */ - rt = in6_rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL, RT_DEFAULT_FIB); - if (rt != NULL) { - if (memcmp(&mltaddr.sin6_addr, - &((struct sockaddr_in6 *)rt_key(rt))->sin6_addr, - MLTMASK_LEN)) { - RTFREE_LOCKED(rt); - rt = NULL; - } - } - if (rt == NULL) { - error = in6_rtrequest(RTM_ADD, (struct sockaddr *)&mltaddr, - (struct sockaddr *)&ia->ia_addr, - (struct sockaddr *)&mltmask, RTF_UP, - (struct rtentry **)0, RT_DEFAULT_FIB); - if (error) - goto cleanup; - } else - RTFREE_LOCKED(rt); - imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error, 0); + imm = in6_joingroup(ifp, &mltaddr, &error, 0); if (imm == NULL) { - nd6log((LOG_WARNING, "%s: addmulti failed for %s on %s " + nd6log((LOG_WARNING, "%s: in6_joingroup failed for %s on %s " "(errno=%d)\n", __func__, ip6_sprintf(ip6buf, - &mltaddr.sin6_addr), if_name(ifp), error)); + &mltaddr), if_name(ifp), error)); goto cleanup; } LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain); -#undef MLTMASK_LEN cleanup: return (error); @@ -1343,135 +1288,17 @@ in6_broadcast_ifa(struct ifnet *ifp, str } /* - * Leave multicast groups. Factored out from in6_purgeaddr(). - * This entire work should only be done once, for the default FIB. + * Leave from multicast groups we have joined for the interface. */ static int in6_purgeaddr_mc(struct ifnet *ifp, struct in6_ifaddr *ia, struct ifaddr *ifa0) { - struct sockaddr_in6 mltaddr, mltmask; struct in6_multi_mship *imm; - struct rtentry *rt; - struct sockaddr_in6 sin6; - int error; - /* - * Leave from multicast groups we have joined for the interface. - */ while ((imm = LIST_FIRST(&ia->ia6_memberships)) != NULL) { LIST_REMOVE(imm, i6mm_chain); in6_leavegroup(imm); } - - /* - * Remove the link-local all-nodes address. - */ - bzero(&mltmask, sizeof(mltmask)); - mltmask.sin6_len = sizeof(struct sockaddr_in6); - mltmask.sin6_family = AF_INET6; - mltmask.sin6_addr = in6mask32; - - bzero(&mltaddr, sizeof(mltaddr)); - mltaddr.sin6_len = sizeof(struct sockaddr_in6); - mltaddr.sin6_family = AF_INET6; - mltaddr.sin6_addr = in6addr_linklocal_allnodes; - - if ((error = in6_setscope(&mltaddr.sin6_addr, ifp, NULL)) != 0) - return (error); - - /* - * As for the mltaddr above, proactively prepare the sin6 to avoid - * rtentry un- and re-locking. - */ - if (ifa0 != NULL) { - bzero(&sin6, sizeof(sin6)); - sin6.sin6_len = sizeof(sin6); - sin6.sin6_family = AF_INET6; - memcpy(&sin6.sin6_addr, &satosin6(ifa0->ifa_addr)->sin6_addr, - sizeof(sin6.sin6_addr)); - error = in6_setscope(&sin6.sin6_addr, ifa0->ifa_ifp, NULL); - if (error != 0) - return (error); - } - - rt = in6_rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL, RT_DEFAULT_FIB); - if (rt != NULL && rt->rt_gateway != NULL && - (memcmp(&satosin6(rt->rt_gateway)->sin6_addr, - &ia->ia_addr.sin6_addr, - sizeof(ia->ia_addr.sin6_addr)) == 0)) { - /* - * If no more IPv6 address exists on this interface then - * remove the multicast address route. - */ - if (ifa0 == NULL) { - memcpy(&mltaddr.sin6_addr, - &satosin6(rt_key(rt))->sin6_addr, - sizeof(mltaddr.sin6_addr)); - RTFREE_LOCKED(rt); - error = in6_rtrequest(RTM_DELETE, - (struct sockaddr *)&mltaddr, - (struct sockaddr *)&ia->ia_addr, - (struct sockaddr *)&mltmask, RTF_UP, - (struct rtentry **)0, RT_DEFAULT_FIB); - if (error) - log(LOG_INFO, "%s: link-local all-nodes " - "multicast address deletion error\n", - __func__); - } else { - /* - * Replace the gateway of the route. - */ - memcpy(rt->rt_gateway, &sin6, sizeof(sin6)); - RTFREE_LOCKED(rt); - } - } else { - if (rt != NULL) - RTFREE_LOCKED(rt); - } - - /* - * Remove the node-local all-nodes address. - */ - mltaddr.sin6_addr = in6addr_nodelocal_allnodes; - if ((error = in6_setscope(&mltaddr.sin6_addr, ifp, NULL)) != 0) - return (error); - - rt = in6_rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL, RT_DEFAULT_FIB); - if (rt != NULL && rt->rt_gateway != NULL && - (memcmp(&satosin6(rt->rt_gateway)->sin6_addr, - &ia->ia_addr.sin6_addr, - sizeof(ia->ia_addr.sin6_addr)) == 0)) { - /* - * If no more IPv6 address exists on this interface then - * remove the multicast address route. - */ - if (ifa0 == NULL) { - memcpy(&mltaddr.sin6_addr, - &satosin6(rt_key(rt))->sin6_addr, - sizeof(mltaddr.sin6_addr)); - - RTFREE_LOCKED(rt); - error = in6_rtrequest(RTM_DELETE, - (struct sockaddr *)&mltaddr, - (struct sockaddr *)&ia->ia_addr, - (struct sockaddr *)&mltmask, RTF_UP, - (struct rtentry **)0, RT_DEFAULT_FIB); - if (error) - log(LOG_INFO, "%s: node-local all-nodes" - "multicast address deletion error\n", - __func__); - } else { - /* - * Replace the gateway of the route. - */ - memcpy(rt->rt_gateway, &sin6, sizeof(sin6)); - RTFREE_LOCKED(rt); - } - } else { - if (rt != NULL) - RTFREE_LOCKED(rt); - } - return (0); } From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 16:20:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B71E8715; Mon, 27 Oct 2014 16:20:39 +0000 (UTC) Received: from f10.opsec.eu (f10.opsec.eu [IPv6:2001:14f8:200:4::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70066D55; Mon, 27 Oct 2014 16:20:39 +0000 (UTC) Received: from pi by f10.opsec.eu with local (Exim 4.84 (FreeBSD)) (envelope-from ) id 1Xin22-0003p5-QK; Mon, 27 Oct 2014 17:20:34 +0100 Date: Mon, 27 Oct 2014 17:20:34 +0100 From: Kurt Jaeger To: Bruce Evans Subject: Re: svn commit: r273734 - head/bin/dd Message-ID: <20141027162034.GN1492@f10.opsec.eu> References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141028005225.S2013@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141028005225.S2013@besplex.bde.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Kurt Jaeger X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 16:20:39 -0000 Hi! > > Log: > > bin/dd: Fix incorrect casting of arguments [...] > Both of these work correctly in my version (with a relatively small patch > and no breakage of other cases). (I actually typed large values as -1 > and 11111111111111111111111111. -1 means (uintmax_t)-1 although this > is undocumented and now broken). So, given this detailed review, should I revert the change ? -- pi@FreeBSD.org +49 171 3101372 6 years to go ! From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 16:29:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6E2EEC88; Mon, 27 Oct 2014 16:29:21 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43290E81; Mon, 27 Oct 2014 16:29:21 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 4B357B96E; Mon, 27 Oct 2014 12:29:20 -0400 (EDT) From: John Baldwin To: Warner Losh Subject: Re: svn commit: r273214 - in head/sys: amd64/vmm/intel modules/vmm Date: Mon, 27 Oct 2014 11:54:47 -0400 Message-ID: <1725598.2CCKLon8F3@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-PRERELEASE; KDE/4.14.2; amd64; ; ) In-Reply-To: <201410171320.s9HDKo53045297@svn.freebsd.org> References: <201410171320.s9HDKo53045297@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 27 Oct 2014 12:29:20 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 16:29:21 -0000 On Friday, October 17, 2014 01:20:50 PM Warner Losh wrote: > Author: imp > Date: Fri Oct 17 13:20:49 2014 > New Revision: 273214 > URL: https://svnweb.freebsd.org/changeset/base/273214 > > Log: > Fix build to not bogusly always rebuild vmm.ko. > > Rename vmx_assym.s to vmx_assym.h to reflect that file's actual use > and update vmx_support.S's include to match. Add vmx_assym.h to the > SRCS to that it gets properly added to the dependency list. Add > vmx_support.S to SRCS as well, so it gets built and needs fewer > special-case goo. Remove now-redundant special-case goo. Finally, > vmx_genassym.o doesn't need to depend on a hand expanded ${_ILINKS} > explicitly, that's all taken care of by beforedepend. > > With these items fixed, we no longer build vmm.ko every single time > through the modules on a KERNFAST build. So I cheered for this before, but it appears to be broken. :( Namely, I rebuilt world + kernel on my laptop this weekend (it was about a month old). My normal setup builds kernels with NO_KERNELCLEAN=yes. On my next reboot when I started a bhyve VM I promptly got a panic due to a page fault in this assembly code: /* * If 'vmx->eptgen[curcpu]' is not identical to 'pmap->pm_eptgen' * then we must invalidate all mappings associated with this EPTP. */ movq PM_EPTGEN(%r11), %r10 cmpq %r10, VMX_EPTGEN(%rsi, %rax, 8) je guest_restore (The 'cmpq' instruction) This change came to mind, so I blew away the 'vmm' module directory and rebuilt my kernel. Comparing the assembly of this instruction before and after used different values for VMX_EPTGEN. In other words, the NO_KERNELCLEAN=yes build failed to regenerate vmx_assym.h and the build used stale values. In particular, if you examine the generated .depend file, you will find that there are no dependencies recorded for vmx_genassym.o, so it is never rebuilt if any of the headers it includes are changed. In my case the panic happened to be one that was easily diagnosed, but I could imagine stale assym headers causing very odd crashes that would be quite hard to track down. I think these changes should be reverted if we can't fix the dependencies of the associated object files they are generated from. :( -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 16:29:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1FB42C8A; Mon, 27 Oct 2014 16:29:22 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC417E82; Mon, 27 Oct 2014 16:29:21 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id F0344B978; Mon, 27 Oct 2014 12:29:20 -0400 (EDT) From: John Baldwin To: Ian Lepore Subject: Re: svn commit: r273644 - head/share/man/man3 Date: Mon, 27 Oct 2014 11:45:45 -0400 Message-ID: <1571247.xrK7mpMDYa@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-PRERELEASE; KDE/4.14.2; amd64; ; ) In-Reply-To: <1414267896.12052.652.camel@revolution.hippie.lan> References: <201410251931.s9PJVYIk080552@svn.freebsd.org> <1414267896.12052.652.camel@revolution.hippie.lan> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 27 Oct 2014 12:29:21 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 16:29:22 -0000 On Saturday, October 25, 2014 02:11:36 PM Ian Lepore wrote: > On Sat, 2014-10-25 at 19:31 +0000, John Baldwin wrote: > > +.Pp > > +The > > +.Fn pthread_cleanup_push > > Should be pop? Doh, yes! -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 16:29:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 38293D25; Mon, 27 Oct 2014 16:29:23 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5DCAE83; Mon, 27 Oct 2014 16:29:22 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id E7A9AB9B1; Mon, 27 Oct 2014 12:29:21 -0400 (EDT) From: John Baldwin To: Mateusz Guzik Subject: Re: svn commit: r273401 - head/sys/kern Date: Mon, 27 Oct 2014 11:43:20 -0400 Message-ID: <5873867.B31rYEIzUD@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-PRERELEASE; KDE/4.14.2; amd64; ; ) In-Reply-To: <20141026015743.GE19066@dft-labs.eu> References: <201410211905.s9LJ5jDb032492@svn.freebsd.org> <201410231214.04027.jhb@freebsd.org> <20141026015743.GE19066@dft-labs.eu> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 27 Oct 2014 12:29:22 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 16:29:23 -0000 On Sunday, October 26, 2014 02:57:43 AM Mateusz Guzik wrote: > On Thu, Oct 23, 2014 at 12:14:03PM -0400, John Baldwin wrote: > I specifically added sysctl_lock/unlock so that next folk with similar > usecse will not have to. So I'm not going to remove it, but if you > really don't like it feel free to do it. However, if there isn't a future use case that needs it then it is just obfuscation. :-/ Given how static the sysctl code is in terms of API changes, etc. I strongly doubt there will be a future use case any time soon. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 16:36:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 88996648 for ; Mon, 27 Oct 2014 16:36:53 +0000 (UTC) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F765FA2 for ; Mon, 27 Oct 2014 16:36:53 +0000 (UTC) Received: by mail-pa0-f47.google.com with SMTP id kx10so5814608pab.34 for ; Mon, 27 Oct 2014 09:36:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:message-id:references:to; bh=JqHTlqcOYzjiGZVbOdD+2rX1ARJWDs2MJFdHTgHXmH4=; b=Cq0RDipUrMu3Jg1bnPxrT9Yy3t2a7/Z5nHi3bQ3YKVo9AMHlzbQtCiwV6GTaka+H0O 0LmmV2Mot/BawMDDL7tmDHtCvmdvp3MgA1UvtKOgyS+ObMKFYxssHiAH70uievRazzij G+eRXzY4TJqysFIVqjn4HTCeLQyVAYwOIpPemqmSw9xnrLGg6hKzqOd8CQAwUka30Ne8 TKoTqiwSvP7pZe/hEHCa35ef4K2aTPibZOGHwojBeF0ujWTXFlbRgZMrN1ng7EgmpQ4t vXlOSoIYfT5Vxy6HnKm93PhGyEWPXzBLG95t1MzaT/R0+qrAZ4KB9Vwpy6+lKQlli9+1 kQ0A== X-Gm-Message-State: ALoCoQke8ahtWU7wxQHbTbUDRk1jxBqw8m5xu3lnjMTCevNngNjiTZL56TNsQc0ZrXzcXoyyCxIl X-Received: by 10.68.88.195 with SMTP id bi3mr25500303pbb.118.1414427807057; Mon, 27 Oct 2014 09:36:47 -0700 (PDT) Received: from [10.64.24.233] (dc1-prod.netflix.com. [69.53.236.251]) by mx.google.com with ESMTPSA id mx7sm9825273pdb.65.2014.10.27.09.36.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Oct 2014 09:36:46 -0700 (PDT) Sender: Warner Losh Content-Type: multipart/signed; boundary="Apple-Mail=_25BDB42C-D6E2-4B9A-BDC5-8C8727B4CD4C"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273214 - in head/sys: amd64/vmm/intel modules/vmm From: Warner Losh In-Reply-To: <1725598.2CCKLon8F3@ralph.baldwin.cx> Date: Mon, 27 Oct 2014 11:36:41 -0500 Message-Id: <2B7C3745-04E4-4FA9-A849-AECE54EA83A3@bsdimp.com> References: <201410171320.s9HDKo53045297@svn.freebsd.org> <1725598.2CCKLon8F3@ralph.baldwin.cx> To: John Baldwin X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , Warner Losh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 16:36:53 -0000 --Apple-Mail=_25BDB42C-D6E2-4B9A-BDC5-8C8727B4CD4C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Oct 27, 2014, at 10:54 AM, John Baldwin wrote: > On Friday, October 17, 2014 01:20:50 PM Warner Losh wrote: >> Author: imp >> Date: Fri Oct 17 13:20:49 2014 >> New Revision: 273214 >> URL: https://svnweb.freebsd.org/changeset/base/273214 >>=20 >> Log: >> Fix build to not bogusly always rebuild vmm.ko. >>=20 >> Rename vmx_assym.s to vmx_assym.h to reflect that file's actual use >> and update vmx_support.S's include to match. Add vmx_assym.h to the >> SRCS to that it gets properly added to the dependency list. Add >> vmx_support.S to SRCS as well, so it gets built and needs fewer >> special-case goo. Remove now-redundant special-case goo. Finally, >> vmx_genassym.o doesn't need to depend on a hand expanded ${_ILINKS} >> explicitly, that's all taken care of by beforedepend. >>=20 >> With these items fixed, we no longer build vmm.ko every single time >> through the modules on a KERNFAST build. >=20 > So I cheered for this before, but it appears to be broken. :( >=20 > Namely, I rebuilt world + kernel on my laptop this weekend (it was = about a=20 > month old). My normal setup builds kernels with NO_KERNELCLEAN=3Dyes. = On my=20 > next reboot when I started a bhyve VM I promptly got a panic due to a = page=20 > fault in this assembly code: >=20 > /* > * If 'vmx->eptgen[curcpu]' is not identical to = 'pmap->pm_eptgen' > * then we must invalidate all mappings associated with this = EPTP. > */ > movq PM_EPTGEN(%r11), %r10 > cmpq %r10, VMX_EPTGEN(%rsi, %rax, 8) > je guest_restore >=20 > (The 'cmpq' instruction) >=20 > This change came to mind, so I blew away the 'vmm' module directory = and=20 > rebuilt my kernel. Comparing the assembly of this instruction before = and=20 > after used different values for VMX_EPTGEN. In other words, the=20 > NO_KERNELCLEAN=3Dyes build failed to regenerate vmx_assym.h and the = build used=20 > stale values. Is there a way to force this condition for testing? > In particular, if you examine the generated .depend file, you will = find that=20 > there are no dependencies recorded for vmx_genassym.o, so it is never = rebuilt=20 > if any of the headers it includes are changed. In my case the panic = happened=20 > to be one that was easily diagnosed, but I could imagine stale assym = headers=20 > causing very odd crashes that would be quite hard to track down. I = think=20 > these changes should be reverted if we can't fix the dependencies of = the=20 > associated object files they are generated from. :( Give me a bit and I=92ll fix it. There=92s a number of implicit = dependencies that don=92t get recorded in the .depend file, iirc, so = that=92s not completely conclusive. Not building, though is kinda a big = hint that something=92s amiss. However, -DNO_CLEAN has always been a very-sharp edged tool that will = cut you in a number of ways, so there=92s no rush to back this out. Warner --Apple-Mail=_25BDB42C-D6E2-4B9A-BDC5-8C8727B4CD4C Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJUTnSZAAoJEGwc0Sh9sBEAtssP/ihxpIZuBrJF0yFr713jTxzQ KAaeFU+ERLT+Uc6KAHUXW4EQ6w59xfFy0ek5bQv+fkteH5RskzE8pPFdNPa2qPkS cgHQkx15eBlCJF1qwIsq9aSfRAUFBy3S0K2qzsI0KgXPr0PSKfepiMIzzyvvh/co GlrG0hBvQsPKwz4FgU+Gqi6rqb9KEvw2BULGcjU047YxEusgeBxpnmpiUeP19arS bR+G/H+gmtFD2vHfB765d4XtB2ktlyFZDKGoeMDwD4OuMzn7A9lGJVDE9SptMy8b N8LtgIli/I5BodZGAp2oNnEp760RQiHeNhxe5yfjbJqsE9OX0NTXT/ZFbQhyWtve sKvbd3hSpTKsX2aCVQ7VwVLp1pniOJx2w7nifh4zA8Fwvj/utUccA626sQ6As2+P cYsAvETq/qkSuDGnngRBMUJS1yq65xFcMJcjt0YslSFpHgbFwP5o9p4qTB9u3957 jSm2mGiTW+B/HIhq8FAZ4/HKDwvrhpnsK6l9/UK/fx1q7Lgv/ybdD/pkl0qdaYNo tYfQULFz3T9sb4UDpU8iGD+GmKsh3nXfTu1pl9GwChwaJne2mL13TuNdWRbV/jNz U8FcbGvcx93fOUBPdshJA/x3PGKqdljS1aBiDYZ2/Oa+mpyk8ZbeCFTAeHN++rZY 0LJvKU/+tiFkbj4qm4JB =/VLc -----END PGP SIGNATURE----- --Apple-Mail=_25BDB42C-D6E2-4B9A-BDC5-8C8727B4CD4C-- From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 16:43:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6AEFF946; Mon, 27 Oct 2014 16:43:54 +0000 (UTC) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id DC96911C; Mon, 27 Oct 2014 16:43:53 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 1948725D37C7; Mon, 27 Oct 2014 16:43:50 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 10BF9C77042; Mon, 27 Oct 2014 16:43:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id AqQz6s5VlRxU; Mon, 27 Oct 2014 16:43:44 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4420:cabc:c8ff:fe8b:4fe6] (orange-tun0-ula.sbone.de [IPv6:fde9:577b:c1a9:4420:cabc:c8ff:fe8b:4fe6]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 8C280C76FD4; Mon, 27 Oct 2014 16:43:43 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273742 - head/sys/netinet6 From: "Bjoern A. Zeeb" In-Reply-To: <201410271615.s9RGFF9A051317@svn.freebsd.org> Date: Mon, 27 Oct 2014 16:43:42 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <77B7E340-1C0A-4322-BDF1-CA945DC64F63@FreeBSD.org> References: <201410271615.s9RGFF9A051317@svn.freebsd.org> To: "Andrey V. Elsukov" X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 16:43:54 -0000 On 27 Oct 2014, at 16:15 , Andrey V. Elsukov wrote: > Author: ae > Date: Mon Oct 27 16:15:15 2014 > New Revision: 273742 > URL: https://svnweb.freebsd.org/changeset/base/273742 >=20 > Log: > Do not automatically install routes to link-local and interface-local = multicast > addresses. Why? >=20 > Obtained from: Yandex LLC > Sponsored by: Yandex LLC >=20 > Modified: > head/sys/netinet6/in6.c >=20 > Modified: head/sys/netinet6/in6.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/netinet6/in6.c Mon Oct 27 16:13:51 2014 = (r273741) > +++ head/sys/netinet6/in6.c Mon Oct 27 16:15:15 2014 = (r273742) > @@ -782,27 +782,24 @@ in6_update_ifa_join_mc(struct ifnet *ifp > struct in6_ifaddr *ia, int flags, struct in6_multi **in6m_sol) > { > char ip6buf[INET6_ADDRSTRLEN]; > - struct sockaddr_in6 mltaddr, mltmask; > - struct in6_addr llsol; > + struct in6_addr mltaddr; > struct in6_multi_mship *imm; > - struct rtentry *rt; > int delay, error; >=20 > KASSERT(in6m_sol !=3D NULL, ("%s: in6m_sol is NULL", __func__)); >=20 > /* Join solicited multicast addr for new host id. */ > - bzero(&llsol, sizeof(struct in6_addr)); > - llsol.s6_addr32[0] =3D IPV6_ADDR_INT32_MLL; > - llsol.s6_addr32[1] =3D 0; > - llsol.s6_addr32[2] =3D htonl(1); > - llsol.s6_addr32[3] =3D ifra->ifra_addr.sin6_addr.s6_addr32[3]; > - llsol.s6_addr8[12] =3D 0xff; > - if ((error =3D in6_setscope(&llsol, ifp, NULL)) !=3D 0) { > + bzero(&mltaddr, sizeof(struct in6_addr)); > + mltaddr.s6_addr32[0] =3D IPV6_ADDR_INT32_MLL; > + mltaddr.s6_addr32[2] =3D htonl(1); > + mltaddr.s6_addr32[3] =3D ifra->ifra_addr.sin6_addr.s6_addr32[3]; > + mltaddr.s6_addr8[12] =3D 0xff; > + if ((error =3D in6_setscope(&mltaddr, ifp, NULL)) !=3D 0) { > /* XXX: should not happen */ > log(LOG_ERR, "%s: in6_setscope failed\n", __func__); > goto cleanup; > } > - delay =3D 0; > + delay =3D error =3D 0; > if ((flags & IN6_IFAUPDATE_DADDELAY)) { > /* > * We need a random delay for DAD on the address being > @@ -812,62 +809,28 @@ in6_update_ifa_join_mc(struct ifnet *ifp > */ > delay =3D arc4random() % (MAX_RTR_SOLICITATION_DELAY * = hz); > } > - imm =3D in6_joingroup(ifp, &llsol, &error, delay); > + imm =3D in6_joingroup(ifp, &mltaddr, &error, delay); > if (imm =3D=3D NULL) { > - nd6log((LOG_WARNING, "%s: addmulti failed for %s on %s " > - "(errno=3D%d)\n", __func__, ip6_sprintf(ip6buf, = &llsol), > + nd6log((LOG_WARNING, "%s: in6_joingroup failed for %s on = %s " > + "(errno=3D%d)\n", __func__, ip6_sprintf(ip6buf, = &mltaddr), > if_name(ifp), error)); > goto cleanup; > } > LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain); > *in6m_sol =3D imm->i6mm_maddr; >=20 > - bzero(&mltmask, sizeof(mltmask)); > - mltmask.sin6_len =3D sizeof(struct sockaddr_in6); > - mltmask.sin6_family =3D AF_INET6; > - mltmask.sin6_addr =3D in6mask32; > -#define MLTMASK_LEN 4 /* mltmask's masklen (=3D32bit=3D4octet) = */ > - > /* > * Join link-local all-nodes address. > */ > - bzero(&mltaddr, sizeof(mltaddr)); > - mltaddr.sin6_len =3D sizeof(struct sockaddr_in6); > - mltaddr.sin6_family =3D AF_INET6; > - mltaddr.sin6_addr =3D in6addr_linklocal_allnodes; > - if ((error =3D in6_setscope(&mltaddr.sin6_addr, ifp, NULL)) !=3D = 0) > + mltaddr =3D in6addr_linklocal_allnodes; > + if ((error =3D in6_setscope(&mltaddr, ifp, NULL)) !=3D 0) > goto cleanup; /* XXX: should not fail */ >=20 > - /* > - * XXX: do we really need this automatic routes? We should = probably > - * reconsider this stuff. Most applications actually do not = need the > - * routes, since they usually specify the outgoing interface. > - */ > - rt =3D in6_rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL, = RT_DEFAULT_FIB); > - if (rt !=3D NULL) { > - /* XXX: only works in !SCOPEDROUTING case. */ > - if (memcmp(&mltaddr.sin6_addr, > - &((struct sockaddr_in6 *)rt_key(rt))->sin6_addr, > - MLTMASK_LEN)) { > - RTFREE_LOCKED(rt); > - rt =3D NULL; > - } > - } > - if (rt =3D=3D NULL) { > - error =3D in6_rtrequest(RTM_ADD, (struct sockaddr = *)&mltaddr, > - (struct sockaddr *)&ia->ia_addr, > - (struct sockaddr *)&mltmask, RTF_UP, > - (struct rtentry **)0, RT_DEFAULT_FIB); > - if (error) > - goto cleanup; > - } else > - RTFREE_LOCKED(rt); > - > - imm =3D in6_joingroup(ifp, &mltaddr.sin6_addr, &error, 0); > + imm =3D in6_joingroup(ifp, &mltaddr, &error, 0); > if (imm =3D=3D NULL) { > - nd6log((LOG_WARNING, "%s: addmulti failed for %s on %s " > - "(errno=3D%d)\n", __func__, ip6_sprintf(ip6buf, > - &mltaddr.sin6_addr), if_name(ifp), error)); > + nd6log((LOG_WARNING, "%s: in6_joingroup failed for %s on = %s " > + "(errno=3D%d)\n", __func__, ip6_sprintf(ip6buf, = &mltaddr), > + if_name(ifp), error)); > goto cleanup; > } > LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain); > @@ -883,24 +846,26 @@ in6_update_ifa_join_mc(struct ifnet *ifp > */ > delay =3D arc4random() % (MAX_RTR_SOLICITATION_DELAY * = hz); > } > - if (in6_nigroup(ifp, NULL, -1, &mltaddr.sin6_addr) =3D=3D 0) { > + if (in6_nigroup(ifp, NULL, -1, &mltaddr) =3D=3D 0) { > /* XXX jinmei */ > - imm =3D in6_joingroup(ifp, &mltaddr.sin6_addr, &error, = delay); > + imm =3D in6_joingroup(ifp, &mltaddr, &error, delay); > if (imm =3D=3D NULL) > - nd6log((LOG_WARNING, "%s: addmulti failed for %s = on %s " > + nd6log((LOG_WARNING, > + "%s: in6_joingroup failed for %s on %s " > "(errno=3D%d)\n", __func__, = ip6_sprintf(ip6buf, > - &mltaddr.sin6_addr), if_name(ifp), error)); > + &mltaddr), if_name(ifp), error)); > /* XXX not very fatal, go on... */ > else > LIST_INSERT_HEAD(&ia->ia6_memberships, imm, = i6mm_chain); > } > - if (V_icmp6_nodeinfo_oldmcprefix &&=20 > - in6_nigroup_oldmcprefix(ifp, NULL, -1, &mltaddr.sin6_addr) = =3D=3D 0) { > - imm =3D in6_joingroup(ifp, &mltaddr.sin6_addr, &error, = delay); > + if (V_icmp6_nodeinfo_oldmcprefix && > + in6_nigroup_oldmcprefix(ifp, NULL, -1, &mltaddr) =3D=3D 0) { > + imm =3D in6_joingroup(ifp, &mltaddr, &error, delay); > if (imm =3D=3D NULL) > - nd6log((LOG_WARNING, "%s: addmulti failed for %s = on %s " > + nd6log((LOG_WARNING, > + "%s: in6_joingroup failed for %s on %s " > "(errno=3D%d)\n", __func__, = ip6_sprintf(ip6buf, > - &mltaddr.sin6_addr), if_name(ifp), error)); > + &mltaddr), if_name(ifp), error)); > /* XXX not very fatal, go on... */ > else > LIST_INSERT_HEAD(&ia->ia6_memberships, imm, = i6mm_chain); > @@ -910,38 +875,18 @@ in6_update_ifa_join_mc(struct ifnet *ifp > * Join interface-local all-nodes address. > * (ff01::1%ifN, and ff01::%ifN/32) > */ > - mltaddr.sin6_addr =3D in6addr_nodelocal_allnodes; > - if ((error =3D in6_setscope(&mltaddr.sin6_addr, ifp, NULL)) !=3D = 0) > + mltaddr =3D in6addr_nodelocal_allnodes; > + if ((error =3D in6_setscope(&mltaddr, ifp, NULL)) !=3D 0) > goto cleanup; /* XXX: should not fail */ > - /* XXX: again, do we really need the route? */ > - rt =3D in6_rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL, = RT_DEFAULT_FIB); > - if (rt !=3D NULL) { > - if (memcmp(&mltaddr.sin6_addr, > - &((struct sockaddr_in6 *)rt_key(rt))->sin6_addr, > - MLTMASK_LEN)) { > - RTFREE_LOCKED(rt); > - rt =3D NULL; > - } > - } > - if (rt =3D=3D NULL) { > - error =3D in6_rtrequest(RTM_ADD, (struct sockaddr = *)&mltaddr, > - (struct sockaddr *)&ia->ia_addr, > - (struct sockaddr *)&mltmask, RTF_UP, > - (struct rtentry **)0, RT_DEFAULT_FIB); > - if (error) > - goto cleanup; > - } else > - RTFREE_LOCKED(rt); >=20 > - imm =3D in6_joingroup(ifp, &mltaddr.sin6_addr, &error, 0); > + imm =3D in6_joingroup(ifp, &mltaddr, &error, 0); > if (imm =3D=3D NULL) { > - nd6log((LOG_WARNING, "%s: addmulti failed for %s on %s " > + nd6log((LOG_WARNING, "%s: in6_joingroup failed for %s on = %s " > "(errno=3D%d)\n", __func__, ip6_sprintf(ip6buf, > - &mltaddr.sin6_addr), if_name(ifp), error)); > + &mltaddr), if_name(ifp), error)); > goto cleanup; > } > LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain); > -#undef MLTMASK_LEN >=20 > cleanup: > return (error); > @@ -1343,135 +1288,17 @@ in6_broadcast_ifa(struct ifnet *ifp, str > } >=20 > /* > - * Leave multicast groups. Factored out from in6_purgeaddr(). > - * This entire work should only be done once, for the default FIB. > + * Leave from multicast groups we have joined for the interface. > */ > static int > in6_purgeaddr_mc(struct ifnet *ifp, struct in6_ifaddr *ia, struct = ifaddr *ifa0) > { > - struct sockaddr_in6 mltaddr, mltmask; > struct in6_multi_mship *imm; > - struct rtentry *rt; > - struct sockaddr_in6 sin6; > - int error; >=20 > - /* > - * Leave from multicast groups we have joined for the interface. > - */ > while ((imm =3D LIST_FIRST(&ia->ia6_memberships)) !=3D NULL) { > LIST_REMOVE(imm, i6mm_chain); > in6_leavegroup(imm); > } > - > - /* > - * Remove the link-local all-nodes address. > - */ > - bzero(&mltmask, sizeof(mltmask)); > - mltmask.sin6_len =3D sizeof(struct sockaddr_in6); > - mltmask.sin6_family =3D AF_INET6; > - mltmask.sin6_addr =3D in6mask32; > - > - bzero(&mltaddr, sizeof(mltaddr)); > - mltaddr.sin6_len =3D sizeof(struct sockaddr_in6); > - mltaddr.sin6_family =3D AF_INET6; > - mltaddr.sin6_addr =3D in6addr_linklocal_allnodes; > - > - if ((error =3D in6_setscope(&mltaddr.sin6_addr, ifp, NULL)) !=3D = 0) > - return (error); > - > - /* > - * As for the mltaddr above, proactively prepare the sin6 to = avoid > - * rtentry un- and re-locking. > - */ > - if (ifa0 !=3D NULL) { > - bzero(&sin6, sizeof(sin6)); > - sin6.sin6_len =3D sizeof(sin6); > - sin6.sin6_family =3D AF_INET6; > - memcpy(&sin6.sin6_addr, = &satosin6(ifa0->ifa_addr)->sin6_addr, > - sizeof(sin6.sin6_addr)); > - error =3D in6_setscope(&sin6.sin6_addr, ifa0->ifa_ifp, = NULL); > - if (error !=3D 0) > - return (error); > - } > - > - rt =3D in6_rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL, = RT_DEFAULT_FIB); > - if (rt !=3D NULL && rt->rt_gateway !=3D NULL && > - (memcmp(&satosin6(rt->rt_gateway)->sin6_addr, > - &ia->ia_addr.sin6_addr, > - sizeof(ia->ia_addr.sin6_addr)) =3D=3D 0)) { > - /* > - * If no more IPv6 address exists on this interface then > - * remove the multicast address route. > - */ > - if (ifa0 =3D=3D NULL) { > - memcpy(&mltaddr.sin6_addr, > - &satosin6(rt_key(rt))->sin6_addr, > - sizeof(mltaddr.sin6_addr)); > - RTFREE_LOCKED(rt); > - error =3D in6_rtrequest(RTM_DELETE, > - (struct sockaddr *)&mltaddr, > - (struct sockaddr *)&ia->ia_addr, > - (struct sockaddr *)&mltmask, RTF_UP, > - (struct rtentry **)0, RT_DEFAULT_FIB); > - if (error) > - log(LOG_INFO, "%s: link-local all-nodes = " > - "multicast address deletion = error\n", > - __func__); > - } else { > - /* > - * Replace the gateway of the route. > - */ > - memcpy(rt->rt_gateway, &sin6, sizeof(sin6)); > - RTFREE_LOCKED(rt); > - } > - } else { > - if (rt !=3D NULL) > - RTFREE_LOCKED(rt); > - } > - > - /* > - * Remove the node-local all-nodes address. > - */ > - mltaddr.sin6_addr =3D in6addr_nodelocal_allnodes; > - if ((error =3D in6_setscope(&mltaddr.sin6_addr, ifp, NULL)) !=3D = 0) > - return (error); > - > - rt =3D in6_rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL, = RT_DEFAULT_FIB); > - if (rt !=3D NULL && rt->rt_gateway !=3D NULL && > - (memcmp(&satosin6(rt->rt_gateway)->sin6_addr, > - &ia->ia_addr.sin6_addr, > - sizeof(ia->ia_addr.sin6_addr)) =3D=3D 0)) { > - /* > - * If no more IPv6 address exists on this interface then > - * remove the multicast address route. > - */ > - if (ifa0 =3D=3D NULL) { > - memcpy(&mltaddr.sin6_addr, > - &satosin6(rt_key(rt))->sin6_addr, > - sizeof(mltaddr.sin6_addr)); > - > - RTFREE_LOCKED(rt); > - error =3D in6_rtrequest(RTM_DELETE, > - (struct sockaddr *)&mltaddr, > - (struct sockaddr *)&ia->ia_addr, > - (struct sockaddr *)&mltmask, RTF_UP, > - (struct rtentry **)0, RT_DEFAULT_FIB); > - if (error) > - log(LOG_INFO, "%s: node-local all-nodes" > - "multicast address deletion = error\n", > - __func__); > - } else { > - /* > - * Replace the gateway of the route. > - */ > - memcpy(rt->rt_gateway, &sin6, sizeof(sin6)); > - RTFREE_LOCKED(rt); > - } > - } else { > - if (rt !=3D NULL) > - RTFREE_LOCKED(rt); > - } > - > return (0); > } >=20 >=20 =97=20 Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 16:49:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:1900:2254:206a::19:2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0184ED25; Mon, 27 Oct 2014 16:49:22 +0000 (UTC) Received: from butcher-nb.yandex.net (hub.freebsd.org [IPv6:2001:1900:2254:206c::16:88]) by mx2.freebsd.org (Postfix) with ESMTP id E84223550; Mon, 27 Oct 2014 16:49:20 +0000 (UTC) Message-ID: <544E778F.3000909@FreeBSD.org> Date: Mon, 27 Oct 2014 19:49:19 +0300 From: "Andrey V. Elsukov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: "Bjoern A. Zeeb" Subject: Re: svn commit: r273742 - head/sys/netinet6 References: <201410271615.s9RGFF9A051317@svn.freebsd.org> <77B7E340-1C0A-4322-BDF1-CA945DC64F63@FreeBSD.org> In-Reply-To: <77B7E340-1C0A-4322-BDF1-CA945DC64F63@FreeBSD.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 16:49:22 -0000 On 27.10.2014 19:43, Bjoern A. Zeeb wrote: > > On 27 Oct 2014, at 16:15 , Andrey V. Elsukov wrote: > >> Author: ae >> Date: Mon Oct 27 16:15:15 2014 >> New Revision: 273742 >> URL: https://svnweb.freebsd.org/changeset/base/273742 >> >> Log: >> Do not automatically install routes to link-local and interface-local multicast >> addresses. > > Why? They are useless. Multicast code maintains needed routing information internally when system does join to multicast groups. -- WBR, Andrey V. Elsukov From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 17:08:24 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5B1BA4CD; Mon, 27 Oct 2014 17:08:24 +0000 (UTC) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 1D14D3CF; Mon, 27 Oct 2014 17:08:23 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 6C24AD42AB3; Tue, 28 Oct 2014 04:08:21 +1100 (AEDT) Date: Tue, 28 Oct 2014 04:08:20 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Kurt Jaeger Subject: Re: svn commit: r273734 - head/bin/dd In-Reply-To: <20141027162034.GN1492@f10.opsec.eu> Message-ID: <20141028040638.O3114@besplex.bde.org> References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141028005225.S2013@besplex.bde.org> <20141027162034.GN1492@f10.opsec.eu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=dMCfxopb c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=Fzk3_7XD2FUfaiSXAJQA:9 a=CjuIK1q_8ugA:10 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 17:08:24 -0000 On Mon, 27 Oct 2014, Kurt Jaeger wrote: >>> Log: >>> bin/dd: Fix incorrect casting of arguments > [...] >> Both of these work correctly in my version (with a relatively small patch >> and no breakage of other cases). (I actually typed large values as -1 >> and 11111111111111111111111111. -1 means (uintmax_t)-1 although this >> is undocumented and now broken). > > So, given this detailed review, should I revert the change ? Yes. You would have to change half of it just to get it to compile on 32-bit arches. Bruce From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 17:09:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8410A610; Mon, 27 Oct 2014 17:09:07 +0000 (UTC) Received: from mho-01-ewr.mailhop.org (mho-03-ewr.mailhop.org [204.13.248.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5532A3DA; Mon, 27 Oct 2014 17:09:07 +0000 (UTC) Received: from [73.34.117.227] (helo=ilsoft.org) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Xinmu-0004rw-CX; Mon, 27 Oct 2014 17:09:00 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id s9RH8wDG076686; Mon, 27 Oct 2014 11:08:58 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX19mYJ9lmhv2zfGI9hyqnGQS X-Authentication-Warning: paranoia.hippie.lan: Host revolution.hippie.lan [172.22.42.240] claimed to be [172.22.42.240] Subject: Re: svn commit: r273734 - head/bin/dd From: Ian Lepore To: Kurt Jaeger In-Reply-To: <20141027162034.GN1492@f10.opsec.eu> References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141028005225.S2013@besplex.bde.org> <20141027162034.GN1492@f10.opsec.eu> Content-Type: text/plain; charset="us-ascii" Date: Mon, 27 Oct 2014 11:08:58 -0600 Message-ID: <1414429738.17308.9.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 17:09:07 -0000 On Mon, 2014-10-27 at 17:20 +0100, Kurt Jaeger wrote: > Hi! > > > > Log: > > > bin/dd: Fix incorrect casting of arguments > [...] > > Both of these work correctly in my version (with a relatively small patch > > and no breakage of other cases). (I actually typed large values as -1 > > and 11111111111111111111111111. -1 means (uintmax_t)-1 although this > > is undocumented and now broken). > > So, given this detailed review, should I revert the change ? > Given that it breaks the build for 32 bit architectures, it probably should be reverted until a different set of changes is available. -- Ian From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 17:28:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 681EBCA6; Mon, 27 Oct 2014 17:28:46 +0000 (UTC) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 2BC987F8; Mon, 27 Oct 2014 17:28:45 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id E29C7D62048; Tue, 28 Oct 2014 04:28:37 +1100 (AEDT) Date: Tue, 28 Oct 2014 04:28:37 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov Subject: Re: svn commit: r273129 - head/sys/kern In-Reply-To: <201410151238.s9FCcRMe018200@svn.freebsd.org> Message-ID: <20141028040935.M3114@besplex.bde.org> References: <201410151238.s9FCcRMe018200@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=BdjhjNd2 c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=wx-8-68_qoafIrUy0MQA:9 a=CjuIK1q_8ugA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 17:28:46 -0000 On Wed, 15 Oct 2014, Konstantin Belousov wrote: > Log: > Implement FIODTYPE for master ptys. > > Requested and reviewed by: bde > Sponsored by: The FreeBSD Foundation > MFC after: 1 week Thanks. This allows dd to work on ptys again. dd has the following bad code: % static void % getfdtype(IO *io) % { % struct stat sb; % int type; % % if (fstat(io->fd, &sb) == -1) % err(1, "%s", io->name); FIODTYPE should only be used as a hint, but dd makes its non-support fatal in some cases. Even fstat() failure for determining the hint shouldn't be fatal. % if (S_ISREG(sb.st_mode)) % io->flags |= ISTRUNC; % if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) { % if (ioctl(io->fd, FIODTYPE, &type) == -1) { % err(1, "%s", io->name); % } else { dd only uses the dtype hint for devices. Otherwise, it uses defaults. It might as well use the defaults for devices that don't support dtype too. % if (type & D_TAPE) % io->flags |= ISTAPE; % else if (type & (D_DISK | D_MEM)) % io->flags |= ISSEEK; % if (S_ISCHR(sb.st_mode) && (type & D_TAPE) == 0) % io->flags |= ISCHR; % } % return; % } % errno = 0; % if (lseek(io->fd, (off_t)0, SEEK_CUR) == -1 && errno == ESPIPE) % io->flags |= ISPIPE; % else % io->flags |= ISSEEK; % } Not only the dtype check is bad. dd still has to guess about seekability, and does this not very well. Guessing is not needed for pipes, but dd guesses for them. Pipes are not seekable, but the converse is false. Tapes ar character devices, but ISCHR is not set for them. I use the following fixes (not complete -- at least the spelling change for ISSEEK is mostly in other files). @diff -u2 dd.c~ dd.c @--- dd.c~ Wed Apr 7 20:20:48 2004 @+++ dd.c Wed Apr 7 20:20:49 2004 @@@ -247,21 +245,18 @@ @ io->flags |= ISTRUNC; @ if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) { @- if (ioctl(io->fd, FIODTYPE, &type) == -1) { @+ if (ioctl(io->fd, FIODTYPE, &type) == -1) @ err(1, "%s", io->name); @- } else { @+ else { @ if (type & D_TAPE) @ io->flags |= ISTAPE; @ else if (type & (D_DISK | D_MEM)) @- io->flags |= ISSEEK; @- if (S_ISCHR(sb.st_mode) && (type & D_TAPE) == 0) @+ io->flags |= ISSEEKABLE; @+ if (S_ISCHR(sb.st_mode)) @ io->flags |= ISCHR; @ } @- return; @- } @- errno = 0; @- if (lseek(io->fd, (off_t)0, SEEK_CUR) == -1 && errno == ESPIPE) @- io->flags |= ISPIPE; @- else @- io->flags |= ISSEEK; @+ } else if (lseek(io->fd, (off_t)0, SEEK_CUR) == 0) @+ io->flags |= ISSEEKABLE; @+ else if (errno == ESPIPE) @+ io->flags |= ISPIPE; /* XXX fixed in 4.4BSD */ @ } @ Bruce From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 17:39:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1E6D02A1; Mon, 27 Oct 2014 17:39:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3313925; Mon, 27 Oct 2014 17:39:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RHdcVu089314; Mon, 27 Oct 2014 17:39:38 GMT (envelope-from pi@FreeBSD.org) Received: (from pi@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RHdbWP089309; Mon, 27 Oct 2014 17:39:37 GMT (envelope-from pi@FreeBSD.org) Message-Id: <201410271739.s9RHdbWP089309@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pi set sender to pi@FreeBSD.org using -f From: Kurt Jaeger Date: Mon, 27 Oct 2014 17:39:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273743 - head/bin/dd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 17:39:39 -0000 Author: pi (ports committer) Date: Mon Oct 27 17:39:37 2014 New Revision: 273743 URL: https://svnweb.freebsd.org/changeset/base/273743 Log: bin/dd: revert 273734, as it fails on 32bit platforms Revert: insufficient testing on 32bit platforms PR: 191263 Modified: head/bin/dd/args.c head/bin/dd/conv.c head/bin/dd/dd.c head/bin/dd/dd.h head/bin/dd/position.c Modified: head/bin/dd/args.c ============================================================================== --- head/bin/dd/args.c Mon Oct 27 16:15:15 2014 (r273742) +++ head/bin/dd/args.c Mon Oct 27 17:39:37 2014 (r273743) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -172,7 +171,8 @@ jcl(char **argv) */ if (in.offset > OFF_MAX / (ssize_t)in.dbsz || out.offset > OFF_MAX / (ssize_t)out.dbsz) - errx(1, "seek offsets cannot be larger than %jd", OFF_MAX); + errx(1, "seek offsets cannot be larger than %jd", + (intmax_t)OFF_MAX); } static int @@ -186,30 +186,37 @@ c_arg(const void *a, const void *b) static void f_bs(char *arg) { + uintmax_t res; - in.dbsz = out.dbsz = get_num(arg); - if (out.dbsz < 1 || out.dbsz > SSIZE_MAX) - errx(1, "bs must be between 1 and %jd", SSIZE_MAX); + res = get_num(arg); + if (res < 1 || res > SSIZE_MAX) + errx(1, "bs must be between 1 and %jd", (intmax_t)SSIZE_MAX); + in.dbsz = out.dbsz = (size_t)res; } static void f_cbs(char *arg) { + uintmax_t res; - cbsz = get_num(arg); - if (cbsz < 1 || cbsz > SSIZE_MAX) - errx(1, "cbs must be between 1 and %jd", SSIZE_MAX); + res = get_num(arg); + if (res < 1 || res > SSIZE_MAX) + errx(1, "cbs must be between 1 and %jd", (intmax_t)SSIZE_MAX); + cbsz = (size_t)res; } static void f_count(char *arg) { + intmax_t res; - cpy_cnt = get_num(arg); - if (cpy_cnt == SIZE_MAX) - errc(1, ERANGE, "%s", oper); - if (cpy_cnt == 0) - cpy_cnt = -1; + res = (intmax_t)get_num(arg); + if (res < 0) + errx(1, "count cannot be negative"); + if (res == 0) + cpy_cnt = (uintmax_t)-1; + else + cpy_cnt = (uintmax_t)res; } static void @@ -218,7 +225,7 @@ f_files(char *arg) files_cnt = get_num(arg); if (files_cnt < 1) - errx(1, "files must be between 1 and %ju", SIZE_MAX); + errx(1, "files must be between 1 and %jd", (uintmax_t)-1); } static void @@ -234,11 +241,14 @@ f_fillchar(char *arg) static void f_ibs(char *arg) { + uintmax_t res; if (!(ddflags & C_BS)) { - in.dbsz = get_num(arg); - if (in.dbsz < 1 || in.dbsz > SSIZE_MAX) - errx(1, "ibs must be between 1 and %ju", SSIZE_MAX); + res = get_num(arg); + if (res < 1 || res > SSIZE_MAX) + errx(1, "ibs must be between 1 and %jd", + (intmax_t)SSIZE_MAX); + in.dbsz = (size_t)res; } } @@ -252,11 +262,14 @@ f_if(char *arg) static void f_obs(char *arg) { + uintmax_t res; if (!(ddflags & C_BS)) { - out.dbsz = get_num(arg); - if (out.dbsz < 1 || out.dbsz > SSIZE_MAX) - errx(1, "obs must be between 1 and %jd", SSIZE_MAX); + res = get_num(arg); + if (res < 1 || res > SSIZE_MAX) + errx(1, "obs must be between 1 and %jd", + (intmax_t)SSIZE_MAX); + out.dbsz = (size_t)res; } } @@ -365,17 +378,11 @@ get_num(const char *val) uintmax_t num, mult, prevnum; char *expr; - while (isspace(val[0])) - val++; - - if (val[0] == '-') - errx(1, "%s: cannot be negative", oper); - errno = 0; - num = strtoull(val, &expr, 0); + num = strtouq(val, &expr, 0); if (errno != 0) /* Overflow or underflow. */ err(1, "%s", oper); - + if (expr == val) /* No valid digits. */ errx(1, "%s: illegal numeric value", oper); Modified: head/bin/dd/conv.c ============================================================================== --- head/bin/dd/conv.c Mon Oct 27 16:15:15 2014 (r273742) +++ head/bin/dd/conv.c Mon Oct 27 17:39:37 2014 (r273743) @@ -133,7 +133,7 @@ block(void) */ ch = 0; for (inp = in.dbp - in.dbcnt, outp = out.dbp; in.dbcnt;) { - maxlen = MIN(cbsz, (size_t)in.dbcnt); + maxlen = MIN(cbsz, in.dbcnt); if ((t = ctab) != NULL) for (cnt = 0; cnt < maxlen && (ch = *inp++) != '\n'; ++cnt) @@ -146,7 +146,7 @@ block(void) * Check for short record without a newline. Reassemble the * input block. */ - if (ch != '\n' && (size_t)in.dbcnt < cbsz) { + if (ch != '\n' && in.dbcnt < cbsz) { (void)memmove(in.db, in.dbp - in.dbcnt, in.dbcnt); break; } @@ -228,7 +228,7 @@ unblock(void) * translation has to already be done or we might not recognize the * spaces. */ - for (inp = in.db; (size_t)in.dbcnt >= cbsz; inp += cbsz, in.dbcnt -= cbsz) { + for (inp = in.db; in.dbcnt >= cbsz; inp += cbsz, in.dbcnt -= cbsz) { for (t = inp + cbsz - 1; t >= inp && *t == ' '; --t) ; if (t >= inp) { Modified: head/bin/dd/dd.c ============================================================================== --- head/bin/dd/dd.c Mon Oct 27 16:15:15 2014 (r273742) +++ head/bin/dd/dd.c Mon Oct 27 17:39:37 2014 (r273743) @@ -168,10 +168,10 @@ setup(void) * record oriented I/O, only need a single buffer. */ if (!(ddflags & (C_BLOCK | C_UNBLOCK))) { - if ((in.db = malloc((size_t)out.dbsz + in.dbsz - 1)) == NULL) + if ((in.db = malloc(out.dbsz + in.dbsz - 1)) == NULL) err(1, "input buffer"); out.db = in.db; - } else if ((in.db = malloc(MAX((size_t)in.dbsz, cbsz) + cbsz)) == NULL || + } else if ((in.db = malloc(MAX(in.dbsz, cbsz) + cbsz)) == NULL || (out.db = malloc(out.dbsz + cbsz)) == NULL) err(1, "output buffer"); @@ -343,7 +343,7 @@ dd_in(void) ++st.in_full; /* Handle full input blocks. */ - } else if ((size_t)n == (size_t)in.dbsz) { + } else if ((size_t)n == in.dbsz) { in.dbcnt += in.dbrcnt = n; ++st.in_full; @@ -493,7 +493,7 @@ dd_out(int force) outp += nw; st.bytes += nw; - if ((size_t)nw == n && n == (size_t)out.dbsz) + if ((size_t)nw == n && n == out.dbsz) ++st.out_full; else ++st.out_part; Modified: head/bin/dd/dd.h ============================================================================== --- head/bin/dd/dd.h Mon Oct 27 16:15:15 2014 (r273742) +++ head/bin/dd/dd.h Mon Oct 27 17:39:37 2014 (r273743) @@ -38,9 +38,10 @@ typedef struct { u_char *db; /* buffer address */ u_char *dbp; /* current buffer I/O address */ - ssize_t dbcnt; /* current buffer byte count */ - ssize_t dbrcnt; /* last read byte count */ - ssize_t dbsz; /* block size */ + /* XXX ssize_t? */ + size_t dbcnt; /* current buffer byte count */ + size_t dbrcnt; /* last read byte count */ + size_t dbsz; /* block size */ #define ISCHR 0x01 /* character device (warn on short) */ #define ISPIPE 0x02 /* pipe-like (see position.c) */ @@ -56,13 +57,13 @@ typedef struct { } IO; typedef struct { - size_t in_full; /* # of full input blocks */ - size_t in_part; /* # of partial input blocks */ - size_t out_full; /* # of full output blocks */ - size_t out_part; /* # of partial output blocks */ - size_t trunc; /* # of truncated records */ - size_t swab; /* # of odd-length swab blocks */ - size_t bytes; /* # of bytes written */ + uintmax_t in_full; /* # of full input blocks */ + uintmax_t in_part; /* # of partial input blocks */ + uintmax_t out_full; /* # of full output blocks */ + uintmax_t out_part; /* # of partial output blocks */ + uintmax_t trunc; /* # of truncated records */ + uintmax_t swab; /* # of odd-length swab blocks */ + uintmax_t bytes; /* # of bytes written */ struct timespec start; /* start time of dd */ } STAT; Modified: head/bin/dd/position.c ============================================================================== --- head/bin/dd/position.c Mon Oct 27 16:15:15 2014 (r273742) +++ head/bin/dd/position.c Mon Oct 27 17:39:37 2014 (r273743) @@ -178,7 +178,7 @@ pos_out(void) n = write(out.fd, out.db, out.dbsz); if (n == -1) err(1, "%s", out.name); - if (n != out.dbsz) + if ((size_t)n != out.dbsz) errx(1, "%s: write failure", out.name); } break; From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 17:40:24 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0EB5C3EB; Mon, 27 Oct 2014 17:40:24 +0000 (UTC) Received: from f10.opsec.eu (f10.opsec.eu [IPv6:2001:14f8:200:4::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA354931; Mon, 27 Oct 2014 17:40:23 +0000 (UTC) Received: from pi by f10.opsec.eu with local (Exim 4.84 (FreeBSD)) (envelope-from ) id 1XioHC-0003tP-Lw; Mon, 27 Oct 2014 18:40:18 +0100 Date: Mon, 27 Oct 2014 18:40:18 +0100 From: Kurt Jaeger To: Bruce Evans Subject: Re: svn commit: r273734 - head/bin/dd Message-ID: <20141027174018.GQ1492@f10.opsec.eu> References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141028005225.S2013@besplex.bde.org> <20141027162034.GN1492@f10.opsec.eu> <20141028040638.O3114@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141028040638.O3114@besplex.bde.org> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Kurt Jaeger X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 17:40:24 -0000 Hi! > > So, given this detailed review, should I revert the change ? > > Yes. You would have to change half of it just to get it to compile > on 32-bit arches. Done. It's clearly my fault, I was sloppy in testing 8-( -- pi@FreeBSD.org +49 171 3101372 6 years to go ! From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 17:52:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C2FF4791; Mon, 27 Oct 2014 17:52:54 +0000 (UTC) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 8558FAD5; Mon, 27 Oct 2014 17:52:54 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 00EA1104403F; Tue, 28 Oct 2014 04:52:45 +1100 (AEDT) Date: Tue, 28 Oct 2014 04:52:45 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov Subject: Re: svn commit: r273130 - head/sys/fs/deadfs In-Reply-To: <201410151308.s9FD8rY4032849@svn.freebsd.org> Message-ID: <20141028042928.J3114@besplex.bde.org> References: <201410151308.s9FD8rY4032849@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=fvDlOjIf c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=mvcpKk_RDYwzxCSpuQ0A:9 a=CjuIK1q_8ugA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 17:52:54 -0000 On Wed, 15 Oct 2014, Konstantin Belousov wrote: > Log: > Change the deadfs poll VOP to return POLLIN|POLLRDNORM if the caller > is interested in i/o state. Return POLLNVAL for invalid bits, similar > to poll_no_poll(). Note that POLLOUT must not be returned, since > POLLHUP is set. > > Noted and reviewed by: bde > Sponsored by: The FreeBSD Foundation > MFC after: 1 week Thanks. This is not a complete fix, but is just bug for bug compatible with poll_no_poll() and less buggy that the previous version. POLLNVAL means that the fd is valid, so it should not be returned for dead fd's (the whole point of deadfs is to keep the fd's alive enough to be valid). POLLIN should only be returned in there is (non-null) data. For some fd's, there may be both hangup and data, but for dead fd's there can only be hangup, so POLLIN is especially useless for deadfs. ttys are one of the few file types that usually set POLLIN correctly for EOF (that is, POLLIN is not set for EOF). 2 unusual broken cases remain for ttys: - when the tty goes away but the fd is still connected to the tty driver, POLLIN is set if it is checked for - but the fd is connected to deadfs (typically after it is revoked), the behaviour is now the same as when the tty goes away, except POLLNVAL is also set. For other file types, the new behaviour matches bugs in the handling for undead fd's better, while fixing some of the bugs in the old behaviour. Bruce From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 18:29:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BEC2EFD9; Mon, 27 Oct 2014 18:29:49 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A54AE99; Mon, 27 Oct 2014 18:29:49 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 6B7BCB98A; Mon, 27 Oct 2014 14:29:48 -0400 (EDT) From: John Baldwin To: Warner Losh Subject: Re: svn commit: r273214 - in head/sys: amd64/vmm/intel modules/vmm Date: Mon, 27 Oct 2014 14:18:17 -0400 Message-ID: <5487187.5oKgfZ1XGT@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-PRERELEASE; KDE/4.14.2; amd64; ; ) In-Reply-To: <2B7C3745-04E4-4FA9-A849-AECE54EA83A3@bsdimp.com> References: <201410171320.s9HDKo53045297@svn.freebsd.org> <1725598.2CCKLon8F3@ralph.baldwin.cx> <2B7C3745-04E4-4FA9-A849-AECE54EA83A3@bsdimp.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 27 Oct 2014 14:29:48 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , Warner Losh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 18:29:49 -0000 On Monday, October 27, 2014 11:36:41 AM Warner Losh wrote: > On Oct 27, 2014, at 10:54 AM, John Baldwin wrote: > > On Friday, October 17, 2014 01:20:50 PM Warner Losh wrote: > >> Author: imp > >> Date: Fri Oct 17 13:20:49 2014 > >> New Revision: 273214 > >> URL: https://svnweb.freebsd.org/changeset/base/273214 > >>=20 > >> Log: > >> Fix build to not bogusly always rebuild vmm.ko. > >> =20 > >> Rename vmx_assym.s to vmx_assym.h to reflect that file's actual u= se > >> and update vmx_support.S's include to match. Add vmx_assym.h to t= he > >> SRCS to that it gets properly added to the dependency list. Add > >> vmx_support.S to SRCS as well, so it gets built and needs fewer > >> special-case goo. Remove now-redundant special-case goo. Finally,= > >> vmx_genassym.o doesn't need to depend on a hand expanded ${_ILINK= S} > >> explicitly, that's all taken care of by beforedepend. > >> =20 > >> With these items fixed, we no longer build vmm.ko every single ti= me > >> through the modules on a KERNFAST build. > >=20 > > So I cheered for this before, but it appears to be broken. :( > >=20 > > Namely, I rebuilt world + kernel on my laptop this weekend (it was = about a > > month old). My normal setup builds kernels with NO_KERNELCLEAN=3Dy= es. On my > > next reboot when I started a bhyve VM I promptly got a panic due to= a page > >=20 > > fault in this assembly code: > > =09/* > > =09 > > =09 * If 'vmx->eptgen[curcpu]' is not identical to 'pmap->pm_eptgen= ' > > =09 * then we must invalidate all mappings associated with this EPT= P. > > =09 */ > > =09 > > =09movq=09PM_EPTGEN(%r11), %r10 > > =09cmpq=09%r10, VMX_EPTGEN(%rsi, %rax, 8) > > =09je=09guest_restore > >=20 > > (The 'cmpq' instruction) > >=20 > > This change came to mind, so I blew away the 'vmm' module directory= and > > rebuilt my kernel. Comparing the assembly of this instruction befo= re and > > after used different values for VMX_EPTGEN. In other words, the > > NO_KERNELCLEAN=3Dyes build failed to regenerate vmx_assym.h and the= build > > used stale values. >=20 > Is there a way to force this condition for testing? You could checkout an older tree (probably before the recent merge of A= MD SVM support) and build vmm.ko, then svn update and see if vmx_assym and vmx_support.o are updated. Actually, this was simpler: % cd sys/modules/vmm % make depend % make vmx_assym.h # reports nothing to do % touch machine/vmm.h # vmx_genassym.c includes this % make vmx_assym.h # should rebuild, but doesn't > > In particular, if you examine the generated .depend file, you will = find > > that there are no dependencies recorded for vmx_genassym.o, so it i= s > > never rebuilt if any of the headers it includes are changed. In my= case > > the panic happened to be one that was easily diagnosed, but I could= > > imagine stale assym headers causing very odd crashes that would be = quite > > hard to track down. I think these changes should be reverted if we= can't > > fix the dependencies of the associated object files they are genera= ted > > from. :( >=20 > Give me a bit and I=E2=80=99ll fix it. There=E2=80=99s a number of im= plicit dependencies > that don=E2=80=99t get recorded in the .depend file, iirc, so that=E2= =80=99s not completely > conclusive. Not building, though is kinda a big hint that something=E2= =80=99s > amiss. I think the thing here is that for the assym files we don't record any dependency info at all. The main kernel build does record dependencies= for genassym.o in .depend, so it must be doable. In kern.pre.mk: GEN_CFILES=3D $S/$M/$M/genassym.c ${MFILES:T:S/.m$/.c/} and those are then explicitly passed to mkdep in kern.post.mk. So this fixes it: Index: Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- Makefile=09(revision 273555) +++ Makefile=09(working copy) @@ -4,6 +4,7 @@ KMOD=3D=09vmm =20 SRCS=3D=09opt_acpi.h opt_ddb.h device_if.h bus_if.h pci_if.h SRCS+=3D=09vmx_assym.h svm_assym.h +DPSRCS=3D=09vmx_genassym.c svm_genassym.c =20 CFLAGS+=3D -DVMM_KEEP_STATS -DSMP CFLAGS+=3D -I${.CURDIR}/../../amd64/vmm I'll try to track down all the other assym files and fix them as well. > However, -DNO_CLEAN has always been a very-sharp edged tool that will= cut > you in a number of ways, so there=E2=80=99s no rush to back this out.= This is the first time in many years that NO_KERNELCLEAN=3Dyes has been= a problem for me. (worlds sometimes have issues, but kernels rarely do).= Also, usually when it breaks it fails to compile, it doesn't compile an= d then panic. :( --=20 John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 18:37:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ED3FD413; Mon, 27 Oct 2014 18:37:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D929AF8D; Mon, 27 Oct 2014 18:37:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RIbCCc018112; Mon, 27 Oct 2014 18:37:12 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RIbCbR018109; Mon, 27 Oct 2014 18:37:12 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410271837.s9RIbCbR018109@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 27 Oct 2014 18:37:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273744 - in head/sys/modules: linux vmm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 18:37:13 -0000 Author: jhb Date: Mon Oct 27 18:37:11 2014 New Revision: 273744 URL: https://svnweb.freebsd.org/changeset/base/273744 Log: Add foo_genassym.c files to DPSRCS so dependencies for them are generated. This ensures these objects are rebuilt to generate an updated header of assembly constants if needed. Modified: head/sys/modules/linux/Makefile head/sys/modules/vmm/Makefile Modified: head/sys/modules/linux/Makefile ============================================================================== --- head/sys/modules/linux/Makefile Mon Oct 27 17:39:37 2014 (r273743) +++ head/sys/modules/linux/Makefile Mon Oct 27 18:37:11 2014 (r273744) @@ -17,6 +17,7 @@ SRCS= linux_fork.c linux${SFX}_dummy.c l opt_inet6.h opt_compat.h opt_posix.h opt_usb.h vnode_if.h \ device_if.h bus_if.h assym.s \ linux${SFX}_locore.s linux${SFX}_support.s +DPSRCS= linux${SFX}_genassym.c # XXX: for assym.s SRCS+= opt_kstack_pages.h opt_nfs.h opt_compat.h opt_hwpmc_hooks.h Modified: head/sys/modules/vmm/Makefile ============================================================================== --- head/sys/modules/vmm/Makefile Mon Oct 27 17:39:37 2014 (r273743) +++ head/sys/modules/vmm/Makefile Mon Oct 27 18:37:11 2014 (r273744) @@ -4,6 +4,7 @@ KMOD= vmm SRCS= opt_acpi.h opt_ddb.h device_if.h bus_if.h pci_if.h SRCS+= vmx_assym.h svm_assym.h +DPSRCS= vmx_genassym.c svm_genassym.c CFLAGS+= -DVMM_KEEP_STATS -DSMP CFLAGS+= -I${.CURDIR}/../../amd64/vmm @@ -53,7 +54,7 @@ SRCS+= vmcb.c \ npt.c \ amdv.c \ svm_msr.c - + CLEANFILES= vmx_assym.h vmx_genassym.o svm_assym.h svm_genassym.o vmx_assym.h: vmx_genassym.o From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 20:18:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5D8B3214; Mon, 27 Oct 2014 20:18:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E9E6D7F; Mon, 27 Oct 2014 20:18:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RKIVt3065653; Mon, 27 Oct 2014 20:18:31 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RKIVjM065652; Mon, 27 Oct 2014 20:18:31 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410272018.s9RKIVjM065652@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 27 Oct 2014 20:18:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273745 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 20:18:31 -0000 Author: mjg Date: Mon Oct 27 20:18:30 2014 New Revision: 273745 URL: https://svnweb.freebsd.org/changeset/base/273745 Log: De-k&r-ify function definitions in kern/kern_resource.c No functional changes. Modified: head/sys/kern/kern_resource.c Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Mon Oct 27 18:37:11 2014 (r273744) +++ head/sys/kern/kern_resource.c Mon Oct 27 20:18:30 2014 (r273745) @@ -92,9 +92,7 @@ struct getpriority_args { }; #endif int -sys_getpriority(td, uap) - struct thread *td; - register struct getpriority_args *uap; +sys_getpriority(struct thread *td, register struct getpriority_args *uap) { struct proc *p; struct pgrp *pg; @@ -177,9 +175,7 @@ struct setpriority_args { }; #endif int -sys_setpriority(td, uap) - struct thread *td; - struct setpriority_args *uap; +sys_setpriority(struct thread *td, struct setpriority_args *uap) { struct proc *curp, *p; struct pgrp *pg; @@ -373,9 +369,7 @@ struct rtprio_args { }; #endif int -sys_rtprio(td, uap) - struct thread *td; /* curthread */ - register struct rtprio_args *uap; +sys_rtprio(struct thread *td, register struct rtprio_args *uap) { struct proc *p; struct thread *tdp; @@ -541,9 +535,7 @@ struct osetrlimit_args { }; #endif int -osetrlimit(td, uap) - struct thread *td; - register struct osetrlimit_args *uap; +osetrlimit(struct thread *td, register struct osetrlimit_args *uap) { struct orlimit olim; struct rlimit lim; @@ -564,9 +556,7 @@ struct ogetrlimit_args { }; #endif int -ogetrlimit(td, uap) - struct thread *td; - register struct ogetrlimit_args *uap; +ogetrlimit(struct thread *td, register struct ogetrlimit_args *uap) { struct orlimit olim; struct rlimit rl; @@ -603,9 +593,7 @@ struct __setrlimit_args { }; #endif int -sys_setrlimit(td, uap) - struct thread *td; - register struct __setrlimit_args *uap; +sys_setrlimit(struct thread *td, register struct __setrlimit_args *uap) { struct rlimit alim; int error; @@ -797,9 +785,7 @@ struct __getrlimit_args { #endif /* ARGSUSED */ int -sys_getrlimit(td, uap) - struct thread *td; - register struct __getrlimit_args *uap; +sys_getrlimit(struct thread *td, register struct __getrlimit_args *uap) { struct rlimit rlim; struct proc *p; @@ -820,10 +806,7 @@ sys_getrlimit(td, uap) * into user and system time usage. */ void -calccru(p, up, sp) - struct proc *p; - struct timeval *up; - struct timeval *sp; +calccru(struct proc *p, struct timeval *up, struct timeval *sp) { PROC_LOCK_ASSERT(p, MA_OWNED); @@ -976,9 +959,7 @@ struct getrusage_args { }; #endif int -sys_getrusage(td, uap) - register struct thread *td; - register struct getrusage_args *uap; +sys_getrusage(register struct thread *td, register struct getrusage_args *uap) { struct rusage ru; int error; @@ -1133,8 +1114,7 @@ lim_alloc() } struct plimit * -lim_hold(limp) - struct plimit *limp; +lim_hold(struct plimit *limp) { refcount_acquire(&limp->pl_refcnt); @@ -1142,8 +1122,7 @@ lim_hold(limp) } static __inline int -lim_shared(limp) - struct plimit *limp; +lim_shared(struct plimit *limp) { return (limp->pl_refcnt > 1); @@ -1164,8 +1143,7 @@ lim_fork(struct proc *p1, struct proc *p } void -lim_free(limp) - struct plimit *limp; +lim_free(struct plimit *limp) { if (refcount_release(&limp->pl_refcnt)) @@ -1177,8 +1155,7 @@ lim_free(limp) * We share these structures copy-on-write after fork. */ void -lim_copy(dst, src) - struct plimit *dst, *src; +lim_copy(struct plimit *dst, struct plimit *src) { KASSERT(!lim_shared(dst), ("lim_copy to shared limit")); @@ -1240,8 +1217,7 @@ uihashinit() * uihashtbl_lock must be locked. */ static struct uidinfo * -uilookup(uid) - uid_t uid; +uilookup(uid_t uid) { struct uihashhead *uipp; struct uidinfo *uip; @@ -1261,8 +1237,7 @@ uilookup(uid) * uifree() should be called on a struct uidinfo when released. */ struct uidinfo * -uifind(uid) - uid_t uid; +uifind(uid_t uid) { struct uidinfo *old_uip, *uip; @@ -1300,8 +1275,7 @@ uifind(uid) * Place another refcount on a uidinfo struct. */ void -uihold(uip) - struct uidinfo *uip; +uihold(struct uidinfo *uip) { refcount_acquire(&uip->ui_ref); @@ -1323,8 +1297,7 @@ uihold(uip) * order to try again. */ void -uifree(uip) - struct uidinfo *uip; +uifree(struct uidinfo *uip) { int old; @@ -1380,10 +1353,7 @@ ui_racct_foreach(void (*callback)(struct * a given user is using. When 'max' is 0, don't enforce a limit */ int -chgproccnt(uip, diff, max) - struct uidinfo *uip; - int diff; - rlim_t max; +chgproccnt(struct uidinfo *uip, int diff, rlim_t max) { /* Don't allow them to exceed max, but allow subtraction. */ @@ -1404,11 +1374,7 @@ chgproccnt(uip, diff, max) * Change the total socket buffer size a user has used. */ int -chgsbsize(uip, hiwat, to, max) - struct uidinfo *uip; - u_int *hiwat; - u_int to; - rlim_t max; +chgsbsize(struct uidinfo *uip, u_int *hiwat, u_int to, rlim_t max) { int diff; @@ -1432,10 +1398,7 @@ chgsbsize(uip, hiwat, to, max) * a given user is using. When 'max' is 0, don't enforce a limit */ int -chgptscnt(uip, diff, max) - struct uidinfo *uip; - int diff; - rlim_t max; +chgptscnt(struct uidinfo *uip, int diff, rlim_t max) { /* Don't allow them to exceed max, but allow subtraction. */ From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 20:20:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BB13E36D; Mon, 27 Oct 2014 20:20:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A7D91D8F; Mon, 27 Oct 2014 20:20:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RKK6Ww065967; Mon, 27 Oct 2014 20:20:06 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RKK6ln065966; Mon, 27 Oct 2014 20:20:06 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410272020.s9RKK6ln065966@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 27 Oct 2014 20:20:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273746 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 20:20:06 -0000 Author: mjg Date: Mon Oct 27 20:20:05 2014 New Revision: 273746 URL: https://svnweb.freebsd.org/changeset/base/273746 Log: Tidy up functions related to uidinfo management. - reference found uidinfo in uilookup - reduce nesting by handling shorter cases first Modified: head/sys/kern/kern_resource.c Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Mon Oct 27 20:18:30 2014 (r273745) +++ head/sys/kern/kern_resource.c Mon Oct 27 20:20:05 2014 (r273746) @@ -1215,6 +1215,7 @@ uihashinit() /* * Look up a uidinfo struct for the parameter uid. * uihashtbl_lock must be locked. + * Increase refcount on uidinfo struct returned. */ static struct uidinfo * uilookup(uid_t uid) @@ -1225,49 +1226,52 @@ uilookup(uid_t uid) rw_assert(&uihashtbl_lock, RA_LOCKED); uipp = UIHASH(uid); LIST_FOREACH(uip, uipp, ui_hash) - if (uip->ui_uid == uid) + if (uip->ui_uid == uid) { + uihold(uip); break; + } return (uip); } /* * Find or allocate a struct uidinfo for a particular uid. - * Increase refcount on uidinfo struct returned. + * Returns with uidinfo struct referenced. * uifree() should be called on a struct uidinfo when released. */ struct uidinfo * uifind(uid_t uid) { - struct uidinfo *old_uip, *uip; + struct uidinfo *new_uip, *uip; rw_rlock(&uihashtbl_lock); uip = uilookup(uid); - if (uip == NULL) { - rw_runlock(&uihashtbl_lock); - uip = malloc(sizeof(*uip), M_UIDINFO, M_WAITOK | M_ZERO); - racct_create(&uip->ui_racct); - rw_wlock(&uihashtbl_lock); - /* - * There's a chance someone created our uidinfo while we - * were in malloc and not holding the lock, so we have to - * make sure we don't insert a duplicate uidinfo. - */ - if ((old_uip = uilookup(uid)) != NULL) { - /* Someone else beat us to it. */ - racct_destroy(&uip->ui_racct); - free(uip, M_UIDINFO); - uip = old_uip; - } else { - refcount_init(&uip->ui_ref, 0); - uip->ui_uid = uid; - mtx_init(&uip->ui_vmsize_mtx, "ui_vmsize", NULL, - MTX_DEF); - LIST_INSERT_HEAD(UIHASH(uid), uip, ui_hash); - } + rw_runlock(&uihashtbl_lock); + if (uip != NULL) + return (uip); + + new_uip = malloc(sizeof(*new_uip), M_UIDINFO, M_WAITOK | M_ZERO); + racct_create(&new_uip->ui_racct); + refcount_init(&new_uip->ui_ref, 1); + new_uip->ui_uid = uid; + mtx_init(&new_uip->ui_vmsize_mtx, "ui_vmsize", NULL, MTX_DEF); + + rw_wlock(&uihashtbl_lock); + /* + * There's a chance someone created our uidinfo while we + * were in malloc and not holding the lock, so we have to + * make sure we don't insert a duplicate uidinfo. + */ + if ((uip = uilookup(uid)) == NULL) { + LIST_INSERT_HEAD(UIHASH(uid), new_uip, ui_hash); + rw_wunlock(&uihashtbl_lock); + uip = new_uip; + } else { + rw_wunlock(&uihashtbl_lock); + racct_destroy(&new_uip->ui_racct); + mtx_destroy(&new_uip->ui_vmsize_mtx); + free(new_uip, M_UIDINFO); } - uihold(uip); - rw_unlock(&uihashtbl_lock); return (uip); } @@ -1308,28 +1312,26 @@ uifree(struct uidinfo *uip) /* Prepare for suboptimal case. */ rw_wlock(&uihashtbl_lock); - if (refcount_release(&uip->ui_ref)) { - racct_destroy(&uip->ui_racct); - LIST_REMOVE(uip, ui_hash); + if (refcount_release(&uip->ui_ref) == 0) { rw_wunlock(&uihashtbl_lock); - if (uip->ui_sbsize != 0) - printf("freeing uidinfo: uid = %d, sbsize = %ld\n", - uip->ui_uid, uip->ui_sbsize); - if (uip->ui_proccnt != 0) - printf("freeing uidinfo: uid = %d, proccnt = %ld\n", - uip->ui_uid, uip->ui_proccnt); - if (uip->ui_vmsize != 0) - printf("freeing uidinfo: uid = %d, swapuse = %lld\n", - uip->ui_uid, (unsigned long long)uip->ui_vmsize); - mtx_destroy(&uip->ui_vmsize_mtx); - free(uip, M_UIDINFO); return; } - /* - * Someone added a reference between atomic_cmpset_int() and - * rw_wlock(&uihashtbl_lock). - */ + + racct_destroy(&uip->ui_racct); + LIST_REMOVE(uip, ui_hash); rw_wunlock(&uihashtbl_lock); + + if (uip->ui_sbsize != 0) + printf("freeing uidinfo: uid = %d, sbsize = %ld\n", + uip->ui_uid, uip->ui_sbsize); + if (uip->ui_proccnt != 0) + printf("freeing uidinfo: uid = %d, proccnt = %ld\n", + uip->ui_uid, uip->ui_proccnt); + if (uip->ui_vmsize != 0) + printf("freeing uidinfo: uid = %d, swapuse = %lld\n", + uip->ui_uid, (unsigned long long)uip->ui_vmsize); + mtx_destroy(&uip->ui_vmsize_mtx); + free(uip, M_UIDINFO); } void From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 21:29:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9F04F436; Mon, 27 Oct 2014 21:29:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F507773; Mon, 27 Oct 2014 21:29:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RLThPh098346; Mon, 27 Oct 2014 21:29:43 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RLTgep098342; Mon, 27 Oct 2014 21:29:42 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410272129.s9RLTgep098342@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 27 Oct 2014 21:29:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273747 - in head: contrib/hyperv/tools share/man/man8 tools/build/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 21:29:43 -0000 Author: delphij Date: Mon Oct 27 21:29:42 2014 New Revision: 273747 URL: https://svnweb.freebsd.org/changeset/base/273747 Log: Remove an extra copy of hv_kvp_daemon(8) [1]. While I'm there also correct typos in OptionalObsoleteFiles and add information of the command line options for hv_kvp_daemon(8). Reported by: jmg [1] Reviewed by: jmg MFC after: 2 weeks Deleted: head/share/man/man8/hv_kvp_daemon.8 Modified: head/contrib/hyperv/tools/hv_kvp_daemon.8 head/share/man/man8/Makefile head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/contrib/hyperv/tools/hv_kvp_daemon.8 ============================================================================== --- head/contrib/hyperv/tools/hv_kvp_daemon.8 Mon Oct 27 20:20:05 2014 (r273746) +++ head/contrib/hyperv/tools/hv_kvp_daemon.8 Mon Oct 27 21:29:42 2014 (r273747) @@ -22,41 +22,71 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 10, 2013 -.Dt HYPER-V 4 +.\" $FreeBSD$ +.Dd October 27, 2014 +.Dt HV_KVP_DAEMON 8 .Os .Sh NAME .Nm hv_kvp_daemon .Nd Hyper-V Key Value Pair Daemon .Sh SYNOPSIS -The \fBhv_kvp_daemon\fP daemon provides the ability to store, retrieve, modify and delete -Key Value pairs for FreeBSD guest partitions running on Hyper-V. +.Nm +.Op Fl dn .Sh DESCRIPTION +The +.Nm +daemon provides the ability to store, retrieve, modify and delete +Key Value pairs for +.Fx +guest partitions running on Hyper-V. +.Pp Hyper-V allows administrators to store custom metadata in the form -of Key Value pairs inside the FreeBSD guest partition. Administrators can +of Key Value pairs inside the +.Fx +guest partition. +Administrators can use Windows Powershell scripts to add, read, modify and delete such Key Value pairs. - -The \fBhv_kvp_daemon\fP accepts Key Value pair management requests from the -\fBhv_utils\fP driver and performs the actual metadata management on the file-system. - +.Pp +The +.Nm +accepts Key Value pair management requests from the +.Xr hv_utils 4 +driver and performs the actual metadata management on the file-system. +.Pp The same daemon and driver combination is also used to set and get -IP addresses from a FreeBSD guest. - +IP addresses from a +.Fx +guest. +.Pp The set functionality is particularly -useful when the FreeBSD guest is assigned a static IP address and is failed -over from one Hyper-V host to another. After failover, Hyper-V uses the set IP +useful when the +.Fx +guest is assigned a static IP address and is failed +over from one Hyper-V host to another. +After failover, Hyper-V uses the set IP functionality to automatically -update the FreeBSD guest's IP address to its original static value. - +update the +.Fx +guest's IP address to its original static value. +.Pp On the other hand, the get IP functionality is used to update the guest IP address in the Hyper-V management console window. +.Pp +The options are as follows: +.Bl -tag -width indent +.It Fl d +Run as regular process instead of a daemon for debugging purpose. +.It Fl n +Generate debugging output. +.El .Sh SEE ALSO .Xr hv_vmbus 4 , .Xr hv_utils 4 , .Xr hv_netvsc 4 , .Xr hv_storvsc 4 , -.Xr hv_ata_pci_disengage 4 +.Xr hv_ata_pci_disengage 4 , +.Xr hv_kvp 4 .Sh HISTORY Support for Hyper-V in the form of ports was first released in September 2013. The daemon was developed through a joint effort between Citrix Inc., @@ -64,5 +94,7 @@ Microsoft Corp. and Network Appliance In .Sh AUTHORS .An -nosplit .Fx -support for \fBhv_kvp_daemon\fP was first added by -.An Microsoft BSD Integration Services Team Aq bsdic@microsoft.com . +support for +.Nm +was first added by +.An Microsoft BSD Integration Services Team Aq Mt bsdic@microsoft.com . Modified: head/share/man/man8/Makefile ============================================================================== --- head/share/man/man8/Makefile Mon Oct 27 20:20:05 2014 (r273746) +++ head/share/man/man8/Makefile Mon Oct 27 21:29:42 2014 (r273747) @@ -3,7 +3,6 @@ MAN= crash.8 \ diskless.8 \ - hv_kvp_daemon.8 \ intro.8 \ nanobsd.8 \ picobsd.8 \ Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Mon Oct 27 20:20:05 2014 (r273746) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Mon Oct 27 21:29:42 2014 (r273747) @@ -4779,5 +4779,6 @@ OLD_FILES+=etc/devd/hyperv.conf OLD_FILES+=usr/libexec/hyperv/hv_set_ifconfig OLD_FILES+=usr/libexec/hyperv/hv_get_dns_info OLD_FILES+=usr/libexec/hyperv/hv_get_dhcp_info -OLD_FILES+=usr/sbin/hv_kvpd +OLD_FILES+=usr/sbin/hv_kvp_daemon +OLD_FILES+=usr/share/man/man8/hv_kvp_daemon.8.gz .endif From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 22:02:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 131D2307; Mon, 27 Oct 2014 22:02:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E833DB73; Mon, 27 Oct 2014 22:02:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RM2ZUT016517; Mon, 27 Oct 2014 22:02:35 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RM2Z7S016516; Mon, 27 Oct 2014 22:02:35 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201410272202.s9RM2Z7S016516@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Mon, 27 Oct 2014 22:02:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273748 - head/sys/x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 22:02:36 -0000 Author: grehan Date: Mon Oct 27 22:02:35 2014 New Revision: 273748 URL: https://svnweb.freebsd.org/changeset/base/273748 Log: Output a summary of optional SVM features in dmesg similar to CPU features. If bootverbose is enabled, a detailed list is provided; otherwise, a single-line summary is displayed. Differential Revision: https://reviews.freebsd.org/D1008 Reviewed by: jhb, neel MFC after: 1 week Modified: head/sys/x86/x86/identcpu.c Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Mon Oct 27 21:29:42 2014 (r273747) +++ head/sys/x86/x86/identcpu.c Mon Oct 27 22:02:35 2014 (r273748) @@ -76,6 +76,7 @@ static u_int find_cpu_vendor_id(void); static void print_AMD_info(void); static void print_INTEL_info(void); static void print_INTEL_TLB(u_int data); +static void print_svm_info(void); static void print_via_padlock_info(void); static void print_vmx_info(void); @@ -932,6 +933,9 @@ printcpuinfo(void) if (cpu_feature2 & CPUID2_VMX) print_vmx_info(); + if (amd_feature2 & AMDID2_SVM) + print_svm_info(); + if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_AMD) cpu_feature &= ~CPUID_HTT; @@ -1735,6 +1739,67 @@ print_INTEL_TLB(u_int data) } } +static void +print_svm_info(void) +{ + u_int features, regs[4]; + uint64_t msr; + int comma; + + printf("\n SVM: "); + do_cpuid(0x8000000A, regs); + features = regs[3]; + + msr = rdmsr(MSR_VM_CR); + if ((msr & VM_CR_SVMDIS) == VM_CR_SVMDIS) + printf("(disabled in BIOS) "); + + if (!bootverbose) { + comma = 0; + if (features & (1 << 0)) { + printf("%sNP", comma ? "," : ""); + comma = 1; + } + if (features & (1 << 3)) { + printf("%sNRIP", comma ? "," : ""); + comma = 1; + } + if (features & (1 << 5)) { + printf("%sVClean", comma ? "," : ""); + comma = 1; + } + if (features & (1 << 6)) { + printf("%sAFlush", comma ? "," : ""); + comma = 1; + } + if (features & (1 << 7)) { + printf("%sDAssist", comma ? "," : ""); + comma = 1; + } + printf("%sNAsids=%d", comma ? "," : "", regs[1]); + return; + } + + printf("Features=0x%b", features, + "\020" + "\001NP" /* Nested paging */ + "\002LbrVirt" /* LBR virtualization */ + "\003SVML" /* SVM lock */ + "\004NRIPS" /* NRIP save */ + "\005TscRateMsr" /* MSR based TSC rate control */ + "\006VmcbClean" /* VMCB clean bits */ + "\007FlushByAsid" /* Flush by ASID */ + "\010DecodeAssist" /* Decode assist */ + "\011" + "\012" + "\013PauseFilter" /* PAUSE intercept filter */ + "\014" + "\015PauseFilterThreshold" /* PAUSE filter threshold */ + "\016AVIC" /* virtual interrupt controller */ + ); + printf("\nRevision=%d, ASIDs=%d", regs[0] & 0xff, regs[1]); +} + #ifdef __i386__ static void print_transmeta_info(void) From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 22:20:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3C5FAA73; Mon, 27 Oct 2014 22:20:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2835ECDF; Mon, 27 Oct 2014 22:20:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RMKqZh023495; Mon, 27 Oct 2014 22:20:52 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RMKqOF023494; Mon, 27 Oct 2014 22:20:52 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201410272220.s9RMKqOF023494@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Mon, 27 Oct 2014 22:20:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273749 - head/sys/amd64/vmm/amd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 22:20:52 -0000 Author: grehan Date: Mon Oct 27 22:20:51 2014 New Revision: 273749 URL: https://svnweb.freebsd.org/changeset/base/273749 Log: Remove bhyve SVM feature printf's now that they are available in the general CPU feature detection code. Reviewed by: neel Modified: head/sys/amd64/vmm/amd/svm.c Modified: head/sys/amd64/vmm/amd/svm.c ============================================================================== --- head/sys/amd64/vmm/amd/svm.c Mon Oct 27 22:02:35 2014 (r273748) +++ head/sys/amd64/vmm/amd/svm.c Mon Oct 27 22:20:51 2014 (r273749) @@ -174,30 +174,9 @@ check_svm_features(void) do_cpuid(0x8000000A, regs); svm_feature = regs[3]; - printf("SVM: Revision %d\n", regs[0] & 0xFF); - printf("SVM: NumASID %u\n", regs[1]); - nasid = regs[1]; KASSERT(nasid > 1, ("Insufficient ASIDs for guests: %#x", nasid)); - printf("SVM: Features 0x%b\n", svm_feature, - "\020" - "\001NP" /* Nested paging */ - "\002LbrVirt" /* LBR virtualization */ - "\003SVML" /* SVM lock */ - "\004NRIPS" /* NRIP save */ - "\005TscRateMsr" /* MSR based TSC rate control */ - "\006VmcbClean" /* VMCB clean bits */ - "\007FlushByAsid" /* Flush by ASID */ - "\010DecodeAssist" /* Decode assist */ - "\011" - "\012" - "\013PauseFilter" - "\014" - "\015PauseFilterThreshold" - "\016AVIC" - ); - /* bhyve requires the Nested Paging feature */ if (!(svm_feature & AMD_CPUID_SVM_NP)) { printf("SVM: Nested Paging feature not available.\n"); From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 22:22:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E5AF2BC5; Mon, 27 Oct 2014 22:22:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1ABDD7B; Mon, 27 Oct 2014 22:22:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RMMkrg026090; Mon, 27 Oct 2014 22:22:46 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RMMkaT026089; Mon, 27 Oct 2014 22:22:46 GMT (envelope-from np@FreeBSD.org) Message-Id: <201410272222.s9RMMkaT026089@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 27 Oct 2014 22:22:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273750 - head/sys/dev/cxgbe/iw_cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 22:22:47 -0000 Author: np Date: Mon Oct 27 22:22:46 2014 New Revision: 273750 URL: https://svnweb.freebsd.org/changeset/base/273750 Log: Some cxgbe/iw_cxgbe fixes: - Free rt in c4iw_connect only if it is allocated. - Call soclose instead of so_shutdown if there is an abort from the peer. - Close socket and return failure if TOE is not enabled. Submitted by: Hariprasad at Chelsio dot com Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c ============================================================================== --- head/sys/dev/cxgbe/iw_cxgbe/cm.c Mon Oct 27 22:20:51 2014 (r273749) +++ head/sys/dev/cxgbe/iw_cxgbe/cm.c Mon Oct 27 22:22:46 2014 (r273750) @@ -474,7 +474,7 @@ process_conn_error(struct c4iw_ep *ep) if (state != ABORTING) { CTR2(KTR_IW_CXGBE, "%s:pce1 %p", __func__, ep); - close_socket(&ep->com, 0); + close_socket(&ep->com, 1); state_set(&ep->com, DEAD); c4iw_put_ep(&ep->com); } @@ -2084,14 +2084,15 @@ int c4iw_connect(struct iw_cm_id *cm_id, CTR2(KTR_IW_CXGBE, "%s:cc7 %p", __func__, ep); printk(KERN_ERR MOD "%s - cannot find route.\n", __func__); err = -EHOSTUNREACH; - goto fail3; + goto fail2; } - - if (!(rt->rt_ifp->if_flags & IFCAP_TOE)) { + if (!(rt->rt_ifp->if_capenable & IFCAP_TOE)) { CTR2(KTR_IW_CXGBE, "%s:cc8 %p", __func__, ep); printf("%s - interface not TOE capable.\n", __func__); + close_socket(&ep->com, 0); + err = -ENOPROTOOPT; goto fail3; } tdev = TOEDEV(rt->rt_ifp); From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 22:41:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 368D0F8E; Mon, 27 Oct 2014 22:41:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 22E71F58; Mon, 27 Oct 2014 22:41:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RMfudM035460; Mon, 27 Oct 2014 22:41:56 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RMftda035459; Mon, 27 Oct 2014 22:41:55 GMT (envelope-from np@FreeBSD.org) Message-Id: <201410272241.s9RMftda035459@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 27 Oct 2014 22:41:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273751 - head/sys/contrib/rdma/krping X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 22:41:56 -0000 Author: np Date: Mon Oct 27 22:41:55 2014 New Revision: 273751 URL: https://svnweb.freebsd.org/changeset/base/273751 Log: krping: In verbose mode print only first 128 bytes of krping data. Submitted by: Hariprasad at Chelsio dot com. Sponsored by: Chelsio Communications Modified: head/sys/contrib/rdma/krping/krping.c Modified: head/sys/contrib/rdma/krping/krping.c ============================================================================== --- head/sys/contrib/rdma/krping/krping.c Mon Oct 27 22:22:46 2014 (r273750) +++ head/sys/contrib/rdma/krping/krping.c Mon Oct 27 22:41:55 2014 (r273751) @@ -1011,9 +1011,17 @@ static void krping_test_server(struct kr DEBUG_LOG(cb, "server received read complete\n"); /* Display data in recv buf */ - if (cb->verbose) - PRINTF(cb, "server ping data: %s\n", - cb->rdma_buf); + if (cb->verbose) { + if (strlen(cb->rdma_buf) > 128) { + char msgbuf[128]; + + strlcpy(msgbuf, cb->rdma_buf, sizeof(msgbuf)); + PRINTF(cb, "server ping data stripped: %s\n", + msgbuf); + } else + PRINTF(cb, "server ping data: %s\n", + cb->rdma_buf); + } /* Tell client to continue */ if (cb->server && cb->server_invalidate) { @@ -1713,8 +1721,16 @@ static void krping_test_client(struct kr break; } - if (cb->verbose) - PRINTF(cb, "ping data: %s\n", cb->rdma_buf); + if (cb->verbose) { + if (strlen(cb->rdma_buf) > 128) { + char msgbuf[128]; + + strlcpy(msgbuf, cb->rdma_buf, sizeof(msgbuf)); + PRINTF(cb, "ping data stripped: %s\n", + msgbuf); + } else + PRINTF(cb, "ping data: %s\n", cb->rdma_buf); + } #ifdef SLOW_KRPING wait_event_interruptible_timeout(cb->sem, cb->state == ERROR, HZ); #endif From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 23:03:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 92595664; Mon, 27 Oct 2014 23:03:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E4251D7; Mon, 27 Oct 2014 23:03:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RN3IrM045083; Mon, 27 Oct 2014 23:03:18 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RN3I2U045082; Mon, 27 Oct 2014 23:03:18 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201410272303.s9RN3I2U045082@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Mon, 27 Oct 2014 23:03:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273752 - head/lib/libnv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 23:03:18 -0000 Author: jmg Date: Mon Oct 27 23:03:17 2014 New Revision: 273752 URL: https://svnweb.freebsd.org/changeset/base/273752 Log: fix typo, properly install a link to nv for nvlist_freev... Modified: head/lib/libnv/Makefile Modified: head/lib/libnv/Makefile ============================================================================== --- head/lib/libnv/Makefile Mon Oct 27 22:41:55 2014 (r273751) +++ head/lib/libnv/Makefile Mon Oct 27 23:03:17 2014 (r273752) @@ -149,7 +149,7 @@ MLINKS+=nv.3 nvlist_existsv.3 \ nv.3 nvlist_takev_nvlist.3 \ nv.3 nvlist_takev_descriptor.3 \ nv.3 nvlist_takev_binary.3 \ - nv.3 nvlist_freef.3 \ + nv.3 nvlist_freev.3 \ nv.3 nvlist_freev_type.3 \ nv.3 nvlist_freev_null.3 \ nv.3 nvlist_freev_bool.3 \ From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 23:11:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B5E52847; Mon, 27 Oct 2014 23:11:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 88A6D2E9; Mon, 27 Oct 2014 23:11:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RNBnCH049699; Mon, 27 Oct 2014 23:11:49 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RNBnHY049698; Mon, 27 Oct 2014 23:11:49 GMT (envelope-from np@FreeBSD.org) Message-Id: <201410272311.s9RNBnHY049698@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 27 Oct 2014 23:11:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273753 - head/sys/dev/cxgbe/iw_cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 23:11:49 -0000 Author: np Date: Mon Oct 27 23:11:48 2014 New Revision: 273753 URL: https://svnweb.freebsd.org/changeset/base/273753 Log: iwcm_event status needs to be populated for close_complete_upcall Submitted by: Hariprasad at Chelsio dot com Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c ============================================================================== --- head/sys/dev/cxgbe/iw_cxgbe/cm.c Mon Oct 27 23:03:17 2014 (r273752) +++ head/sys/dev/cxgbe/iw_cxgbe/cm.c Mon Oct 27 23:11:48 2014 (r273753) @@ -94,7 +94,7 @@ static void abort_socket(struct c4iw_ep static void send_mpa_req(struct c4iw_ep *ep); static int send_mpa_reject(struct c4iw_ep *ep, const void *pdata, u8 plen); static int send_mpa_reply(struct c4iw_ep *ep, const void *pdata, u8 plen); -static void close_complete_upcall(struct c4iw_ep *ep); +static void close_complete_upcall(struct c4iw_ep *ep, int status); static int abort_connection(struct c4iw_ep *ep); static void peer_close_upcall(struct c4iw_ep *ep); static void peer_abort_upcall(struct c4iw_ep *ep); @@ -366,7 +366,7 @@ process_peer_close(struct c4iw_ep *ep) C4IW_QP_ATTR_NEXT_STATE, &attrs, 1); } close_socket(&ep->com, 0); - close_complete_upcall(ep); + close_complete_upcall(ep, 0); __state_set(&ep->com, DEAD); release = 1; disconnect = 0; @@ -528,7 +528,7 @@ process_close_complete(struct c4iw_ep *e CTR2(KTR_IW_CXGBE, "%s:pcc4 %p", __func__, ep); close_socket(&ep->com, 0); } - close_complete_upcall(ep); + close_complete_upcall(ep, 0); __state_set(&ep->com, DEAD); release = 1; break; @@ -1192,13 +1192,14 @@ static int send_mpa_reply(struct c4iw_ep -static void close_complete_upcall(struct c4iw_ep *ep) +static void close_complete_upcall(struct c4iw_ep *ep, int status) { struct iw_cm_event event; CTR2(KTR_IW_CXGBE, "%s:ccuB %p", __func__, ep); memset(&event, 0, sizeof(event)); event.event = IW_CM_EVENT_CLOSE; + event.status = status; if (ep->com.cm_id) { @@ -1217,7 +1218,7 @@ static int abort_connection(struct c4iw_ int err; CTR2(KTR_IW_CXGBE, "%s:abB %p", __func__, ep); - close_complete_upcall(ep); + close_complete_upcall(ep, -ECONNRESET); state_set(&ep->com, ABORTING); abort_socket(ep); err = close_socket(&ep->com, 0); @@ -2212,7 +2213,7 @@ int c4iw_ep_disconnect(struct c4iw_ep *e CTR2(KTR_IW_CXGBE, "%s:ced1 %p", __func__, ep); fatal = 1; - close_complete_upcall(ep); + close_complete_upcall(ep, -EIO); ep->com.state = DEAD; } CTR3(KTR_IW_CXGBE, "%s:ced2 %p %s", __func__, ep, From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 23:19:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A9CFEB59; Mon, 27 Oct 2014 23:19:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A5B0361; Mon, 27 Oct 2014 23:19:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RNJqBI050740; Mon, 27 Oct 2014 23:19:52 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RNJqCo050738; Mon, 27 Oct 2014 23:19:52 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201410272319.s9RNJqCo050738@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Mon, 27 Oct 2014 23:19:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273754 - head/usr.sbin/pkg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 23:19:52 -0000 Author: nwhitehorn Date: Mon Oct 27 23:19:51 2014 New Revision: 273754 URL: https://svnweb.freebsd.org/changeset/base/273754 Log: Use pkg-1.4-style platform identifiers based on MACHINE_ARCH (e.g. FreeBSD:11:amd64 instead of freebsd:11:x86:64) when bootstrapping pkg. Thanks to portmgr for providing symlinks so both styles work. Reviewed by: bapt MFC after: 3 weeks Deleted: head/usr.sbin/pkg/elf_tables.h Modified: head/usr.sbin/pkg/Makefile head/usr.sbin/pkg/config.c Modified: head/usr.sbin/pkg/Makefile ============================================================================== --- head/usr.sbin/pkg/Makefile Mon Oct 27 23:11:48 2014 (r273753) +++ head/usr.sbin/pkg/Makefile Mon Oct 27 23:19:51 2014 (r273754) @@ -8,7 +8,7 @@ CFLAGS+=-I${.CURDIR}/../../contrib/libuc .PATH: ${.CURDIR}/../../contrib/libucl/include DPADD= ${LIBARCHIVE} ${LIBELF} ${LIBFETCH} ${LIBUCL} ${LIBSBUF} ${LIBSSL} \ ${LIBCRYPTO} ${LIBM} -LDADD= -larchive -lelf -lfetch ${LDUCL} -lsbuf -lssl -lcrypto -lm +LDADD= -larchive -lfetch ${LDUCL} -lsbuf -lssl -lcrypto -lm USEPRIVATELIB= ucl .include Modified: head/usr.sbin/pkg/config.c ============================================================================== --- head/usr.sbin/pkg/config.c Mon Oct 27 23:11:48 2014 (r273753) +++ head/usr.sbin/pkg/config.c Mon Oct 27 23:19:51 2014 (r273754) @@ -31,9 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include +#include +#include #include #include @@ -42,14 +42,12 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include #include #include -#include "elf_tables.h" #include "config.h" #define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ @@ -135,349 +133,32 @@ static struct config_entry c[] = { }, }; -static const char * -elf_corres_to_string(struct _elf_corres *m, int e) -{ - int i; - - for (i = 0; m[i].string != NULL; i++) - if (m[i].elf_nb == e) - return (m[i].string); - - return ("unknown"); -} - -static const char * -aeabi_parse_arm_attributes(void *data, size_t length) -{ - uint32_t sect_len; - uint8_t *section = data; - -#define MOVE(len) do { \ - assert(length >= (len)); \ - section += (len); \ - length -= (len); \ -} while (0) - - if (length == 0 || *section != 'A') - return (NULL); - - MOVE(1); - - /* Read the section length */ - if (length < sizeof(sect_len)) - return (NULL); - - memcpy(§_len, section, sizeof(sect_len)); - - /* - * The section length should be no longer than the section it is within - */ - if (sect_len > length) - return (NULL); - - MOVE(sizeof(sect_len)); - - /* Skip the vendor name */ - while (length != 0) { - if (*section == '\0') - break; - MOVE(1); - } - if (length == 0) - return (NULL); - MOVE(1); - - while (length != 0) { - uint32_t tag_length; - - switch(*section) { - case 1: /* Tag_File */ - MOVE(1); - if (length < sizeof(tag_length)) - return (NULL); - memcpy(&tag_length, section, sizeof(tag_length)); - break; - case 2: /* Tag_Section */ - case 3: /* Tag_Symbol */ - default: - return (NULL); - } - /* At least space for the tag and size */ - if (tag_length <= 5) - return (NULL); - tag_length--; - /* Check the tag fits */ - if (tag_length > length) - return (NULL); - -#define MOVE_TAG(len) do { \ - assert(tag_length >= (len)); \ - MOVE(len); \ - tag_length -= (len); \ -} while(0) - - MOVE(sizeof(tag_length)); - tag_length -= sizeof(tag_length); - - while (tag_length != 0) { - uint8_t tag; - - assert(tag_length >= length); - - tag = *section; - MOVE_TAG(1); - - /* - * These tag values come from: - * - * Addenda to, and Errata in, the ABI for the - * ARM Architecture. Release 2.08, section 2.3. - */ - if (tag == 6) { /* == Tag_CPU_arch */ - uint8_t val; - - val = *section; - /* - * We don't support values that require - * more than one byte. - */ - if (val & (1 << 7)) - return (NULL); - - /* We have an ARMv4 or ARMv5 */ - if (val <= 5) - return ("arm"); - else /* We have an ARMv6+ */ - return ("armv6"); - } else if (tag == 4 || tag == 5 || tag == 32 || - tag == 65 || tag == 67) { - while (*section != '\0' && length != 0) - MOVE_TAG(1); - if (tag_length == 0) - return (NULL); - /* Skip the last byte */ - MOVE_TAG(1); - } else if ((tag >= 7 && tag <= 31) || tag == 34 || - tag == 36 || tag == 38 || tag == 42 || tag == 44 || - tag == 64 || tag == 66 || tag == 68 || tag == 70) { - /* Skip the uleb128 data */ - while (*section & (1 << 7) && length != 0) - MOVE_TAG(1); - if (tag_length == 0) - return (NULL); - /* Skip the last byte */ - MOVE_TAG(1); - } else - return (NULL); -#undef MOVE_TAG - } - - break; - } - return (NULL); -#undef MOVE -} - static int pkg_get_myabi(char *dest, size_t sz) { - Elf *elf; - Elf_Data *data; - Elf_Note note; - Elf_Scn *scn; - char *src, *osname; - const char *arch, *abi, *fpu, *endian_corres_str; - const char *wordsize_corres_str; - GElf_Ehdr elfhdr; - GElf_Shdr shdr; - int fd, i, ret; - uint32_t version; - - version = 0; - ret = -1; - scn = NULL; - abi = NULL; - - if (elf_version(EV_CURRENT) == EV_NONE) { - warnx("ELF library initialization failed: %s", - elf_errmsg(-1)); - return (-1); - } - - if ((fd = open(_PATH_BSHELL, O_RDONLY)) < 0) { - warn("open()"); - return (-1); - } - - if ((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) { - ret = -1; - warnx("elf_begin() failed: %s.", elf_errmsg(-1)); - goto cleanup; - } - - if (gelf_getehdr(elf, &elfhdr) == NULL) { - ret = -1; - warn("getehdr() failed: %s.", elf_errmsg(-1)); - goto cleanup; - } - while ((scn = elf_nextscn(elf, scn)) != NULL) { - if (gelf_getshdr(scn, &shdr) != &shdr) { - ret = -1; - warn("getshdr() failed: %s.", elf_errmsg(-1)); - goto cleanup; - } + struct utsname uts; + char machine_arch[255]; + size_t len; + int error; + + error = uname(&uts); + if (error) + return (errno); + + len = sizeof(machine_arch); + error = sysctlbyname("hw.machine_arch", machine_arch, &len, NULL, 0); + if (error) + return (errno); + machine_arch[len] = '\0'; - if (shdr.sh_type == SHT_NOTE) - break; - } - - if (scn == NULL) { - ret = -1; - warn("failed to get the note section"); - goto cleanup; - } - - data = elf_getdata(scn, NULL); - src = data->d_buf; - for (;;) { - memcpy(¬e, src, sizeof(Elf_Note)); - src += sizeof(Elf_Note); - if (note.n_type == NT_VERSION) - break; - src += note.n_namesz + note.n_descsz; - } - osname = src; - src += roundup2(note.n_namesz, 4); - if (elfhdr.e_ident[EI_DATA] == ELFDATA2MSB) - version = be32dec(src); - else - version = le32dec(src); - - for (i = 0; osname[i] != '\0'; i++) - osname[i] = (char)tolower(osname[i]); - - wordsize_corres_str = elf_corres_to_string(wordsize_corres, - (int)elfhdr.e_ident[EI_CLASS]); - - arch = elf_corres_to_string(mach_corres, (int) elfhdr.e_machine); - - snprintf(dest, sz, "%s:%d", - osname, version / 100000); - - ret = 0; - - switch (elfhdr.e_machine) { - case EM_ARM: - endian_corres_str = elf_corres_to_string(endian_corres, - (int)elfhdr.e_ident[EI_DATA]); - - /* FreeBSD doesn't support the hard-float ABI yet */ - fpu = "softfp"; - if ((elfhdr.e_flags & 0xFF000000) != 0) { - const char *sh_name = NULL; - size_t shstrndx; - - /* This is an EABI file, the conformance level is set */ - abi = "eabi"; - /* Find which TARGET_ARCH we are building for. */ - elf_getshdrstrndx(elf, &shstrndx); - while ((scn = elf_nextscn(elf, scn)) != NULL) { - sh_name = NULL; - if (gelf_getshdr(scn, &shdr) != &shdr) { - scn = NULL; - break; - } - - sh_name = elf_strptr(elf, shstrndx, - shdr.sh_name); - if (sh_name == NULL) - continue; - if (strcmp(".ARM.attributes", sh_name) == 0) - break; - } - if (scn != NULL && sh_name != NULL) { - data = elf_getdata(scn, NULL); - /* - * Prior to FreeBSD 10.0 libelf would return - * NULL from elf_getdata on the .ARM.attributes - * section. As this was the first release to - * get armv6 support assume a NULL value means - * arm. - * - * This assumption can be removed when 9.x - * is unsupported. - */ - if (data != NULL) { - arch = aeabi_parse_arm_attributes( - data->d_buf, data->d_size); - if (arch == NULL) { - ret = 1; - warn("unknown ARM ARCH"); - goto cleanup; - } - } - } else { - ret = 1; - warn("Unable to find the .ARM.attributes " - "section"); - goto cleanup; - } - } else if (elfhdr.e_ident[EI_OSABI] != ELFOSABI_NONE) { - /* - * EABI executables all have this field set to - * ELFOSABI_NONE, therefore it must be an oabi file. - */ - abi = "oabi"; - } else { - ret = 1; - warn("unknown ARM ABI"); - goto cleanup; - } - snprintf(dest + strlen(dest), sz - strlen(dest), - ":%s:%s:%s:%s:%s", arch, wordsize_corres_str, - endian_corres_str, abi, fpu); - break; - case EM_MIPS: - /* - * this is taken from binutils sources: - * include/elf/mips.h - * mapping is figured out from binutils: - * gas/config/tc-mips.c - */ - switch (elfhdr.e_flags & EF_MIPS_ABI) { - case E_MIPS_ABI_O32: - abi = "o32"; - break; - case E_MIPS_ABI_N32: - abi = "n32"; - break; - default: - if (elfhdr.e_ident[EI_DATA] == - ELFCLASS32) - abi = "o32"; - else if (elfhdr.e_ident[EI_DATA] == - ELFCLASS64) - abi = "n64"; - break; - } - endian_corres_str = elf_corres_to_string(endian_corres, - (int)elfhdr.e_ident[EI_DATA]); - - snprintf(dest + strlen(dest), sz - strlen(dest), ":%s:%s:%s:%s", - arch, wordsize_corres_str, endian_corres_str, abi); - break; - default: - snprintf(dest + strlen(dest), sz - strlen(dest), ":%s:%s", - arch, wordsize_corres_str); - } - -cleanup: - if (elf != NULL) - elf_end(elf); + /* + * Use __FreeBSD_version rather than kernel version (uts.release) for + * use in jails. This is equivalent to the value of uname -U. + */ + snprintf(dest, sz, "%s:%d:%s", uts.sysname, __FreeBSD_version/100000, + machine_arch); - close(fd); - return (ret); + return (error); } static void From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 23:31:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5BE8AD45; Mon, 27 Oct 2014 23:31:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 484E1655; Mon, 27 Oct 2014 23:31:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RNV8N2058122; Mon, 27 Oct 2014 23:31:08 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RNV8pJ058121; Mon, 27 Oct 2014 23:31:08 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410272331.s9RNV8pJ058121@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 27 Oct 2014 23:31:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273755 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 23:31:08 -0000 Author: bapt Date: Mon Oct 27 23:31:07 2014 New Revision: 273755 URL: https://svnweb.freebsd.org/changeset/base/273755 Log: Rename XFLAGS to XCFLAGS and XXFLAGS to XCXXFLAGS This is less confusing names and actually more reflexting what they are intended to. Discussed with: brooks Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Oct 27 23:19:51 2014 (r273754) +++ head/Makefile.inc1 Mon Oct 27 23:31:07 2014 (r273755) @@ -323,9 +323,9 @@ X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${ X${BINUTIL}?= ${${BINUTIL}} .endif .endfor -WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS} ${XXFLAGS}" \ +WMAKEENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \ DEPFLAGS="${DEPFLAGS}" \ - CPP="${XCPP} ${XFLAGS}" \ + CPP="${XCPP} ${XCFLAGS}" \ AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \ OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \ RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \ @@ -351,13 +351,13 @@ TARGET_ABI= gnueabi .endif .endif .if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc -XFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib -XXFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 -std=gnu++11 -L${WORLDTMP}/../lib/libc++ +XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib +XCXXFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 -std=gnu++11 -L${WORLDTMP}/../lib/libc++ DEPFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 .else TARGET_ABI?= unknown TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0 -XFLAGS+= -target ${TARGET_TRIPLE} +XCFLAGS+= -target ${TARGET_TRIPLE} .endif .endif From owner-svn-src-head@FreeBSD.ORG Mon Oct 27 23:43:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2728B194; Mon, 27 Oct 2014 23:43:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1348883D; Mon, 27 Oct 2014 23:43:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9RNhPbC064077; Mon, 27 Oct 2014 23:43:25 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9RNhPW8064075; Mon, 27 Oct 2014 23:43:25 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201410272343.s9RNhPW8064075@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Mon, 27 Oct 2014 23:43:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273756 - in head/lib: libusb libz X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 23:43:26 -0000 Author: jmg Date: Mon Oct 27 23:43:25 2014 New Revision: 273756 URL: https://svnweb.freebsd.org/changeset/base/273756 Log: only install .pc files when we are not installing 32bit compat libs... This fixes the problem of installing the .pc files multiple times... Modified: head/lib/libusb/Makefile head/lib/libz/Makefile Modified: head/lib/libusb/Makefile ============================================================================== --- head/lib/libusb/Makefile Mon Oct 27 23:31:07 2014 (r273755) +++ head/lib/libusb/Makefile Mon Oct 27 23:43:25 2014 (r273756) @@ -38,6 +38,7 @@ SRCS+= libusb10_io.c CFLAGS+= -DCOMPAT_32BIT .endif +.ifndef COMPAT_32BIT beforeinstall: ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${.CURDIR}/libusb-0.1.pc ${DESTDIR}${LIBDATADIR}/pkgconfig @@ -45,6 +46,7 @@ beforeinstall: ${.CURDIR}/libusb-1.0.pc ${DESTDIR}${LIBDATADIR}/pkgconfig ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${.CURDIR}/libusb-2.0.pc ${DESTDIR}${LIBDATADIR}/pkgconfig +.endif # # Cross platform support Modified: head/lib/libz/Makefile ============================================================================== --- head/lib/libz/Makefile Mon Oct 27 23:31:07 2014 (r273755) +++ head/lib/libz/Makefile Mon Oct 27 23:43:25 2014 (r273756) @@ -68,9 +68,11 @@ test: example minigzip (export LD_LIBRARY_PATH=. ; \ echo hello world | ./minigzip | ./minigzip -d ) +.ifndef COMPAT_32BIT beforeinstall: ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${.CURDIR}/zlib.pc ${DESTDIR}${LIBDATADIR}/pkgconfig +.endif .include From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 00:04:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6BA0B5B0; Tue, 28 Oct 2014 00:04:28 +0000 (UTC) Received: from mail-wg0-x22b.google.com (mail-wg0-x22b.google.com [IPv6:2a00:1450:400c:c00::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 881C8A2F; Tue, 28 Oct 2014 00:04:27 +0000 (UTC) Received: by mail-wg0-f43.google.com with SMTP id n12so6791913wgh.2 for ; Mon, 27 Oct 2014 17:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=KzXOUHfJB78rv8CXGTSIbY5wRGC86i7McLgrUJcHR8U=; b=kVTrdta2P9OTdr54QDJLQs+A91B0DxXCXVEMdnk0iKxREc2q1XK1tnps3/lchSaTXe ti/IiQ/wUVUXWCbHoKOkJVe1N2y/vRi3AyJWZnzuLND74FKxlpVkYgoxF5m+WbtKxQ1a TYkFcCiH9KsW0lHUePOaWxEcmAPH7eXxX8RLznDX9Uykn/ydhBLpo2DVSf+7xgSC/FO3 y0NSWlqccOERznfRCAlIZ0dA1TcT9+rGLg1spash+Kf+0Rw8BDOYupKRta+B2IYSA/Wt 5FHWYexBxIL66qu8xt7gSxjOE0vvp0ag8lgVor92LTZWUU2oYm5g3/+btDHMcl5ogKtR C2xA== X-Received: by 10.180.107.136 with SMTP id hc8mr21484122wib.78.1414454665898; Mon, 27 Oct 2014 17:04:25 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by mx.google.com with ESMTPSA id hk9sm7422041wjb.46.2014.10.27.17.04.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Oct 2014 17:04:24 -0700 (PDT) Sender: Baptiste Daroussin Date: Tue, 28 Oct 2014 01:04:22 +0100 From: Baptiste Daroussin To: John-Mark Gurney Subject: Re: svn commit: r273756 - in head/lib: libusb libz Message-ID: <20141028000422.GB26796@ivaldir.etoilebsd.net> References: <201410272343.s9RNhPW8064075@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dc+cDN39EJAMEtIO" Content-Disposition: inline In-Reply-To: <201410272343.s9RNhPW8064075@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 00:04:28 -0000 --dc+cDN39EJAMEtIO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 27, 2014 at 11:43:25PM +0000, John-Mark Gurney wrote: > Author: jmg > Date: Mon Oct 27 23:43:25 2014 > New Revision: 273756 > URL: https://svnweb.freebsd.org/changeset/base/273756 >=20 > Log: > only install .pc files when we are not installing 32bit compat libs... > =20 > This fixes the problem of installing the .pc files multiple times... >=20 May be we should start having an infrastructure to work with .pc files beca= use we will add more of them I do have in mind at least libarchive so far regards, Bapt --dc+cDN39EJAMEtIO Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlRO3YYACgkQ8kTtMUmk6EwUyACgwxrFxuECPSqlBi97gdoIs3dt k68AnisItbh7QjIoEi0dTogetfOQPJ2G =xuFy -----END PGP SIGNATURE----- --dc+cDN39EJAMEtIO-- From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 00:26:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A1E3AE3; Tue, 28 Oct 2014 00:26:43 +0000 (UTC) Received: from mail-ie0-x231.google.com (mail-ie0-x231.google.com [IPv6:2607:f8b0:4001:c03::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E1F6FC89; Tue, 28 Oct 2014 00:26:42 +0000 (UTC) Received: by mail-ie0-f177.google.com with SMTP id tp5so5300035ieb.8 for ; Mon, 27 Oct 2014 17:26:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=JObc/IDouqsRo29kJdHtsHa6nEqIRtM7XDWZxjjTwVM=; b=XGNin6DbAKoz5/6juJeKubbcxbqxpc5YsWBJY6UvrPZ9vJaqOBaV62zCkdjQIHOabC 43mvKBH5mvJXIMpj2B9IO9Vk4dUETzO5jdnLTVIvslReXGKtFnKci4VP7YJAvBj0QuTc MmvsDnYdh1QROgJKuLJ3hOBn8FIz7BlTsmboyfJx6Jumv55QfC0pMQeiNZLIXQ5dbWVK 1mYJ8fzS3P2TKgzWl/MwDeD6ZkHGihaQf2DlIuNeqtWIqdy/80DSG3eorbnRslNqN2a/ F8ECXEgou8ygvNXjvn6kvx29RW6peur2zQVwGkLbXAsQRWcDWQAUdpn3X8Ot9/j3MfmL R4Sw== MIME-Version: 1.0 X-Received: by 10.50.23.80 with SMTP id k16mr824427igf.26.1414456002400; Mon, 27 Oct 2014 17:26:42 -0700 (PDT) Received: by 10.50.193.135 with HTTP; Mon, 27 Oct 2014 17:26:42 -0700 (PDT) In-Reply-To: <201410272331.s9RNV8pJ058121@svn.freebsd.org> References: <201410272331.s9RNV8pJ058121@svn.freebsd.org> Date: Mon, 27 Oct 2014 17:26:42 -0700 Message-ID: Subject: Re: svn commit: r273755 - head From: NGie Cooper To: Baptiste Daroussin Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 00:26:43 -0000 On Mon, Oct 27, 2014 at 4:31 PM, Baptiste Daroussin wrote: > Author: bapt > Date: Mon Oct 27 23:31:07 2014 > New Revision: 273755 > URL: https://svnweb.freebsd.org/changeset/base/273755 > > Log: > Rename XFLAGS to XCFLAGS and XXFLAGS to XCXXFLAGS > > This is less confusing names and actually more reflexting what they are intended > to. > > Discussed with: brooks Add an UPDATING entry? From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 01:34:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A8BD7C0C; Tue, 28 Oct 2014 01:34:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94C6264C; Tue, 28 Oct 2014 01:34:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9S1Y2CA017679; Tue, 28 Oct 2014 01:34:02 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9S1Y20d017678; Tue, 28 Oct 2014 01:34:02 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201410280134.s9S1Y20d017678@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 28 Oct 2014 01:34:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273759 - head/sys/powerpc/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 01:34:02 -0000 Author: jhibbits Date: Tue Oct 28 01:34:01 2014 New Revision: 273759 URL: https://svnweb.freebsd.org/changeset/base/273759 Log: Add CAPABILITIES and CAPABILITY_MODE to powerpc GENERIC64, missed with the addition to GENERIC MFC after: 3 weeks Modified: head/sys/powerpc/conf/GENERIC64 Modified: head/sys/powerpc/conf/GENERIC64 ============================================================================== --- head/sys/powerpc/conf/GENERIC64 Tue Oct 28 00:44:20 2014 (r273758) +++ head/sys/powerpc/conf/GENERIC64 Tue Oct 28 01:34:01 2014 (r273759) @@ -70,6 +70,8 @@ options SYSVSEM #SYSV-style semaphore options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) options AUDIT # Security event auditing +options CAPABILITY_MODE # Capsicum capability mode +options CAPABILITIES # Capsicum capabilities options MAC # TrustedBSD MAC Framework options KDTRACE_HOOKS # Kernel DTrace hooks options DDB_CTF # Kernel ELF linker loads CTF data From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 02:05:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 89FC133F; Tue, 28 Oct 2014 02:05:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 76508949; Tue, 28 Oct 2014 02:05:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9S25wrG032325; Tue, 28 Oct 2014 02:05:58 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9S25wwe032324; Tue, 28 Oct 2014 02:05:58 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201410280205.s9S25wwe032324@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Tue, 28 Oct 2014 02:05:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273760 - head/lib/libc/stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 02:05:58 -0000 Author: kevlo Date: Tue Oct 28 02:05:57 2014 New Revision: 273760 URL: https://svnweb.freebsd.org/changeset/base/273760 Log: Fix prototypes. Modified: head/lib/libc/stdio/open_memstream.3 Modified: head/lib/libc/stdio/open_memstream.3 ============================================================================== --- head/lib/libc/stdio/open_memstream.3 Tue Oct 28 01:34:01 2014 (r273759) +++ head/lib/libc/stdio/open_memstream.3 Tue Oct 28 02:05:57 2014 (r273760) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 27, 2013 +.Dd October 28, 2014 .Dt OPEN_MEMSTREAM 3 .Os .Sh NAME @@ -37,10 +37,10 @@ .Sh SYNOPSIS .In stdio.h .Ft FILE * -.Fn open_memstream "char **bufp" "size_t **sizep" +.Fn open_memstream "char **bufp" "size_t *sizep" .In wchar.h .Ft FILE * -.Fn open_wmemstream "wchar_t **bufp" "size_t **sizep" +.Fn open_wmemstream "wchar_t **bufp" "size_t *sizep" .Sh DESCRIPTION The .Fn open_memstream From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 03:04:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BFB3DFA1 for ; Tue, 28 Oct 2014 03:04:46 +0000 (UTC) Received: from mail-yh0-f48.google.com (mail-yh0-f48.google.com [209.85.213.48]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 782BFF16 for ; Tue, 28 Oct 2014 03:04:46 +0000 (UTC) Received: by mail-yh0-f48.google.com with SMTP id v1so5246918yhn.21 for ; Mon, 27 Oct 2014 20:04:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:message-id:references:to; bh=dOUmjB9f1DlvSnHMy/wJx8ZDyWnBg0+wkOS4Cxv1RK4=; b=I3w4ECsyQFQlSBVb0KiyX1Hx66qaNf/d6WUnn4/7zzTFCX+TJwwxr4CGMzyKqKjmdb G1fMg2KLjuJzWDZE0o4wklB2AvLMnr6wGQAm6j4iAnJZw6oI1zlTrhDLcKMzDxunPErh dPHCsNTKfAhQTYH+kgqS0rqIvWhFS7C6QQ4a1bojz3QSFJWczwR71quK1vO9lWUvepJW zTsORrsfNCjxKW5gq/uovR0kGfsh3NtJ2jsFAE9gG4Dc4fakSYr38U3uN+wd6bmQZ3pF 7UnXlsD/5dNgAr6kft1tdh3TbCIi4HZhfwyuuwuXGiZUT8bxKa09vDGpKeNQqDeZonoi +QgA== X-Gm-Message-State: ALoCoQkmHhXbL9mApP0yaQAZsTdv4bW0AfrTDkarX8fximh+Xf2wM31YRonhwrjwi+WUjZkeEJ9I X-Received: by 10.236.216.82 with SMTP id f78mr106060yhp.33.1414461528574; Mon, 27 Oct 2014 18:58:48 -0700 (PDT) Received: from [192.168.0.14] (173-18-133-79.client.mchsi.com. [173.18.133.79]) by mx.google.com with ESMTPSA id v42sm56218yhn.31.2014.10.27.18.58.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Oct 2014 18:58:47 -0700 (PDT) Sender: Warner Losh Content-Type: multipart/signed; boundary="Apple-Mail=_E2B88923-0130-4DF4-A045-532A780EADC9"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273214 - in head/sys: amd64/vmm/intel modules/vmm From: Warner Losh In-Reply-To: <5487187.5oKgfZ1XGT@ralph.baldwin.cx> Date: Mon, 27 Oct 2014 20:58:36 -0500 Message-Id: <19D1B515-74B3-43A0-A017-B170FFAEBA6F@bsdimp.com> References: <201410171320.s9HDKo53045297@svn.freebsd.org> <1725598.2CCKLon8F3@ralph.baldwin.cx> <2B7C3745-04E4-4FA9-A849-AECE54EA83A3@bsdimp.com> <5487187.5oKgfZ1XGT@ralph.baldwin.cx> To: John Baldwin X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers , Warner Losh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 03:04:46 -0000 --Apple-Mail=_E2B88923-0130-4DF4-A045-532A780EADC9 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Oct 27, 2014, at 1:18 PM, John Baldwin wrote: > On Monday, October 27, 2014 11:36:41 AM Warner Losh wrote: >> On Oct 27, 2014, at 10:54 AM, John Baldwin wrote: >>> On Friday, October 17, 2014 01:20:50 PM Warner Losh wrote: >>>> Author: imp >>>> Date: Fri Oct 17 13:20:49 2014 >>>> New Revision: 273214 >>>> URL: https://svnweb.freebsd.org/changeset/base/273214 >>>>=20 >>>> Log: >>>> Fix build to not bogusly always rebuild vmm.ko. >>>>=20 >>>> Rename vmx_assym.s to vmx_assym.h to reflect that file's actual use >>>> and update vmx_support.S's include to match. Add vmx_assym.h to the >>>> SRCS to that it gets properly added to the dependency list. Add >>>> vmx_support.S to SRCS as well, so it gets built and needs fewer >>>> special-case goo. Remove now-redundant special-case goo. Finally, >>>> vmx_genassym.o doesn't need to depend on a hand expanded ${_ILINKS} >>>> explicitly, that's all taken care of by beforedepend. >>>>=20 >>>> With these items fixed, we no longer build vmm.ko every single time >>>> through the modules on a KERNFAST build. >>>=20 >>> So I cheered for this before, but it appears to be broken. :( >>>=20 >>> Namely, I rebuilt world + kernel on my laptop this weekend (it was = about a >>> month old). My normal setup builds kernels with NO_KERNELCLEAN=3Dyes.= On my >>> next reboot when I started a bhyve VM I promptly got a panic due to = a page >>>=20 >>> fault in this assembly code: >>> /* >>> =09 >>> * If 'vmx->eptgen[curcpu]' is not identical to = 'pmap->pm_eptgen' >>> * then we must invalidate all mappings associated with this = EPTP. >>> */ >>> =09 >>> movq PM_EPTGEN(%r11), %r10 >>> cmpq %r10, VMX_EPTGEN(%rsi, %rax, 8) >>> je guest_restore >>>=20 >>> (The 'cmpq' instruction) >>>=20 >>> This change came to mind, so I blew away the 'vmm' module directory = and >>> rebuilt my kernel. Comparing the assembly of this instruction = before and >>> after used different values for VMX_EPTGEN. In other words, the >>> NO_KERNELCLEAN=3Dyes build failed to regenerate vmx_assym.h and the = build >>> used stale values. >>=20 >> Is there a way to force this condition for testing? >=20 > You could checkout an older tree (probably before the recent merge of = AMD SVM > support) and build vmm.ko, then svn update and see if vmx_assym and > vmx_support.o are updated. >=20 > Actually, this was simpler: >=20 > % cd sys/modules/vmm > % make depend > % make vmx_assym.h # reports nothing to do > % touch machine/vmm.h # vmx_genassym.c includes this > % make vmx_assym.h # should rebuild, but doesn=92t Thanks! >>> In particular, if you examine the generated .depend file, you will = find >>> that there are no dependencies recorded for vmx_genassym.o, so it is >>> never rebuilt if any of the headers it includes are changed. In my = case >>> the panic happened to be one that was easily diagnosed, but I could >>> imagine stale assym headers causing very odd crashes that would be = quite >>> hard to track down. I think these changes should be reverted if we = can't >>> fix the dependencies of the associated object files they are = generated >>> from. :( >>=20 >> Give me a bit and I=92ll fix it. There=92s a number of implicit = dependencies >> that don=92t get recorded in the .depend file, iirc, so that=92s not = completely >> conclusive. Not building, though is kinda a big hint that something=92s= >> amiss. >=20 > I think the thing here is that for the assym files we don't record any > dependency info at all. The main kernel build does record = dependencies > for genassym.o in .depend, so it must be doable. True. > In kern.pre.mk: >=20 > GEN_CFILES=3D $S/$M/$M/genassym.c ${MFILES:T:S/.m$/.c/} >=20 > and those are then explicitly passed to mkdep in kern.post.mk. >=20 > So this fixes it: >=20 > Index: Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- Makefile (revision 273555) > +++ Makefile (working copy) > @@ -4,6 +4,7 @@ KMOD=3D vmm >=20 > SRCS=3D opt_acpi.h opt_ddb.h device_if.h bus_if.h pci_if.h > SRCS+=3D vmx_assym.h svm_assym.h > +DPSRCS=3D vmx_genassym.c svm_genassym.c That=92s the magic I was looking for... > CFLAGS+=3D -DVMM_KEEP_STATS -DSMP > CFLAGS+=3D -I${.CURDIR}/../../amd64/vmm >=20 > I'll try to track down all the other assym files and fix them as well. Cool. There=92s three more (but I had only fixed two of them, since I = didn=92t have a i386 build handy). >> However, -DNO_CLEAN has always been a very-sharp edged tool that will = cut >> you in a number of ways, so there=92s no rush to back this out. >=20 > This is the first time in many years that NO_KERNELCLEAN=3Dyes has = been a > problem for me. (worlds sometimes have issues, but kernels rarely = do). > Also, usually when it breaks it fails to compile, it doesn't compile = and > then panic. :( But it is current=85 :) Warner --Apple-Mail=_E2B88923-0130-4DF4-A045-532A780EADC9 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJUTvhMAAoJEGwc0Sh9sBEAjAcP/3pgovT4SIGF175htGXM6qRp ntMa5kE6M9ccJVZLBqCsMLZPYYP1cY10J6jLTxdVup+hfvT3VbD8UMeqmkCoK8Qf iWD+IjzNEs8VQY2HBHD1mlPVHxgh8mcKPVu56WPRRsdfmfrk5SeKpBxQZCNfdAME HpxYZXQfUoTD4evHqCCz5yL0UZpoCeLMhsN+Tf5iY+Ldm69Pq3259JNVbS32cBuw zHSstSoRi/5QpbU6amzluUKXJrgr6ao63caR4zFITkU3YjGPzyHoBR77L2XxkT/q WRSvh4VdkrqGeKmAO0zPMUcM4jRVEfuE6ayeJpAoGaEZ/7W9JR7sjgs9una4NEB9 77dRKL1KOrbam+tA4g7O37N34ubpOvTiMhZCbhiA0WE0cwGyUGvKXxKWuFXB7fkZ usscxI7QXq9kI7bTyqk4MHsp1ZUcaP8vdohfRp1Ex6v2L6Zn6f7Kg/BOEi1ydWoQ 3mAHi5jKNNj+wXAwhQgu3ps9BDtNL5RlPIG++JZ3FB9WS//Tg64r8mSX7Rbfk/z3 9pLvwQ9evRv3xTWp0verqaxyBiWXkKu82TVd0MCBrwxp1x7uZHPDgaJnqF2xsTRj UOHb3bsu5N1MQ/ZaarnL0iPsUoOV4CD+Y59SlQ+ZR5J3TAsfj68YsAtl7f5WyWgg GptlW9WOkAmUN3CRYIjX =gG2/ -----END PGP SIGNATURE----- --Apple-Mail=_E2B88923-0130-4DF4-A045-532A780EADC9-- From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 03:42:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 37733437; Tue, 28 Oct 2014 03:42:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0897933C; Tue, 28 Oct 2014 03:42:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9S3g9Ix079230; Tue, 28 Oct 2014 03:42:09 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9S3g9oJ079229; Tue, 28 Oct 2014 03:42:09 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201410280342.s9S3g9oJ079229@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Tue, 28 Oct 2014 03:42:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273761 - head/sys/dev/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 03:42:10 -0000 Author: araujo (ports committer) Date: Tue Oct 28 03:42:09 2014 New Revision: 273761 URL: https://svnweb.freebsd.org/changeset/base/273761 Log: Drop __DECONST as well as few fixes of style(9). Phabric: D1012 Suggested by: mjg, jhb Reviewed by: mjg, jhb Sponsored by: QNAP Systems Inc. Modified: head/sys/dev/uart/uart_subr.c Modified: head/sys/dev/uart/uart_subr.c ============================================================================== --- head/sys/dev/uart/uart_subr.c Tue Oct 28 02:05:57 2014 (r273760) +++ head/sys/dev/uart/uart_subr.c Tue Oct 28 03:42:09 2014 (r273761) @@ -196,7 +196,8 @@ out: int uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class) { - const char *cp, *spec; + const char *spec; + char *cp; bus_addr_t addr = ~0U; int error; @@ -213,12 +214,18 @@ uart_getenv(int devtype, struct uart_dev * which UART port is to be used as serial console or debug * port (resp). */ - if (devtype == UART_DEV_CONSOLE) + switch (devtype) { + case UART_DEV_CONSOLE: cp = kern_getenv("hw.uart.console"); - else if (devtype == UART_DEV_DBGPORT) + break; + case UART_DEV_DBGPORT: cp = kern_getenv("hw.uart.dbgport"); - else + break; + default: cp = NULL; + break; + } + if (cp == NULL) return (ENXIO); @@ -233,7 +240,7 @@ uart_getenv(int devtype, struct uart_dev /* Parse the attributes. */ spec = cp; - while (1) { + for (;;) { switch (uart_parse_tag(&spec)) { case UART_TAG_BR: di->baudrate = uart_parse_long(&spec); @@ -268,18 +275,18 @@ uart_getenv(int devtype, struct uart_dev di->bas.rclk = uart_parse_long(&spec); break; default: - freeenv(__DECONST(char *, cp)); + freeenv(cp); return (EINVAL); } if (*spec == '\0') break; if (*spec != ',') { - freeenv(__DECONST(char *, cp)); + freeenv(cp); return (EINVAL); } spec++; } - freeenv(__DECONST(char *, cp)); + freeenv(cp); /* * If we still have an invalid address, the specification must be From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 03:43:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4DE86587; Tue, 28 Oct 2014 03:43:39 +0000 (UTC) Received: from mail-wg0-x22d.google.com (mail-wg0-x22d.google.com [IPv6:2a00:1450:400c:c00::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A82134A; Tue, 28 Oct 2014 03:43:38 +0000 (UTC) Received: by mail-wg0-f45.google.com with SMTP id x12so2723960wgg.4 for ; Mon, 27 Oct 2014 20:43:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=2NEOMGr/BIQugsNY4lTK2JJog77epGlEZ7dzD/6yqOo=; b=QidRXjC8fIayPXdRFA7EzHkBP/2D/vNMkVkcbOI9fMlp55L2x0kphFXS+3gv+8s46p 8uJ80veWmHgmfE6I8Ky7irglKkWxbEPdowyToJBd0i968oOdTyIAWc8DCb+iU3/T6d1J lGWY5pXg7H0qZiPX0514jdDlg14RLvtTzDphTYDEAlAX/pqT/My4RzfL2grOGeAotBKG jYh6xB+eaGf5mY78jnnFuF1bo9Y4F6q0irBonOKE/z8DXPXwU+r8Ku/+mXiCCAkB434Y jI3kNEafVbcwiEdhBuydapgLwmc1coDnynz3Ppfc+H4UxEvPdIVE1fGcfdCyVGnBHWnt nnGw== MIME-Version: 1.0 X-Received: by 10.194.157.137 with SMTP id wm9mr663475wjb.5.1414467816544; Mon, 27 Oct 2014 20:43:36 -0700 (PDT) Received: by 10.216.159.193 with HTTP; Mon, 27 Oct 2014 20:43:36 -0700 (PDT) Reply-To: araujo@FreeBSD.org In-Reply-To: <235737869.CpTJALnJpW@ralph.baldwin.cx> References: <201410240539.s9O5dWWK002150@svn.freebsd.org> <235737869.CpTJALnJpW@ralph.baldwin.cx> Date: Tue, 28 Oct 2014 11:43:36 +0800 Message-ID: Subject: Re: svn commit: r273576 - head/sys/dev/uart From: Marcelo Araujo To: John Baldwin Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 03:43:39 -0000 Done: https://svnweb.freebsd.org/base?view=revision&revision=273761 Thank you guys!!!! 2014-10-25 0:14 GMT+08:00 John Baldwin : > On Friday, October 24, 2014 05:39:32 AM Marcelo Araujo wrote: > > Author: araujo (ports committer) > > Date: Fri Oct 24 05:39:32 2014 > > New Revision: 273576 > > URL: https://svnweb.freebsd.org/changeset/base/273576 > > > > Log: > > Fix a leaked Storage Variable. > > > > Phabric: D981 > > Submitted by: myself > > Reported by: Coverity > > CID: 1248848 > > Reworked by: kevlo > > Reviewed by: marcel, davide, ray, kevlo > > Approved by: marcel, kevlo > > > > Modified: > > head/sys/dev/uart/uart_subr.c > > > > Modified: head/sys/dev/uart/uart_subr.c > > > ============================================================================== > > --- head/sys/dev/uart/uart_subr.c Fri Oct 24 04:01:14 2014 > (r273575) > > +++ head/sys/dev/uart/uart_subr.c Fri Oct 24 05:39:32 2014 > (r273576) > > @@ -196,7 +196,7 @@ out: > > int > > uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class > *class) > > { > > - const char *spec; > > + const char *cp, *spec; > > Dropping const here is preferable to using __DECONST() for the freeenv() > calls. > > -- > John Baldwin > -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_) From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 04:18:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EC13FD13; Tue, 28 Oct 2014 04:18:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D82FE92E; Tue, 28 Oct 2014 04:18:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9S4I9Yq094391; Tue, 28 Oct 2014 04:18:09 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9S4I9qh094390; Tue, 28 Oct 2014 04:18:09 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201410280418.s9S4I9qh094390@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Tue, 28 Oct 2014 04:18:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273762 - head/sys/modules/dtrace/dtraceall X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 04:18:10 -0000 Author: julian Date: Tue Oct 28 04:18:09 2014 New Revision: 273762 URL: https://svnweb.freebsd.org/changeset/base/273762 Log: Allow loading of dtraceall without nfscl if what you really wnat is nfsclient Obtained from: Panzura tree MFC after: 1 week Modified: head/sys/modules/dtrace/dtraceall/dtraceall.c Modified: head/sys/modules/dtrace/dtraceall/dtraceall.c ============================================================================== --- head/sys/modules/dtrace/dtraceall/dtraceall.c Tue Oct 28 03:42:09 2014 (r273761) +++ head/sys/modules/dtrace/dtraceall/dtraceall.c Tue Oct 28 04:18:09 2014 (r273762) @@ -67,7 +67,9 @@ MODULE_DEPEND(dtraceall, cyclic, 1, 1, 1 MODULE_DEPEND(dtraceall, opensolaris, 1, 1, 1); MODULE_DEPEND(dtraceall, dtrace, 1, 1, 1); MODULE_DEPEND(dtraceall, dtmalloc, 1, 1, 1); +#if defined(NFSCLIENT) MODULE_DEPEND(dtraceall, dtnfscl, 1, 1, 1); +#endif #if defined(NFSCLIENT) MODULE_DEPEND(dtraceall, dtnfsclient, 1, 1, 1); #endif From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 04:33:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7874CF94; Tue, 28 Oct 2014 04:33:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 64861AE1; Tue, 28 Oct 2014 04:33:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9S4XwZK003260; Tue, 28 Oct 2014 04:33:58 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9S4XwnT003259; Tue, 28 Oct 2014 04:33:58 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410280433.s9S4XwnT003259@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 28 Oct 2014 04:33:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273763 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 04:33:58 -0000 Author: mjg Date: Tue Oct 28 04:33:57 2014 New Revision: 273763 URL: https://svnweb.freebsd.org/changeset/base/273763 Log: Change loginclass mutex to an rwlock. While here reduce nesting in loginclass_free. Submitted by: Tiwei Bie X-Additional: JuniorJobs project MFC after: 2 weeks Modified: head/sys/kern/kern_loginclass.c Modified: head/sys/kern/kern_loginclass.c ============================================================================== --- head/sys/kern/kern_loginclass.c Tue Oct 28 04:18:09 2014 (r273762) +++ head/sys/kern/kern_loginclass.c Tue Oct 28 04:33:57 2014 (r273763) @@ -51,13 +51,13 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include #include #include #include +#include #include #include @@ -68,8 +68,8 @@ LIST_HEAD(, loginclass) loginclasses; /* * Lock protecting loginclasses list. */ -static struct mtx loginclasses_lock; -MTX_SYSINIT(loginclasses_init, &loginclasses_lock, "loginclasses lock", MTX_DEF); +static struct rwlock loginclasses_lock; +RW_SYSINIT(loginclasses_init, &loginclasses_lock, "loginclasses lock"); void loginclass_hold(struct loginclass *lc) @@ -87,16 +87,37 @@ loginclass_free(struct loginclass *lc) if (old > 1 && atomic_cmpset_int(&lc->lc_refcount, old, old - 1)) return; - mtx_lock(&loginclasses_lock); - if (refcount_release(&lc->lc_refcount)) { - racct_destroy(&lc->lc_racct); - LIST_REMOVE(lc, lc_next); - mtx_unlock(&loginclasses_lock); - free(lc, M_LOGINCLASS); - + rw_wlock(&loginclasses_lock); + if (!refcount_release(&lc->lc_refcount)) { + rw_wunlock(&loginclasses_lock); return; } - mtx_unlock(&loginclasses_lock); + + racct_destroy(&lc->lc_racct); + LIST_REMOVE(lc, lc_next); + rw_wunlock(&loginclasses_lock); + + free(lc, M_LOGINCLASS); +} + +/* + * Look up a loginclass struct for the parameter name. + * loginclasses_lock must be locked. + * Increase refcount on loginclass struct returned. + */ +static struct loginclass * +loginclass_lookup(const char *name) +{ + struct loginclass *lc; + + rw_assert(&loginclasses_lock, RA_LOCKED); + LIST_FOREACH(lc, &loginclasses, lc_next) + if (strcmp(name, lc->lc_name) == 0) { + loginclass_hold(lc); + break; + } + + return (lc); } /* @@ -109,34 +130,39 @@ loginclass_free(struct loginclass *lc) struct loginclass * loginclass_find(const char *name) { - struct loginclass *lc, *newlc; + struct loginclass *lc, *new_lc; if (name[0] == '\0' || strlen(name) >= MAXLOGNAME) return (NULL); - newlc = malloc(sizeof(*newlc), M_LOGINCLASS, M_ZERO | M_WAITOK); - racct_create(&newlc->lc_racct); - - mtx_lock(&loginclasses_lock); - LIST_FOREACH(lc, &loginclasses, lc_next) { - if (strcmp(name, lc->lc_name) != 0) - continue; - - /* Found loginclass with a matching name? */ - loginclass_hold(lc); - mtx_unlock(&loginclasses_lock); - racct_destroy(&newlc->lc_racct); - free(newlc, M_LOGINCLASS); + rw_rlock(&loginclasses_lock); + lc = loginclass_lookup(name); + rw_runlock(&loginclasses_lock); + if (lc != NULL) return (lc); - } - /* Add new loginclass. */ - strcpy(newlc->lc_name, name); - refcount_init(&newlc->lc_refcount, 1); - LIST_INSERT_HEAD(&loginclasses, newlc, lc_next); - mtx_unlock(&loginclasses_lock); + new_lc = malloc(sizeof(*new_lc), M_LOGINCLASS, M_ZERO | M_WAITOK); + racct_create(&new_lc->lc_racct); + refcount_init(&new_lc->lc_refcount, 1); + strcpy(new_lc->lc_name, name); + + rw_wlock(&loginclasses_lock); + /* + * There's a chance someone created our loginclass while we + * were in malloc and not holding the lock, so we have to + * make sure we don't insert a duplicate loginclass. + */ + if ((lc = loginclass_lookup(name)) == NULL) { + LIST_INSERT_HEAD(&loginclasses, new_lc, lc_next); + rw_wunlock(&loginclasses_lock); + lc = new_lc; + } else { + rw_wunlock(&loginclasses_lock); + racct_destroy(&new_lc->lc_racct); + free(new_lc, M_LOGINCLASS); + } - return (newlc); + return (lc); } /* @@ -222,8 +248,8 @@ loginclass_racct_foreach(void (*callback { struct loginclass *lc; - mtx_lock(&loginclasses_lock); + rw_rlock(&loginclasses_lock); LIST_FOREACH(lc, &loginclasses, lc_next) (callback)(lc->lc_racct, arg2, arg3); - mtx_unlock(&loginclasses_lock); + rw_runlock(&loginclasses_lock); } From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 04:59:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B304A465; Tue, 28 Oct 2014 04:59:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F6E7CF8; Tue, 28 Oct 2014 04:59:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9S4xYft013112; Tue, 28 Oct 2014 04:59:34 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9S4xYfA013111; Tue, 28 Oct 2014 04:59:34 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410280459.s9S4xYfA013111@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 28 Oct 2014 04:59:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273764 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 04:59:34 -0000 Author: mjg Date: Tue Oct 28 04:59:33 2014 New Revision: 273764 URL: https://svnweb.freebsd.org/changeset/base/273764 Log: Simplify sys_getloginclass. Just use current thread credentials as they have the same accuracy as the ones obtained from proc.. Modified: head/sys/kern/kern_loginclass.c Modified: head/sys/kern/kern_loginclass.c ============================================================================== --- head/sys/kern/kern_loginclass.c Tue Oct 28 04:33:57 2014 (r273763) +++ head/sys/kern/kern_loginclass.c Tue Oct 28 04:59:33 2014 (r273764) @@ -178,24 +178,14 @@ struct getloginclass_args { int sys_getloginclass(struct thread *td, struct getloginclass_args *uap) { - int error = 0; - size_t lcnamelen; - struct proc *p; struct loginclass *lc; + size_t lcnamelen; - p = td->td_proc; - PROC_LOCK(p); - lc = p->p_ucred->cr_loginclass; - loginclass_hold(lc); - PROC_UNLOCK(p); - + lc = td->td_ucred->cr_loginclass; lcnamelen = strlen(lc->lc_name) + 1; if (lcnamelen > uap->namelen) - error = ERANGE; - if (error == 0) - error = copyout(lc->lc_name, uap->namebuf, lcnamelen); - loginclass_free(lc); - return (error); + return (ERANGE); + return (copyout(lc->lc_name, uap->namebuf, lcnamelen)); } /* From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 06:44:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3F5A5808; Tue, 28 Oct 2014 06:44:07 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "funkthat.com", Issuer "funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E687FA8E; Tue, 28 Oct 2014 06:44:06 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id s9S6i4tr080927 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 27 Oct 2014 23:44:05 -0700 (PDT) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id s9S6i4nI080926; Mon, 27 Oct 2014 23:44:04 -0700 (PDT) (envelope-from jmg) Date: Mon, 27 Oct 2014 23:44:04 -0700 From: John-Mark Gurney To: Julian Elischer Subject: Re: svn commit: r273762 - head/sys/modules/dtrace/dtraceall Message-ID: <20141028064404.GV82214@funkthat.com> References: <201410280418.s9S4I9qh094390@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410280418.s9S4I9qh094390@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Mon, 27 Oct 2014 23:44:05 -0700 (PDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 06:44:07 -0000 Julian Elischer wrote this message on Tue, Oct 28, 2014 at 04:18 +0000: > Author: julian > Date: Tue Oct 28 04:18:09 2014 > New Revision: 273762 > URL: https://svnweb.freebsd.org/changeset/base/273762 > > Log: > Allow loading of dtraceall without nfscl if what you really wnat is nfsclient > > Obtained from: Panzura tree > MFC after: 1 week > > Modified: > head/sys/modules/dtrace/dtraceall/dtraceall.c > > Modified: head/sys/modules/dtrace/dtraceall/dtraceall.c > ============================================================================== > --- head/sys/modules/dtrace/dtraceall/dtraceall.c Tue Oct 28 03:42:09 2014 (r273761) > +++ head/sys/modules/dtrace/dtraceall/dtraceall.c Tue Oct 28 04:18:09 2014 (r273762) > @@ -67,7 +67,9 @@ MODULE_DEPEND(dtraceall, cyclic, 1, 1, 1 > MODULE_DEPEND(dtraceall, opensolaris, 1, 1, 1); > MODULE_DEPEND(dtraceall, dtrace, 1, 1, 1); > MODULE_DEPEND(dtraceall, dtmalloc, 1, 1, 1); > +#if defined(NFSCLIENT) > MODULE_DEPEND(dtraceall, dtnfscl, 1, 1, 1); > +#endif > #if defined(NFSCLIENT) > MODULE_DEPEND(dtraceall, dtnfsclient, 1, 1, 1); > #endif Why not put the MODULE_DEPEND in the same #if defined block that follows? -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 06:50:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9A1EBA7D; Tue, 28 Oct 2014 06:50:50 +0000 (UTC) Received: from mail-wi0-x231.google.com (mail-wi0-x231.google.com [IPv6:2a00:1450:400c:c05::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C4F79AE1; Tue, 28 Oct 2014 06:50:49 +0000 (UTC) Received: by mail-wi0-f177.google.com with SMTP id ex7so573713wid.4 for ; Mon, 27 Oct 2014 23:50:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=SjiUxhhKi9FaB+r89mDq4A1viMzER6EUdcS+Cj8Fgtk=; b=PMW6UPIkm2YEKzFtqNCJaVjmsqDoF8OfWIidz4nZH5P9kAsfBvU/bExQAdBvr3rMSd yMC39/YCqW+Bs4Ym1fti4FBjhbC6zJUu2tYACy+h4wxvJjP+NsyCu6ulqvLeX49PUTi/ W9pxVM09PYPaEvfWRxCYj0qhs+n9JN9hDGYJ07ijSbr58aul2/rS30nth0OIGlt2j/1f GwGdVSfKrt3RnPhyrTXEXdPxfPN7T3Tt/CT9DKF/D+LSqc03GcKkXIa80Cg0+mY4pY3k 5qtKLyZwpXzHihHTykD/pMqqMsLmXR98JsZAdIM9aNrSBI6blWsKQS/gT/LrLXUdIDkQ 2OfA== X-Received: by 10.180.149.169 with SMTP id ub9mr2215237wib.73.1414479048073; Mon, 27 Oct 2014 23:50:48 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by mx.google.com with ESMTPSA id bc5sm695821wjb.14.2014.10.27.23.50.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Oct 2014 23:50:46 -0700 (PDT) Sender: Baptiste Daroussin Date: Tue, 28 Oct 2014 07:50:44 +0100 From: Baptiste Daroussin To: NGie Cooper Subject: Re: svn commit: r273755 - head Message-ID: <20141028065043.GC26796@ivaldir.etoilebsd.net> References: <201410272331.s9RNV8pJ058121@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1ccMZA6j1vT5UqiK" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 06:50:50 -0000 --1ccMZA6j1vT5UqiK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 27, 2014 at 05:26:42PM -0700, NGie Cooper wrote: > On Mon, Oct 27, 2014 at 4:31 PM, Baptiste Daroussin wr= ote: > > Author: bapt > > Date: Mon Oct 27 23:31:07 2014 > > New Revision: 273755 > > URL: https://svnweb.freebsd.org/changeset/base/273755 > > > > Log: > > Rename XFLAGS to XCFLAGS and XXFLAGS to XCXXFLAGS > > > > This is less confusing names and actually more reflexting what they a= re intended > > to. > > > > Discussed with: brooks >=20 > Add an UPDATING entry? Well XCFLAGS and XCXXFLAGS are inernal only and concerning a feature (exter= nal toolchain) which is still WIP so it is worth adding an UPDATING entry? regards, Bapt --1ccMZA6j1vT5UqiK Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlRPPMMACgkQ8kTtMUmk6Ez7lQCfcw+SDWVVJJ+Oz5h2/xsYIx1M zi0An3Jsk6vlfMhrNEt6Lrh2wJoOVBxr =kmIJ -----END PGP SIGNATURE----- --1ccMZA6j1vT5UqiK-- From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 07:19:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C52372DE; Tue, 28 Oct 2014 07:19:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6FB5DB8; Tue, 28 Oct 2014 07:19:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9S7J3VJ078740; Tue, 28 Oct 2014 07:19:03 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9S7J3DP078739; Tue, 28 Oct 2014 07:19:03 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201410280719.s9S7J3DP078739@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Tue, 28 Oct 2014 07:19:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273766 - head/sys/amd64/vmm/amd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 07:19:03 -0000 Author: araujo (ports committer) Date: Tue Oct 28 07:19:02 2014 New Revision: 273766 URL: https://svnweb.freebsd.org/changeset/base/273766 Log: Reported by: Coverity CID: 1249760 Reviewed by: neel Approved by: neel Sponsored by: QNAP Systems Inc. Modified: head/sys/amd64/vmm/amd/vmcb.c Modified: head/sys/amd64/vmm/amd/vmcb.c ============================================================================== --- head/sys/amd64/vmm/amd/vmcb.c Tue Oct 28 06:17:25 2014 (r273765) +++ head/sys/amd64/vmm/amd/vmcb.c Tue Oct 28 07:19:02 2014 (r273766) @@ -389,6 +389,7 @@ vmcb_setdesc(void *arg, int vcpu, int re case VM_REG_GUEST_ES: case VM_REG_GUEST_SS: svm_set_dirty(sc, vcpu, VMCB_CACHE_SEG); + break; case VM_REG_GUEST_GDTR: case VM_REG_GUEST_IDTR: svm_set_dirty(sc, vcpu, VMCB_CACHE_DT); From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 07:26:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 62CAB5B1; Tue, 28 Oct 2014 07:26:45 +0000 (UTC) Received: from mail-wg0-x229.google.com (mail-wg0-x229.google.com [IPv6:2a00:1450:400c:c00::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C556EAC; Tue, 28 Oct 2014 07:26:44 +0000 (UTC) Received: by mail-wg0-f41.google.com with SMTP id k14so101076wgh.12 for ; Tue, 28 Oct 2014 00:26:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=pIdI2qfernomIw7irc2S1EBlcErhRBqPBoZgAhHMyUA=; b=AUhMYan1IlNDHkdQAH+JBgi4vdDuhF+N5cWBnT17iSa9mztW8h1AKvsFg9YTbPllvG frMbVZRfNV2Mn0/QVYIKH+AlPer0QFdQBl75QMPUxXKV2eR1NZLh6qyebJuzOCPO4LWD hRMAVKBO85Ky7frvfAyGLQrIn7DTO6vwSLG2YjQkGk8Cr3GjD23EAUIsQclv9vN3uYhn 7aB6IaLXg5sJ+vEd37hkIxnYHCWC15i/yzCHXrBCbydcB3+WC7haCKDnRgcB+CZkBxOx eq4vo4HUJMIFqqZXXm8b3uzUnWUnRKyMCysO7SxLODMhwrYHUtQZwxmyvWa65fnogDoS FlRQ== MIME-Version: 1.0 X-Received: by 10.194.157.137 with SMTP id wm9mr1778458wjb.5.1414481202644; Tue, 28 Oct 2014 00:26:42 -0700 (PDT) Received: by 10.216.159.193 with HTTP; Tue, 28 Oct 2014 00:26:42 -0700 (PDT) Reply-To: araujo@FreeBSD.org In-Reply-To: <201410280719.s9S7J3DP078739@svn.freebsd.org> References: <201410280719.s9S7J3DP078739@svn.freebsd.org> Date: Tue, 28 Oct 2014 15:26:42 +0800 Message-ID: Subject: Re: svn commit: r273766 - head/sys/amd64/vmm/amd From: Marcelo Araujo To: Marcelo Araujo Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 07:26:45 -0000 2014-10-28 15:19 GMT+08:00 Marcelo Araujo : > Author: araujo (ports committer) > Date: Tue Oct 28 07:19:02 2014 > New Revision: 273766 > URL: https://svnweb.freebsd.org/changeset/base/273766 > > Log: > Reported by: Coverity > CID: 1249760 > Reviewed by: neel > Approved by: neel > Sponsored by: QNAP Systems Inc. > > Modified: > head/sys/amd64/vmm/amd/vmcb.c > > Modified: head/sys/amd64/vmm/amd/vmcb.c > > ============================================================================== > --- head/sys/amd64/vmm/amd/vmcb.c Tue Oct 28 06:17:25 2014 > (r273765) > +++ head/sys/amd64/vmm/amd/vmcb.c Tue Oct 28 07:19:02 2014 > (r273766) > @@ -389,6 +389,7 @@ vmcb_setdesc(void *arg, int vcpu, int re > case VM_REG_GUEST_ES: > case VM_REG_GUEST_SS: > svm_set_dirty(sc, vcpu, VMCB_CACHE_SEG); > + break; > case VM_REG_GUEST_GDTR: > case VM_REG_GUEST_IDTR: > svm_set_dirty(sc, vcpu, VMCB_CACHE_DT); Missing the log, my bad!!! And as we don't have 'svn "force commit"' to append it. Change log: Missing break on the switch case statement. Best Regards, -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_) From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 08:37:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F329C26C; Tue, 28 Oct 2014 08:37:16 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id AF05F89C; Tue, 28 Oct 2014 08:37:16 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id EEC7EA931; Tue, 28 Oct 2014 08:37:09 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 0693E10693; Tue, 28 Oct 2014 09:37:10 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Kurt Jaeger Subject: Re: svn commit: r273734 - head/bin/dd References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141027153957.GZ1877@kib.kiev.ua> <20141027155427.GM1492@f10.opsec.eu> Date: Tue, 28 Oct 2014 09:37:10 +0100 In-Reply-To: <20141027155427.GM1492@f10.opsec.eu> (Kurt Jaeger's message of "Mon, 27 Oct 2014 16:54:27 +0100") Message-ID: <86vbn4egjt.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Konstantin Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 08:37:17 -0000 Kurt Jaeger writes: > Konstantin Belousov writes: > > On Mon, Oct 27, 2014 at 11:38:17AM +0000, Kurt Jaeger wrote: > > /scratch/tmp/kib/src/bin/dd/args.c:192: warning: format '%jd' expects t= ype 'intmax_t', but argument 3 has type 'int' > Thanks for the pointer. I'll take it up with the submitter. In an ideal world, you would have reviewed the patch before committing it... > I do not have a working arm setup right now. This is a bug on all platforms, and both clang and (recent) gcc should complain about it. That printf() call will print garbage. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 09:23:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B0819AEF; Tue, 28 Oct 2014 09:23:44 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 4B425D2E; Tue, 28 Oct 2014 09:23:43 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 6F4D5A976; Tue, 28 Oct 2014 09:16:42 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 7E664106A6; Tue, 28 Oct 2014 10:16:43 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Kurt Jaeger Subject: Re: svn commit: r273734 - head/bin/dd References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141027153957.GZ1877@kib.kiev.ua> <20141027155427.GM1492@f10.opsec.eu> <86vbn4egjt.fsf@nine.des.no> Date: Tue, 28 Oct 2014 10:16:43 +0100 In-Reply-To: <86vbn4egjt.fsf@nine.des.no> ("Dag-Erling =?utf-8?Q?Sm=C3=B8r?= =?utf-8?Q?grav=22's?= message of "Tue, 28 Oct 2014 09:37:10 +0100") Message-ID: <86r3xseepw.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Konstantin Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 09:23:44 -0000 Dag-Erling Sm=C3=B8rgrav writes: > Kurt Jaeger writes: > > I do not have a working arm setup right now. > This is a bug on all platforms, and both clang and (recent) gcc should > complain about it. That printf() call will print garbage. Correction: it will print garbage on 32-bit platforms, where sizeof(int) !=3D sizeof(intmax_t), but clang and gcc should still emit a warning. You don't need "a working arm setup" to see this; all you need is to cross-build (make TARGET=3Darm TARGET_ARCH=3Darm buildworld). It won't even take long (15 minutes on my AMD FX8350) since the arm world is significantly smaller than the i386 or amd64 world. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 09:28:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F2057C71; Tue, 28 Oct 2014 09:28:25 +0000 (UTC) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id A8F1AD4F; Tue, 28 Oct 2014 09:28:25 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id B970AD64411; Tue, 28 Oct 2014 20:28:22 +1100 (AEDT) Date: Tue, 28 Oct 2014 20:28:16 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= Subject: Re: svn commit: r273734 - head/bin/dd In-Reply-To: <86vbn4egjt.fsf@nine.des.no> Message-ID: <20141028200418.E849@besplex.bde.org> References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141027153957.GZ1877@kib.kiev.ua> <20141027155427.GM1492@f10.opsec.eu> <86vbn4egjt.fsf@nine.des.no> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=BdjhjNd2 c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=nlC_4_pT8q9DhB4Ho9EA:9 a=cz2ZRIgtxKwA:10 a=wJWlkF7cXJYA:10 a=6I5d2MoRAAAA:8 a=pGLkceISAAAA:8 a=x6D4cnrRXBCFxlKM-O0A:9 a=aavBeuD2s3L_R28L:21 a=Opo4oY_bKmlN-vx-:21 a=45ClL6m2LaAA:10 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: Konstantin Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Kurt Jaeger X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 09:28:26 -0000 On Tue, 28 Oct 2014, [utf-8] Dag-Erling Sm=C3=B8rgrav wrote: > Kurt Jaeger writes: >> Konstantin Belousov writes: >>> On Mon, Oct 27, 2014 at 11:38:17AM +0000, Kurt Jaeger wrote: >>> /scratch/tmp/kib/src/bin/dd/args.c:192: warning: format '%jd' expects t= ype 'intmax_t', but argument 3 has type 'int' >> Thanks for the pointer. I'll take it up with the submitter. > > In an ideal world, you would have reviewed the patch before committing > it... > >> I do not have a working arm setup right now. > > This is a bug on all platforms, and both clang and (recent) gcc should > complain about it. That printf() call will print garbage. No, this is only a bug on 32-bit arches. The is is SSIZE_MAX. It has type int on 32-bit arches and type long on 64-bit arches. These types are the same as ssize_t. The compiler prints 'int' in the diagnostic on 32-bit arches since it cannot see that the int is really an ssize_t. SSIZE_MAX is defined as a literal constant with a correct type so that it works in cpp expressions, so it doesn't have a cast to ssize_t. At least clang has more understanding of typedefed types then the C standard requires, so it can distinguish identical types diagnostics. Of course the patch is just broken in removing the casts of SSIZE_MAX. They were carefully done to avoid precisely this portability bug. Long long is an abomination, but you could find a lot of these portability bugs on 64-bit arches by changing [u]intmax_t to [unsigned] while keeping [u]int64_t, [s]size_t and off_t as [unsigned] long. Then everything except [u]intmax_t and would need to be cast to print it using %j[du], the same as on 32-bit arches. Only change this transiently. It breaks detection of the mismatch between and intmax_t. Bruce From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 09:52:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8337F3C0; Tue, 28 Oct 2014 09:52:40 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 2A772A; Tue, 28 Oct 2014 09:52:39 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id E51CEA9FC; Tue, 28 Oct 2014 09:52:38 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 03CA0106AB; Tue, 28 Oct 2014 10:52:40 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Bruce Evans Subject: Re: svn commit: r273734 - head/bin/dd References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141027153957.GZ1877@kib.kiev.ua> <20141027155427.GM1492@f10.opsec.eu> <86vbn4egjt.fsf@nine.des.no> <20141028200418.E849@besplex.bde.org> Date: Tue, 28 Oct 2014 10:52:39 +0100 In-Reply-To: <20141028200418.E849@besplex.bde.org> (Bruce Evans's message of "Tue, 28 Oct 2014 20:28:16 +1100 (EST)") Message-ID: <86mw8ged20.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Konstantin Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Kurt Jaeger X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 09:52:40 -0000 Bruce Evans writes: > Dag-Erling Sm=C3=B8rgrav writes: > > This is a bug on all platforms, and both clang and (recent) gcc > > should complain about it. That printf() call will print garbage. > No, this is only a bug on 32-bit arches. The is is SSIZE_MAX. If you mean "it only has consequences on 32-bit arches", then I agree - but it is still a bug to pass an int to %jd. =C2=A77.19.6.1 9 If a conversion specification is invalid, the behavior is undefined. 239) If any argument is not the correct type for the corresponding conversion specification, the behavior is undefined. The term "correct type" is not defined anywhere, and is only used in the descriptions of fprintf() and fwprintf(). DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 10:26:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 888D0C39; Tue, 28 Oct 2014 10:26:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D0773D3; Tue, 28 Oct 2014 10:26:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SAPxVf066565; Tue, 28 Oct 2014 10:25:59 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SAPxCw066563; Tue, 28 Oct 2014 10:25:59 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410281025.s9SAPxCw066563@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 28 Oct 2014 10:25:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273768 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 10:26:00 -0000 Author: trasz Date: Tue Oct 28 10:25:59 2014 New Revision: 273768 URL: https://svnweb.freebsd.org/changeset/base/273768 Log: Remove the distinction between strings and numbers from ctld(8) yacc parser. This fixes problems with passing strings that look like numbers to clauses that expect strings; previously it caused syntax errors and had to be worked by user, using quotes. The workaround introduced in r267833 is no longer neccessary. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/parse.y head/usr.sbin/ctld/token.l Modified: head/usr.sbin/ctld/parse.y ============================================================================== --- head/usr.sbin/ctld/parse.y Tue Oct 28 08:00:28 2014 (r273767) +++ head/usr.sbin/ctld/parse.y Tue Oct 28 10:25:59 2014 (r273768) @@ -101,21 +101,45 @@ statement: target ; -debug: DEBUG NUM +debug: DEBUG STR { - conf->conf_debug = $2; + uint64_t tmp; + + if (expand_number($2, &tmp) != 0) { + log_warnx("invalid numeric value \"%s\"", $2); + free($2); + return (1); + } + + conf->conf_debug = tmp; } ; -timeout: TIMEOUT NUM +timeout: TIMEOUT STR { - conf->conf_timeout = $2; + uint64_t tmp; + + if (expand_number($2, &tmp) != 0) { + log_warnx("invalid numeric value \"%s\"", $2); + free($2); + return (1); + } + + conf->conf_timeout = tmp; } ; -maxproc: MAXPROC NUM +maxproc: MAXPROC STR { - conf->conf_maxproc = $2; + uint64_t tmp; + + if (expand_number($2, &tmp) != 0) { + log_warnx("invalid numeric value \"%s\"", $2); + free($2); + return (1); + } + + conf->conf_maxproc = tmp; } ; @@ -583,9 +607,17 @@ target_lun: LUN lun_number } ; -lun_number: NUM +lun_number: STR { - lun = lun_new(target, $1); + uint64_t tmp; + + if (expand_number($1, &tmp) != 0) { + log_warnx("invalid numeric value \"%s\"", $1); + free($1); + return (1); + } + + lun = lun_new(target, tmp); if (lun == NULL) return (1); } @@ -626,15 +658,23 @@ lun_backend: BACKEND STR } ; -lun_blocksize: BLOCKSIZE NUM +lun_blocksize: BLOCKSIZE STR { + uint64_t tmp; + + if (expand_number($2, &tmp) != 0) { + log_warnx("invalid numeric value \"%s\"", $2); + free($2); + return (1); + } + if (lun->l_blocksize != 0) { log_warnx("blocksize for lun %d, target \"%s\" " "specified more than once", lun->l_lun, target->t_name); return (1); } - lun_set_blocksize(lun, $2); + lun_set_blocksize(lun, tmp); } ; @@ -689,31 +729,26 @@ lun_serial: SERIAL STR } lun_set_serial(lun, $2); free($2); - } | SERIAL NUM + } + ; + +lun_size: SIZE STR { - char *str = NULL; + uint64_t tmp; - if (lun->l_serial != NULL) { - log_warnx("serial for lun %d, target \"%s\" " - "specified more than once", - lun->l_lun, target->t_name); + if (expand_number($2, &tmp) != 0) { + log_warnx("invalid numeric value \"%s\"", $2); + free($2); return (1); } - asprintf(&str, "%ju", $2); - lun_set_serial(lun, str); - free(str); - } - ; -lun_size: SIZE NUM - { if (lun->l_size != 0) { log_warnx("size for lun %d, target \"%s\" " "specified more than once", lun->l_lun, target->t_name); return (1); } - lun_set_size(lun, $2); + lun_set_size(lun, tmp); } ; %% Modified: head/usr.sbin/ctld/token.l ============================================================================== --- head/usr.sbin/ctld/token.l Tue Oct 28 08:00:28 2014 (r273767) +++ head/usr.sbin/ctld/token.l Tue Oct 28 10:25:59 2014 (r273768) @@ -75,12 +75,6 @@ serial { return SERIAL; } size { return SIZE; } target { return TARGET; } timeout { return TIMEOUT; } -[0-9]+[kKmMgGtTpPeE]? { if (expand_number(yytext, &yylval.num) == 0) - return NUM; - else { - yylval.str = strdup(yytext); return STR; - } - } \"[^"]+\" { yylval.str = strndup(yytext + 1, strlen(yytext) - 2); return STR; } [a-zA-Z0-9\.\-_/\:\[\]]+ { yylval.str = strdup(yytext); return STR; } From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 10:33:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A9713F80; Tue, 28 Oct 2014 10:33:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 860AB69D; Tue, 28 Oct 2014 10:33:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SAXWsN070880; Tue, 28 Oct 2014 10:33:32 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SAXWdZ070878; Tue, 28 Oct 2014 10:33:32 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410281033.s9SAXWdZ070878@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 28 Oct 2014 10:33:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273769 - head/usr.bin/timeout X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 10:33:32 -0000 Author: bapt Date: Tue Oct 28 10:33:31 2014 New Revision: 273769 URL: https://svnweb.freebsd.org/changeset/base/273769 Log: Improve compatibility with GNU timeout According to the coreutils regression testsuite for timeout(1) It is expect to exit with a status being: 125 in case an invalid duration or signal is passed in arguments 126 in case an invalid command is passed in arguments 127 in case the command passed in arguments does not exists. While here document this behaviour in the man page Modified: head/usr.bin/timeout/timeout.1 head/usr.bin/timeout/timeout.c Modified: head/usr.bin/timeout/timeout.1 ============================================================================== --- head/usr.bin/timeout/timeout.1 Tue Oct 28 10:25:59 2014 (r273768) +++ head/usr.bin/timeout/timeout.1 Tue Oct 28 10:33:31 2014 (r273769) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 19, 2014 +.Dd Oct 28, 2014 .Dt TIMEOUT 1 .Os .Sh NAME @@ -108,7 +108,22 @@ is not set, an exit status of 124 is ret .Pp If .Ar command -exits after receiving a signal, the exit status returned is the signal number plus 128. +exits after receiving a signal, the exit status returned is the signal number +plus 128. +.Pp +If +.Ar command +is an invalid command, the exit status returned is 126. +.Pp +If +.Ar command +is a non existing command, the exit status returned is 127. +.Pp +If an invalid parameter is passed to +.Fl s +or +.Fl k , +the exit status return is 125. .Sh SEE ALSO .Xr kill 1 , .Xr signal 3 Modified: head/usr.bin/timeout/timeout.c ============================================================================== --- head/usr.bin/timeout/timeout.c Tue Oct 28 10:25:59 2014 (r273768) +++ head/usr.bin/timeout/timeout.c Tue Oct 28 10:33:31 2014 (r273769) @@ -68,7 +68,7 @@ parse_duration(const char *duration) ret = strtod(duration, &end); if (ret == 0 && end == duration) - errx(EXIT_FAILURE, "invalid duration"); + errx(125, "invalid duration"); if (end == NULL || *end == '\0') return (ret); @@ -89,11 +89,11 @@ parse_duration(const char *duration) ret *= 60 * 60 * 24; break; default: - errx(EX_USAGE, "invalid duration"); + errx(125, "invalid duration"); } if (ret < 0 || ret >= 100000000UL) - errx(EX_USAGE, "invalid duration"); + errx(125, "invalid duration"); return (ret); } @@ -116,7 +116,7 @@ parse_signal(const char *str) return (i); } - errx(EX_USAGE, "invalid signal"); + errx(125, "invalid signal"); } static void @@ -260,8 +260,12 @@ main(int argc, char **argv) signal(SIGTTOU, SIG_DFL); error = execvp(argv[0], argv); - if (error == -1) - err(EX_UNAVAILABLE, "exec()"); + if (error == -1) { + if (errno == ENOENT) + err(127, "exec(%s)", argv[0]); + else + err(126, "exec(%s)", argv[0]); + } } if (sigprocmask(SIG_BLOCK, &signals.sa_mask, NULL) == -1) From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 10:39:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 28FDF1BB; Tue, 28 Oct 2014 10:39:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 055C86CD; Tue, 28 Oct 2014 10:39:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SAdTWa071654; Tue, 28 Oct 2014 10:39:29 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SAdTVQ071653; Tue, 28 Oct 2014 10:39:29 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410281039.s9SAdTVQ071653@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 28 Oct 2014 10:39:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273770 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 10:39:30 -0000 Author: trasz Date: Tue Oct 28 10:39:29 2014 New Revision: 273770 URL: https://svnweb.freebsd.org/changeset/base/273770 Log: Fix build after previous commit. While here, improve error messages. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/parse.y Modified: head/usr.sbin/ctld/parse.y ============================================================================== --- head/usr.sbin/ctld/parse.y Tue Oct 28 10:33:31 2014 (r273769) +++ head/usr.sbin/ctld/parse.y Tue Oct 28 10:39:29 2014 (r273770) @@ -59,17 +59,15 @@ extern void yyrestart(FILE *); %token ALIAS AUTH_GROUP AUTH_TYPE BACKEND BLOCKSIZE CHAP CHAP_MUTUAL %token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP INITIATOR_NAME -%token INITIATOR_PORTAL LISTEN LISTEN_ISER LUN MAXPROC NUM OPENING_BRACKET +%token INITIATOR_PORTAL LISTEN LISTEN_ISER LUN MAXPROC OPENING_BRACKET %token OPTION PATH PIDFILE PORTAL_GROUP SERIAL SIZE STR TARGET TIMEOUT %token ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT %union { - uint64_t num; char *str; } -%token NUM %token STR %% @@ -106,7 +104,7 @@ debug: DEBUG STR uint64_t tmp; if (expand_number($2, &tmp) != 0) { - log_warnx("invalid numeric value \"%s\"", $2); + yyerror("invalid numeric value"); free($2); return (1); } @@ -120,7 +118,7 @@ timeout: TIMEOUT STR uint64_t tmp; if (expand_number($2, &tmp) != 0) { - log_warnx("invalid numeric value \"%s\"", $2); + yyerror("invalid numeric value"); free($2); return (1); } @@ -134,7 +132,7 @@ maxproc: MAXPROC STR uint64_t tmp; if (expand_number($2, &tmp) != 0) { - log_warnx("invalid numeric value \"%s\"", $2); + yyerror("invalid numeric value"); free($2); return (1); } @@ -165,15 +163,31 @@ isns_server: ISNS_SERVER STR } ; -isns_period: ISNS_PERIOD NUM +isns_period: ISNS_PERIOD STR { - conf->conf_isns_period = $2; + uint64_t tmp; + + if (expand_number($2, &tmp) != 0) { + yyerror("invalid numeric value"); + free($2); + return (1); + } + + conf->conf_isns_period = tmp; } ; -isns_timeout: ISNS_TIMEOUT NUM +isns_timeout: ISNS_TIMEOUT STR { - conf->conf_isns_timeout = $2; + uint64_t tmp; + + if (expand_number($2, &tmp) != 0) { + yyerror("invalid numeric value"); + free($2); + return (1); + } + + conf->conf_isns_timeout = tmp; } ; @@ -612,7 +626,7 @@ lun_number: STR uint64_t tmp; if (expand_number($1, &tmp) != 0) { - log_warnx("invalid numeric value \"%s\"", $1); + yyerror("invalid numeric value"); free($1); return (1); } @@ -663,7 +677,7 @@ lun_blocksize: BLOCKSIZE STR uint64_t tmp; if (expand_number($2, &tmp) != 0) { - log_warnx("invalid numeric value \"%s\"", $2); + yyerror("invalid numeric value"); free($2); return (1); } @@ -737,7 +751,7 @@ lun_size: SIZE STR uint64_t tmp; if (expand_number($2, &tmp) != 0) { - log_warnx("invalid numeric value \"%s\"", $2); + yyerror("invalid numeric value"); free($2); return (1); } From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 10:39:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 13BD4341; Tue, 28 Oct 2014 10:39:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA2686D4; Tue, 28 Oct 2014 10:39:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SAdgCZ071722; Tue, 28 Oct 2014 10:39:42 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SAdfvq071716; Tue, 28 Oct 2014 10:39:41 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410281039.s9SAdfvq071716@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 28 Oct 2014 10:39:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273771 - in head: etc/mtree usr.bin/timeout usr.bin/timeout/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 10:39:43 -0000 Author: bapt Date: Tue Oct 28 10:39:41 2014 New Revision: 273771 URL: https://svnweb.freebsd.org/changeset/base/273771 Log: Add regression tests for the timeout(1) utility They are modeled over the regression tests that are provided for the GNU coreutils timeout(1) utility Added: head/usr.bin/timeout/tests/ head/usr.bin/timeout/tests/Makefile (contents, props changed) head/usr.bin/timeout/tests/timeout.sh (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/usr.bin/timeout/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Tue Oct 28 10:39:29 2014 (r273770) +++ head/etc/mtree/BSD.tests.dist Tue Oct 28 10:39:41 2014 (r273771) @@ -281,6 +281,8 @@ regress.multitest.out .. .. + timeout + .. tr .. truncate Modified: head/usr.bin/timeout/Makefile ============================================================================== --- head/usr.bin/timeout/Makefile Tue Oct 28 10:39:29 2014 (r273770) +++ head/usr.bin/timeout/Makefile Tue Oct 28 10:39:41 2014 (r273771) @@ -1,5 +1,11 @@ # $FreeBSD$ +.include + PROG= timeout +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Added: head/usr.bin/timeout/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/timeout/tests/Makefile Tue Oct 28 10:39:41 2014 (r273771) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/usr.bin/timeout + +ATF_TESTS_SH= timeout + +.include Added: head/usr.bin/timeout/tests/timeout.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/timeout/tests/timeout.sh Tue Oct 28 10:39:41 2014 (r273771) @@ -0,0 +1,215 @@ +# $FreeBSD$ + +atf_test_case nominal +nominal_head() +{ + atf_set "descr" "Basic tests on timeout(1) utility" +} + +nominal_body() +{ + atf_check \ + -o empty \ + -e empty \ + -s exit:0 \ + -x timeout 5 true +} + +atf_test_case time_unit +time_unit_head() +{ + atf_set "descr" "Test parsing the default time unit" +} + +time_unit_body() +{ + atf_check \ + -o empty \ + -e empty \ + -s exit:0 \ + -x timeout 1d true + + atf_check \ + -o empty \ + -e empty \ + -s exit:0 \ + -x timeout 1h true + + atf_check \ + -o empty \ + -e empty \ + -s exit:0 \ + -x timeout 1m true + + atf_check \ + -o empty \ + -e empty \ + -s exit:0 \ + -x timeout 1s true +} + +atf_test_case no_timeout +no_timeout_head() +{ + atf_set "descr" "Test disabled timeout" +} + +no_timeout_body() +{ + atf_check \ + -o empty \ + -e empty \ + -s exit:0 \ + -x timeout 0 true +} + +atf_test_case exit_numbers +exit_numbers_head() +{ + atf_set "descr" "Test exit numbers" +} + +exit_numbers_body() +{ + atf_check \ + -o empty \ + -e empty \ + -s exit:2 \ + -x timeout 5 sh -c \'exit 2\' + + atf_check \ + -o empty \ + -e empty \ + -s exit:124 \ + -x timeout .1 sleep 1 + + # With preserv status exit shoudl be 128 + TERM aka 143 + atf_check \ + -o empty \ + -e empty \ + -s exit:143 \ + -x timeout --preserve-status .1 sleep 10 + + atf_check \ + -o empty \ + -e empty \ + -s exit:124 \ + -x timeout -s1 -k1 .1 sleep 10 + + atf_check \ + -o empty \ + -e empty \ + -s exit:0 \ + -x sh -c 'trap "" CHLD; exec timeout 10 true' +} + +atf_test_case with_a_child +with_a_child_head() +{ + atf_set "descr" "When starting with a child (coreutils bug#9098)" +} + +with_a_child_body() +{ + out=$(sleep .1 & exec timeout .5 sh -c 'sleep 2; echo foo') + status=$? + test "$out" = "" && test $status = 124 || atf_fail + +} + +atf_test_case invalid_timeout +invalid_timeout_head() +{ + atf_set "descr" "Invalid timeout" +} + +invalid_timeout_body() +{ + atf_check \ + -o empty \ + -e inline:"timeout: invalid duration\n" \ + -s exit:125 \ + -x timeout invalid sleep 0 + + atf_check \ + -o empty \ + -e inline:"timeout: invalid duration\n" \ + -s exit:125 \ + -x timeout --kill-after=invalid 1 sleep 0 + + atf_check \ + -o empty \ + -e inline:"timeout: invalid duration\n" \ + -s exit:125 \ + -x timeout 42D sleep 0 + + atf_check \ + -o empty \ + -e inline:"timeout: invalid duration\n" \ + -s exit:125 \ + -x timeout 999999999999999999999999999999999999999999999999999999999999d sleep 0 + + atf_check \ + -o empty \ + -e inline:"timeout: invalid duration\n" \ + -s exit:125 \ + -x timeout 2.34e+5d sleep 0 +} + +atf_test_case invalid_signal +invalid_signal_head() +{ + atf_set "descr" "Invalid signal" +} + +invalid_signal_body() +{ + atf_check \ + -o empty \ + -e inline:"timeout: invalid signal\n" \ + -s exit:125 \ + -x timeout --signal=invalid 1 sleep 0 +} + +atf_test_case invalid_command +invalid_command_head() +{ + atf_set "descr" "Invalid command" +} + +invalid_command_body() +{ + atf_check \ + -o empty \ + -e inline:"timeout: exec(.): Permission denied\n" \ + -s exit:126 \ + -x timeout 10 . +} + +atf_test_case no_such_command +no_such_command_head() +{ + atf_set "descr" "No such command" +} + +no_such_command_body() +{ + atf_check \ + -o empty \ + -e inline:"timeout: exec(enoexists): No such file or directory\n" \ + -s exit:127 \ + -x timeout 10 enoexists +} + +atf_init_test_cases() +{ + atf_add_test_case nominal + atf_add_test_case time_unit + atf_add_test_case no_timeout + atf_add_test_case exit_numbers + atf_add_test_case with_a_child + atf_add_test_case invalid_timeout + atf_add_test_case invalid_signal + atf_add_test_case invalid_command + atf_add_test_case no_such_command +} From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 11:20:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 78D6CA76; Tue, 28 Oct 2014 11:20:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B90DB33; Tue, 28 Oct 2014 11:20:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SBKVsw093099; Tue, 28 Oct 2014 11:20:31 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SBKULS093097; Tue, 28 Oct 2014 11:20:30 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410281120.s9SBKULS093097@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 28 Oct 2014 11:20:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273772 - in head/usr.sbin/pw: . tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 11:20:31 -0000 Author: bapt Date: Tue Oct 28 11:20:30 2014 New Revision: 273772 URL: https://svnweb.freebsd.org/changeset/base/273772 Log: When a group is renamed then the group has been invalidated for sure. In that case get the group information using the new name. Add a regression test about this bug PR: 193704 Reported by: az Modified: head/usr.sbin/pw/pw_group.c head/usr.sbin/pw/tests/pw_modify.sh Modified: head/usr.sbin/pw/pw_group.c ============================================================================== --- head/usr.sbin/pw/pw_group.c Tue Oct 28 10:39:41 2014 (r273771) +++ head/usr.sbin/pw/pw_group.c Tue Oct 28 11:20:30 2014 (r273772) @@ -51,6 +51,7 @@ int pw_group(struct userconf * cnf, int mode, struct cargs * args) { int rc; + struct carg *a_newname = getarg(args, 'l'); struct carg *a_name = getarg(args, 'n'); struct carg *a_gid = getarg(args, 'g'); struct carg *arg; @@ -140,8 +141,8 @@ pw_group(struct userconf * cnf, int mode if (a_gid) grp->gr_gid = (gid_t) atoi(a_gid->val); - if ((arg = getarg(args, 'l')) != NULL) - grp->gr_name = pw_checkname((u_char *)arg->val, 0); + if (a_newname != NULL) + grp->gr_name = pw_checkname((u_char *)a_newname->val, 0); } else { if (a_name == NULL) /* Required */ errx(EX_DATAERR, "group name required"); @@ -270,8 +271,10 @@ pw_group(struct userconf * cnf, int mode warn("group update"); return EX_IOERR; } + + arg = a_newname != NULL ? a_newname : a_name; /* grp may have been invalidated */ - if ((grp = GETGRNAM(a_name->val)) == NULL) + if ((grp = GETGRNAM(arg->val)) == NULL) errx(EX_SOFTWARE, "group disappeared during update"); pw_log(cnf, mode, W_GROUP, "%s(%ld)", grp->gr_name, (long) grp->gr_gid); Modified: head/usr.sbin/pw/tests/pw_modify.sh ============================================================================== --- head/usr.sbin/pw/tests/pw_modify.sh Tue Oct 28 10:39:41 2014 (r273771) +++ head/usr.sbin/pw/tests/pw_modify.sh Tue Oct 28 11:20:30 2014 (r273772) @@ -27,8 +27,19 @@ groupmod_invalid_user_body() { atf_check -s exit:0 pw -V ${HOME} groupmod test -d foo } +atf_test_case groupmod_bug_193704 +groupmod_bug_193704_head() { + atf_set "descr" "Regression test for the #193704 bug" +} +groupmod_bug_193704_body() { + populate_etc_skel + atf_check -s exit:0 -x pw -V ${HOME} groupadd test + atf_check -s exit:0 -x pw -V ${HOME} groupmod test -l newgroupname + atf_check -s exit:65 -e match:"^pw: unknown group" -x pw -V ${HOME} groupshow test +} atf_init_test_cases() { atf_add_test_case groupmod_user atf_add_test_case groupmod_invalid_user + atf_add_test_case groupmod_bug_193704 } From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 11:33:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 74791D05; Tue, 28 Oct 2014 11:33:12 +0000 (UTC) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 33219CE3; Tue, 28 Oct 2014 11:33:11 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 77F5B1A2CFF; Tue, 28 Oct 2014 22:33:03 +1100 (AEDT) Date: Tue, 28 Oct 2014 22:33:01 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= Subject: Re: svn commit: r273734 - head/bin/dd In-Reply-To: <86mw8ged20.fsf@nine.des.no> Message-ID: <20141028210830.L1034@besplex.bde.org> References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141027153957.GZ1877@kib.kiev.ua> <20141027155427.GM1492@f10.opsec.eu> <86vbn4egjt.fsf@nine.des.no> <20141028200418.E849@besplex.bde.org> <86mw8ged20.fsf@nine.des.no> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=BdjhjNd2 c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=nlC_4_pT8q9DhB4Ho9EA:9 a=cz2ZRIgtxKwA:10 a=wJWlkF7cXJYA:10 a=R2VWvxA4upp-_jUe8dYA:9 a=45ClL6m2LaAA:10 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: src-committers@freebsd.org, Bruce Evans , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Kurt Jaeger , Konstantin Belousov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 11:33:12 -0000 On Tue, 28 Oct 2014, [utf-8] Dag-Erling Sm=C3=B8rgrav wrote: > Bruce Evans writes: >> Dag-Erling Sm=C3=B8rgrav writes: >>> This is a bug on all platforms, and both clang and (recent) gcc >>> should complain about it. That printf() call will print garbage. >> No, this is only a bug on 32-bit arches. The is is SSIZE_MAX. > > If you mean "it only has consequences on 32-bit arches", then I agree - > but it is still a bug to pass an int to %jd. This is machine-dependent. intmax_t may be int. The only requirement on intmax_t is that it can represent any value of any signed integer type. This is possible if the largest integer type is 64 bits (the smallest permitted largest type) and int is also 64 bits (and there are no complications for padding bits). intmax_t can even be signed char if that is wide enough (not in POSIX starting 10-15 years ago, since signed char is now required to be 8 bits. It is weird for intmax_t to have the lowest rank (not counting Bool), but FreeBSD uses this loophole to make it have second highest rank on 64-bit arches. > =C2=A77.19.6.1 > > 9 If a conversion specification is invalid, the behavior is > undefined. 239) If any argument is not the correct type for the > corresponding conversion specification, the behavior is undefined. > > The term "correct type" is not defined anywhere, and is only used in the > descriptions of fprintf() and fwprintf(). Binary compatibility gives strong restrictions, and I think the standard is just as strict. Types must match after the default promotions, since otherwise their sizes and representations may be completely different even when their range is the same. "Correct type" for %jd should meant "the same type after the default promotion as intmax_t after its default promotion", but %jd also works for args of type uintmax_t that are not too large, since then they are required to have the same respresentation as when they are cast to the correct type (intmax_t). Bruce From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 12:00:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3D3CE28E; Tue, 28 Oct 2014 12:00:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25606EF6; Tue, 28 Oct 2014 12:00:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SC0gTp010547; Tue, 28 Oct 2014 12:00:42 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SC0eMm010535; Tue, 28 Oct 2014 12:00:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410281200.s9SC0eMm010535@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 28 Oct 2014 12:00:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273773 - in head/sys: dev/acpi_support dev/acpica dev/asmc kern net netinet netinet/cc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 12:00:42 -0000 Author: hselasky Date: Tue Oct 28 12:00:39 2014 New Revision: 273773 URL: https://svnweb.freebsd.org/changeset/base/273773 Log: The SYSCTL data pointers can come from userspace and must not be directly accessed. Although this will work on some platforms, it can throw an exception if the pointer is invalid and then panic the kernel. Add a missing SYSCTL_IN() of "SCTP_BASE_STATS" structure. MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/acpi_support/acpi_ibm.c head/sys/dev/acpica/acpi.c head/sys/dev/asmc/asmc.c head/sys/kern/kern_ffclock.c head/sys/net/bpf.c head/sys/netinet/cc/cc.c head/sys/netinet/sctp_sysctl.c head/sys/netinet/siftr.c Modified: head/sys/dev/acpi_support/acpi_ibm.c ============================================================================== --- head/sys/dev/acpi_support/acpi_ibm.c Tue Oct 28 11:20:30 2014 (r273772) +++ head/sys/dev/acpi_support/acpi_ibm.c Tue Oct 28 12:00:39 2014 (r273773) @@ -899,6 +899,7 @@ acpi_ibm_handlerevents_sysctl(SYSCTL_HAN char *cp, *ep; int l, val; unsigned int handler_events; + char temp[128]; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -920,17 +921,18 @@ acpi_ibm_handlerevents_sysctl(SYSCTL_HAN sbuf_trim(&sb); sbuf_finish(&sb); - - /* Copy out the old values to the user. */ - error = SYSCTL_OUT(req, sbuf_data(&sb), sbuf_len(&sb)); + strlcpy(temp, sbuf_data(&sb), sizeof(temp)); sbuf_delete(&sb); + error = sysctl_handle_string(oidp, temp, sizeof(temp), req); + + /* Check for error or no change */ if (error != 0 || req->newptr == NULL) goto out; /* If the user is setting a string, parse it. */ handler_events = 0; - cp = (char *)req->newptr; + cp = temp; while (*cp) { if (isspace(*cp)) { cp++; Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Tue Oct 28 11:20:30 2014 (r273772) +++ head/sys/dev/acpica/acpi.c Tue Oct 28 12:00:39 2014 (r273773) @@ -3783,6 +3783,7 @@ acpi_debug_sysctl(SYSCTL_HANDLER_ARGS) int error, *dbg; struct debugtag *tag; struct sbuf sb; + char temp[128]; if (sbuf_new(&sb, NULL, 128, SBUF_AUTOEXTEND) == NULL) return (ENOMEM); @@ -3806,16 +3807,16 @@ acpi_debug_sysctl(SYSCTL_HANDLER_ARGS) } sbuf_trim(&sb); sbuf_finish(&sb); - - /* Copy out the old values to the user. */ - error = SYSCTL_OUT(req, sbuf_data(&sb), sbuf_len(&sb)); + strlcpy(temp, sbuf_data(&sb), sizeof(temp)); sbuf_delete(&sb); - /* If the user is setting a string, parse it. */ + error = sysctl_handle_string(oidp, temp, sizeof(temp), req); + + /* Check for error or no change */ if (error == 0 && req->newptr != NULL) { - *dbg = 0; - kern_setenv((char *)oidp->oid_arg1, (char *)req->newptr); - acpi_set_debugging(NULL); + *dbg = 0; + kern_setenv((char *)oidp->oid_arg1, temp); + acpi_set_debugging(NULL); } ACPI_SERIAL_END(acpi); Modified: head/sys/dev/asmc/asmc.c ============================================================================== --- head/sys/dev/asmc/asmc.c Tue Oct 28 11:20:30 2014 (r273772) +++ head/sys/dev/asmc/asmc.c Tue Oct 28 12:00:39 2014 (r273773) @@ -1052,7 +1052,7 @@ asmc_mb_sysctl_fanminspeed(SYSCTL_HANDLE error = sysctl_handle_int(oidp, &v, 0, req); if (error == 0 && req->newptr != NULL) { - unsigned int newspeed = *(unsigned int *)req->newptr; + unsigned int newspeed = v; asmc_fan_setvalue(dev, ASMC_KEY_FANMINSPEED, fan, newspeed); } @@ -1071,7 +1071,7 @@ asmc_mb_sysctl_fanmaxspeed(SYSCTL_HANDLE error = sysctl_handle_int(oidp, &v, 0, req); if (error == 0 && req->newptr != NULL) { - unsigned int newspeed = *(unsigned int *)req->newptr; + unsigned int newspeed = v; asmc_fan_setvalue(dev, ASMC_KEY_FANMAXSPEED, fan, newspeed); } @@ -1090,7 +1090,7 @@ asmc_mb_sysctl_fantargetspeed(SYSCTL_HAN error = sysctl_handle_int(oidp, &v, 0, req); if (error == 0 && req->newptr != NULL) { - unsigned int newspeed = *(unsigned int *)req->newptr; + unsigned int newspeed = v; asmc_fan_setvalue(dev, ASMC_KEY_FANTARGETSPEED, fan, newspeed); } @@ -1283,7 +1283,7 @@ asmc_mb_sysctl_sms_z(SYSCTL_HANDLER_ARGS asmc_sms_read(dev, ASMC_KEY_SMS_Z, &val); v = (int32_t) val; - error = sysctl_handle_int(oidp, &v, sizeof(v), req); + error = sysctl_handle_int(oidp, &v, 0, req); return (error); } @@ -1298,7 +1298,7 @@ asmc_mbp_sysctl_light_left(SYSCTL_HANDLE asmc_key_read(dev, ASMC_KEY_LIGHTLEFT, buf, sizeof buf); v = buf[2]; - error = sysctl_handle_int(oidp, &v, sizeof(v), req); + error = sysctl_handle_int(oidp, &v, 0, req); return (error); } @@ -1313,7 +1313,7 @@ asmc_mbp_sysctl_light_right(SYSCTL_HANDL asmc_key_read(dev, ASMC_KEY_LIGHTRIGHT, buf, sizeof buf); v = buf[2]; - error = sysctl_handle_int(oidp, &v, sizeof(v), req); + error = sysctl_handle_int(oidp, &v, 0, req); return (error); } @@ -1324,19 +1324,19 @@ asmc_mbp_sysctl_light_control(SYSCTL_HAN device_t dev = (device_t) arg1; uint8_t buf[2]; int error; - unsigned int level; - static int32_t v; - - error = sysctl_handle_int(oidp, &v, sizeof(v), req); + static unsigned int level; + int v; + + v = level; + error = sysctl_handle_int(oidp, &v, 0, req); + if (error == 0 && req->newptr != NULL) { - level = *(unsigned int *)req->newptr; - if (level > 255) + if (v < 0 || v > 255) return (EINVAL); - v = level; + level = v; buf[0] = level; buf[1] = 0x00; asmc_key_write(dev, ASMC_KEY_LIGHTVALUE, buf, sizeof buf); } - return (error); } Modified: head/sys/kern/kern_ffclock.c ============================================================================== --- head/sys/kern/kern_ffclock.c Tue Oct 28 11:20:30 2014 (r273772) +++ head/sys/kern/kern_ffclock.c Tue Oct 28 12:00:39 2014 (r273773) @@ -203,26 +203,29 @@ static int sysctl_kern_sysclock_active(SYSCTL_HANDLER_ARGS) { char newclock[MAX_SYSCLOCK_NAME_LEN]; - int clk, error; + int error; + int clk; - if (req->newptr == NULL) { - /* Return the name of the current active sysclock. */ - strlcpy(newclock, sysclocks[sysclock_active], sizeof(newclock)); - error = sysctl_handle_string(oidp, newclock, - sizeof(newclock), req); - } else { - /* Change the active sysclock to the user specified one. */ - error = EINVAL; - for (clk = 0; clk < NUM_SYSCLOCKS; clk++) { - if (strncmp((char *)req->newptr, sysclocks[clk], - strlen(sysclocks[clk])) == 0) { - sysclock_active = clk; - error = 0; - break; - } + /* Return the name of the current active sysclock. */ + strlcpy(newclock, sysclocks[sysclock_active], sizeof(newclock)); + error = sysctl_handle_string(oidp, newclock, sizeof(newclock), req); + + /* Check for error or no change */ + if (error != 0 || req->newptr == NULL) + goto done; + + /* Change the active sysclock to the user specified one: */ + error = EINVAL; + for (clk = 0; clk < NUM_SYSCLOCKS; clk++) { + if (strncmp(newclock, sysclocks[clk], + MAX_SYSCLOCK_NAME_LEN - 1)) { + continue; } + sysclock_active = clk; + error = 0; + break; } - +done: return (error); } Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Tue Oct 28 11:20:30 2014 (r273772) +++ head/sys/net/bpf.c Tue Oct 28 12:00:39 2014 (r273773) @@ -2807,7 +2807,8 @@ bpfstats_fill_xbpf(struct xbpf_d *d, str static int bpf_stats_sysctl(SYSCTL_HANDLER_ARGS) { - struct xbpf_d *xbdbuf, *xbd, zerostats; + static const struct xbpf_d zerostats; + struct xbpf_d *xbdbuf, *xbd, tempstats; int index, error; struct bpf_if *bp; struct bpf_d *bd; @@ -2827,11 +2828,13 @@ bpf_stats_sysctl(SYSCTL_HANDLER_ARGS) * as we aren't allowing the user to set the counters currently. */ if (req->newptr != NULL) { - if (req->newlen != sizeof(zerostats)) + if (req->newlen != sizeof(tempstats)) return (EINVAL); - bzero(&zerostats, sizeof(zerostats)); - xbd = req->newptr; - if (bcmp(xbd, &zerostats, sizeof(*xbd)) != 0) + memset(&tempstats, 0, sizeof(tempstats)); + error = SYSCTL_IN(req, &tempstats, sizeof(tempstats)); + if (error) + return (error); + if (bcmp(&tempstats, &zerostats, sizeof(tempstats)) != 0) return (EINVAL); bpf_zero_counters(); return (0); Modified: head/sys/netinet/cc/cc.c ============================================================================== --- head/sys/netinet/cc/cc.c Tue Oct 28 11:20:30 2014 (r273772) +++ head/sys/netinet/cc/cc.c Tue Oct 28 12:00:39 2014 (r273773) @@ -92,36 +92,33 @@ cc_default_algo(SYSCTL_HANDLER_ARGS) { char default_cc[TCP_CA_NAME_MAX]; struct cc_algo *funcs; - int err, found; + int error; - err = found = 0; + /* Get the current default: */ + CC_LIST_RLOCK(); + strlcpy(default_cc, CC_DEFAULT()->name, sizeof(default_cc)); + CC_LIST_RUNLOCK(); - if (req->newptr == NULL) { - /* Just print the current default. */ - CC_LIST_RLOCK(); - strlcpy(default_cc, CC_DEFAULT()->name, TCP_CA_NAME_MAX); - CC_LIST_RUNLOCK(); - err = sysctl_handle_string(oidp, default_cc, 0, req); - } else { - /* Find algo with specified name and set it to default. */ - CC_LIST_RLOCK(); - STAILQ_FOREACH(funcs, &cc_list, entries) { - /* NOTE: "newptr" is not zero terminated */ - if (req->newlen != strnlen(funcs->name, - TCP_CA_NAME_MAX - 1)) - continue; - if (bcmp(req->newptr, funcs->name, req->newlen)) - continue; - found = 1; - V_default_cc_ptr = funcs; - } - CC_LIST_RUNLOCK(); + error = sysctl_handle_string(oidp, default_cc, sizeof(default_cc), req); - if (!found) - err = ESRCH; - } + /* Check for error or no change */ + if (error != 0 || req->newptr == NULL) + goto done; - return (err); + error = ESRCH; + + /* Find algo with specified name and set it to default. */ + CC_LIST_RLOCK(); + STAILQ_FOREACH(funcs, &cc_list, entries) { + if (strncmp(default_cc, funcs->name, sizeof(default_cc))) + continue; + V_default_cc_ptr = funcs; + error = 0; + break; + } + CC_LIST_RUNLOCK(); +done: + return (error); } /* Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Tue Oct 28 11:20:30 2014 (r273772) +++ head/sys/netinet/sctp_sysctl.c Tue Oct 28 12:00:39 2014 (r273773) @@ -636,17 +636,26 @@ sctp_sysctl_handle_stats(SYSCTL_HANDLER_ int error; #if defined(SMP) && defined(SCTP_USE_PERCPU_STAT) + struct sctpstat sb_temp; + struct sctpstat *sarry; + struct sctpstat sb; int cpu; - struct sctpstat sb, *sarry; - #endif if ((req->newptr != NULL) && (req->newlen != sizeof(struct sctpstat))) { return (EINVAL); } + #if defined(SMP) && defined(SCTP_USE_PERCPU_STAT) - memset(&sb, 0, sizeof(struct sctpstat)); + memset(&sb, 0, sizeof(sb)); + memset(&sb_temp, 0, sizeof(sb_temp)); + + if (req->newptr != NULL) { + error = SYSCTL_IN(req, &sb_temp, sizeof(sb_temp)); + if (error != 0) + return (error); + } for (cpu = 0; cpu < mp_maxid; cpu++) { sarry = &SCTP_BASE_STATS[cpu]; if (sarry->sctps_discontinuitytime.tv_sec > sb.sctps_discontinuitytime.tv_sec) { @@ -774,12 +783,14 @@ sctp_sysctl_handle_stats(SYSCTL_HANDLER_ sb.sctps_send_burst_avoid += sarry->sctps_send_burst_avoid; sb.sctps_send_cwnd_avoid += sarry->sctps_send_cwnd_avoid; sb.sctps_fwdtsn_map_over += sarry->sctps_fwdtsn_map_over; - if (req->newptr != NULL) { - memcpy(sarry, req->newptr, sizeof(struct sctpstat)); - } + if (req->newptr != NULL) + memcpy(sarry, &sb_temp, sizeof(struct sctpstat)); } error = SYSCTL_OUT(req, &sb, sizeof(struct sctpstat)); #else + error = SYSCTL_IN(req, &SCTP_BASE_STATS, sizeof(struct sctpstat)); + if (error) + return (error); error = SYSCTL_OUT(req, &SCTP_BASE_STATS, sizeof(struct sctpstat)); #endif return (error); Modified: head/sys/netinet/siftr.c ============================================================================== --- head/sys/netinet/siftr.c Tue Oct 28 11:20:30 2014 (r273772) +++ head/sys/netinet/siftr.c Tue Oct 28 12:00:39 2014 (r273773) @@ -268,6 +268,7 @@ static unsigned int siftr_pkts_per_log = static unsigned int siftr_generate_hashes = 0; /* static unsigned int siftr_binary_log = 0; */ static char siftr_logfile[PATH_MAX] = "/var/log/siftr.log"; +static char siftr_logfile_shadow[PATH_MAX] = "/var/log/siftr.log"; static u_long siftr_hashmask; STAILQ_HEAD(pkthead, pkt_node) pkt_queue = STAILQ_HEAD_INITIALIZER(pkt_queue); LIST_HEAD(listhead, flow_hash_node) *counter_hash; @@ -299,7 +300,7 @@ SYSCTL_PROC(_net_inet_siftr, OID_AUTO, e "switch siftr module operations on/off"); SYSCTL_PROC(_net_inet_siftr, OID_AUTO, logfile, CTLTYPE_STRING|CTLFLAG_RW, - &siftr_logfile, sizeof(siftr_logfile), &siftr_sysctl_logfile_name_handler, + &siftr_logfile_shadow, sizeof(siftr_logfile_shadow), &siftr_sysctl_logfile_name_handler, "A", "file to save siftr log messages to"); SYSCTL_UINT(_net_inet_siftr, OID_AUTO, ppl, CTLFLAG_RW, @@ -1145,38 +1146,38 @@ siftr_sysctl_logfile_name_handler(SYSCTL struct alq *new_alq; int error; - if (req->newptr == NULL) - goto skip; - - /* If old filename and new filename are different. */ - if (strncmp(siftr_logfile, (char *)req->newptr, PATH_MAX)) { - - error = alq_open(&new_alq, req->newptr, curthread->td_ucred, - SIFTR_LOG_FILE_MODE, SIFTR_ALQ_BUFLEN, 0); + error = sysctl_handle_string(oidp, arg1, arg2, req); - /* Bail if unable to create new alq. */ - if (error) - return (1); + /* Check for error or same filename */ + if (error != 0 || req->newptr == NULL || + strncmp(siftr_logfile, arg1, arg2) == 0) + goto done; + + /* Filname changed */ + error = alq_open(&new_alq, arg1, curthread->td_ucred, + SIFTR_LOG_FILE_MODE, SIFTR_ALQ_BUFLEN, 0); + if (error != 0) + goto done; - /* - * If disabled, siftr_alq == NULL so we simply close - * the alq as we've proved it can be opened. - * If enabled, close the existing alq and switch the old - * for the new. - */ - if (siftr_alq == NULL) - alq_close(new_alq); - else { - alq_close(siftr_alq); - siftr_alq = new_alq; - } + /* + * If disabled, siftr_alq == NULL so we simply close + * the alq as we've proved it can be opened. + * If enabled, close the existing alq and switch the old + * for the new. + */ + if (siftr_alq == NULL) { + alq_close(new_alq); + } else { + alq_close(siftr_alq); + siftr_alq = new_alq; } -skip: - return (sysctl_handle_string(oidp, arg1, arg2, req)); + /* Update filename upon success */ + strlcpy(siftr_logfile, arg1, arg2); +done: + return (error); } - static int siftr_manage_ops(uint8_t action) { From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 12:46:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 246C5D1A; Tue, 28 Oct 2014 12:46:53 +0000 (UTC) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id DD0C461C; Tue, 28 Oct 2014 12:46:52 +0000 (UTC) Received: from lgwl-lstewart2.corp.netflix.com (c110-22-7-57.eburwd3.vic.optusnet.com.au [110.22.7.57]) by lauren.room52.net (Postfix) with ESMTPSA id 708067E820; Tue, 28 Oct 2014 23:46:36 +1100 (EST) Message-ID: <544F901A.4000600@freebsd.org> Date: Tue, 28 Oct 2014 23:46:18 +1100 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Hiroki Sato , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r272386 - in head: sbin/ifconfig share/man/man4 sys/net References: <201410012137.s91LbXL4025967@svn.freebsd.org> <544DB140.7070807@freebsd.org> In-Reply-To: <544DB140.7070807@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lauren.room52.net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 12:46:53 -0000 On 10/27/14 13:43, Lawrence Stewart wrote: > Hi Hiroki-san, > > On 10/02/14 07:37, Hiroki Sato wrote: >> Author: hrs >> Date: Wed Oct 1 21:37:32 2014 >> New Revision: 272386 >> URL: https://svnweb.freebsd.org/changeset/base/272386 >> >> Log: >> Virtualize lagg(4) cloner. This change fixes a panic when tearing down >> if_lagg(4) interfaces which were cloned in a vnet jail. >> >> Sysctl nodes which are dynamically generated for each cloned interface >> (net.link.lagg.N.*) have been removed, and use_flowid and flowid_shift >> ifconfig(8) parameters have been added instead. Flags and per-interface >> statistics counters are displayed in "ifconfig -v". >> >> CR: D842 >> >> Modified: >> head/sbin/ifconfig/ifconfig.8 >> head/sbin/ifconfig/iflagg.c >> head/share/man/man4/lagg.4 >> head/sys/net/ieee8023ad_lacp.c >> head/sys/net/if_lagg.c >> head/sys/net/if_lagg.h > > What was the reasoning for removing the net.link.lagg.* sysctls? We use > them at Netflix and the new way of obtaining the information via > ifconfig -v is less structured and significantly higher overhead by > comparison. Would be good to have the sysctls back or an equivalent low > overhead way of obtaining the previously available information. So it turns out I was missing some important context on this matter. We don't in fact want or need the sysctls back and have a sane way to access the information via means other than parsing ifconfig output. In short, apologies for the noise and move along, there's nothing to see here :) Cheers, Lawrence From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 13:38:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2A3A1B6B; Tue, 28 Oct 2014 13:38:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0AB21C64; Tue, 28 Oct 2014 13:38:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SDcClU058657; Tue, 28 Oct 2014 13:38:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SDcBXk058646; Tue, 28 Oct 2014 13:38:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410281338.s9SDcBXk058646@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 28 Oct 2014 13:38:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273774 - in head/contrib/ofed: librdmacm/examples librdmacm/examples/build librdmacm/examples/build/cmatose librdmacm/examples/build/mckey librdmacm/examples/build/rping librdmacm/exam... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 13:38:13 -0000 Author: hselasky Date: Tue Oct 28 13:38:10 2014 New Revision: 273774 URL: https://svnweb.freebsd.org/changeset/base/273774 Log: Make some infiniband example utilities easily buildable: - Add new Makefiles. - Add more include directories when building. - Fixed a printf() formatting string. MFC after: 3 days Sponsored by: Mellanox Technologies Added: head/contrib/ofed/librdmacm/examples/build/ head/contrib/ofed/librdmacm/examples/build/Makefile (contents, props changed) head/contrib/ofed/librdmacm/examples/build/Makefile.inc (contents, props changed) head/contrib/ofed/librdmacm/examples/build/cmatose/ head/contrib/ofed/librdmacm/examples/build/cmatose/Makefile (contents, props changed) head/contrib/ofed/librdmacm/examples/build/mckey/ head/contrib/ofed/librdmacm/examples/build/mckey/Makefile (contents, props changed) head/contrib/ofed/librdmacm/examples/build/rping/ head/contrib/ofed/librdmacm/examples/build/rping/Makefile (contents, props changed) head/contrib/ofed/librdmacm/examples/build/udaddy/ head/contrib/ofed/librdmacm/examples/build/udaddy/Makefile (contents, props changed) Modified: head/contrib/ofed/librdmacm/examples/rping.c head/contrib/ofed/usr.lib/Makefile.inc Added: head/contrib/ofed/librdmacm/examples/build/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/ofed/librdmacm/examples/build/Makefile Tue Oct 28 13:38:10 2014 (r273774) @@ -0,0 +1,3 @@ +SUBDIR= cmatose mckey rping udaddy + +.include Added: head/contrib/ofed/librdmacm/examples/build/Makefile.inc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/ofed/librdmacm/examples/build/Makefile.inc Tue Oct 28 13:38:10 2014 (r273774) @@ -0,0 +1,9 @@ +IBDIR=../../../.. + +CFLAGS+= \ + -I${IBDIR}/include/infiniband \ + -I${IBDIR}/include \ + -I${IBDIR}/librdmacm/include \ + -I${IBDIR}/libibv/include \ + -I${IBDIR}/libibverbs/include + Added: head/contrib/ofed/librdmacm/examples/build/cmatose/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/ofed/librdmacm/examples/build/cmatose/Makefile Tue Oct 28 13:38:10 2014 (r273774) @@ -0,0 +1,10 @@ +# +# $FreeBSD$ +# +.PATH: ${.CURDIR}/../.. +PROG= cmatose +MAN= +SRCS= cmatose.c +LDADD+= -libverbs -lrdmacm -lpthread + +.include Added: head/contrib/ofed/librdmacm/examples/build/mckey/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/ofed/librdmacm/examples/build/mckey/Makefile Tue Oct 28 13:38:10 2014 (r273774) @@ -0,0 +1,10 @@ +# +# $FreeBSD$ +# +.PATH: ${.CURDIR}/../.. +PROG= mckey +MAN= +SRCS= mckey.c +LDADD+= -libverbs -lrdmacm -lpthread + +.include Added: head/contrib/ofed/librdmacm/examples/build/rping/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/ofed/librdmacm/examples/build/rping/Makefile Tue Oct 28 13:38:10 2014 (r273774) @@ -0,0 +1,10 @@ +# +# $FreeBSD$ +# +.PATH: ${.CURDIR}/../.. +PROG= rping +MAN= +SRCS= rping.c +LDADD+= -libverbs -lrdmacm -lpthread + +.include Added: head/contrib/ofed/librdmacm/examples/build/udaddy/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/ofed/librdmacm/examples/build/udaddy/Makefile Tue Oct 28 13:38:10 2014 (r273774) @@ -0,0 +1,10 @@ +# +# $FreeBSD$ +# +.PATH: ${.CURDIR}/../.. +PROG= udaddy +MAN= +SRCS= udaddy.c +LDADD+= -libverbs -lrdmacm -lpthread + +.include Modified: head/contrib/ofed/librdmacm/examples/rping.c ============================================================================== --- head/contrib/ofed/librdmacm/examples/rping.c Tue Oct 28 12:00:39 2014 (r273773) +++ head/contrib/ofed/librdmacm/examples/rping.c Tue Oct 28 13:38:10 2014 (r273774) @@ -1148,8 +1148,9 @@ int main(int argc, char *argv[]) if ((cb->size < RPING_MIN_BUFSIZE) || (cb->size > (RPING_BUFSIZE - 1))) { fprintf(stderr, "Invalid size %d " - "(valid range is %Zd to %d)\n", - cb->size, RPING_MIN_BUFSIZE, RPING_BUFSIZE); + "(valid range is %d to %d)\n", + (int)cb->size, (int)(RPING_MIN_BUFSIZE), + (int)(RPING_BUFSIZE)); ret = EINVAL; } else DEBUG_LOG("size %d\n", (int) atoi(optarg)); Modified: head/contrib/ofed/usr.lib/Makefile.inc ============================================================================== --- head/contrib/ofed/usr.lib/Makefile.inc Tue Oct 28 12:00:39 2014 (r273773) +++ head/contrib/ofed/usr.lib/Makefile.inc Tue Oct 28 13:38:10 2014 (r273774) @@ -7,11 +7,18 @@ COMPLIBDIR= ${OPENSMDIR}/complib VENDORLIBDIR= ${OPENSMDIR}/libvendor IBVERBSDIR= ${.CURDIR}/../../libibverbs IBINC= ${.CURDIR}/../../include +RDMACMDIR= ${.CURDIR}/../../librdmacm + +CFLAGS+= -I${.CURDIR} \ + -I${IBINC}/infiniband \ + -I${IBINC} \ + -I${IBCOMMONDIR}/include/infiniband \ + -I${IBCOMMONDIR}/include \ + -I${IBMADDIR}/include/infiniband \ + -I${IBMADDIR}/include \ + -I${UMADDIR}/include/infiniband \ + -I${UMADDIR}/include \ + -I${OPENSMDIR}/include \ + -I${RDMACMDIR}/include \ + -I${IBVERBSDIR}/include -CFLAGS+= -I${.CURDIR} -I${IBINC}/infiniband -CFLAGS+= -I${IBCOMMONDIR}/include/infiniband -CFLAGS+= -I${IBMADDIR}/include/infiniband -CFLAGS+= -I${UMADDIR}/include/infiniband -CFLAGS+= -I${OPENSMDIR}/include -# CFLAGS+= -I${UMADDIR}/include -# CFLAGS+= -I${IBVERBSDIR}/include From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 14:11:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C1D237A0; Tue, 28 Oct 2014 14:11:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADD52EC; Tue, 28 Oct 2014 14:11:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SEBtDv077415; Tue, 28 Oct 2014 14:11:55 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SEBtFT077414; Tue, 28 Oct 2014 14:11:55 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201410281411.s9SEBtFT077414@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Tue, 28 Oct 2014 14:11:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273778 - head/usr.sbin/pkg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 14:11:55 -0000 Author: nwhitehorn Date: Tue Oct 28 14:11:54 2014 New Revision: 273778 URL: https://svnweb.freebsd.org/changeset/base/273778 Log: Remove spurious libelf dependency. Submitted by: pluknet Modified: head/usr.sbin/pkg/Makefile Modified: head/usr.sbin/pkg/Makefile ============================================================================== --- head/usr.sbin/pkg/Makefile Tue Oct 28 14:03:22 2014 (r273777) +++ head/usr.sbin/pkg/Makefile Tue Oct 28 14:11:54 2014 (r273778) @@ -6,7 +6,7 @@ MAN= pkg.7 CFLAGS+=-I${.CURDIR}/../../contrib/libucl/include .PATH: ${.CURDIR}/../../contrib/libucl/include -DPADD= ${LIBARCHIVE} ${LIBELF} ${LIBFETCH} ${LIBUCL} ${LIBSBUF} ${LIBSSL} \ +DPADD= ${LIBARCHIVE} ${LIBFETCH} ${LIBUCL} ${LIBSBUF} ${LIBSSL} \ ${LIBCRYPTO} ${LIBM} LDADD= -larchive -lfetch ${LDUCL} -lsbuf -lssl -lcrypto -lm USEPRIVATELIB= ucl From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 14:14:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7AC17AC3; Tue, 28 Oct 2014 14:14:31 +0000 (UTC) Received: from f10.opsec.eu (f10.opsec.eu [IPv6:2001:14f8:200:4::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3541C12E; Tue, 28 Oct 2014 14:14:31 +0000 (UTC) Received: from pi by f10.opsec.eu with local (Exim 4.84 (FreeBSD)) (envelope-from ) id 1Xj7XW-000B8E-4P; Tue, 28 Oct 2014 15:14:26 +0100 Date: Tue, 28 Oct 2014 15:14:26 +0100 From: Kurt Jaeger To: Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= Subject: Re: svn commit: r273734 - head/bin/dd Message-ID: <20141028141426.GA42752@f10.opsec.eu> References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141027153957.GZ1877@kib.kiev.ua> <20141027155427.GM1492@f10.opsec.eu> <86vbn4egjt.fsf@nine.des.no> <86r3xseepw.fsf@nine.des.no> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <86r3xseepw.fsf@nine.des.no> Cc: Konstantin Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Kurt Jaeger X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 14:14:31 -0000 Hi! > Dag-Erling Smørgrav writes: > > Kurt Jaeger writes: > > > I do not have a working arm setup right now. > > This is a bug on all platforms, and both clang and (recent) gcc should > > complain about it. That printf() call will print garbage. > > Correction: it will print garbage on 32-bit platforms, where sizeof(int) > != sizeof(intmax_t), but clang and gcc should still emit a warning. Yes. I'm old enough to remember the mess in C when going from 16bit to 32bit that I should have paid attention to the test case on 32bit, but my stupidity won 8-( Right now the submitter tests on 32bit and if time permits, I'll experiment on ARM as well. Sorry again for the mess. -- pi@FreeBSD.org +49 171 3101372 6 years to go ! From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 14:19:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DF757C76; Tue, 28 Oct 2014 14:19:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C20E916F; Tue, 28 Oct 2014 14:19:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SEJIKB078381; Tue, 28 Oct 2014 14:19:18 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SEJIZD078379; Tue, 28 Oct 2014 14:19:18 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410281419.s9SEJIZD078379@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 28 Oct 2014 14:19:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273779 - in head/usr.sbin/pw: . tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 14:19:19 -0000 Author: bapt Date: Tue Oct 28 14:19:17 2014 New Revision: 273779 URL: https://svnweb.freebsd.org/changeset/base/273779 Log: Fix a regression in pw usermod -G list The user was perperly adding the to different groups from "list" but was not removed from the other groups it could have belong to. While here add a regression test about this bug PR: 185666 Reported by: sub.mesa@gmail.com MFC after: 1 week Modified: head/usr.sbin/pw/pw_user.c head/usr.sbin/pw/tests/pw_modify.sh Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Tue Oct 28 14:11:54 2014 (r273778) +++ head/usr.sbin/pw/pw_user.c Tue Oct 28 14:19:17 2014 (r273779) @@ -751,7 +751,25 @@ pw_user(struct userconf * cnf, int mode, */ if (mode == M_ADD || getarg(args, 'G') != NULL) { - int i; + int i, j; + /* First remove the user from all group */ + SETGRENT(); + while ((grp = GETGRENT()) != NULL) { + char group[MAXLOGNAME]; + if (grp->gr_mem == NULL) + continue; + for (i = 0; grp->gr_mem[i] != NULL; i++) { + if (strcmp(grp->gr_mem[i] , pwd->pw_name) != 0) + continue; + for (j = i; grp->gr_mem[j] != NULL ; j++) + grp->gr_mem[j] = grp->gr_mem[j+1]; + strlcpy(group, grp->gr_name, MAXLOGNAME); + chggrent(group, grp); + } + } + ENDGRENT(); + + /* now add to group where needed */ for (i = 0; cnf->groups[i] != NULL; i++) { grp = GETGRNAM(cnf->groups[i]); grp = gr_add(grp, pwd->pw_name); Modified: head/usr.sbin/pw/tests/pw_modify.sh ============================================================================== --- head/usr.sbin/pw/tests/pw_modify.sh Tue Oct 28 14:11:54 2014 (r273778) +++ head/usr.sbin/pw/tests/pw_modify.sh Tue Oct 28 14:19:17 2014 (r273779) @@ -38,8 +38,29 @@ groupmod_bug_193704_body() { atf_check -s exit:65 -e match:"^pw: unknown group" -x pw -V ${HOME} groupshow test } +atf_test_case usermod_bug_185666 +usermod_bug_185666_head() { + atf_set "descr" "Regression test for the #185666 bug" +} + +usermod_bug_185666_body() { + populate_etc_skel + atf_check -s exit:0 -x pw -V ${HOME} useradd testuser + atf_check -s exit:0 -x pw -V ${HOME} groupadd testgroup + atf_check -s exit:0 -x pw -V ${HOME} groupadd testgroup2 + atf_check -s exit:0 -x pw -V ${HOME} usermod testuser -G testgroup + atf_check -o inline:"testuser:*:1001:\n" -x pw -V${HOME} groupshow testuser + atf_check -o inline:"testgroup:*:1002:testuser\n" -x pw -V ${HOME} groupshow testgroup + atf_check -o inline:"testgroup2:*:1003:\n" -x pw -V${HOME} groupshow testgroup2 + atf_check -s exit:0 -x pw -V ${HOME} usermod testuser -G testgroup2 + atf_check -o inline:"testuser:*:1001:\n" -x pw -V ${HOME} groupshow testuser + atf_check -o inline:"testgroup:*:1002:\n" -x pw -V ${HOME} groupshow testgroup + atf_check -o inline:"testgroup2:*:1003:testuser\n" -x pw -V ${HOME} groupshow testgroup2 +} + atf_init_test_cases() { atf_add_test_case groupmod_user atf_add_test_case groupmod_invalid_user atf_add_test_case groupmod_bug_193704 + atf_add_test_case usermod_bug_185666 } From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 14:34:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B9A7037C; Tue, 28 Oct 2014 14:34:28 +0000 (UTC) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) by mx1.freebsd.org (Postfix) with ESMTP id 6691E385; Tue, 28 Oct 2014 14:34:28 +0000 (UTC) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 1DEBA5A9F25; Tue, 28 Oct 2014 14:34:28 +0000 (UTC) Date: Tue, 28 Oct 2014 14:34:28 +0000 From: Brooks Davis To: Baptiste Daroussin Subject: Re: svn commit: r273755 - head Message-ID: <20141028143428.GC12109@spindle.one-eyed-alien.net> References: <201410272331.s9RNV8pJ058121@svn.freebsd.org> <20141028065043.GC26796@ivaldir.etoilebsd.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ZmUaFz6apKcXQszQ" Content-Disposition: inline In-Reply-To: <20141028065043.GC26796@ivaldir.etoilebsd.net> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , NGie Cooper X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 14:34:28 -0000 --ZmUaFz6apKcXQszQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 28, 2014 at 07:50:44AM +0100, Baptiste Daroussin wrote: > On Mon, Oct 27, 2014 at 05:26:42PM -0700, NGie Cooper wrote: > > On Mon, Oct 27, 2014 at 4:31 PM, Baptiste Daroussin = wrote: > > > Author: bapt > > > Date: Mon Oct 27 23:31:07 2014 > > > New Revision: 273755 > > > URL: https://svnweb.freebsd.org/changeset/base/273755 > > > > > > Log: > > > Rename XFLAGS to XCFLAGS and XXFLAGS to XCXXFLAGS > > > > > > This is less confusing names and actually more reflexting what they= are intended > > > to. > > > > > > Discussed with: brooks > >=20 > > Add an UPDATING entry? >=20 > Well XCFLAGS and XCXXFLAGS are inernal only and concerning a feature (ext= ernal > toolchain) which is still WIP so it is worth adding an UPDATING entry? Probably not. It isn't documented on the wiki page and I've never needed to use it when using the other X* variables in several different scenerios. -- Brooks --ZmUaFz6apKcXQszQ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlRPqXMACgkQXY6L6fI4GtRJrQCfXIJCDQMkyfMKl3Ih5QfzQTY7 wQoAn2+mcnid0Eeb+bp9tbOW7itnQp0o =/lGs -----END PGP SIGNATURE----- --ZmUaFz6apKcXQszQ-- From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 14:48:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0CE577C1; Tue, 28 Oct 2014 14:48:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ECEF56BB; Tue, 28 Oct 2014 14:48:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SEmrbM092436; Tue, 28 Oct 2014 14:48:53 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SEmrrW092434; Tue, 28 Oct 2014 14:48:53 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410281448.s9SEmrrW092434@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 28 Oct 2014 14:48:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273780 - in head: . etc/mtree X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 14:48:54 -0000 Author: emaste Date: Tue Oct 28 14:48:52 2014 New Revision: 273780 URL: https://svnweb.freebsd.org/changeset/base/273780 Log: Add missing /usr/lib/debug directories Directories for /usr/lib{,32}/{i18n,private} were missing from the mtree file, which caused installworld to install the files that should be in the directory as the name of the directory. Modified: head/ObsoleteFiles.inc head/etc/mtree/BSD.debug.dist Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Oct 28 14:19:17 2014 (r273779) +++ head/ObsoleteFiles.inc Tue Oct 28 14:48:52 2014 (r273780) @@ -38,6 +38,11 @@ # xargs -n1 | sort | uniq -d; # done +# 20141028: debug files accidentally installed as directory name +OLD_FILES+=usr/lib/debug/usr/lib/i18n +OLD_FILES+=usr/lib/debug/usr/lib/private +OLD_FILES+=usr/lib/debug/usr/lib32/i18n +OLD_FILES+=usr/lib/debug/usr/lib32/private # 20141015: OpenSSL 1.0.1j import OLD_FILES+=usr/share/openssl/man/man3/CMS_sign_add1_signer.3.gz # 20140922: sleepq_calc_signal_retval.9 and sleepq_catch_signals.9 removed Modified: head/etc/mtree/BSD.debug.dist ============================================================================== --- head/etc/mtree/BSD.debug.dist Tue Oct 28 14:19:17 2014 (r273779) +++ head/etc/mtree/BSD.debug.dist Tue Oct 28 14:48:52 2014 (r273780) @@ -26,8 +26,16 @@ lib engines .. + i18n + .. + private + .. .. lib32 + i18n + .. + private + .. .. libexec bsdinstall From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 14:54:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2D73DAA6; Tue, 28 Oct 2014 14:54:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3D347F2; Tue, 28 Oct 2014 14:54:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SEs5Id098827; Tue, 28 Oct 2014 14:54:05 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SEs5kb098825; Tue, 28 Oct 2014 14:54:05 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410281454.s9SEs5kb098825@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 28 Oct 2014 14:54:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273782 - in head/usr.sbin/pw: . tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 14:54:06 -0000 Author: bapt Date: Tue Oct 28 14:54:04 2014 New Revision: 273782 URL: https://svnweb.freebsd.org/changeset/base/273782 Log: Do not delete the group wheel when bad argument is passed to pw groupdel -g Check that the -g argument is actually a number, if not report an error. This argument is converted without checking with atoi(3) later so without this check it converts any alpha entries into 0 meaning it deletes the group wheel Add a regression test about it PR: 90114 Reported by: bkoenig@cs.tu-berlin.de MFC after: 1 week Modified: head/usr.sbin/pw/pw_group.c head/usr.sbin/pw/tests/pw_delete.sh Modified: head/usr.sbin/pw/pw_group.c ============================================================================== --- head/usr.sbin/pw/pw_group.c Tue Oct 28 14:49:10 2014 (r273781) +++ head/usr.sbin/pw/pw_group.c Tue Oct 28 14:54:04 2014 (r273782) @@ -67,6 +67,11 @@ pw_group(struct userconf * cnf, int mode NULL }; + if (a_gid != NULL) { + if (strspn(a_gid->val, "0123456789") != strlen(a_gid->val)) + errx(EX_USAGE, "-g expects a number"); + } + if (mode == M_LOCK || mode == M_UNLOCK) errx(EX_USAGE, "'lock' command is not available for groups"); Modified: head/usr.sbin/pw/tests/pw_delete.sh ============================================================================== --- head/usr.sbin/pw/tests/pw_delete.sh Tue Oct 28 14:49:10 2014 (r273781) +++ head/usr.sbin/pw/tests/pw_delete.sh Tue Oct 28 14:54:04 2014 (r273782) @@ -18,7 +18,19 @@ rmuser_seperate_group_body() { pw -V ${HOME} userdel test || atf_fail "delete the user" } +atf_test_case group_do_not_delete_wheel_if_group_unkown +group_do_not_delete_wheel_if_group_unkown_head() { + atf_set "descr" "Make sure we do not consider as gid 0 an unknown group" +} + +group_do_not_delete_wheel_if_group_unkown_body() { + populate_etc_skel + atf_check -s exit:0 -o inline:"wheel:*:0:root\n" -x pw -V ${HOME} groupshow wheel + atf_check -e inline:"pw: -g expects a number\n" -s exit:64 -x pw -V ${HOME} groupdel -g I_do_not_exist + atf_check -s exit:0 -o "wheel:*:0:root\n" -x pw -V ${HOME} groupshow wheel +} atf_init_test_cases() { atf_add_test_case rmuser_seperate_group + atf_add_test_case group_do_not_delete_wheel_if_group_unkown } From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 15:22:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0A0BFFF1; Tue, 28 Oct 2014 15:22:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E6A2EAE8; Tue, 28 Oct 2014 15:22:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SFMGH6012986; Tue, 28 Oct 2014 15:22:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SFMEBP012969; Tue, 28 Oct 2014 15:22:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410281522.s9SFMEBP012969@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Oct 2014 15:22:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273783 - in head: share/man/man9 sys/amd64/amd64 sys/arm/include sys/i386/i386 sys/kern sys/mips/include sys/powerpc/powerpc sys/sparc64/include sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 15:22:17 -0000 Author: kib Date: Tue Oct 28 15:22:13 2014 New Revision: 273783 URL: https://svnweb.freebsd.org/changeset/base/273783 Log: Add fueword(9) and casueword(9) functions. They are like fuword(9) and casuword(9), but do not mix value read and indication of fault. I know (or remember) enough assembly to handle x86 and powerpc. For arm, mips and sparc64, implement fueword() and casueword() as wrappers around fuword() and casuword(), which means that the functions cannot distinguish between -1 and fault. On architectures where fueword() and casueword() are native, implement fuword() and casuword() using fueword() and casuword(), to reduce assembly code duplication. Sponsored by: The FreeBSD Foundation Tested by: pho MFC after: 2 weeks (ia64 needs treating) Added: head/share/man/man9/casuword.9 (contents, props changed) Modified: head/share/man/man9/Makefile head/share/man/man9/fetch.9 head/sys/amd64/amd64/support.S head/sys/arm/include/param.h head/sys/i386/i386/support.s head/sys/kern/subr_uio.c head/sys/mips/include/param.h head/sys/powerpc/powerpc/copyinout.c head/sys/sparc64/include/param.h head/sys/sys/systm.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Tue Oct 28 14:54:04 2014 (r273782) +++ head/share/man/man9/Makefile Tue Oct 28 15:22:13 2014 (r273783) @@ -581,6 +581,9 @@ MLINKS+=condvar.9 cv_broadcast.9 \ MLINKS+=config_intrhook.9 config_intrhook_disestablish.9 \ config_intrhook.9 config_intrhook_establish.9 MLINKS+=contigmalloc.9 contigfree.9 +MLINKS+=casuword.9 casueword.9 \ + casuword.9 casueword32.9 \ + casuword.9 casuword32.9 MLINKS+=copy.9 copyin.9 \ copy.9 copyin_nofault.9 \ copy.9 copyinstr.9 \ @@ -688,7 +691,10 @@ MLINKS+=fetch.9 fubyte.9 \ fetch.9 fuword.9 \ fetch.9 fuword16.9 \ fetch.9 fuword32.9 \ - fetch.9 fuword64.9 + fetch.9 fuword64.9 \ + fetch.9 fueword.9 \ + fetch.9 fueword32.9 \ + fetch.9 fueword64.9 MLINKS+=firmware.9 firmware_get.9 \ firmware.9 firmware_put.9 \ firmware.9 firmware_register.9 \ Added: head/share/man/man9/casuword.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/casuword.9 Tue Oct 28 15:22:13 2014 (r273783) @@ -0,0 +1,95 @@ +.\" Copyright (c) 2014 The FreeBSD Foundation +.\" All rights reserved. +.\" +.\" Part of this documentation was written by +.\" Konstantin Belousov under sponsorship +.\" from the FreeBSD Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 21, 2014 +.Dt CASU 9 +.Os +.Sh NAME +.Nm casueword , +.Nm casueword32 , +.Nm casuword , +.Nm casuword32 +.Nd fetch, compare and store data from user-space +.Sh SYNOPSIS +.In sys/types.h +.In sys/systm.h +.Ft int +.Fn casueword "volatile u_long *base" "u_long oldval" "u_long *oldvalp" "u_long newval" +.Ft int +.Fn casueword32 "volatile uint32_t *base" "uint32_t oldval" "uint32_t *oldvalp" "uint32_t newval" +.Ft u_long +.Fn casuword "volatile u_long *base" "u_long oldval" "u_long newval" +.Ft uint32_t +.Fn casuword32 "volatile uint32_t *base" "uint32_t oldval" "uint32_t newval" +.Sh DESCRIPTION +The +.Nm +functions are designed to perform atomic compare-and-swap operation on +the value in the usermode memory of the current process. +.Pp +The +.Nm +routines reads the value from user memory with address +.Pa base , +and compare the value read with +.Pa oldval . +If the values are equal, +.Pa newval +is written to the +.Pa *base . +In case of +.Fn casueword32 +and +.Fn casueword , +old value is stored into the (kernel-mode) variable pointed by +.Pa *oldvalp . +The userspace value must be naturally aligned. +.Pp +The callers of +.Fn casuword +and +.Fn casuword32 +functions cannot distinguish between -1 read from +userspace and function failure. +.Sh RETURN VALUES +The +.Fn casuword +and +.Fn casuword32 +functions return the data fetched or -1 on failure. +The +.Fn casueword +and +.Fn casueword32 +functions return 0 on success and -1 on failure. +.Sh SEE ALSO +.Xr atomic 9 , +.Xr fetch 9 , +.Xr store 9 Modified: head/share/man/man9/fetch.9 ============================================================================== --- head/share/man/man9/fetch.9 Tue Oct 28 14:54:04 2014 (r273782) +++ head/share/man/man9/fetch.9 Tue Oct 28 15:22:13 2014 (r273783) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 5, 2009 +.Dd October 21, 2014 .Dt FETCH 9 .Os .Sh NAME @@ -44,11 +44,13 @@ .Nm fuword , .Nm fuword16 , .Nm fuword32 , -.Nm fuword64 +.Nm fuword64 , +.Nm fueword , +.Nm fueword32 , +.Nm fueword64 .Nd fetch data from user-space .Sh SYNOPSIS .In sys/types.h -.In sys/time.h .In sys/systm.h .Ft int .Fn fubyte "const void *base" @@ -60,27 +62,38 @@ .Fn fuword32 "const void *base" .Ft int64_t .Fn fuword64 "const void *base" +.Ft long +.Fn fueword "const void *base" "long *val" +.Ft int32_t +.Fn fueword32 "const void *base" "int32_t *val" +.Ft int64_t +.Fn fueword64 "const void *base" "int64_t *val" .In sys/resourcevar.h .Ft int .Fn fuswintr "void *base" .Sh DESCRIPTION The .Nm -functions are designed to copy small amounts of data from user-space. +functions are designed to copy small amounts of data from user-space +of the current process. +If read is successful, it is performed atomically. +The data read must be naturally aligned. .Pp The .Nm routines provide the following functionality: -.Bl -tag -width "fuswintr()" +.Bl -tag -width "fueword32()" .It Fn fubyte Fetches a byte of data from the user-space address .Pa base . +The byte read is zero-extended into the results variable. .It Fn fuword -Fetches a word of data from the user-space address +Fetches a word of data (long) from the user-space address .Pa base . .It Fn fuword16 Fetches 16 bits of data from the user-space address .Pa base . +The half-word read is zero-extended into the results variable. .It Fn fuword32 Fetches 32 bits of data from the user-space address .Pa base . @@ -91,11 +104,46 @@ Fetches 64 bits of data from the user-sp Fetches a short word of data from the user-space address .Pa base . This function is safe to call during an interrupt context. +.It Fn fueword +Fetches a word of data (long) from the user-space address +.Pa base +and stores the result in the variable pointed by +.Pa val . +.It Fn fueword32 +Fetches 32 bits of data from the user-space address +.Pa base +and stores the result in the variable pointed by +.Pa val . +.It Fn fueword64 +Fetches 64 bits of data from the user-space address +.Pa base +and stores the result in the variable pointed by +.Pa val . .El +.Pp +The callers of +.Fn fuword , +.Fn fuword32 +and +.Fn fuword64 +functions cannot distinguish between -1 read from +userspace and function failure. .Sh RETURN VALUES The -.Nm +.Fn fubyte , +.Fn fuword , +.Fn fuword16 , +.Fn fuword32 , +.Fn fuword64 , +and +.Fn fuswintr functions return the data fetched or -1 on failure. +The +.Fn fueword , +.Fn fueword32 +and +.Fn fueword64 +functions return 0 on success and -1 on failure. .Sh SEE ALSO .Xr copy 9 , .Xr store 9 Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Tue Oct 28 14:54:04 2014 (r273782) +++ head/sys/amd64/amd64/support.S Tue Oct 28 15:22:13 2014 (r273783) @@ -312,12 +312,13 @@ copyin_fault: END(copyin) /* - * casuword32. Compare and set user integer. Returns -1 or the current value. - * dst = %rdi, old = %rsi, new = %rdx + * casueword32. Compare and set user integer. Returns -1 on fault, + * 0 if access was successful. Old value is written to *oldp. + * dst = %rdi, old = %esi, oldp = %rdx, new = %ecx */ -ENTRY(casuword32) - movq PCPU(CURPCB),%rcx - movq $fusufault,PCB_ONFAULT(%rcx) +ENTRY(casueword32) + movq PCPU(CURPCB),%r8 + movq $fusufault,PCB_ONFAULT(%r8) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rdi /* verify address is valid */ @@ -327,26 +328,34 @@ ENTRY(casuword32) #ifdef SMP lock #endif - cmpxchgl %edx,(%rdi) /* new = %edx */ + cmpxchgl %ecx,(%rdi) /* new = %ecx */ /* * The old value is in %eax. If the store succeeded it will be the * value we expected (old) from before the store, otherwise it will - * be the current value. + * be the current value. Save %eax into %esi to prepare the return + * value. */ + movl %eax,%esi + xorl %eax,%eax + movq %rax,PCB_ONFAULT(%r8) - movq PCPU(CURPCB),%rcx - movq $0,PCB_ONFAULT(%rcx) + /* + * Access the oldp after the pcb_onfault is cleared, to correctly + * catch corrupted pointer. + */ + movl %esi,(%rdx) /* oldp = %rdx */ ret -END(casuword32) +END(casueword32) /* - * casuword. Compare and set user word. Returns -1 or the current value. - * dst = %rdi, old = %rsi, new = %rdx + * casueword. Compare and set user long. Returns -1 on fault, + * 0 if access was successful. Old value is written to *oldp. + * dst = %rdi, old = %rsi, oldp = %rdx, new = %rcx */ -ENTRY(casuword) - movq PCPU(CURPCB),%rcx - movq $fusufault,PCB_ONFAULT(%rcx) +ENTRY(casueword) + movq PCPU(CURPCB),%r8 + movq $fusufault,PCB_ONFAULT(%r8) movq $VM_MAXUSER_ADDRESS-4,%rax cmpq %rax,%rdi /* verify address is valid */ @@ -356,28 +365,28 @@ ENTRY(casuword) #ifdef SMP lock #endif - cmpxchgq %rdx,(%rdi) /* new = %rdx */ + cmpxchgq %rcx,(%rdi) /* new = %rcx */ /* - * The old value is in %eax. If the store succeeded it will be the + * The old value is in %rax. If the store succeeded it will be the * value we expected (old) from before the store, otherwise it will * be the current value. */ - - movq PCPU(CURPCB),%rcx - movq $fusufault,PCB_ONFAULT(%rcx) - movq $0,PCB_ONFAULT(%rcx) + movq %rax,%rsi + xorl %eax,%eax + movq %rax,PCB_ONFAULT(%r8) + movq %rsi,(%rdx) ret -END(casuword) +END(casueword) /* * Fetch (load) a 64-bit word, a 32-bit word, a 16-bit word, or an 8-bit - * byte from user memory. All these functions are MPSAFE. - * addr = %rdi + * byte from user memory. + * addr = %rdi, valp = %rsi */ -ALTENTRY(fuword64) -ENTRY(fuword) +ALTENTRY(fueword64) +ENTRY(fueword) movq PCPU(CURPCB),%rcx movq $fusufault,PCB_ONFAULT(%rcx) @@ -385,13 +394,15 @@ ENTRY(fuword) cmpq %rax,%rdi /* verify address is valid */ ja fusufault - movq (%rdi),%rax - movq $0,PCB_ONFAULT(%rcx) + xorl %eax,%eax + movq (%rdi),%r11 + movq %rax,PCB_ONFAULT(%rcx) + movq %r11,(%rsi) ret END(fuword64) END(fuword) -ENTRY(fuword32) +ENTRY(fueword32) movq PCPU(CURPCB),%rcx movq $fusufault,PCB_ONFAULT(%rcx) @@ -399,10 +410,12 @@ ENTRY(fuword32) cmpq %rax,%rdi /* verify address is valid */ ja fusufault - movl (%rdi),%eax - movq $0,PCB_ONFAULT(%rcx) + xorl %eax,%eax + movl (%rdi),%r11d + movq %rax,PCB_ONFAULT(%rcx) + movl %r11d,(%rsi) ret -END(fuword32) +END(fueword32) /* * fuswintr() and suswintr() are specialized variants of fuword16() and Modified: head/sys/arm/include/param.h ============================================================================== --- head/sys/arm/include/param.h Tue Oct 28 14:54:04 2014 (r273782) +++ head/sys/arm/include/param.h Tue Oct 28 15:22:13 2014 (r273783) @@ -149,4 +149,8 @@ #define pgtok(x) ((x) * (PAGE_SIZE / 1024)) +#ifdef _KERNEL +#define NO_FUEWORD 1 +#endif + #endif /* !_ARM_INCLUDE_PARAM_H_ */ Modified: head/sys/i386/i386/support.s ============================================================================== --- head/sys/i386/i386/support.s Tue Oct 28 14:54:04 2014 (r273782) +++ head/sys/i386/i386/support.s Tue Oct 28 15:22:13 2014 (r273783) @@ -389,16 +389,16 @@ copyin_fault: ret /* - * casuword. Compare and set user word. Returns -1 or the current value. + * casueword. Compare and set user word. Returns -1 on fault, + * 0 on non-faulting access. The current value is in *oldp. */ - -ALTENTRY(casuword32) -ENTRY(casuword) +ALTENTRY(casueword32) +ENTRY(casueword) movl PCPU(CURPCB),%ecx movl $fusufault,PCB_ONFAULT(%ecx) movl 4(%esp),%edx /* dst */ movl 8(%esp),%eax /* old */ - movl 12(%esp),%ecx /* new */ + movl 16(%esp),%ecx /* new */ cmpl $VM_MAXUSER_ADDRESS-4,%edx /* verify address is valid */ ja fusufault @@ -416,17 +416,20 @@ ENTRY(casuword) movl PCPU(CURPCB),%ecx movl $0,PCB_ONFAULT(%ecx) + movl 12(%esp),%edx /* oldp */ + movl %eax,(%edx) + xorl %eax,%eax ret -END(casuword32) -END(casuword) +END(casueword32) +END(casueword) /* * Fetch (load) a 32-bit word, a 16-bit word, or an 8-bit byte from user - * memory. All these functions are MPSAFE. + * memory. */ -ALTENTRY(fuword32) -ENTRY(fuword) +ALTENTRY(fueword32) +ENTRY(fueword) movl PCPU(CURPCB),%ecx movl $fusufault,PCB_ONFAULT(%ecx) movl 4(%esp),%edx /* from */ @@ -436,9 +439,12 @@ ENTRY(fuword) movl (%edx),%eax movl $0,PCB_ONFAULT(%ecx) + movl 8(%esp),%edx + movl %eax,(%edx) + xorl %eax,%eax ret -END(fuword32) -END(fuword) +END(fueword32) +END(fueword) /* * fuswintr() and suswintr() are specialized variants of fuword16() and Modified: head/sys/kern/subr_uio.c ============================================================================== --- head/sys/kern/subr_uio.c Tue Oct 28 14:54:04 2014 (r273782) +++ head/sys/kern/subr_uio.c Tue Oct 28 15:22:13 2014 (r273783) @@ -7,6 +7,11 @@ * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * + * Copyright (c) 2014 The FreeBSD Foundation + * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -438,3 +443,128 @@ copyout_unmap(struct thread *td, vm_offs return (0); } + +#ifdef NO_FUEWORD +/* + * XXXKIB The temporal implementation of fue*() functions which do not + * handle usermode -1 properly, mixing it with the fault code. Keep + * this until MD code is written. Currently sparc64, mips and arm do + * not have proper implementation. + */ + +int +fueword(const void *base, long *val) +{ + long res; + + res = fuword(base); + if (res == -1) + return (-1); + *val = res; + return (0); +} + +int +fueword32(const void *base, int32_t *val) +{ + int32_t res; + + res = fuword32(base); + if (res == -1) + return (-1); + *val = res; + return (0); +} + +#ifdef _LP64 +int +fueword64(const void *base, int64_t *val) +{ + int32_t res; + + res = fuword64(base); + if (res == -1) + return (-1); + *val = res; + return (0); +} +#endif + +int +casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp, + uint32_t newval) +{ + int32_t ov; + + ov = casuword32(base, oldval, newval); + if (ov == -1) + return (-1); + *oldvalp = ov; + return (0); +} + +int +casueword(volatile u_long *p, u_long oldval, u_long *oldvalp, u_long newval) +{ + u_long ov; + + ov = casuword(p, oldval, newval); + if (ov == -1) + return (-1); + *oldvalp = ov; + return (0); +} +#else /* NO_FUEWORD */ +int32_t +fuword32(const void *addr) +{ + int rv; + int32_t val; + + rv = fueword32(addr, &val); + return (rv == -1 ? -1 : val); +} + +#ifdef _LP64 +int64_t +fuword64(const void *addr) +{ + int rv; + int64_t val; + + rv = fueword64(addr, &val); + return (rv == -1 ? -1 : val); +} +#endif /* _LP64 */ + +long +fuword(const void *addr) +{ + long val; + int rv; + + rv = fueword(addr, &val); + return (rv == -1 ? -1 : val); +} + +uint32_t +casuword32(volatile uint32_t *addr, uint32_t old, uint32_t new) +{ + int rv; + uint32_t val; + + rv = casueword32(addr, old, &val, new); + return (rv == -1 ? -1 : val); +} + +u_long +casuword(volatile u_long *addr, u_long old, u_long new) +{ + int rv; + u_long val; + + rv = casueword(addr, old, &val, new); + return (rv == -1 ? -1 : val); +} + +#endif /* NO_FUEWORD */ Modified: head/sys/mips/include/param.h ============================================================================== --- head/sys/mips/include/param.h Tue Oct 28 14:54:04 2014 (r273782) +++ head/sys/mips/include/param.h Tue Oct 28 15:22:13 2014 (r273783) @@ -178,4 +178,8 @@ #define pgtok(x) ((x) * (PAGE_SIZE / 1024)) +#ifdef _KERNEL +#define NO_FUEWORD 1 +#endif + #endif /* !_MIPS_INCLUDE_PARAM_H_ */ Modified: head/sys/powerpc/powerpc/copyinout.c ============================================================================== --- head/sys/powerpc/powerpc/copyinout.c Tue Oct 28 14:54:04 2014 (r273782) +++ head/sys/powerpc/powerpc/copyinout.c Tue Oct 28 15:22:13 2014 (r273783) @@ -405,14 +405,13 @@ fubyte(const void *addr) return (val); } -#ifdef __powerpc64__ -int32_t -fuword32(const void *addr) +int +fuword16(const void *addr) { struct thread *td; pmap_t pm; faultbuf env; - int32_t *p, val; + uint16_t *p, val; td = curthread; pm = &td->td_proc->p_vmspace->vm_pmap; @@ -432,15 +431,14 @@ fuword32(const void *addr) td->td_pcb->pcb_onfault = NULL; return (val); } -#endif -long -fuword(const void *addr) +int +fueword32(const void *addr, int32_t *val) { struct thread *td; pmap_t pm; faultbuf env; - long *p, val; + int32_t *p; td = curthread; pm = &td->td_proc->p_vmspace->vm_pmap; @@ -455,22 +453,71 @@ fuword(const void *addr) return (-1); } - val = *p; + *val = *p; td->td_pcb->pcb_onfault = NULL; - return (val); + return (0); } -#ifndef __powerpc64__ -int32_t -fuword32(const void *addr) +#ifdef __powerpc64__ +int +fueword64(const void *addr, int64_t *val) { - return ((int32_t)fuword(addr)); + struct thread *td; + pmap_t pm; + faultbuf env; + int64_t *p; + + td = curthread; + pm = &td->td_proc->p_vmspace->vm_pmap; + + if (setfault(env)) { + td->td_pcb->pcb_onfault = NULL; + return (-1); + } + + if (map_user_ptr(pm, addr, (void **)&p, sizeof(*p), NULL)) { + td->td_pcb->pcb_onfault = NULL; + return (-1); + } + + *val = *p; + + td->td_pcb->pcb_onfault = NULL; + return (0); } #endif -uint32_t -casuword32(volatile uint32_t *addr, uint32_t old, uint32_t new) +int +fueword(const void *addr, long *val) +{ + struct thread *td; + pmap_t pm; + faultbuf env; + long *p; + + td = curthread; + pm = &td->td_proc->p_vmspace->vm_pmap; + + if (setfault(env)) { + td->td_pcb->pcb_onfault = NULL; + return (-1); + } + + if (map_user_ptr(pm, addr, (void **)&p, sizeof(*p), NULL)) { + td->td_pcb->pcb_onfault = NULL; + return (-1); + } + + *val = *p; + + td->td_pcb->pcb_onfault = NULL; + return (0); +} + +int +casueword32(volatile uint32_t *addr, uint32_t old, uint32_t *oldvalp, + uint32_t new) { struct thread *td; pmap_t pm; @@ -507,18 +554,21 @@ casuword32(volatile uint32_t *addr, uint td->td_pcb->pcb_onfault = NULL; - return (val); + *oldvalp = val; + return (0); } #ifndef __powerpc64__ -u_long -casuword(volatile u_long *addr, u_long old, u_long new) +int +casueword(volatile u_long *addr, u_long old, u_long *oldvalp, u_long new) { - return (casuword32((volatile uint32_t *)addr, old, new)); + + return (casueword32((volatile uint32_t *)addr, old, + (uint32_t *)oldvalp, new)); } #else -u_long -casuword(volatile u_long *addr, u_long old, u_long new) +int +casueword(volatile u_long *addr, u_long old, u_long *oldvalp, u_long new) { struct thread *td; pmap_t pm; @@ -555,7 +605,7 @@ casuword(volatile u_long *addr, u_long o td->td_pcb->pcb_onfault = NULL; - return (val); + *oldvalp = val; + return (0); } #endif - Modified: head/sys/sparc64/include/param.h ============================================================================== --- head/sys/sparc64/include/param.h Tue Oct 28 14:54:04 2014 (r273782) +++ head/sys/sparc64/include/param.h Tue Oct 28 15:22:13 2014 (r273783) @@ -146,4 +146,8 @@ #define pgtok(x) ((unsigned long)(x) * (PAGE_SIZE / 1024)) +#ifdef _KERNEL +#define NO_FUEWORD 1 +#endif + #endif /* !_SPARC64_INCLUDE_PARAM_H_ */ Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Tue Oct 28 14:54:04 2014 (r273782) +++ head/sys/sys/systm.h Tue Oct 28 15:22:13 2014 (r273783) @@ -254,16 +254,23 @@ int copyout_nofault(const void * __restr int fubyte(const void *base); long fuword(const void *base); -int fuword16(void *base); +int fuword16(const void *base); int32_t fuword32(const void *base); int64_t fuword64(const void *base); +int fueword(const void *base, long *val); +int fueword32(const void *base, int32_t *val); +int fueword64(const void *base, int64_t *val); int subyte(void *base, int byte); int suword(void *base, long word); int suword16(void *base, int word); int suword32(void *base, int32_t word); int suword64(void *base, int64_t word); uint32_t casuword32(volatile uint32_t *base, uint32_t oldval, uint32_t newval); -u_long casuword(volatile u_long *p, u_long oldval, u_long newval); +u_long casuword(volatile u_long *p, u_long oldval, u_long newval); +int casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp, + uint32_t newval); +int casueword(volatile u_long *p, u_long oldval, u_long *oldvalp, + u_long newval); void realitexpire(void *); From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 15:28:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EA67C290; Tue, 28 Oct 2014 15:28:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D552AB54; Tue, 28 Oct 2014 15:28:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SFSMUU013771; Tue, 28 Oct 2014 15:28:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SFSLs2013764; Tue, 28 Oct 2014 15:28:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410281528.s9SFSLs2013764@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Oct 2014 15:28:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273784 - in head/sys: amd64/ia32 compat/freebsd32 i386/i386 kern net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 15:28:23 -0000 Author: kib Date: Tue Oct 28 15:28:20 2014 New Revision: 273784 URL: https://svnweb.freebsd.org/changeset/base/273784 Log: Replace some calls to fuword() by fueword() with proper error checking. Sponsored by: The FreeBSD Foundation Tested by: pho MFC after: 3 weeks Modified: head/sys/amd64/ia32/ia32_syscall.c head/sys/compat/freebsd32/freebsd32_misc.c head/sys/i386/i386/trap.c head/sys/kern/kern_exec.c head/sys/kern/vfs_acl.c head/sys/net/if_spppsubr.c Modified: head/sys/amd64/ia32/ia32_syscall.c ============================================================================== --- head/sys/amd64/ia32/ia32_syscall.c Tue Oct 28 15:22:13 2014 (r273783) +++ head/sys/amd64/ia32/ia32_syscall.c Tue Oct 28 15:28:20 2014 (r273784) @@ -110,7 +110,7 @@ ia32_fetch_syscall_args(struct thread *t struct proc *p; struct trapframe *frame; caddr_t params; - u_int32_t args[8]; + u_int32_t args[8], tmp; int error, i; p = td->td_proc; @@ -126,7 +126,10 @@ ia32_fetch_syscall_args(struct thread *t /* * Code is first argument, followed by actual args. */ - sa->code = fuword32(params); + error = fueword32(params, &tmp); + if (error == -1) + return (EFAULT); + sa->code = tmp; params += sizeof(int); } else if (sa->code == SYS___syscall) { /* @@ -135,7 +138,10 @@ ia32_fetch_syscall_args(struct thread *t * We use a 32-bit fetch in case params is not * aligned. */ - sa->code = fuword32(params); + error = fueword32(params, &tmp); + if (error == -1) + return (EFAULT); + sa->code = tmp; params += sizeof(quad_t); } if (p->p_sysent->sv_mask) Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Tue Oct 28 15:22:13 2014 (r273783) +++ head/sys/compat/freebsd32/freebsd32_misc.c Tue Oct 28 15:28:20 2014 (r273784) @@ -1832,16 +1832,21 @@ freebsd32_sysctl(struct thread *td, stru { int error, name[CTL_MAXNAME]; size_t j, oldlen; + uint32_t tmp; if (uap->namelen > CTL_MAXNAME || uap->namelen < 2) return (EINVAL); error = copyin(uap->name, name, uap->namelen * sizeof(int)); if (error) return (error); - if (uap->oldlenp) - oldlen = fuword32(uap->oldlenp); - else + if (uap->oldlenp) { + error = fueword32(uap->oldlenp, &tmp); + oldlen = tmp; + } else { oldlen = 0; + } + if (error != 0) + return (EFAULT); error = userland_sysctl(td, name, uap->namelen, uap->old, &oldlen, 1, uap->new, uap->newlen, &j, SCTL_MASK32); Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Tue Oct 28 15:22:13 2014 (r273783) +++ head/sys/i386/i386/trap.c Tue Oct 28 15:28:20 2014 (r273784) @@ -1059,6 +1059,7 @@ cpu_fetch_syscall_args(struct thread *td struct proc *p; struct trapframe *frame; caddr_t params; + long tmp; int error; p = td->td_proc; @@ -1074,14 +1075,20 @@ cpu_fetch_syscall_args(struct thread *td /* * Code is first argument, followed by actual args. */ - sa->code = fuword(params); + error = fueword(params, &tmp); + if (error == -1) + return (EFAULT); + sa->code = tmp; params += sizeof(int); } else if (sa->code == SYS___syscall) { /* * Like syscall, but code is a quad, so as to maintain * quad alignment for the rest of the arguments. */ - sa->code = fuword(params); + error = fueword(params, &tmp); + if (error == -1) + return (EFAULT); + sa->code = tmp; params += sizeof(quad_t); } Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Tue Oct 28 15:22:13 2014 (r273783) +++ head/sys/kern/kern_exec.c Tue Oct 28 15:28:20 2014 (r273784) @@ -1091,7 +1091,7 @@ int exec_copyin_args(struct image_args *args, char *fname, enum uio_seg segflg, char **argv, char **envv) { - char *argp, *envp; + u_long argp, envp; int error; size_t length; @@ -1127,13 +1127,17 @@ exec_copyin_args(struct image_args *args /* * extract arguments first */ - while ((argp = (caddr_t) (intptr_t) fuword(argv++))) { - if (argp == (caddr_t) -1) { + for (;;) { + error = fueword(argv++, &argp); + if (error == -1) { error = EFAULT; goto err_exit; } - if ((error = copyinstr(argp, args->endp, - args->stringspace, &length))) { + if (argp == 0) + break; + error = copyinstr((void *)(uintptr_t)argp, args->endp, + args->stringspace, &length); + if (error != 0) { if (error == ENAMETOOLONG) error = E2BIG; goto err_exit; @@ -1149,13 +1153,17 @@ exec_copyin_args(struct image_args *args * extract environment strings */ if (envv) { - while ((envp = (caddr_t)(intptr_t)fuword(envv++))) { - if (envp == (caddr_t)-1) { + for (;;) { + error = fueword(envv++, &envp); + if (error == -1) { error = EFAULT; goto err_exit; } - if ((error = copyinstr(envp, args->endp, - args->stringspace, &length))) { + if (envp == 0) + break; + error = copyinstr((void *)(uintptr_t)envp, + args->endp, args->stringspace, &length); + if (error != 0) { if (error == ENAMETOOLONG) error = E2BIG; goto err_exit; Modified: head/sys/kern/vfs_acl.c ============================================================================== --- head/sys/kern/vfs_acl.c Tue Oct 28 15:22:13 2014 (r273783) +++ head/sys/kern/vfs_acl.c Tue Oct 28 15:28:20 2014 (r273784) @@ -148,6 +148,7 @@ acl_copyin(void *user_acl, struct acl *k static int acl_copyout(struct acl *kernel_acl, void *user_acl, acl_type_t type) { + uint32_t am; int error; struct oldacl old; @@ -162,8 +163,11 @@ acl_copyout(struct acl *kernel_acl, void break; default: - if (fuword32((char *)user_acl + - offsetof(struct acl, acl_maxcnt)) != ACL_MAX_ENTRIES) + error = fueword32((char *)user_acl + + offsetof(struct acl, acl_maxcnt), &am); + if (error == -1) + return (EFAULT); + if (am != ACL_MAX_ENTRIES) return (EINVAL); error = copyout(kernel_acl, user_acl, sizeof(*kernel_acl)); Modified: head/sys/net/if_spppsubr.c ============================================================================== --- head/sys/net/if_spppsubr.c Tue Oct 28 15:22:13 2014 (r273783) +++ head/sys/net/if_spppsubr.c Tue Oct 28 15:28:20 2014 (r273784) @@ -5060,7 +5060,8 @@ sppp_params(struct sppp *sp, u_long cmd, * Check the cmd word first before attempting to fetch all the * data. */ - if ((subcmd = fuword(ifr->ifr_data)) == -1) { + rv = fueword(ifr->ifr_data, &subcmd); + if (rv == -1) { rv = EFAULT; goto quit; } From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 15:30:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5EBAE403; Tue, 28 Oct 2014 15:30:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A42EB71; Tue, 28 Oct 2014 15:30:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SFUYh4015692; Tue, 28 Oct 2014 15:30:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SFUYBd015691; Tue, 28 Oct 2014 15:30:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410281530.s9SFUYBd015691@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Oct 2014 15:30:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273785 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 15:30:34 -0000 Author: kib Date: Tue Oct 28 15:30:33 2014 New Revision: 273785 URL: https://svnweb.freebsd.org/changeset/base/273785 Log: Convert kern_umtx.c to use fueword() and casueword(). Also fix some mishandling of suword(9) errors as errno, which resulted in spurious ERESTART. Sponsored by: The FreeBSD Foundation Tested by: pho MFC after: 3 weeks Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Tue Oct 28 15:28:20 2014 (r273784) +++ head/sys/kern/kern_umtx.c Tue Oct 28 15:30:33 2014 (r273785) @@ -510,6 +510,15 @@ umtxq_unbusy(struct umtx_key *key) wakeup_one(uc); } +static inline void +umtxq_unbusy_unlocked(struct umtx_key *key) +{ + + umtxq_lock(key); + umtxq_unbusy(key); + umtxq_unlock(key); +} + static struct umtxq_queue * umtxq_queue_lookup(struct umtx_key *key, int q) { @@ -847,6 +856,7 @@ do_wait(struct thread *td, void *addr, u struct abs_timeout timo; struct umtx_q *uq; u_long tmp; + uint32_t tmp32; int error = 0; uq = td->td_umtxq; @@ -860,18 +870,29 @@ do_wait(struct thread *td, void *addr, u umtxq_lock(&uq->uq_key); umtxq_insert(uq); umtxq_unlock(&uq->uq_key); - if (compat32 == 0) - tmp = fuword(addr); - else - tmp = (unsigned int)fuword32(addr); + if (compat32 == 0) { + error = fueword(addr, &tmp); + if (error != 0) + error = EFAULT; + } else { + error = fueword32(addr, &tmp32); + if (error == 0) + tmp = tmp32; + else + error = EFAULT; + } umtxq_lock(&uq->uq_key); - if (tmp == id) - error = umtxq_sleep(uq, "uwait", timeout == NULL ? - NULL : &timo); - if ((uq->uq_flags & UQF_UMTXQ) == 0) - error = 0; - else + if (error == 0) { + if (tmp == id) + error = umtxq_sleep(uq, "uwait", timeout == NULL ? + NULL : &timo); + if ((uq->uq_flags & UQF_UMTXQ) == 0) + error = 0; + else + umtxq_remove(uq); + } else if ((uq->uq_flags & UQF_UMTXQ) != 0) { umtxq_remove(uq); + } umtxq_unlock(&uq->uq_key); umtx_key_release(&uq->uq_key); if (error == ERESTART) @@ -908,11 +929,11 @@ do_lock_normal(struct thread *td, struct struct abs_timeout timo; struct umtx_q *uq; uint32_t owner, old, id; - int error = 0; + int error, rv; id = td->td_tid; uq = td->td_umtxq; - + error = 0; if (timeout != NULL) abs_timeout_init2(&timo, timeout); @@ -921,7 +942,9 @@ do_lock_normal(struct thread *td, struct * can fault on any access. */ for (;;) { - owner = fuword32(__DEVOLATILE(void *, &m->m_owner)); + rv = fueword32(__DEVOLATILE(void *, &m->m_owner), &owner); + if (rv == -1) + return (EFAULT); if (mode == _UMUTEX_WAIT) { if (owner == UMUTEX_UNOWNED || owner == UMUTEX_CONTESTED) return (0); @@ -929,31 +952,31 @@ do_lock_normal(struct thread *td, struct /* * Try the uncontested case. This should be done in userland. */ - owner = casuword32(&m->m_owner, UMUTEX_UNOWNED, id); + rv = casueword32(&m->m_owner, UMUTEX_UNOWNED, + &owner, id); + /* The address was invalid. */ + if (rv == -1) + return (EFAULT); /* The acquire succeeded. */ if (owner == UMUTEX_UNOWNED) return (0); - /* The address was invalid. */ - if (owner == -1) - return (EFAULT); - /* If no one owns it but it is contested try to acquire it. */ if (owner == UMUTEX_CONTESTED) { - owner = casuword32(&m->m_owner, - UMUTEX_CONTESTED, id | UMUTEX_CONTESTED); + rv = casueword32(&m->m_owner, + UMUTEX_CONTESTED, &owner, + id | UMUTEX_CONTESTED); + /* The address was invalid. */ + if (rv == -1) + return (EFAULT); if (owner == UMUTEX_CONTESTED) return (0); - /* The address was invalid. */ - if (owner == -1) - return (EFAULT); - - error = umtxq_check_susp(td); - if (error != 0) - return (error); + rv = umtxq_check_susp(td); + if (rv != 0) + return (rv); /* If this failed the lock has changed, restart. */ continue; @@ -985,10 +1008,11 @@ do_lock_normal(struct thread *td, struct * either some one else has acquired the lock or it has been * released. */ - old = casuword32(&m->m_owner, owner, owner | UMUTEX_CONTESTED); + rv = casueword32(&m->m_owner, owner, &old, + owner | UMUTEX_CONTESTED); /* The address was invalid. */ - if (old == -1) { + if (rv == -1) { umtxq_lock(&uq->uq_key); umtxq_remove(uq); umtxq_unbusy(&uq->uq_key); @@ -1033,16 +1057,16 @@ do_unlock_normal(struct thread *td, stru /* * Make sure we own this mtx. */ - owner = fuword32(__DEVOLATILE(uint32_t *, &m->m_owner)); - if (owner == -1) + error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), &owner); + if (error == -1) return (EFAULT); if ((owner & ~UMUTEX_CONTESTED) != id) return (EPERM); if ((owner & UMUTEX_CONTESTED) == 0) { - old = casuword32(&m->m_owner, owner, UMUTEX_UNOWNED); - if (old == -1) + error = casueword32(&m->m_owner, owner, &old, UMUTEX_UNOWNED); + if (error == -1) return (EFAULT); if (old == owner) return (0); @@ -1064,14 +1088,14 @@ do_unlock_normal(struct thread *td, stru * there is zero or one thread only waiting for it. * Otherwise, it must be marked as contested. */ - old = casuword32(&m->m_owner, owner, - count <= 1 ? UMUTEX_UNOWNED : UMUTEX_CONTESTED); + error = casueword32(&m->m_owner, owner, &old, + count <= 1 ? UMUTEX_UNOWNED : UMUTEX_CONTESTED); umtxq_lock(&key); umtxq_signal(&key,1); umtxq_unbusy(&key); umtxq_unlock(&key); umtx_key_release(&key); - if (old == -1) + if (error == -1) return (EFAULT); if (old != owner) return (EINVAL); @@ -1091,14 +1115,16 @@ do_wake_umutex(struct thread *td, struct int error; int count; - owner = fuword32(__DEVOLATILE(uint32_t *, &m->m_owner)); - if (owner == -1) + error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), &owner); + if (error == -1) return (EFAULT); if ((owner & ~UMUTEX_CONTESTED) != 0) return (0); - flags = fuword32(&m->m_flags); + error = fueword32(&m->m_flags, &flags); + if (error == -1) + return (EFAULT); /* We should only ever be in here for contested locks */ if ((error = umtx_key_get(m, TYPE_NORMAL_UMUTEX, GET_SHARE(flags), @@ -1110,16 +1136,20 @@ do_wake_umutex(struct thread *td, struct count = umtxq_count(&key); umtxq_unlock(&key); - if (count <= 1) - owner = casuword32(&m->m_owner, UMUTEX_CONTESTED, UMUTEX_UNOWNED); + if (count <= 1) { + error = casueword32(&m->m_owner, UMUTEX_CONTESTED, &owner, + UMUTEX_UNOWNED); + if (error == -1) + error = EFAULT; + } umtxq_lock(&key); - if (count != 0 && (owner & ~UMUTEX_CONTESTED) == 0) + if (error == 0 && count != 0 && (owner & ~UMUTEX_CONTESTED) == 0) umtxq_signal(&key, 1); umtxq_unbusy(&key); umtxq_unlock(&key); umtx_key_release(&key); - return (0); + return (error); } /* @@ -1162,41 +1192,49 @@ do_wake2_umutex(struct thread *td, struc * any memory. */ if (count > 1) { - owner = fuword32(__DEVOLATILE(uint32_t *, &m->m_owner)); - while ((owner & UMUTEX_CONTESTED) ==0) { - old = casuword32(&m->m_owner, owner, - owner|UMUTEX_CONTESTED); + error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), + &owner); + if (error == -1) + error = EFAULT; + while (error == 0 && (owner & UMUTEX_CONTESTED) == 0) { + error = casueword32(&m->m_owner, owner, &old, + owner | UMUTEX_CONTESTED); + if (error == -1) { + error = EFAULT; + break; + } if (old == owner) break; owner = old; - if (old == -1) - break; error = umtxq_check_susp(td); if (error != 0) break; } } else if (count == 1) { - owner = fuword32(__DEVOLATILE(uint32_t *, &m->m_owner)); - while ((owner & ~UMUTEX_CONTESTED) != 0 && + error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), + &owner); + if (error == -1) + error = EFAULT; + while (error == 0 && (owner & ~UMUTEX_CONTESTED) != 0 && (owner & UMUTEX_CONTESTED) == 0) { - old = casuword32(&m->m_owner, owner, - owner|UMUTEX_CONTESTED); + error = casueword32(&m->m_owner, owner, &old, + owner | UMUTEX_CONTESTED); + if (error == -1) { + error = EFAULT; + break; + } if (old == owner) break; owner = old; - if (old == -1) - break; error = umtxq_check_susp(td); if (error != 0) break; } } umtxq_lock(&key); - if (owner == -1) { - error = EFAULT; + if (error == EFAULT) { umtxq_signal(&key, INT_MAX); - } - else if (count != 0 && (owner & ~UMUTEX_CONTESTED) == 0) + } else if (count != 0 && (owner & ~UMUTEX_CONTESTED) == 0) umtxq_signal(&key, 1); umtxq_unbusy(&key); umtxq_unlock(&key); @@ -1576,7 +1614,7 @@ do_lock_pi(struct thread *td, struct umu struct umtx_q *uq; struct umtx_pi *pi, *new_pi; uint32_t id, owner, old; - int error; + int error, rv; id = td->td_tid; uq = td->td_umtxq; @@ -1619,7 +1657,12 @@ do_lock_pi(struct thread *td, struct umu /* * Try the uncontested case. This should be done in userland. */ - owner = casuword32(&m->m_owner, UMUTEX_UNOWNED, id); + rv = casueword32(&m->m_owner, UMUTEX_UNOWNED, &owner, id); + /* The address was invalid. */ + if (rv == -1) { + error = EFAULT; + break; + } /* The acquire succeeded. */ if (owner == UMUTEX_UNOWNED) { @@ -1627,16 +1670,15 @@ do_lock_pi(struct thread *td, struct umu break; } - /* The address was invalid. */ - if (owner == -1) { - error = EFAULT; - break; - } - /* If no one owns it but it is contested try to acquire it. */ if (owner == UMUTEX_CONTESTED) { - owner = casuword32(&m->m_owner, - UMUTEX_CONTESTED, id | UMUTEX_CONTESTED); + rv = casueword32(&m->m_owner, + UMUTEX_CONTESTED, &owner, id | UMUTEX_CONTESTED); + /* The address was invalid. */ + if (rv == -1) { + error = EFAULT; + break; + } if (owner == UMUTEX_CONTESTED) { umtxq_lock(&uq->uq_key); @@ -1647,12 +1689,6 @@ do_lock_pi(struct thread *td, struct umu break; } - /* The address was invalid. */ - if (owner == -1) { - error = EFAULT; - break; - } - error = umtxq_check_susp(td); if (error != 0) break; @@ -1683,13 +1719,12 @@ do_lock_pi(struct thread *td, struct umu * either some one else has acquired the lock or it has been * released. */ - old = casuword32(&m->m_owner, owner, owner | UMUTEX_CONTESTED); + rv = casueword32(&m->m_owner, owner, &old, + owner | UMUTEX_CONTESTED); /* The address was invalid. */ - if (old == -1) { - umtxq_lock(&uq->uq_key); - umtxq_unbusy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + if (rv == -1) { + umtxq_unbusy_unlocked(&uq->uq_key); error = EFAULT; break; } @@ -1741,8 +1776,8 @@ do_unlock_pi(struct thread *td, struct u /* * Make sure we own this mtx. */ - owner = fuword32(__DEVOLATILE(uint32_t *, &m->m_owner)); - if (owner == -1) + error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), &owner); + if (error == -1) return (EFAULT); if ((owner & ~UMUTEX_CONTESTED) != id) @@ -1750,8 +1785,8 @@ do_unlock_pi(struct thread *td, struct u /* This should be done in userland */ if ((owner & UMUTEX_CONTESTED) == 0) { - old = casuword32(&m->m_owner, owner, UMUTEX_UNOWNED); - if (old == -1) + error = casueword32(&m->m_owner, owner, &old, UMUTEX_UNOWNED); + if (error == -1) return (EFAULT); if (old == owner) return (0); @@ -1809,14 +1844,12 @@ do_unlock_pi(struct thread *td, struct u * there is zero or one thread only waiting for it. * Otherwise, it must be marked as contested. */ - old = casuword32(&m->m_owner, owner, - count <= 1 ? UMUTEX_UNOWNED : UMUTEX_CONTESTED); + error = casueword32(&m->m_owner, owner, &old, + count <= 1 ? UMUTEX_UNOWNED : UMUTEX_CONTESTED); - umtxq_lock(&key); - umtxq_unbusy(&key); - umtxq_unlock(&key); + umtxq_unbusy_unlocked(&key); umtx_key_release(&key); - if (old == -1) + if (error == -1) return (EFAULT); if (old != owner) return (EINVAL); @@ -1835,7 +1868,7 @@ do_lock_pp(struct thread *td, struct umu struct umtx_pi *pi; uint32_t ceiling; uint32_t owner, id; - int error, pri, old_inherited_pri, su; + int error, pri, old_inherited_pri, su, rv; id = td->td_tid; uq = td->td_umtxq; @@ -1853,7 +1886,12 @@ do_lock_pp(struct thread *td, struct umu umtxq_busy(&uq->uq_key); umtxq_unlock(&uq->uq_key); - ceiling = RTP_PRIO_MAX - fuword32(&m->m_ceilings[0]); + rv = fueword32(&m->m_ceilings[0], &ceiling); + if (rv == -1) { + error = EFAULT; + goto out; + } + ceiling = RTP_PRIO_MAX - ceiling; if (ceiling > RTP_PRIO_MAX) { error = EINVAL; goto out; @@ -1874,17 +1912,16 @@ do_lock_pp(struct thread *td, struct umu } mtx_unlock_spin(&umtx_lock); - owner = casuword32(&m->m_owner, - UMUTEX_CONTESTED, id | UMUTEX_CONTESTED); - - if (owner == UMUTEX_CONTESTED) { - error = 0; + rv = casueword32(&m->m_owner, + UMUTEX_CONTESTED, &owner, id | UMUTEX_CONTESTED); + /* The address was invalid. */ + if (rv == -1) { + error = EFAULT; break; } - /* The address was invalid. */ - if (owner == -1) { - error = EFAULT; + if (owner == UMUTEX_CONTESTED) { + error = 0; break; } @@ -1946,9 +1983,7 @@ do_lock_pp(struct thread *td, struct umu } out: - umtxq_lock(&uq->uq_key); - umtxq_unbusy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_unbusy_unlocked(&uq->uq_key); umtx_key_release(&uq->uq_key); return (error); } @@ -1973,8 +2008,8 @@ do_unlock_pp(struct thread *td, struct u /* * Make sure we own this mtx. */ - owner = fuword32(__DEVOLATILE(uint32_t *, &m->m_owner)); - if (owner == -1) + error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), &owner); + if (error == -1) return (EFAULT); if ((owner & ~UMUTEX_CONTESTED) != id) @@ -2047,9 +2082,11 @@ do_set_ceiling(struct thread *td, struct uint32_t save_ceiling; uint32_t owner, id; uint32_t flags; - int error; + int error, rv; - flags = fuword32(&m->m_flags); + error = fueword32(&m->m_flags, &flags); + if (error == -1) + return (EFAULT); if ((flags & UMUTEX_PRIO_PROTECT) == 0) return (EINVAL); if (ceiling > RTP_PRIO_MAX) @@ -2064,10 +2101,18 @@ do_set_ceiling(struct thread *td, struct umtxq_busy(&uq->uq_key); umtxq_unlock(&uq->uq_key); - save_ceiling = fuword32(&m->m_ceilings[0]); + rv = fueword32(&m->m_ceilings[0], &save_ceiling); + if (rv == -1) { + error = EFAULT; + break; + } - owner = casuword32(&m->m_owner, - UMUTEX_CONTESTED, id | UMUTEX_CONTESTED); + rv = casueword32(&m->m_owner, + UMUTEX_CONTESTED, &owner, id | UMUTEX_CONTESTED); + if (rv == -1) { + error = EFAULT; + break; + } if (owner == UMUTEX_CONTESTED) { suword32(&m->m_ceilings[0], ceiling); @@ -2077,12 +2122,6 @@ do_set_ceiling(struct thread *td, struct break; } - /* The address was invalid. */ - if (owner == -1) { - error = EFAULT; - break; - } - if ((owner & ~UMUTEX_CONTESTED) == id) { suword32(&m->m_ceilings[0], ceiling); error = 0; @@ -2129,8 +2168,8 @@ do_lock_umutex(struct thread *td, struct uint32_t flags; int error; - flags = fuword32(&m->m_flags); - if (flags == -1) + error = fueword32(&m->m_flags, &flags); + if (error == -1) return (EFAULT); switch(flags & (UMUTEX_PRIO_INHERIT | UMUTEX_PRIO_PROTECT)) { @@ -2164,9 +2203,10 @@ static int do_unlock_umutex(struct thread *td, struct umutex *m) { uint32_t flags; + int error; - flags = fuword32(&m->m_flags); - if (flags == -1) + error = fueword32(&m->m_flags, &flags); + if (error == -1) return (EFAULT); switch(flags & (UMUTEX_PRIO_INHERIT | UMUTEX_PRIO_PROTECT)) { @@ -2187,21 +2227,27 @@ do_cv_wait(struct thread *td, struct uco { struct abs_timeout timo; struct umtx_q *uq; - uint32_t flags; - uint32_t clockid; + uint32_t flags, clockid, hasw; int error; uq = td->td_umtxq; - flags = fuword32(&cv->c_flags); + error = fueword32(&cv->c_flags, &flags); + if (error == -1) + return (EFAULT); error = umtx_key_get(cv, TYPE_CV, GET_SHARE(flags), &uq->uq_key); if (error != 0) return (error); if ((wflags & CVWAIT_CLOCKID) != 0) { - clockid = fuword32(&cv->c_clockid); + error = fueword32(&cv->c_clockid, &clockid); + if (error == -1) { + umtx_key_release(&uq->uq_key); + return (EFAULT); + } if (clockid < CLOCK_REALTIME || clockid >= CLOCK_THREAD_CPUTIME_ID) { /* hmm, only HW clock id will work. */ + umtx_key_release(&uq->uq_key); return (EINVAL); } } else { @@ -2217,12 +2263,12 @@ do_cv_wait(struct thread *td, struct uco * Set c_has_waiters to 1 before releasing user mutex, also * don't modify cache line when unnecessary. */ - if (fuword32(__DEVOLATILE(uint32_t *, &cv->c_has_waiters)) == 0) + error = fueword32(__DEVOLATILE(uint32_t *, &cv->c_has_waiters), + &hasw); + if (error == 0 && hasw == 0) suword32(__DEVOLATILE(uint32_t *, &cv->c_has_waiters), 1); - umtxq_lock(&uq->uq_key); - umtxq_unbusy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_unbusy_unlocked(&uq->uq_key); error = do_unlock_umutex(td, m); @@ -2276,7 +2322,9 @@ do_cv_signal(struct thread *td, struct u int error, cnt, nwake; uint32_t flags; - flags = fuword32(&cv->c_flags); + error = fueword32(&cv->c_flags, &flags); + if (error == -1) + return (EFAULT); if ((error = umtx_key_get(cv, TYPE_CV, GET_SHARE(flags), &key)) != 0) return (error); umtxq_lock(&key); @@ -2287,6 +2335,8 @@ do_cv_signal(struct thread *td, struct u umtxq_unlock(&key); error = suword32( __DEVOLATILE(uint32_t *, &cv->c_has_waiters), 0); + if (error == -1) + error = EFAULT; umtxq_lock(&key); } umtxq_unbusy(&key); @@ -2302,7 +2352,9 @@ do_cv_broadcast(struct thread *td, struc int error; uint32_t flags; - flags = fuword32(&cv->c_flags); + error = fueword32(&cv->c_flags, &flags); + if (error == -1) + return (EFAULT); if ((error = umtx_key_get(cv, TYPE_CV, GET_SHARE(flags), &key)) != 0) return (error); @@ -2312,10 +2364,10 @@ do_cv_broadcast(struct thread *td, struc umtxq_unlock(&key); error = suword32(__DEVOLATILE(uint32_t *, &cv->c_has_waiters), 0); + if (error == -1) + error = EFAULT; - umtxq_lock(&key); - umtxq_unbusy(&key); - umtxq_unlock(&key); + umtxq_unbusy_unlocked(&key); umtx_key_release(&key); return (error); @@ -2329,10 +2381,12 @@ do_rw_rdlock(struct thread *td, struct u uint32_t flags, wrflags; int32_t state, oldstate; int32_t blocked_readers; - int error; + int error, rv; uq = td->td_umtxq; - flags = fuword32(&rwlock->rw_flags); + error = fueword32(&rwlock->rw_flags, &flags); + if (error == -1) + return (EFAULT); error = umtx_key_get(rwlock, TYPE_RWLOCK, GET_SHARE(flags), &uq->uq_key); if (error != 0) return (error); @@ -2345,15 +2399,22 @@ do_rw_rdlock(struct thread *td, struct u wrflags |= URWLOCK_WRITE_WAITERS; for (;;) { - state = fuword32(__DEVOLATILE(int32_t *, &rwlock->rw_state)); + rv = fueword32(__DEVOLATILE(int32_t *, &rwlock->rw_state), + &state); + if (rv == -1) { + umtx_key_release(&uq->uq_key); + return (EFAULT); + } + /* try to lock it */ while (!(state & wrflags)) { if (__predict_false(URWLOCK_READER_COUNT(state) == URWLOCK_MAX_READERS)) { umtx_key_release(&uq->uq_key); return (EAGAIN); } - oldstate = casuword32(&rwlock->rw_state, state, state + 1); - if (oldstate == -1) { + rv = casueword32(&rwlock->rw_state, state, + &oldstate, state + 1); + if (rv == -1) { umtx_key_release(&uq->uq_key); return (EFAULT); } @@ -2379,12 +2440,17 @@ do_rw_rdlock(struct thread *td, struct u * re-read the state, in case it changed between the try-lock above * and the check below */ - state = fuword32(__DEVOLATILE(int32_t *, &rwlock->rw_state)); + rv = fueword32(__DEVOLATILE(int32_t *, &rwlock->rw_state), + &state); + if (rv == -1) + error = EFAULT; /* set read contention bit */ - while ((state & wrflags) && !(state & URWLOCK_READ_WAITERS)) { - oldstate = casuword32(&rwlock->rw_state, state, state | URWLOCK_READ_WAITERS); - if (oldstate == -1) { + while (error == 0 && (state & wrflags) && + !(state & URWLOCK_READ_WAITERS)) { + rv = casueword32(&rwlock->rw_state, state, + &oldstate, state | URWLOCK_READ_WAITERS); + if (rv == -1) { error = EFAULT; break; } @@ -2396,17 +2462,13 @@ do_rw_rdlock(struct thread *td, struct u break; } if (error != 0) { - umtxq_lock(&uq->uq_key); - umtxq_unbusy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_unbusy_unlocked(&uq->uq_key); break; } /* state is changed while setting flags, restart */ if (!(state & wrflags)) { - umtxq_lock(&uq->uq_key); - umtxq_unbusy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_unbusy_unlocked(&uq->uq_key); error = umtxq_check_susp(td); if (error != 0) break; @@ -2415,7 +2477,13 @@ do_rw_rdlock(struct thread *td, struct u sleep: /* contention bit is set, before sleeping, increase read waiter count */ - blocked_readers = fuword32(&rwlock->rw_blocked_readers); + rv = fueword32(&rwlock->rw_blocked_readers, + &blocked_readers); + if (rv == -1) { + umtxq_unbusy_unlocked(&uq->uq_key); + error = EFAULT; + break; + } suword32(&rwlock->rw_blocked_readers, blocked_readers+1); while (state & wrflags) { @@ -2431,18 +2499,32 @@ sleep: umtxq_unlock(&uq->uq_key); if (error) break; - state = fuword32(__DEVOLATILE(int32_t *, &rwlock->rw_state)); + rv = fueword32(__DEVOLATILE(int32_t *, + &rwlock->rw_state), &state); + if (rv == -1) { + error = EFAULT; + break; + } } /* decrease read waiter count, and may clear read contention bit */ - blocked_readers = fuword32(&rwlock->rw_blocked_readers); + rv = fueword32(&rwlock->rw_blocked_readers, + &blocked_readers); + if (rv == -1) { + umtxq_unbusy_unlocked(&uq->uq_key); + error = EFAULT; + break; + } suword32(&rwlock->rw_blocked_readers, blocked_readers-1); if (blocked_readers == 1) { - state = fuword32(__DEVOLATILE(int32_t *, &rwlock->rw_state)); - for (;;) { - oldstate = casuword32(&rwlock->rw_state, state, - state & ~URWLOCK_READ_WAITERS); - if (oldstate == -1) { + rv = fueword32(__DEVOLATILE(int32_t *, + &rwlock->rw_state), &state); + if (rv == -1) + error = EFAULT; + while (error == 0) { + rv = casueword32(&rwlock->rw_state, state, + &oldstate, state & ~URWLOCK_READ_WAITERS); + if (rv == -1) { error = EFAULT; break; } @@ -2450,14 +2532,10 @@ sleep: break; state = oldstate; error = umtxq_check_susp(td); - if (error != 0) - break; } } - umtxq_lock(&uq->uq_key); - umtxq_unbusy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_unbusy_unlocked(&uq->uq_key); if (error != 0) break; } @@ -2476,10 +2554,12 @@ do_rw_wrlock(struct thread *td, struct u int32_t state, oldstate; int32_t blocked_writers; int32_t blocked_readers; - int error; + int error, rv; uq = td->td_umtxq; - flags = fuword32(&rwlock->rw_flags); + error = fueword32(&rwlock->rw_flags, &flags); + if (error == -1) + return (EFAULT); error = umtx_key_get(rwlock, TYPE_RWLOCK, GET_SHARE(flags), &uq->uq_key); if (error != 0) return (error); @@ -2489,10 +2569,16 @@ do_rw_wrlock(struct thread *td, struct u blocked_readers = 0; for (;;) { - state = fuword32(__DEVOLATILE(int32_t *, &rwlock->rw_state)); + rv = fueword32(__DEVOLATILE(int32_t *, &rwlock->rw_state), + &state); + if (rv == -1) { + umtx_key_release(&uq->uq_key); + return (EFAULT); + } while (!(state & URWLOCK_WRITE_OWNER) && URWLOCK_READER_COUNT(state) == 0) { - oldstate = casuword32(&rwlock->rw_state, state, state | URWLOCK_WRITE_OWNER); - if (oldstate == -1) { + rv = casueword32(&rwlock->rw_state, state, + &oldstate, state | URWLOCK_WRITE_OWNER); + if (rv == -1) { umtx_key_release(&uq->uq_key); return (EFAULT); } @@ -2528,12 +2614,17 @@ do_rw_wrlock(struct thread *td, struct u * re-read the state, in case it changed between the try-lock above * and the check below */ - state = fuword32(__DEVOLATILE(int32_t *, &rwlock->rw_state)); + rv = fueword32(__DEVOLATILE(int32_t *, &rwlock->rw_state), + &state); + if (rv == -1) + error = EFAULT; - while (((state & URWLOCK_WRITE_OWNER) || URWLOCK_READER_COUNT(state) != 0) && - (state & URWLOCK_WRITE_WAITERS) == 0) { - oldstate = casuword32(&rwlock->rw_state, state, state | URWLOCK_WRITE_WAITERS); - if (oldstate == -1) { + while (error == 0 && ((state & URWLOCK_WRITE_OWNER) || + URWLOCK_READER_COUNT(state) != 0) && + (state & URWLOCK_WRITE_WAITERS) == 0) { + rv = casueword32(&rwlock->rw_state, state, + &oldstate, state | URWLOCK_WRITE_WAITERS); + if (rv == -1) { error = EFAULT; break; } @@ -2545,23 +2636,25 @@ do_rw_wrlock(struct thread *td, struct u break; } if (error != 0) { - umtxq_lock(&uq->uq_key); - umtxq_unbusy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_unbusy_unlocked(&uq->uq_key); break; } if (!(state & URWLOCK_WRITE_OWNER) && URWLOCK_READER_COUNT(state) == 0) { - umtxq_lock(&uq->uq_key); - umtxq_unbusy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_unbusy_unlocked(&uq->uq_key); error = umtxq_check_susp(td); if (error != 0) break; continue; } sleep: - blocked_writers = fuword32(&rwlock->rw_blocked_writers); + rv = fueword32(&rwlock->rw_blocked_writers, + &blocked_writers); + if (rv == -1) { + umtxq_unbusy_unlocked(&uq->uq_key); + error = EFAULT; + break; + } suword32(&rwlock->rw_blocked_writers, blocked_writers+1); while ((state & URWLOCK_WRITE_OWNER) || URWLOCK_READER_COUNT(state) != 0) { @@ -2577,17 +2670,34 @@ sleep: umtxq_unlock(&uq->uq_key); if (error) break; - state = fuword32(__DEVOLATILE(int32_t *, &rwlock->rw_state)); + rv = fueword32(__DEVOLATILE(int32_t *, + &rwlock->rw_state), &state); + if (rv == -1) { + error = EFAULT; + break; + } } - blocked_writers = fuword32(&rwlock->rw_blocked_writers); + rv = fueword32(&rwlock->rw_blocked_writers, + &blocked_writers); + if (rv == -1) { + umtxq_unbusy_unlocked(&uq->uq_key); + error = EFAULT; + break; + } suword32(&rwlock->rw_blocked_writers, blocked_writers-1); if (blocked_writers == 1) { - state = fuword32(__DEVOLATILE(int32_t *, &rwlock->rw_state)); + rv = fueword32(__DEVOLATILE(int32_t *, + &rwlock->rw_state), &state); + if (rv == -1) { + umtxq_unbusy_unlocked(&uq->uq_key); + error = EFAULT; + break; + } for (;;) { - oldstate = casuword32(&rwlock->rw_state, state, - state & ~URWLOCK_WRITE_WAITERS); - if (oldstate == -1) { + rv = casueword32(&rwlock->rw_state, state, + &oldstate, state & ~URWLOCK_WRITE_WAITERS); + if (rv == -1) { error = EFAULT; break; } @@ -2603,13 +2713,17 @@ sleep: if (error != 0) break; } - blocked_readers = fuword32(&rwlock->rw_blocked_readers); + rv = fueword32(&rwlock->rw_blocked_readers, + &blocked_readers); + if (rv == -1) { + umtxq_unbusy_unlocked(&uq->uq_key); + error = EFAULT; + break; + } } else blocked_readers = 0; - umtxq_lock(&uq->uq_key); - umtxq_unbusy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); + umtxq_unbusy_unlocked(&uq->uq_key); } umtx_key_release(&uq->uq_key); @@ -2624,20 +2738,26 @@ do_rw_unlock(struct thread *td, struct u struct umtx_q *uq; uint32_t flags; int32_t state, oldstate; - int error, q, count; + int error, rv, q, count; uq = td->td_umtxq; - flags = fuword32(&rwlock->rw_flags); + error = fueword32(&rwlock->rw_flags, &flags); + if (error == -1) + return (EFAULT); error = umtx_key_get(rwlock, TYPE_RWLOCK, GET_SHARE(flags), &uq->uq_key); if (error != 0) return (error); - state = fuword32(__DEVOLATILE(int32_t *, &rwlock->rw_state)); + error = fueword32(__DEVOLATILE(int32_t *, &rwlock->rw_state), &state); + if (error == -1) { + error = EFAULT; + goto out; + } if (state & URWLOCK_WRITE_OWNER) { for (;;) { - oldstate = casuword32(&rwlock->rw_state, state, - state & ~URWLOCK_WRITE_OWNER); - if (oldstate == -1) { + rv = casueword32(&rwlock->rw_state, state, + &oldstate, state & ~URWLOCK_WRITE_OWNER); + if (rv == -1) { error = EFAULT; goto out; } @@ -2655,9 +2775,9 @@ do_rw_unlock(struct thread *td, struct u } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 15:33:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 80A225B7; Tue, 28 Oct 2014 15:33:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6CF95C2F; Tue, 28 Oct 2014 15:33:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SFXG8p017920; Tue, 28 Oct 2014 15:33:16 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SFXGa8017919; Tue, 28 Oct 2014 15:33:16 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410281533.s9SFXGa8017919@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 28 Oct 2014 15:33:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273786 - head/usr.sbin/pw/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 15:33:16 -0000 Author: bapt Date: Tue Oct 28 15:33:15 2014 New Revision: 273786 URL: https://svnweb.freebsd.org/changeset/base/273786 Log: Fix atf syntax Modified: head/usr.sbin/pw/tests/pw_delete.sh Modified: head/usr.sbin/pw/tests/pw_delete.sh ============================================================================== --- head/usr.sbin/pw/tests/pw_delete.sh Tue Oct 28 15:30:33 2014 (r273785) +++ head/usr.sbin/pw/tests/pw_delete.sh Tue Oct 28 15:33:15 2014 (r273786) @@ -27,7 +27,7 @@ group_do_not_delete_wheel_if_group_unkow populate_etc_skel atf_check -s exit:0 -o inline:"wheel:*:0:root\n" -x pw -V ${HOME} groupshow wheel atf_check -e inline:"pw: -g expects a number\n" -s exit:64 -x pw -V ${HOME} groupdel -g I_do_not_exist - atf_check -s exit:0 -o "wheel:*:0:root\n" -x pw -V ${HOME} groupshow wheel + atf_check -s exit:0 -o inline:"wheel:*:0:root\n" -x pw -V ${HOME} groupshow wheel } atf_init_test_cases() { From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 15:40:14 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E5C25890; Tue, 28 Oct 2014 15:40:14 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59C29C90; Tue, 28 Oct 2014 15:40:14 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9SFe6CN053728 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 28 Oct 2014 17:40:06 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9SFe6CN053728 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9SFe64H053727; Tue, 28 Oct 2014 17:40:06 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 28 Oct 2014 17:40:06 +0200 From: Konstantin Belousov To: Konstantin Belousov Subject: Re: svn commit: r273785 - head/sys/kern Message-ID: <20141028154006.GG1877@kib.kiev.ua> References: <201410281530.s9SFUYBd015691@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410281530.s9SFUYBd015691@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 15:40:15 -0000 On Tue, Oct 28, 2014 at 03:30:34PM +0000, Konstantin Belousov wrote: > Author: kib > Date: Tue Oct 28 15:30:33 2014 > New Revision: 273785 > URL: https://svnweb.freebsd.org/changeset/base/273785 > > Log: > Convert kern_umtx.c to use fueword() and casueword(). > > Also fix some mishandling of suword(9) errors as errno, which resulted > in spurious ERESTART. > > Sponsored by: The FreeBSD Foundation > Tested by: pho > MFC after: 3 weeks > > Modified: > head/sys/kern/kern_umtx.c Some explanation which I did not want to put into commit message. The kern_umtx.c commit is split from the other conversion commit for ease of reversal. The most tricky part of the work for fueword() was to preserve the logic of locking loops which rely on the suspension check functions errors preserved for next iteration. Another cause of troubles if kern_umtx.c were incomplete cleanups in case of userspace access errors, which left umtx sleepchains locked. The only consumers of fuword() left in tree are solaris compat layer/dtrace. Architectures which lack proper fueword() implementations are arm, mips and sparc64. I already forgot enough of sparc64 assembly, and do not know mips and arm. These arches currently should run with compat shims in subr_uio.c, but hopefully maintaners will plug the missed implementations. From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 15:46:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7BFB4AAA; Tue, 28 Oct 2014 15:46:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6870BD88; Tue, 28 Oct 2014 15:46:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SFkN0L022934; Tue, 28 Oct 2014 15:46:23 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SFkNZD022931; Tue, 28 Oct 2014 15:46:23 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410281546.s9SFkNZD022931@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 28 Oct 2014 15:46:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273787 - in head/usr.sbin/pw: . tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 15:46:23 -0000 Author: bapt Date: Tue Oct 28 15:46:22 2014 New Revision: 273787 URL: https://svnweb.freebsd.org/changeset/base/273787 Log: Ensure pw userdel -u do not try to remove root Check the uid passed is actually a number as early as possible MFC after: 1 week Modified: head/usr.sbin/pw/pw_user.c head/usr.sbin/pw/tests/pw_delete.sh Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Tue Oct 28 15:33:15 2014 (r273786) +++ head/usr.sbin/pw/pw_user.c Tue Oct 28 15:46:22 2014 (r273787) @@ -321,6 +321,9 @@ pw_user(struct userconf * cnf, int mode, (a_uid = a_name)->ch = 'u'; a_name = NULL; } + } else { + if (strspn(a_uid->val, "0123456789") != strlen(a_uid->val)) + errx(EX_USAGE, "-u expects a number"); } /* Modified: head/usr.sbin/pw/tests/pw_delete.sh ============================================================================== --- head/usr.sbin/pw/tests/pw_delete.sh Tue Oct 28 15:33:15 2014 (r273786) +++ head/usr.sbin/pw/tests/pw_delete.sh Tue Oct 28 15:46:22 2014 (r273787) @@ -30,7 +30,18 @@ group_do_not_delete_wheel_if_group_unkow atf_check -s exit:0 -o inline:"wheel:*:0:root\n" -x pw -V ${HOME} groupshow wheel } +atf_test_case user_do_not_try_to_delete_root_if_user_unkown +user_do_not_try_to_delete_root_if_user_unkown_head() { + atf_set "descr" "Make sure not to try to remove root if deleteing an unknown user" +} + +user_do_not_try_to_delete_root_if_user_unkown_body() { + populate_etc_skel + atf_check -e inline:"pw: -u expects a number\n" -s exit:64 -x pw -V ${HOME} userdel -u plop +} + atf_init_test_cases() { atf_add_test_case rmuser_seperate_group atf_add_test_case group_do_not_delete_wheel_if_group_unkown + atf_add_test_case user_do_not_try_to_delete_root_if_user_unkown } From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 16:19:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8ADB3142; Tue, 28 Oct 2014 16:19:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77E0A16D; Tue, 28 Oct 2014 16:19:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SGJ3MV037354; Tue, 28 Oct 2014 16:19:03 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SGJ3su037353; Tue, 28 Oct 2014 16:19:03 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201410281619.s9SGJ3su037353@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 28 Oct 2014 16:19:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273788 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 16:19:03 -0000 Author: jkim Date: Tue Oct 28 16:19:02 2014 New Revision: 273788 URL: https://svnweb.freebsd.org/changeset/base/273788 Log: Actually install casuword(9) to fix build. Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Tue Oct 28 15:46:22 2014 (r273787) +++ head/share/man/man9/Makefile Tue Oct 28 16:19:02 2014 (r273788) @@ -46,6 +46,7 @@ MAN= accept_filter.9 \ BUS_SETUP_INTR.9 \ bus_space.9 \ byteorder.9 \ + casuword.9 \ cd.9 \ condvar.9 \ config_intrhook.9 \ From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 16:27:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6B088942; Tue, 28 Oct 2014 16:27:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D91E271; Tue, 28 Oct 2014 16:27:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SGRUk2041921; Tue, 28 Oct 2014 16:27:30 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SGRT7S041916; Tue, 28 Oct 2014 16:27:29 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410281627.s9SGRT7S041916@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 28 Oct 2014 16:27:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273791 - in head: lib/libutil usr.sbin/pw/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 16:27:30 -0000 Author: bapt Date: Tue Oct 28 16:27:29 2014 New Revision: 273791 URL: https://svnweb.freebsd.org/changeset/base/273791 Log: Fix renaming a group via the gr_copy function Add a regression test to pw(8) because the bug was discovered via using: pw groupmod PR: 187189 Reported by: mcdouga9@egr.msu.edu Tested by: mcdouga9@egr.msu.edu Patch by: Marc de la Gueronniere Modified: head/lib/libutil/gr_util.c head/usr.sbin/pw/tests/pw_modify.sh Modified: head/lib/libutil/gr_util.c ============================================================================== --- head/lib/libutil/gr_util.c Tue Oct 28 16:24:44 2014 (r273790) +++ head/lib/libutil/gr_util.c Tue Oct 28 16:27:29 2014 (r273791) @@ -170,14 +170,21 @@ gr_copy(int ffd, int tfd, const struct g size_t len; int eof, readlen; - sgr = gr; + if (old_gr == NULL && gr == NULL) + return(-1); + + sgr = old_gr; + /* deleting a group */ if (gr == NULL) { line = NULL; - if (old_gr == NULL) + } else { + if ((line = gr_make(gr)) == NULL) return (-1); - sgr = old_gr; - } else if ((line = gr_make(gr)) == NULL) - return (-1); + } + + /* adding a group */ + if (sgr == NULL) + sgr = gr; eof = 0; len = 0; Modified: head/usr.sbin/pw/tests/pw_modify.sh ============================================================================== --- head/usr.sbin/pw/tests/pw_modify.sh Tue Oct 28 16:24:44 2014 (r273790) +++ head/usr.sbin/pw/tests/pw_modify.sh Tue Oct 28 16:27:29 2014 (r273791) @@ -58,9 +58,23 @@ usermod_bug_185666_body() { atf_check -o inline:"testgroup2:*:1003:testuser\n" -x pw -V ${HOME} groupshow testgroup2 } +atf_test_case do_not_duplicate_group_on_gid_change +do_not_duplicate_group_on_gid_change_head() { + atf_set "descr" "Do not duplicate group on gid change" +} + +do_not_duplicate_group_on_gid_change_body() { + populate_etc_skel + atf_check -s exit:0 -x pw -V ${HOME} groupadd testgroup + atf_check -s exit:0 -x pw -V ${HOME} groupmod testgroup -g 12345 + # use grep to see if the entry has not be duplicated + atf_check -o inline:"testgroup:*:12345:\n" -s exit:0 -x grep "^testgroup" ${HOME}/group +} + atf_init_test_cases() { atf_add_test_case groupmod_user atf_add_test_case groupmod_invalid_user atf_add_test_case groupmod_bug_193704 atf_add_test_case usermod_bug_185666 + atf_add_test_case do_not_duplicate_group_on_gid_change } From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 17:11:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C744C7A7; Tue, 28 Oct 2014 17:11:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B33E6A2F; Tue, 28 Oct 2014 17:11:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SHBp2o064591; Tue, 28 Oct 2014 17:11:51 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SHBpmu064590; Tue, 28 Oct 2014 17:11:51 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410281711.s9SHBpmu064590@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 28 Oct 2014 17:11:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273793 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 17:11:51 -0000 Author: trasz Date: Tue Oct 28 17:11:51 2014 New Revision: 273793 URL: https://svnweb.freebsd.org/changeset/base/273793 Log: Document iSNS defaults. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/ctl.conf.5 Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Tue Oct 28 17:08:13 2014 (r273792) +++ head/usr.sbin/ctld/ctl.conf.5 Tue Oct 28 17:11:51 2014 (r273793) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 23, 2014 +.Dd October 28, 2014 .Dt CTL.CONF 5 .Os .Sh NAME @@ -111,8 +111,10 @@ An IPv4 or IPv6 address and optionally p .It Ic isns-period Ar seconds iSNS registration period. Registered Network Entity not updated during this period will be unregistered. +The default is 900. .It Ic isns-timeout Ar seconds Timeout for iSNS requests. +The default is 5. .El .Ss auth-group Context .Bl -tag -width indent From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 17:52:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D3AE74F3; Tue, 28 Oct 2014 17:52:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC465E4B; Tue, 28 Oct 2014 17:52:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SHqRJn083206; Tue, 28 Oct 2014 17:52:27 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SHqQZf083200; Tue, 28 Oct 2014 17:52:26 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201410281752.s9SHqQZf083200@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 28 Oct 2014 17:52:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273796 - head/contrib/mtree X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 17:52:27 -0000 Author: brooks Date: Tue Oct 28 17:52:26 2014 New Revision: 273796 URL: https://svnweb.freebsd.org/changeset/base/273796 Log: Import in latest mtree from NetBSD to fix a bug in parsing group files that jmg fixed upstream. MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/contrib/mtree/create.c head/contrib/mtree/extern.h head/contrib/mtree/getid.c head/contrib/mtree/mtree.c head/contrib/mtree/spec.c Directory Properties: head/contrib/mtree/ (props changed) Modified: head/contrib/mtree/create.c ============================================================================== --- head/contrib/mtree/create.c Tue Oct 28 17:32:49 2014 (r273795) +++ head/contrib/mtree/create.c Tue Oct 28 17:52:26 2014 (r273796) @@ -1,4 +1,4 @@ -/* $NetBSD: create.c,v 1.72 2013/10/17 17:22:59 christos Exp $ */ +/* $NetBSD: create.c,v 1.73 2014/04/24 17:22:41 christos Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: create.c,v 1.72 2013/10/17 17:22:59 christos Exp $"); +__RCSID("$NetBSD: create.c,v 1.73 2014/04/24 17:22:41 christos Exp $"); #endif #endif /* not lint */ @@ -91,13 +91,14 @@ static u_long flags; #endif static int dcmp(const FTSENT *FTS_CONST *, const FTSENT *FTS_CONST *); -static void output(int, int *, const char *, ...) - __attribute__((__format__(__printf__, 3, 4))); -static int statd(FTS *, FTSENT *, uid_t *, gid_t *, mode_t *, u_long *); -static void statf(int, FTSENT *); +static void output(FILE *, int, int *, const char *, ...) + __printflike(4, 5); +static int statd(FILE *, FTS *, FTSENT *, uid_t *, gid_t *, mode_t *, + u_long *); +static void statf(FILE *, int, FTSENT *); void -cwalk(void) +cwalk(FILE *fp) { FTS *t; FTSENT *p; @@ -121,7 +122,7 @@ cwalk(void) } if (!nflag) - printf( + fprintf(fp, "#\t user: %s\n#\tmachine: %s\n#\t tree: %s\n" "#\t date: %s", user, host, fullpath, ctime(&clocktime)); @@ -142,21 +143,21 @@ cwalk(void) switch(p->fts_info) { case FTS_D: if (!bflag) - printf("\n"); + fprintf(fp, "\n"); if (!nflag) - printf("# %s\n", p->fts_path); - statd(t, p, &uid, &gid, &mode, &flags); - statf(indent, p); + fprintf(fp, "# %s\n", p->fts_path); + statd(fp, t, p, &uid, &gid, &mode, &flags); + statf(fp, indent, p); break; case FTS_DP: if (p->fts_level > 0) if (!nflag) - printf("%*s# %s\n", indent, "", + fprintf(fp, "%*s# %s\n", indent, "", p->fts_path); if (p->fts_level > 0 || flavor == F_FREEBSD9) { - printf("%*s..\n", indent, ""); + fprintf(fp, "%*s..\n", indent, ""); if (!bflag) - printf("\n"); + fprintf(fp, "\n"); } break; case FTS_DNR: @@ -167,7 +168,7 @@ cwalk(void) break; default: if (!dflag) - statf(indent, p); + statf(fp, indent, p); break; } @@ -178,7 +179,7 @@ cwalk(void) } static void -statf(int indent, FTSENT *p) +statf(FILE *fp, int indent, FTSENT *p) { u_int32_t len, val; int fd, offset; @@ -187,51 +188,54 @@ statf(int indent, FTSENT *p) char *digestbuf; #endif - offset = printf("%*s%s%s", indent, "", + offset = fprintf(fp, "%*s%s%s", indent, "", S_ISDIR(p->fts_statp->st_mode) ? "" : " ", vispath(p->fts_name)); if (offset > (INDENTNAMELEN + indent)) offset = MAXLINELEN; else - offset += printf("%*s", (INDENTNAMELEN + indent) - offset, ""); + offset += fprintf(fp, "%*s", + (INDENTNAMELEN + indent) - offset, ""); if (!S_ISREG(p->fts_statp->st_mode) && (flavor == F_NETBSD6 || !dflag)) - output(indent, &offset, "type=%s", + output(fp, indent, &offset, "type=%s", inotype(p->fts_statp->st_mode)); if (keys & (F_UID | F_UNAME) && p->fts_statp->st_uid != uid) { if (keys & F_UNAME && (name = user_from_uid(p->fts_statp->st_uid, 1)) != NULL) - output(indent, &offset, "uname=%s", name); + output(fp, indent, &offset, "uname=%s", name); if (keys & F_UID || (keys & F_UNAME && name == NULL)) - output(indent, &offset, "uid=%u", p->fts_statp->st_uid); + output(fp, indent, &offset, "uid=%u", + p->fts_statp->st_uid); } if (keys & (F_GID | F_GNAME) && p->fts_statp->st_gid != gid) { if (keys & F_GNAME && (name = group_from_gid(p->fts_statp->st_gid, 1)) != NULL) - output(indent, &offset, "gname=%s", name); + output(fp, indent, &offset, "gname=%s", name); if (keys & F_GID || (keys & F_GNAME && name == NULL)) - output(indent, &offset, "gid=%u", p->fts_statp->st_gid); + output(fp, indent, &offset, "gid=%u", + p->fts_statp->st_gid); } if (keys & F_MODE && (p->fts_statp->st_mode & MBITS) != mode) - output(indent, &offset, "mode=%#o", + output(fp, indent, &offset, "mode=%#o", p->fts_statp->st_mode & MBITS); if (keys & F_DEV && (S_ISBLK(p->fts_statp->st_mode) || S_ISCHR(p->fts_statp->st_mode))) - output(indent, &offset, "device=%#jx", + output(fp, indent, &offset, "device=%#jx", (uintmax_t)p->fts_statp->st_rdev); if (keys & F_NLINK && p->fts_statp->st_nlink != 1) - output(indent, &offset, "nlink=%u", p->fts_statp->st_nlink); + output(fp, indent, &offset, "nlink=%u", p->fts_statp->st_nlink); if (keys & F_SIZE && (flavor == F_FREEBSD9 || S_ISREG(p->fts_statp->st_mode))) - output(indent, &offset, "size=%ju", + output(fp, indent, &offset, "size=%ju", (uintmax_t)p->fts_statp->st_size); if (keys & F_TIME) #if defined(BSD4_4) && !defined(HAVE_NBTOOL_CONFIG_H) - output(indent, &offset, "time=%jd.%09ld", + output(fp, indent, &offset, "time=%jd.%09ld", (intmax_t)p->fts_statp->st_mtimespec.tv_sec, p->fts_statp->st_mtimespec.tv_nsec); #else - output(indent, &offset, "time=%jd.%09ld", + output(fp, indent, &offset, "time=%jd.%09ld", (intmax_t)p->fts_statp->st_mtime, (long)0); #endif if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) { @@ -239,14 +243,14 @@ statf(int indent, FTSENT *p) crc(fd, &val, &len)) mtree_err("%s: %s", p->fts_accpath, strerror(errno)); close(fd); - output(indent, &offset, "cksum=%lu", (long)val); + output(fp, indent, &offset, "cksum=%lu", (long)val); } #ifndef NO_MD5 if (keys & F_MD5 && S_ISREG(p->fts_statp->st_mode)) { if ((digestbuf = MD5File(p->fts_accpath, NULL)) == NULL) mtree_err("%s: MD5File failed: %s", p->fts_accpath, strerror(errno)); - output(indent, &offset, "%s=%s", MD5KEY, digestbuf); + output(fp, indent, &offset, "%s=%s", MD5KEY, digestbuf); free(digestbuf); } #endif /* ! NO_MD5 */ @@ -255,7 +259,7 @@ statf(int indent, FTSENT *p) if ((digestbuf = RMD160File(p->fts_accpath, NULL)) == NULL) mtree_err("%s: RMD160File failed: %s", p->fts_accpath, strerror(errno)); - output(indent, &offset, "%s=%s", RMD160KEY, digestbuf); + output(fp, indent, &offset, "%s=%s", RMD160KEY, digestbuf); free(digestbuf); } #endif /* ! NO_RMD160 */ @@ -264,7 +268,7 @@ statf(int indent, FTSENT *p) if ((digestbuf = SHA1File(p->fts_accpath, NULL)) == NULL) mtree_err("%s: SHA1File failed: %s", p->fts_accpath, strerror(errno)); - output(indent, &offset, "%s=%s", SHA1KEY, digestbuf); + output(fp, indent, &offset, "%s=%s", SHA1KEY, digestbuf); free(digestbuf); } #endif /* ! NO_SHA1 */ @@ -273,7 +277,7 @@ statf(int indent, FTSENT *p) if ((digestbuf = SHA256_File(p->fts_accpath, NULL)) == NULL) mtree_err("%s: SHA256_File failed: %s", p->fts_accpath, strerror(errno)); - output(indent, &offset, "%s=%s", SHA256KEY, digestbuf); + output(fp, indent, &offset, "%s=%s", SHA256KEY, digestbuf); free(digestbuf); } #ifdef SHA384_BLOCK_LENGTH @@ -281,7 +285,7 @@ statf(int indent, FTSENT *p) if ((digestbuf = SHA384_File(p->fts_accpath, NULL)) == NULL) mtree_err("%s: SHA384_File failed: %s", p->fts_accpath, strerror(errno)); - output(indent, &offset, "%s=%s", SHA384KEY, digestbuf); + output(fp, indent, &offset, "%s=%s", SHA384KEY, digestbuf); free(digestbuf); } #endif @@ -289,18 +293,18 @@ statf(int indent, FTSENT *p) if ((digestbuf = SHA512_File(p->fts_accpath, NULL)) == NULL) mtree_err("%s: SHA512_File failed: %s", p->fts_accpath, strerror(errno)); - output(indent, &offset, "%s=%s", SHA512KEY, digestbuf); + output(fp, indent, &offset, "%s=%s", SHA512KEY, digestbuf); free(digestbuf); } #endif /* ! NO_SHA2 */ if (keys & F_SLINK && (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) - output(indent, &offset, "link=%s", + output(fp, indent, &offset, "link=%s", vispath(rlink(p->fts_accpath))); #if HAVE_STRUCT_STAT_ST_FLAGS if (keys & F_FLAGS && p->fts_statp->st_flags != flags) { char *str = flags_to_string(p->fts_statp->st_flags, "none"); - output(indent, &offset, "flags=%s", str); + output(fp, indent, &offset, "flags=%s", str); free(str); } #endif @@ -324,8 +328,8 @@ statf(int indent, FTSENT *p) #define MTREE_MAXS 16 static int -statd(FTS *t, FTSENT *parent, uid_t *puid, gid_t *pgid, mode_t *pmode, - u_long *pflags) +statd(FILE *fp, FTS *t, FTSENT *parent, uid_t *puid, gid_t *pgid, mode_t *pmode, + u_long *pflags) { FTSENT *p; gid_t sgid; @@ -398,33 +402,33 @@ statd(FTS *t, FTSENT *parent, uid_t *pui first) { first = 0; if (flavor != F_NETBSD6 && dflag) - printf("/set type=dir"); + fprintf(fp, "/set type=dir"); else - printf("/set type=file"); + fprintf(fp, "/set type=file"); if (keys & (F_UID | F_UNAME)) { if (keys & F_UNAME && (name = user_from_uid(saveuid, 1)) != NULL) - printf(" uname=%s", name); + fprintf(fp, " uname=%s", name); if (keys & F_UID || (keys & F_UNAME && name == NULL)) - printf(" uid=%lu", (u_long)saveuid); + fprintf(fp, " uid=%lu", (u_long)saveuid); } if (keys & (F_GID | F_GNAME)) { if (keys & F_GNAME && (name = group_from_gid(savegid, 1)) != NULL) - printf(" gname=%s", name); + fprintf(fp, " gname=%s", name); if (keys & F_GID || (keys & F_GNAME && name == NULL)) - printf(" gid=%lu", (u_long)savegid); + fprintf(fp, " gid=%lu", (u_long)savegid); } if (keys & F_MODE) - printf(" mode=%#lo", (u_long)savemode); + fprintf(fp, " mode=%#lo", (u_long)savemode); if (keys & F_NLINK) - printf(" nlink=1"); + fprintf(fp, " nlink=1"); if (keys & F_FLAGS) { char *str = flags_to_string(saveflags, "none"); - printf(" flags=%s", str); + fprintf(fp, " flags=%s", str); free(str); } - printf("\n"); + fprintf(fp, "\n"); *puid = saveuid; *pgid = savegid; *pmode = savemode; @@ -455,7 +459,7 @@ dcmp(const FTSENT *FTS_CONST *a, const F } void -output(int indent, int *offset, const char *fmt, ...) +output(FILE *fp, int indent, int *offset, const char *fmt, ...) { va_list ap; char buf[1024]; @@ -465,8 +469,8 @@ output(int indent, int *offset, const ch va_end(ap); if (*offset + strlen(buf) > MAXLINELEN - 3) { - printf(" \\\n%*s", INDENTNAMELEN + indent, ""); + fprintf(fp, " \\\n%*s", INDENTNAMELEN + indent, ""); *offset = INDENTNAMELEN + indent; } - *offset += printf(" %s", buf) + 1; + *offset += fprintf(fp, " %s", buf) + 1; } Modified: head/contrib/mtree/extern.h ============================================================================== --- head/contrib/mtree/extern.h Tue Oct 28 17:32:49 2014 (r273795) +++ head/contrib/mtree/extern.h Tue Oct 28 17:52:26 2014 (r273796) @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.38 2013/02/03 19:15:17 christos Exp $ */ +/* $NetBSD: extern.h,v 1.39 2014/04/24 17:22:41 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -63,8 +63,8 @@ void addtag(slist_t *, char *); int check_excludes(const char *, const char *); int compare(NODE *, FTSENT *); int crc(int, u_int32_t *, u_int32_t *); -void cwalk(void); -void dump_nodes(const char *, NODE *, int); +void cwalk(FILE *); +void dump_nodes(FILE *, const char *, NODE *, int); void init_excludes(void); int matchtags(NODE *); __dead __printflike(1,2) void mtree_err(const char *, ...); Modified: head/contrib/mtree/getid.c ============================================================================== --- head/contrib/mtree/getid.c Tue Oct 28 17:32:49 2014 (r273795) +++ head/contrib/mtree/getid.c Tue Oct 28 17:52:26 2014 (r273796) @@ -1,4 +1,4 @@ -/* $NetBSD: getid.c,v 1.8 2013/10/16 17:27:42 christos Exp $ */ +/* $NetBSD: getid.c,v 1.10 2014/10/27 21:46:45 christos Exp $ */ /* from: NetBSD: getpwent.c,v 1.48 2000/10/03 03:22:26 enami Exp */ /* from: NetBSD: getgrent.c,v 1.41 2002/01/12 23:51:30 lukem Exp */ @@ -65,7 +65,7 @@ #endif #include -__RCSID("$NetBSD: getid.c,v 1.8 2013/10/16 17:27:42 christos Exp $"); +__RCSID("$NetBSD: getid.c,v 1.10 2014/10/27 21:46:45 christos Exp $"); #include @@ -206,7 +206,12 @@ grstart(void) } if (grfile[0] == '\0') /* sanity check */ return 0; - return (_gr_fp = fopen(grfile, "r")) ? 1 : 0; + + _gr_fp = fopen(grfile, "r"); + if (_gr_fp != NULL) + return 1; + warn("Can't open `%s'", grfile); + return 0; } @@ -231,7 +236,7 @@ grscan(int search, gid_t gid, const char continue; } /* skip comments */ - if (pwline[0] == '#') + if (grline[0] == '#') continue; if (grmatchline(search, gid, name)) return 1; @@ -350,7 +355,11 @@ pwstart(void) } if (pwfile[0] == '\0') /* sanity check */ return 0; - return (_pw_fp = fopen(pwfile, "r")) ? 1 : 0; + _pw_fp = fopen(pwfile, "r"); + if (_pw_fp != NULL) + return 1; + warn("Can't open `%s'", pwfile); + return 0; } Modified: head/contrib/mtree/mtree.c ============================================================================== --- head/contrib/mtree/mtree.c Tue Oct 28 17:32:49 2014 (r273795) +++ head/contrib/mtree/mtree.c Tue Oct 28 17:52:26 2014 (r273796) @@ -1,4 +1,4 @@ -/* $NetBSD: mtree.c,v 1.48 2013/04/08 17:39:11 christos Exp $ */ +/* $NetBSD: mtree.c,v 1.49 2014/04/24 17:22:41 christos Exp $ */ /*- * Copyright (c) 1989, 1990, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19 #if 0 static char sccsid[] = "@(#)mtree.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: mtree.c,v 1.48 2013/04/08 17:39:11 christos Exp $"); +__RCSID("$NetBSD: mtree.c,v 1.49 2014/04/24 17:22:41 christos Exp $"); #endif #endif /* not lint */ @@ -296,11 +296,11 @@ main(int argc, char **argv) mtree_err("-l and -u flags are mutually exclusive"); if (cflag) { - cwalk(); + cwalk(stdout); exit(0); } if (Cflag || Dflag) { - dump_nodes("", spec(spec1), Dflag); + dump_nodes(stdout, "", spec(spec1), Dflag); exit(0); } if (spec2 != NULL) Modified: head/contrib/mtree/spec.c ============================================================================== --- head/contrib/mtree/spec.c Tue Oct 28 17:32:49 2014 (r273795) +++ head/contrib/mtree/spec.c Tue Oct 28 17:52:26 2014 (r273796) @@ -1,4 +1,4 @@ -/* $NetBSD: spec.c,v 1.88 2013/10/17 17:22:59 christos Exp $ */ +/* $NetBSD: spec.c,v 1.89 2014/04/24 17:22:41 christos Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -67,7 +67,7 @@ #if 0 static char sccsid[] = "@(#)spec.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: spec.c,v 1.88 2013/10/17 17:22:59 christos Exp $"); +__RCSID("$NetBSD: spec.c,v 1.89 2014/04/24 17:22:41 christos Exp $"); #endif #endif /* not lint */ @@ -102,7 +102,7 @@ static void set(char *, NODE *); static void unset(char *, NODE *); static void addchild(NODE *, NODE *); static int nodecmp(const NODE *, const NODE *); -static int appendfield(int, const char *, ...) __printflike(2, 3); +static int appendfield(FILE *, int, const char *, ...) __printflike(3, 4); #define REPLACEPTR(x,v) do { if ((x)) free((x)); (x) = (v); } while (0) @@ -290,21 +290,21 @@ free_nodes(NODE *root) /* * appendfield -- - * Like printf(), but output a space either before or after + * Like fprintf(), but output a space either before or after * the regular output, according to the pathlast flag. */ static int -appendfield(int pathlast, const char *fmt, ...) +appendfield(FILE *fp, int pathlast, const char *fmt, ...) { va_list ap; int result; va_start(ap, fmt); if (!pathlast) - printf(" "); + fprintf(fp, " "); result = vprintf(fmt, ap); if (pathlast) - printf(" "); + fprintf(fp, " "); va_end(ap); return result; } @@ -316,7 +316,7 @@ appendfield(int pathlast, const char *fm * it first. */ void -dump_nodes(const char *dir, NODE *root, int pathlast) +dump_nodes(FILE *fp, const char *dir, NODE *root, int pathlast) { NODE *cur; char path[MAXPATHLEN]; @@ -334,70 +334,75 @@ dump_nodes(const char *dir, NODE *root, mtree_err("Pathname too long."); if (!pathlast) - printf("%s", vispath(path)); + fprintf(fp, "%s", vispath(path)); #define MATCHFLAG(f) ((keys & (f)) && (cur->flags & (f))) if (MATCHFLAG(F_TYPE)) - appendfield(pathlast, "type=%s", nodetype(cur->type)); + appendfield(fp, pathlast, "type=%s", + nodetype(cur->type)); if (MATCHFLAG(F_UID | F_UNAME)) { if (keys & F_UNAME && (name = user_from_uid(cur->st_uid, 1)) != NULL) - appendfield(pathlast, "uname=%s", name); + appendfield(fp, pathlast, "uname=%s", name); else - appendfield(pathlast, "uid=%u", cur->st_uid); + appendfield(fp, pathlast, "uid=%u", + cur->st_uid); } if (MATCHFLAG(F_GID | F_GNAME)) { if (keys & F_GNAME && (name = group_from_gid(cur->st_gid, 1)) != NULL) - appendfield(pathlast, "gname=%s", name); + appendfield(fp, pathlast, "gname=%s", name); else - appendfield(pathlast, "gid=%u", cur->st_gid); + appendfield(fp, pathlast, "gid=%u", + cur->st_gid); } if (MATCHFLAG(F_MODE)) - appendfield(pathlast, "mode=%#o", cur->st_mode); + appendfield(fp, pathlast, "mode=%#o", cur->st_mode); if (MATCHFLAG(F_DEV) && (cur->type == F_BLOCK || cur->type == F_CHAR)) - appendfield(pathlast, "device=%#jx", + appendfield(fp, pathlast, "device=%#jx", (uintmax_t)cur->st_rdev); if (MATCHFLAG(F_NLINK)) - appendfield(pathlast, "nlink=%d", cur->st_nlink); + appendfield(fp, pathlast, "nlink=%d", cur->st_nlink); if (MATCHFLAG(F_SLINK)) - appendfield(pathlast, "link=%s", vispath(cur->slink)); + appendfield(fp, pathlast, "link=%s", + vispath(cur->slink)); if (MATCHFLAG(F_SIZE)) - appendfield(pathlast, "size=%ju", + appendfield(fp, pathlast, "size=%ju", (uintmax_t)cur->st_size); if (MATCHFLAG(F_TIME)) - appendfield(pathlast, "time=%jd.%09ld", + appendfield(fp, pathlast, "time=%jd.%09ld", (intmax_t)cur->st_mtimespec.tv_sec, cur->st_mtimespec.tv_nsec); if (MATCHFLAG(F_CKSUM)) - appendfield(pathlast, "cksum=%lu", cur->cksum); + appendfield(fp, pathlast, "cksum=%lu", cur->cksum); if (MATCHFLAG(F_MD5)) - appendfield(pathlast, "%s=%s", MD5KEY, cur->md5digest); + appendfield(fp, pathlast, "%s=%s", MD5KEY, + cur->md5digest); if (MATCHFLAG(F_RMD160)) - appendfield(pathlast, "%s=%s", RMD160KEY, + appendfield(fp, pathlast, "%s=%s", RMD160KEY, cur->rmd160digest); if (MATCHFLAG(F_SHA1)) - appendfield(pathlast, "%s=%s", SHA1KEY, + appendfield(fp, pathlast, "%s=%s", SHA1KEY, cur->sha1digest); if (MATCHFLAG(F_SHA256)) - appendfield(pathlast, "%s=%s", SHA256KEY, + appendfield(fp, pathlast, "%s=%s", SHA256KEY, cur->sha256digest); if (MATCHFLAG(F_SHA384)) - appendfield(pathlast, "%s=%s", SHA384KEY, + appendfield(fp, pathlast, "%s=%s", SHA384KEY, cur->sha384digest); if (MATCHFLAG(F_SHA512)) - appendfield(pathlast, "%s=%s", SHA512KEY, + appendfield(fp, pathlast, "%s=%s", SHA512KEY, cur->sha512digest); if (MATCHFLAG(F_FLAGS)) { str = flags_to_string(cur->st_flags, "none"); - appendfield(pathlast, "flags=%s", str); + appendfield(fp, pathlast, "flags=%s", str); free(str); } if (MATCHFLAG(F_IGN)) - appendfield(pathlast, "ignore"); + appendfield(fp, pathlast, "ignore"); if (MATCHFLAG(F_OPT)) - appendfield(pathlast, "optional"); + appendfield(fp, pathlast, "optional"); if (MATCHFLAG(F_TAGS)) { /* don't output leading or trailing commas */ p = cur->tags; @@ -406,12 +411,12 @@ dump_nodes(const char *dir, NODE *root, q = p + strlen(p); while(q > p && q[-1] == ',') q--; - appendfield(pathlast, "tags=%.*s", (int)(q - p), p); + appendfield(fp, pathlast, "tags=%.*s", (int)(q - p), p); } puts(pathlast ? vispath(path) : ""); if (cur->child) - dump_nodes(path, cur->child, pathlast); + dump_nodes(fp, path, cur->child, pathlast); } } From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 18:10:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 29A689AE; Tue, 28 Oct 2014 18:10:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12036FCB; Tue, 28 Oct 2014 18:10:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SIAva3091541; Tue, 28 Oct 2014 18:10:57 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SIAvYv091540; Tue, 28 Oct 2014 18:10:57 GMT (envelope-from np@FreeBSD.org) Message-Id: <201410281810.s9SIAvYv091540@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 28 Oct 2014 18:10:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273797 - head/sys/dev/cxgbe/tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 18:10:58 -0000 Author: np Date: Tue Oct 28 18:10:57 2014 New Revision: 273797 URL: https://svnweb.freebsd.org/changeset/base/273797 Log: Always request a completion for every work request for iWARP. The initial MPA exchange must be tracked this way so that t4_tom's state for the tid is all clean at the time the tid transitions to RDMA mode. Once it does, t4_tom is out of the way and iw_cxgbe uses the qp endpoints directly. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Tue Oct 28 17:52:26 2014 (r273796) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Tue Oct 28 18:10:57 2014 (r273797) @@ -739,7 +739,7 @@ t4_push_frames(struct adapter *sc, struc toep->tx_nocompl >= toep->tx_total / 4) compl = 1; - if (compl) { + if (compl || toep->ulp_mode == ULP_MODE_RDMA) { txwr->op_to_immdlen |= htobe32(F_FW_WR_COMPL); toep->tx_nocompl = 0; toep->plen_nocompl = 0; From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 18:26:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0C334197; Tue, 28 Oct 2014 18:26:44 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D504E233; Tue, 28 Oct 2014 18:26:43 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id B311EB984; Tue, 28 Oct 2014 14:26:42 -0400 (EDT) From: John Baldwin To: Konstantin Belousov Subject: Re: svn commit: r273785 - head/sys/kern Date: Tue, 28 Oct 2014 13:38:23 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <201410281530.s9SFUYBd015691@svn.freebsd.org> <20141028154006.GG1877@kib.kiev.ua> In-Reply-To: <20141028154006.GG1877@kib.kiev.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201410281338.23538.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 28 Oct 2014 14:26:42 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 18:26:44 -0000 On Tuesday, October 28, 2014 11:40:06 am Konstantin Belousov wrote: > On Tue, Oct 28, 2014 at 03:30:34PM +0000, Konstantin Belousov wrote: > > Author: kib > > Date: Tue Oct 28 15:30:33 2014 > > New Revision: 273785 > > URL: https://svnweb.freebsd.org/changeset/base/273785 > > > > Log: > > Convert kern_umtx.c to use fueword() and casueword(). > > > > Also fix some mishandling of suword(9) errors as errno, which resulted > > in spurious ERESTART. > > > > Sponsored by: The FreeBSD Foundation > > Tested by: pho > > MFC after: 3 weeks > > > > Modified: > > head/sys/kern/kern_umtx.c > > Some explanation which I did not want to put into commit message. > > The kern_umtx.c commit is split from the other conversion commit > for ease of reversal. The most tricky part of the work for fueword() > was to preserve the logic of locking loops which rely on the suspension > check functions errors preserved for next iteration. Another cause > of troubles if kern_umtx.c were incomplete cleanups in case of > userspace access errors, which left umtx sleepchains locked. > > The only consumers of fuword() left in tree are solaris compat layer/dtrace. > > Architectures which lack proper fueword() implementations are arm, > mips and sparc64. I already forgot enough of sparc64 assembly, and do > not know mips and arm. These arches currently should run with compat > shims in subr_uio.c, but hopefully maintaners will plug the missed > implementations. Thanks for fixing this! -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 18:34:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E8406748; Tue, 28 Oct 2014 18:34:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B1884353; Tue, 28 Oct 2014 18:34:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SIY4JD002619; Tue, 28 Oct 2014 18:34:04 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SIY09S002582; Tue, 28 Oct 2014 18:34:00 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410281834.s9SIY09S002582@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Tue, 28 Oct 2014 18:34:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273799 - in head/sys: arm/allwinner arm/broadcom/bcm2835 arm/freescale/imx arm/freescale/vybrid arm/lpc arm/rockchip arm/samsung/exynos arm/ti arm/xilinx arm/xscale/ixp425 mips/atheros... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 18:34:05 -0000 Author: loos Date: Tue Oct 28 18:33:59 2014 New Revision: 273799 URL: https://svnweb.freebsd.org/changeset/base/273799 Log: Make the GPIO children attach to the first unit available and not only to unit 0. It seems that this 'simplification' was copied to all GPIO drivers in tree. This fix a bug where a GPIO controller could fail to attach its children (gpioc and gpiobus) if another GPIO driver attach first. Modified: head/sys/arm/allwinner/a10_gpio.c head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c head/sys/arm/freescale/imx/imx_gpio.c head/sys/arm/freescale/vybrid/vf_gpio.c head/sys/arm/lpc/lpc_gpio.c head/sys/arm/rockchip/rk30xx_gpio.c head/sys/arm/samsung/exynos/exynos5_pad.c head/sys/arm/ti/ti_gpio.c head/sys/arm/xilinx/zy7_gpio.c head/sys/arm/xscale/ixp425/avila_gpio.c head/sys/arm/xscale/ixp425/cambria_gpio.c head/sys/mips/atheros/ar71xx_gpio.c head/sys/mips/cavium/octeon_gpio.c head/sys/mips/rt305x/rt305x_gpio.c head/sys/powerpc/wii/wii_gpio.c Modified: head/sys/arm/allwinner/a10_gpio.c ============================================================================== --- head/sys/arm/allwinner/a10_gpio.c Tue Oct 28 18:19:22 2014 (r273798) +++ head/sys/arm/allwinner/a10_gpio.c Tue Oct 28 18:33:59 2014 (r273799) @@ -474,8 +474,8 @@ a10_gpio_attach(device_t dev) } sc->sc_gpio_npins = i; - device_add_child(dev, "gpioc", device_get_unit(dev)); - device_add_child(dev, "gpiobus", device_get_unit(dev)); + device_add_child(dev, "gpioc", -1); + device_add_child(dev, "gpiobus", -1); a10_gpio_sc = sc; Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Tue Oct 28 18:19:22 2014 (r273798) +++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Tue Oct 28 18:33:59 2014 (r273799) @@ -747,8 +747,9 @@ bcm_gpio_attach(device_t dev) bcm_gpio_sysctl_init(sc); - device_add_child(dev, "gpioc", device_get_unit(dev)); - device_add_child(dev, "gpiobus", device_get_unit(dev)); + device_add_child(dev, "gpioc", -1); + device_add_child(dev, "gpiobus", -1); + return (bus_generic_attach(dev)); fail: Modified: head/sys/arm/freescale/imx/imx_gpio.c ============================================================================== --- head/sys/arm/freescale/imx/imx_gpio.c Tue Oct 28 18:19:22 2014 (r273798) +++ head/sys/arm/freescale/imx/imx_gpio.c Tue Oct 28 18:33:59 2014 (r273799) @@ -435,8 +435,8 @@ imx51_gpio_attach(device_t dev) "imx_gpio%d.%d", device_get_unit(dev), i); } - device_add_child(dev, "gpioc", device_get_unit(dev)); - device_add_child(dev, "gpiobus", device_get_unit(dev)); + device_add_child(dev, "gpioc", -1); + device_add_child(dev, "gpiobus", -1); return (bus_generic_attach(dev)); } Modified: head/sys/arm/freescale/vybrid/vf_gpio.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_gpio.c Tue Oct 28 18:19:22 2014 (r273798) +++ head/sys/arm/freescale/vybrid/vf_gpio.c Tue Oct 28 18:33:59 2014 (r273799) @@ -146,8 +146,8 @@ vf_gpio_attach(device_t dev) "vf_gpio%d.%d", device_get_unit(dev), i); } - device_add_child(dev, "gpioc", device_get_unit(dev)); - device_add_child(dev, "gpiobus", device_get_unit(dev)); + device_add_child(dev, "gpioc", -1); + device_add_child(dev, "gpiobus", -1); return (bus_generic_attach(dev)); } Modified: head/sys/arm/lpc/lpc_gpio.c ============================================================================== --- head/sys/arm/lpc/lpc_gpio.c Tue Oct 28 18:19:22 2014 (r273798) +++ head/sys/arm/lpc/lpc_gpio.c Tue Oct 28 18:33:59 2014 (r273799) @@ -192,8 +192,8 @@ lpc_gpio_attach(device_t dev) lpc_gpio_sc = sc; - device_add_child(dev, "gpioc", device_get_unit(dev)); - device_add_child(dev, "gpiobus", device_get_unit(dev)); + device_add_child(dev, "gpioc", -1); + device_add_child(dev, "gpiobus", -1); return (bus_generic_attach(dev)); } Modified: head/sys/arm/rockchip/rk30xx_gpio.c ============================================================================== --- head/sys/arm/rockchip/rk30xx_gpio.c Tue Oct 28 18:19:22 2014 (r273798) +++ head/sys/arm/rockchip/rk30xx_gpio.c Tue Oct 28 18:33:59 2014 (r273799) @@ -504,8 +504,8 @@ rk30_gpio_attach(device_t dev) } sc->sc_gpio_npins = i; - device_add_child(dev, "gpioc", device_get_unit(dev)); - device_add_child(dev, "gpiobus", device_get_unit(dev)); + device_add_child(dev, "gpioc", -1); + device_add_child(dev, "gpiobus", -1); rk30_gpio_sc = sc; Modified: head/sys/arm/samsung/exynos/exynos5_pad.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_pad.c Tue Oct 28 18:19:22 2014 (r273798) +++ head/sys/arm/samsung/exynos/exynos5_pad.c Tue Oct 28 18:33:59 2014 (r273799) @@ -559,8 +559,8 @@ pad_attach(device_t dev) "pad%d.%d", device_get_unit(dev), i); } - device_add_child(dev, "gpioc", device_get_unit(dev)); - device_add_child(dev, "gpiobus", device_get_unit(dev)); + device_add_child(dev, "gpioc", -1); + device_add_child(dev, "gpiobus", -1); return (bus_generic_attach(dev)); } Modified: head/sys/arm/ti/ti_gpio.c ============================================================================== --- head/sys/arm/ti/ti_gpio.c Tue Oct 28 18:19:22 2014 (r273798) +++ head/sys/arm/ti/ti_gpio.c Tue Oct 28 18:33:59 2014 (r273799) @@ -800,8 +800,8 @@ ti_gpio_attach(device_t dev) } /* Finish of the probe call */ - device_add_child(dev, "gpioc", device_get_unit(dev)); - device_add_child(dev, "gpiobus", device_get_unit(dev)); + device_add_child(dev, "gpioc", -1); + device_add_child(dev, "gpiobus", -1); return (bus_generic_attach(dev)); } Modified: head/sys/arm/xilinx/zy7_gpio.c ============================================================================== --- head/sys/arm/xilinx/zy7_gpio.c Tue Oct 28 18:19:22 2014 (r273798) +++ head/sys/arm/xilinx/zy7_gpio.c Tue Oct 28 18:33:59 2014 (r273799) @@ -329,8 +329,8 @@ zy7_gpio_attach(device_t dev) /* Completely reset. */ zy7_gpio_hw_reset(sc); - device_add_child(dev, "gpioc", device_get_unit(dev)); - device_add_child(dev, "gpiobus", device_get_unit(dev)); + device_add_child(dev, "gpioc", -1); + device_add_child(dev, "gpiobus", -1); return (bus_generic_attach(dev)); } Modified: head/sys/arm/xscale/ixp425/avila_gpio.c ============================================================================== --- head/sys/arm/xscale/ixp425/avila_gpio.c Tue Oct 28 18:19:22 2014 (r273798) +++ head/sys/arm/xscale/ixp425/avila_gpio.c Tue Oct 28 18:33:59 2014 (r273799) @@ -318,8 +318,9 @@ avila_gpio_attach(device_t dev) sc->sc_valid |= 1 << p->pin; } - device_add_child(dev, "gpioc", device_get_unit(dev)); - device_add_child(dev, "gpiobus", device_get_unit(dev)); + device_add_child(dev, "gpioc", -1); + device_add_child(dev, "gpiobus", -1); + return (bus_generic_attach(dev)); #undef N } Modified: head/sys/arm/xscale/ixp425/cambria_gpio.c ============================================================================== --- head/sys/arm/xscale/ixp425/cambria_gpio.c Tue Oct 28 18:19:22 2014 (r273798) +++ head/sys/arm/xscale/ixp425/cambria_gpio.c Tue Oct 28 18:33:59 2014 (r273799) @@ -447,8 +447,9 @@ cambria_gpio_attach(device_t dev) cambria_gpio_pin_setflags(dev, pin, p->flags); } - device_add_child(dev, "gpioc", device_get_unit(dev)); - device_add_child(dev, "gpiobus", device_get_unit(dev)); + device_add_child(dev, "gpioc", -1); + device_add_child(dev, "gpiobus", -1); + return (bus_generic_attach(dev)); } Modified: head/sys/mips/atheros/ar71xx_gpio.c ============================================================================== --- head/sys/mips/atheros/ar71xx_gpio.c Tue Oct 28 18:19:22 2014 (r273798) +++ head/sys/mips/atheros/ar71xx_gpio.c Tue Oct 28 18:33:59 2014 (r273799) @@ -441,8 +441,9 @@ ar71xx_gpio_attach(device_t dev) ar71xx_gpio_pin_set(dev, j, 1); } } - device_add_child(dev, "gpioc", device_get_unit(dev)); - device_add_child(dev, "gpiobus", device_get_unit(dev)); + device_add_child(dev, "gpioc", -1); + device_add_child(dev, "gpiobus", -1); + return (bus_generic_attach(dev)); } Modified: head/sys/mips/cavium/octeon_gpio.c ============================================================================== --- head/sys/mips/cavium/octeon_gpio.c Tue Oct 28 18:19:22 2014 (r273798) +++ head/sys/mips/cavium/octeon_gpio.c Tue Oct 28 18:33:59 2014 (r273799) @@ -441,8 +441,9 @@ octeon_gpio_attach(device_t dev) } } - device_add_child(dev, "gpioc", device_get_unit(dev)); - device_add_child(dev, "gpiobus", device_get_unit(dev)); + device_add_child(dev, "gpioc", -1); + device_add_child(dev, "gpiobus", -1); + return (bus_generic_attach(dev)); } Modified: head/sys/mips/rt305x/rt305x_gpio.c ============================================================================== --- head/sys/mips/rt305x/rt305x_gpio.c Tue Oct 28 18:19:22 2014 (r273798) +++ head/sys/mips/rt305x/rt305x_gpio.c Tue Oct 28 18:33:59 2014 (r273799) @@ -511,9 +511,8 @@ rt305x_gpio_attach(device_t dev) } #endif - device_add_child(dev, "gpioc", device_get_unit(dev)); - device_add_child(dev, "gpiobus", device_get_unit(dev)); - + device_add_child(dev, "gpioc", -1); + device_add_child(dev, "gpiobus", -1); return (bus_generic_attach(dev)); } Modified: head/sys/powerpc/wii/wii_gpio.c ============================================================================== --- head/sys/powerpc/wii/wii_gpio.c Tue Oct 28 18:19:22 2014 (r273798) +++ head/sys/powerpc/wii/wii_gpio.c Tue Oct 28 18:33:59 2014 (r273799) @@ -182,8 +182,8 @@ wiigpio_attach(device_t dev) "GPIO_PIN_INPUT" : "GPIO_PIN_OUTPUT"); #endif } - device_add_child(dev, "gpioc", device_get_unit(dev)); - device_add_child(dev, "gpiobus", device_get_unit(dev)); + device_add_child(dev, "gpioc", -1); + device_add_child(dev, "gpiobus", -1); /* * We will be responsible for powering off the system. */ From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 19:17:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CDA73364; Tue, 28 Oct 2014 19:17:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0E589A9; Tue, 28 Oct 2014 19:17:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SJHkdO021930; Tue, 28 Oct 2014 19:17:46 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SJHihe021918; Tue, 28 Oct 2014 19:17:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410281917.s9SJHihe021918@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 28 Oct 2014 19:17:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273800 - in head/sys: amd64/include i386/include kern sys x86/include x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 19:17:46 -0000 Author: jhb Date: Tue Oct 28 19:17:44 2014 New Revision: 273800 URL: https://svnweb.freebsd.org/changeset/base/273800 Log: Rework virtual machine hypervisor detection. - Move the existing code to x86/x86/identcpu.c since it is x86-specific. - If the CPUID2_HV flag is set, assume a hypervisor is present and query the 0x40000000 leaf to determine the hypervisor vendor ID. Export the vendor ID and the highest supported hypervisor CPUID leaf via hv_vendor[] and hv_high variables, respectively. The hv_vendor[] array is also exported via the hw.hv_vendor sysctl. - Merge the VMWare detection code from tsc.c into the new probe in identcpu.c. Add a VM_GUEST_VMWARE to identify vmware and use that in the TSC code to identify VMWare. Differential Revision: https://reviews.freebsd.org/D1010 Reviewed by: delphij, jkim, neel Added: head/sys/x86/include/vmware.h (contents, props changed) Modified: head/sys/amd64/include/md_var.h head/sys/i386/include/md_var.h head/sys/kern/subr_param.c head/sys/sys/systm.h head/sys/x86/x86/identcpu.c head/sys/x86/x86/tsc.c Modified: head/sys/amd64/include/md_var.h ============================================================================== --- head/sys/amd64/include/md_var.h Tue Oct 28 18:33:59 2014 (r273799) +++ head/sys/amd64/include/md_var.h Tue Oct 28 19:17:44 2014 (r273800) @@ -62,6 +62,8 @@ extern u_int cpu_mon_mwait_flags; extern u_int cpu_mon_min_size; extern u_int cpu_mon_max_size; extern char ctx_switch_xsave[]; +extern u_int hv_high; +extern char hv_vendor[]; extern char kstack[]; extern char sigcode[]; extern int szsigcode; Modified: head/sys/i386/include/md_var.h ============================================================================== --- head/sys/i386/include/md_var.h Tue Oct 28 18:33:59 2014 (r273799) +++ head/sys/i386/include/md_var.h Tue Oct 28 19:17:44 2014 (r273800) @@ -64,6 +64,8 @@ extern u_int cyrix_did; #if defined(I586_CPU) && !defined(NO_F00F_HACK) extern int has_f00f_bug; #endif +extern u_int hv_high; +extern char hv_vendor[]; extern char kstack[]; extern char sigcode[]; extern int szsigcode; Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Tue Oct 28 18:33:59 2014 (r273799) +++ head/sys/kern/subr_param.c Tue Oct 28 19:17:44 2014 (r273800) @@ -99,7 +99,11 @@ pid_t pid_max = PID_MAX; long maxswzone; /* max swmeta KVA storage */ long maxbcache; /* max buffer cache KVA storage */ long maxpipekva; /* Limit on pipe KVA */ -int vm_guest; /* Running as virtual machine guest? */ +#ifdef XEN +int vm_guest = VM_GUEST_XEN; +#else +int vm_guest = VM_GUEST_NO; /* Running as virtual machine guest? */ +#endif u_long maxtsiz; /* max text size */ u_long dfldsiz; /* initial data size limit */ u_long maxdsiz; /* max data size */ @@ -136,7 +140,7 @@ SYSCTL_ULONG(_kern, OID_AUTO, sgrowsiz, "Amount to grow stack on a stack fault"); SYSCTL_PROC(_kern, OID_AUTO, vm_guest, CTLFLAG_RD | CTLTYPE_STRING, NULL, 0, sysctl_kern_vm_guest, "A", - "Virtual machine guest detected? (none|generic|xen)"); + "Virtual machine guest detected?"); /* * These have to be allocated somewhere; allocating @@ -154,73 +158,18 @@ static const char *const vm_guest_sysctl "generic", "xen", "hv", + "vmware", NULL }; CTASSERT(nitems(vm_guest_sysctl_names) - 1 == VM_LAST); -#ifndef XEN -static const char *const vm_bnames[] = { - "QEMU", /* QEMU */ - "Plex86", /* Plex86 */ - "Bochs", /* Bochs */ - "Xen", /* Xen */ - "BHYVE", /* bhyve */ - "Seabios", /* KVM */ - NULL -}; - -static const char *const vm_pnames[] = { - "VMware Virtual Platform", /* VMWare VM */ - "Virtual Machine", /* Microsoft VirtualPC */ - "VirtualBox", /* Sun xVM VirtualBox */ - "Parallels Virtual Platform", /* Parallels VM */ - "KVM", /* KVM */ - NULL -}; - - -/* - * Detect known Virtual Machine hosts by inspecting the emulated BIOS. - */ -static enum VM_GUEST -detect_virtual(void) -{ - char *sysenv; - int i; - - sysenv = kern_getenv("smbios.bios.vendor"); - if (sysenv != NULL) { - for (i = 0; vm_bnames[i] != NULL; i++) - if (strcmp(sysenv, vm_bnames[i]) == 0) { - freeenv(sysenv); - return (VM_GUEST_VM); - } - freeenv(sysenv); - } - sysenv = kern_getenv("smbios.system.product"); - if (sysenv != NULL) { - for (i = 0; vm_pnames[i] != NULL; i++) - if (strcmp(sysenv, vm_pnames[i]) == 0) { - freeenv(sysenv); - return (VM_GUEST_VM); - } - freeenv(sysenv); - } - return (VM_GUEST_NO); -} -#endif - /* * Boot time overrides that are not scaled against main memory */ void init_param1(void) { -#ifndef XEN - vm_guest = detect_virtual(); -#else - vm_guest = VM_GUEST_XEN; -#endif + hz = -1; TUNABLE_INT_FETCH("kern.hz", &hz); if (hz == -1) Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Tue Oct 28 18:33:59 2014 (r273799) +++ head/sys/sys/systm.h Tue Oct 28 19:17:44 2014 (r273800) @@ -73,7 +73,7 @@ extern int vm_guest; /* Running as virt * Keep in sync with vm_guest_sysctl_names[]. */ enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV, - VM_LAST }; + VM_GUEST_VMWARE, VM_LAST }; #if defined(WITNESS) || defined(INVARIANTS) void kassert_panic(const char *fmt, ...) __printflike(1, 2); Added: head/sys/x86/include/vmware.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/x86/include/vmware.h Tue Oct 28 19:17:44 2014 (r273800) @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 2011-2014 Jung-uk Kim + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _X86_VMWARE_H_ +#define _X86_VMWARE_H_ + +#define VMW_HVMAGIC 0x564d5868 +#define VMW_HVPORT 0x5658 +#define VMW_HVCMD_GETVERSION 10 +#define VMW_HVCMD_GETHZ 45 + +static __inline void +vmware_hvcall(u_int cmd, u_int *p) +{ + + __asm __volatile("inl %w3, %0" + : "=a" (p[0]), "=b" (p[1]), "=c" (p[2]), "=d" (p[3]) + : "0" (VMW_HVMAGIC), "1" (UINT_MAX), "2" (cmd), "3" (VMW_HVPORT) + : "memory"); +} + +#endif /* !_X86_VMWARE_H_ */ Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Tue Oct 28 18:33:59 2014 (r273799) +++ head/sys/x86/x86/identcpu.c Tue Oct 28 19:17:44 2014 (r273800) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -63,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #ifdef __i386__ #define IDENTBLUE_CYRIX486 0 @@ -76,6 +78,7 @@ static u_int find_cpu_vendor_id(void); static void print_AMD_info(void); static void print_INTEL_info(void); static void print_INTEL_TLB(u_int data); +static void print_hypervisor_info(void); static void print_svm_info(void); static void print_via_padlock_info(void); static void print_vmx_info(void); @@ -120,6 +123,11 @@ static int hw_clockrate; SYSCTL_INT(_hw, OID_AUTO, clockrate, CTLFLAG_RD, &hw_clockrate, 0, "CPU instruction clock rate"); +u_int hv_high; +char hv_vendor[16]; +SYSCTL_STRING(_hw, OID_AUTO, hv_vendor, CTLFLAG_RD, hv_vendor, 0, + "Hypervisor vendor"); + static eventhandler_tag tsc_post_tag; static char cpu_brand[48]; @@ -949,7 +957,6 @@ printcpuinfo(void) if (tsc_perf_stat) printf(", performance statistics"); } - } #ifdef __i386__ } else if (cpu_vendor_id == CPU_VENDOR_CYRIX) { @@ -967,17 +974,18 @@ printcpuinfo(void) if (*cpu_vendor || cpu_id) printf("\n"); - if (!bootverbose) - return; - - if (cpu_vendor_id == CPU_VENDOR_AMD) - print_AMD_info(); - else if (cpu_vendor_id == CPU_VENDOR_INTEL) - print_INTEL_info(); + if (bootverbose) { + if (cpu_vendor_id == CPU_VENDOR_AMD) + print_AMD_info(); + else if (cpu_vendor_id == CPU_VENDOR_INTEL) + print_INTEL_info(); #ifdef __i386__ - else if (cpu_vendor_id == CPU_VENDOR_TRANSMETA) - print_transmeta_info(); + else if (cpu_vendor_id == CPU_VENDOR_TRANSMETA) + print_transmeta_info(); #endif + } + + print_hypervisor_info(); } void @@ -1182,6 +1190,99 @@ hook_tsc_freq(void *arg __unused) SYSINIT(hook_tsc_freq, SI_SUB_CONFIGURE, SI_ORDER_ANY, hook_tsc_freq, NULL); +#ifndef XEN +static const char *const vm_bnames[] = { + "QEMU", /* QEMU */ + "Plex86", /* Plex86 */ + "Bochs", /* Bochs */ + "Xen", /* Xen */ + "BHYVE", /* bhyve */ + "Seabios", /* KVM */ + NULL +}; + +static const char *const vm_pnames[] = { + "VMware Virtual Platform", /* VMWare VM */ + "Virtual Machine", /* Microsoft VirtualPC */ + "VirtualBox", /* Sun xVM VirtualBox */ + "Parallels Virtual Platform", /* Parallels VM */ + "KVM", /* KVM */ + NULL +}; + +static void +identify_hypervisor(void) +{ + u_int regs[4]; + char *p; + int i; + + /* + * [RFC] CPUID usage for interaction between Hypervisors and Linux. + * http://lkml.org/lkml/2008/10/1/246 + * + * KB1009458: Mechanisms to determine if software is running in + * a VMware virtual machine + * http://kb.vmware.com/kb/1009458 + */ + if (cpu_feature2 & CPUID2_HV) { + vm_guest = VM_GUEST_VM; + do_cpuid(0x40000000, regs); + if (regs[0] >= 0x40000000) { + hv_high = regs[0]; + ((u_int *)&hv_vendor)[0] = regs[1]; + ((u_int *)&hv_vendor)[1] = regs[2]; + ((u_int *)&hv_vendor)[2] = regs[3]; + hv_vendor[12] = '\0'; + if (strcmp(hv_vendor, "VMwareVMware") == 0) + vm_guest = VM_GUEST_VMWARE; + } + return; + } + + /* + * Examine SMBIOS strings for older hypervisors. + */ + p = kern_getenv("smbios.system.serial"); + if (p != NULL) { + if (strncmp(p, "VMware-", 7) == 0 || strncmp(p, "VMW", 3) == 0) { + vmware_hvcall(VMW_HVCMD_GETVERSION, regs); + if (regs[1] == VMW_HVMAGIC) { + vm_guest = VM_GUEST_VMWARE; + freeenv(p); + return; + } + } + freeenv(p); + } + + /* + * XXX: Some of these entries may not be needed since they were + * added to FreeBSD before the checks above. + */ + p = kern_getenv("smbios.bios.vendor"); + if (p != NULL) { + for (i = 0; vm_bnames[i] != NULL; i++) + if (strcmp(p, vm_bnames[i]) == 0) { + vm_guest = VM_GUEST_VM; + freeenv(p); + return; + } + freeenv(p); + } + p = kern_getenv("smbios.system.product"); + if (p != NULL) { + for (i = 0; vm_pnames[i] != NULL; i++) + if (strcmp(p, vm_pnames[i]) == 0) { + vm_guest = VM_GUEST_VM; + freeenv(p); + return; + } + freeenv(p); + } +} +#endif + /* * Final stage of CPU identification. */ @@ -1213,6 +1314,9 @@ identify_cpu(void) cpu_feature2 = regs[2]; #endif +#ifndef XEN + identify_hypervisor(); +#endif cpu_vendor_id = find_cpu_vendor_id(); /* @@ -2046,3 +2150,11 @@ print_vmx_info(void) ); } } + +static void +print_hypervisor_info(void) +{ + + if (*hv_vendor) + printf("Hypervisor: Origin = \"%s\"\n", hv_vendor); +} Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Tue Oct 28 18:33:59 2014 (r273799) +++ head/sys/x86/x86/tsc.c Tue Oct 28 19:17:44 2014 (r273800) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "cpufreq_if.h" @@ -102,72 +103,11 @@ static struct timecounter tsc_timecounte 800, /* quality (adjusted in code) */ }; -#define VMW_HVMAGIC 0x564d5868 -#define VMW_HVPORT 0x5658 -#define VMW_HVCMD_GETVERSION 10 -#define VMW_HVCMD_GETHZ 45 - -static __inline void -vmware_hvcall(u_int cmd, u_int *p) -{ - - __asm __volatile("inl %w3, %0" - : "=a" (p[0]), "=b" (p[1]), "=c" (p[2]), "=d" (p[3]) - : "0" (VMW_HVMAGIC), "1" (UINT_MAX), "2" (cmd), "3" (VMW_HVPORT) - : "memory"); -} - -static int +static void tsc_freq_vmware(void) { - char hv_sig[13]; u_int regs[4]; - char *p; - u_int hv_high; - int i; - /* - * [RFC] CPUID usage for interaction between Hypervisors and Linux. - * http://lkml.org/lkml/2008/10/1/246 - * - * KB1009458: Mechanisms to determine if software is running in - * a VMware virtual machine - * http://kb.vmware.com/kb/1009458 - */ - hv_high = 0; - if ((cpu_feature2 & CPUID2_HV) != 0) { - do_cpuid(0x40000000, regs); - hv_high = regs[0]; - for (i = 1, p = hv_sig; i < 4; i++, p += sizeof(regs) / 4) - memcpy(p, ®s[i], sizeof(regs[i])); - *p = '\0'; - if (bootverbose) { - /* - * HV vendor ID string - * ------------+-------------- - * KVM "KVMKVMKVM" - * Microsoft "Microsoft Hv" - * VMware "VMwareVMware" - * Xen "XenVMMXenVMM" - */ - printf("Hypervisor: Origin = \"%s\"\n", hv_sig); - } - if (strncmp(hv_sig, "VMwareVMware", 12) != 0) - return (0); - } else { - p = kern_getenv("smbios.system.serial"); - if (p == NULL) - return (0); - if (strncmp(p, "VMware-", 7) != 0 && - strncmp(p, "VMW", 3) != 0) { - freeenv(p); - return (0); - } - freeenv(p); - vmware_hvcall(VMW_HVCMD_GETVERSION, regs); - if (regs[1] != VMW_HVMAGIC) - return (0); - } if (hv_high >= 0x40000010) { do_cpuid(0x40000010, regs); tsc_freq = regs[0] * 1000; @@ -177,7 +117,6 @@ tsc_freq_vmware(void) tsc_freq = regs[0] | ((uint64_t)regs[1] << 32); } tsc_is_invariant = 1; - return (1); } static void @@ -261,8 +200,10 @@ probe_tsc_freq(void) } } - if (tsc_freq_vmware()) + if (vm_guest == VM_GUEST_VMWARE) { + tsc_freq_vmware(); return; + } switch (cpu_vendor_id) { case CPU_VENDOR_AMD: From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 19:26:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 63342872; Tue, 28 Oct 2014 19:26:53 +0000 (UTC) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id D58BDAE2; Tue, 28 Oct 2014 19:26:52 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 355F4D47447; Wed, 29 Oct 2014 06:26:44 +1100 (AEDT) Date: Wed, 29 Oct 2014 06:26:42 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov Subject: Re: svn commit: r273784 - in head/sys: amd64/ia32 compat/freebsd32 i386/i386 kern net In-Reply-To: <201410281528.s9SFSLs2013764@svn.freebsd.org> Message-ID: <20141029042007.N2423@besplex.bde.org> References: <201410281528.s9SFSLs2013764@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=BdjhjNd2 c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=3o5ZHGEtQ1bD-Fw3Y7AA:9 a=3QTGIgrYzqncwDpa:21 a=QpfHI327jUG1pkl_:21 a=CjuIK1q_8ugA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 19:26:53 -0000 On Tue, 28 Oct 2014, Konstantin Belousov wrote: > Log: > Replace some calls to fuword() by fueword() with proper error checking. I just noticed some more API design errors. The pointer type for new APIs should be [qualifed] wordsize_t *, not [qualified] void *. Using void * reduces type safety for almost no benefits. The casuword() family already doesn't use void *. > Modified: head/sys/kern/kern_exec.c > ============================================================================== > --- head/sys/kern/kern_exec.c Tue Oct 28 15:22:13 2014 (r273783) > +++ head/sys/kern/kern_exec.c Tue Oct 28 15:28:20 2014 (r273784) > @@ -1091,7 +1091,7 @@ int > exec_copyin_args(struct image_args *args, char *fname, > enum uio_seg segflg, char **argv, char **envv) > { > - char *argp, *envp; > + u_long argp, envp; > int error; > size_t length; > Here you made some changes to reduce the type errors allowed by the bad type safety. Some places use caddr_t for the pointer type. This would be correct if caddr_t is actually an opaque type, but many uses of it require it to be precisely char *. Here the char * was used directly. > @@ -1127,13 +1127,17 @@ exec_copyin_args(struct image_args *args > /* > * extract arguments first > */ > - while ((argp = (caddr_t) (intptr_t) fuword(argv++))) { > - if (argp == (caddr_t) -1) { fuword() returns an integer type, and that is often what is wanted. But here argv is a pointer to a pointer and we want to follow it. We use lots of type puns to follow this user pointer in kernel code. The casts here should have been (char *)(uintptr_t). char * is the best type for argp, unless you change the API massively so that fu*word*() represents user pointers using a scalar type (vm_offset_t, or just a properly opaque caddr_t). > + for (;;) { > + error = fueword(argv++, &argp); > + if (error == -1) { > error = EFAULT; > goto err_exit; > } > - if ((error = copyinstr(argp, args->endp, > - args->stringspace, &length))) { > + if (argp == 0) > + break; > + error = copyinstr((void *)(uintptr_t)argp, args->endp, > + args->stringspace, &length); char * argp was a better match to the API than u_long. Now it is assumed (for fueword() to work) that long can represent all user pointers, and there are many more assumptions that type puns between long and u_long work. > + if (error != 0) { > if (error == ENAMETOOLONG) > error = E2BIG; > goto err_exit; This shows that the void * arg type for fu*word*() provides few benefits in a complicated case -- you still need some casts to defeat type safety. In simpler cases, I think the void * arg type just gives the negative benefit of built-in defeat of type safety. The simple use is: wordsize_t *user_foo_ptr; wordsize_t kernel_foo; .. error = fueword(user_foo_ptr, &kernel_foo); The new API already enforces some type safety for kernel_foo here (in the old API, you could easily assign to a kernel_foo of the wrong type). It is not much to ask that user_foo_ptr has a matching type too. For argv above, this makes it clear that significant type puns are needed to go from char ** to wordsize_t *. We already punned away a const. I just noticed some more type errors: - wordsize_t is long, to be bug for bug compatible with the old API. This is more bogus than before, since -1 no longer needs to be returned in wordsize_t. The casuword() family uses the slightly better type u_long. vm_offset_t would be more correct. - the above change takes a trip through u_long instead of a trip through caddr_t and char *. It should use long directly, given that the API uses long. Bruce From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 22:14:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C827CB21; Tue, 28 Oct 2014 22:14:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F2CBEFB; Tue, 28 Oct 2014 22:14:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SMEX0s007589; Tue, 28 Oct 2014 22:14:33 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SMEWFD007584; Tue, 28 Oct 2014 22:14:32 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201410282214.s9SMEWFD007584@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Tue, 28 Oct 2014 22:14:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273802 - in head/bin/sh: . tests/parameters X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 22:14:33 -0000 Author: jilles Date: Tue Oct 28 22:14:31 2014 New Revision: 273802 URL: https://svnweb.freebsd.org/changeset/base/273802 Log: Treat IFS separators in "$*" as quoted. This makes a difference if IFS starts with *, ?, [ or a CTL* byte. Added: head/bin/sh/tests/parameters/positional6.0 (contents, props changed) head/bin/sh/tests/parameters/positional7.0 (contents, props changed) Modified: head/bin/sh/expand.c head/bin/sh/tests/parameters/Makefile Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Tue Oct 28 21:06:04 2014 (r273801) +++ head/bin/sh/expand.c Tue Oct 28 22:14:31 2014 (r273802) @@ -878,7 +878,7 @@ varvalue(const char *name, int quoted, i int num; char *p; int i; - char sep; + char sep[2]; char **ap; switch (*name) { @@ -912,15 +912,18 @@ varvalue(const char *name, int quoted, i /* FALLTHROUGH */ case '*': if (ifsset()) - sep = ifsval()[0]; + sep[0] = ifsval()[0]; else - sep = ' '; + sep[0] = ' '; + sep[1] = '\0'; for (ap = shellparam.p ; (p = *ap++) != NULL ; ) { strtodest(p, flag, subtype, quoted); if (!*ap) break; - if (sep || (flag & EXP_FULL && !quoted && **ap != '\0')) - STPUTC(sep, expdest); + if (sep[0]) + strtodest(sep, flag, subtype, quoted); + else if (flag & EXP_FULL && !quoted && **ap != '\0') + STPUTC('\0', expdest); } return; default: Modified: head/bin/sh/tests/parameters/Makefile ============================================================================== --- head/bin/sh/tests/parameters/Makefile Tue Oct 28 21:06:04 2014 (r273801) +++ head/bin/sh/tests/parameters/Makefile Tue Oct 28 22:14:31 2014 (r273802) @@ -18,6 +18,8 @@ FILES+= positional2.0 FILES+= positional3.0 FILES+= positional4.0 FILES+= positional5.0 +FILES+= positional6.0 +FILES+= positional7.0 FILES+= pwd1.0 FILES+= pwd2.0 Added: head/bin/sh/tests/parameters/positional6.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parameters/positional6.0 Tue Oct 28 22:14:31 2014 (r273802) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +IFS=? +set p r +v=pqrs +r=${v#"$*"} +[ "$r" = pqrs ] Added: head/bin/sh/tests/parameters/positional7.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parameters/positional7.0 Tue Oct 28 22:14:31 2014 (r273802) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +set -- / '' +IFS=* +set -- "$*" +IFS=: +args="$*" +[ "$#:$args" = "1:/*" ] From owner-svn-src-head@FreeBSD.ORG Tue Oct 28 23:01:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A9D5727; Tue, 28 Oct 2014 23:01:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 220413EE; Tue, 28 Oct 2014 23:01:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9SN19Lg028333; Tue, 28 Oct 2014 23:01:09 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9SN196Z028332; Tue, 28 Oct 2014 23:01:09 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410282301.s9SN196Z028332@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 28 Oct 2014 23:01:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273803 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2014 23:01:10 -0000 Author: ngie Date: Tue Oct 28 23:01:09 2014 New Revision: 273803 URL: https://svnweb.freebsd.org/changeset/base/273803 Log: Filter out TESTS_SUBDIRS already added to SUBDIR instead of blindly appending the TESTS_SUBDIRS variable to SUBDIR Duplicate directory entries can cause unexpected side effects, like installing the same files multiple times. This can be easily reproduced via the following testcase prior to this commit: SUBDIR= dir TESTS_SUBDIRS+= dir .include Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/bsd.test.mk Modified: head/share/mk/bsd.test.mk ============================================================================== --- head/share/mk/bsd.test.mk Tue Oct 28 22:14:31 2014 (r273802) +++ head/share/mk/bsd.test.mk Tue Oct 28 23:01:09 2014 (r273803) @@ -54,9 +54,11 @@ _TESTS= .include .include -.if !empty(TESTS_SUBDIRS) -SUBDIR+= ${TESTS_SUBDIRS} +.for ts in ${TESTS_SUBDIRS} +.if empty(SUBDIR:N${ts}) +SUBDIR+= ${ts} .endif +.endfor # it is rare for test cases to have man pages .if !defined(MAN) From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 01:15:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A662B46B; Wed, 29 Oct 2014 01:15:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 912FC32E; Wed, 29 Oct 2014 01:15:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9T1FnMm094117; Wed, 29 Oct 2014 01:15:49 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9T1FnTv094112; Wed, 29 Oct 2014 01:15:49 GMT (envelope-from np@FreeBSD.org) Message-Id: <201410290115.s9T1FnTv094112@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 29 Oct 2014 01:15:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273806 - in head/contrib/ofed: libcxgb4 libcxgb4/src usr.lib usr.lib/libcxgb4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 01:15:49 -0000 Author: np Date: Wed Oct 29 01:15:48 2014 New Revision: 273806 URL: https://svnweb.freebsd.org/changeset/base/273806 Log: Userspace library for Chelsio's Terminator 5 based iWARP RNICs (pretty much every T5 card that does _not_ have "-SO" in its name is RDMA capable). This plugs into the OFED verbs framework and allows userspace RDMA applications to work over T5 RNICs. Tested with rping. Obtained from: Chelsio Communications Relnotes: Yes Sponsored by: Chelsio Communications Added: head/contrib/ofed/libcxgb4/ head/contrib/ofed/libcxgb4/AUTHORS head/contrib/ofed/libcxgb4/COPYING head/contrib/ofed/libcxgb4/ChangeLog head/contrib/ofed/libcxgb4/README head/contrib/ofed/libcxgb4/cxgb4.driver head/contrib/ofed/libcxgb4/src/ head/contrib/ofed/libcxgb4/src/cq.c head/contrib/ofed/libcxgb4/src/cxgb4-abi.h head/contrib/ofed/libcxgb4/src/cxgb4.map head/contrib/ofed/libcxgb4/src/dev.c head/contrib/ofed/libcxgb4/src/libcxgb4.h head/contrib/ofed/libcxgb4/src/qp.c head/contrib/ofed/libcxgb4/src/queue.h head/contrib/ofed/libcxgb4/src/t4.h head/contrib/ofed/libcxgb4/src/t4_chip_type.h head/contrib/ofed/libcxgb4/src/t4_pci_id_tbl.h head/contrib/ofed/libcxgb4/src/t4_regs.h head/contrib/ofed/libcxgb4/src/t4fw_interface.h head/contrib/ofed/libcxgb4/src/verbs.c head/contrib/ofed/usr.lib/libcxgb4/ head/contrib/ofed/usr.lib/libcxgb4/Makefile head/contrib/ofed/usr.lib/libcxgb4/config.h Modified: head/contrib/ofed/usr.lib/Makefile Added: head/contrib/ofed/libcxgb4/AUTHORS ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/ofed/libcxgb4/AUTHORS Wed Oct 29 01:15:48 2014 (r273806) @@ -0,0 +1 @@ +Chelsio Communications, Inc. Added: head/contrib/ofed/libcxgb4/COPYING ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/ofed/libcxgb4/COPYING Wed Oct 29 01:15:48 2014 (r273806) @@ -0,0 +1,29 @@ +Copyright (c) 2010-2013. Chelsio Communications. All rights reserved. + +This software is available to you under a choice of one of two +licenses. You may choose to be licensed under the terms of the GNU +General Public License (GPL) Version 2, available from the file +COPYING in the main directory of this source tree, or the +OpenIB.org BSD license below: + + Redistribution and use in source and binary forms, with or + without modification, are permitted provided that the following + conditions are met: + + - Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + - Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials + provided with the distribution. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. Added: head/contrib/ofed/libcxgb4/ChangeLog ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/ofed/libcxgb4/ChangeLog Wed Oct 29 01:15:48 2014 (r273806) @@ -0,0 +1,1054 @@ +commit 6a417d903b9add7c8ab2b71ac11c85c46671e020 +Author: Steve Wise +Date: Thu Jul 31 11:25:22 2014 -0500 + + Spin release 1.3.5. + + Signed-off-by: Steve Wise + +commit 52ecbea1b908d3b449022e2d75ebe0ca3885bcf2 +Author: Steve Wise +Date: Thu Jul 31 11:14:05 2014 -0500 + + libcxb4: use wc_wmb() instead of wmb(). + + The user mode RDMA macro for wmb() is not sufficient to provide the + fencing needed. This was causing corrupted packets when running multiple + WD-UDP sockperf processes. The correct "sfence" instruction is provided + with the wc_wmb() macro. See /usr/include/infiniband/arch.h. + + Note: The kernel implementation of wmb() is sufficient. This is a + libcxgb4 issue only... + + Signed-off-by: Steve Wise + +commit 242c29715372bf6999aa343a5aad5654da3ecf3a +Author: Steve Wise +Date: Wed Jun 18 10:17:00 2014 -0500 + + Spin release 1.3.4 + + Signed-off-by: Steve Wise + +commit 2d54f4c5604cae24caac493aaf6d8b0907ac2ed2 +Author: Steve Wise +Date: Wed Jun 18 10:16:52 2014 -0500 + + Support the query_qp() verb + + Signed-off-by: Steve Wise + +commit f80159d12148774646ad65d03cd070f6d5f86eb4 +Author: Steve Wise +Date: Mon Jun 9 15:20:47 2014 -0500 + + Account for the full qid range. + + The total qid range is should really be based on the max_cq attribute. + + Signed-off-by: Steve Wise + +commit 5aaf5e7277a1c12964aac11a4cff94520717e805 +Author: Yann Droneaud +Date: Mon May 5 12:59:23 2014 -0500 + + kernel abi: adds explicit padding in struct c4iw_alloc_ucontext_resp + + i386 ABI disagree with most other ABIs regarding alignment + of data type larger than 4 bytes: on most ABIs a padding must + be added at end of the structures, while it is not + required on i386. + + Such ABI disagreement will make an x86_64 kernel try to write past + the struct c4iw_alloc_ucontext_resp buffer provided by an i386 + userspace binary. As struct c4iw_alloc_ucontext_resp is likely + on stack, see function c4iw_alloc_context(), side effects are + expected. + + On kernel side, this structure was modified for kernel v3.15-rc1 + by following commit: + + Commit 05eb23893c2cf9502a9cec0c32e7f1d1ed2895c8 + Author: Steve Wise + Date: Fri Mar 14 21:52:08 2014 +0530 + + cxgb4/iw_cxgb4: Doorbell Drop Avoidance Bug Fixes + + If boundary check is implemented on kernel side, the x86_64 + kernel will instead refuse to write past the i386 userspace + provided buffer and the uverbs will fail. + + To fix these issues, this patch adds an explicit padding at end + of structure so that i386 and others ABI share the same structure + layout. This patch makes c4iw_alloc_context() check for a value + in the padding field to detect newer kernel using the field for + a future purpose (only activated in debug). + + With this patch, libcxgb4 will work against older kernel and + newer patched kernel. + + Link: http://marc.info/?i=cover.1399216475.git.ydroneaud@opteya.com + Signed-off-by: Yann Droneaud + Signed-off-by: Steve Wise + +commit 5c65bf17913949368db8802656dc7dbc291271ed +Author: Yann Droneaud +Date: Mon May 5 12:59:23 2014 -0500 + + kernel abi: adds explicit padding in struct c4iw_create_cq_resp + + i386 ABI disagree with most other ABIs regarding alignment + of data type larger than 4 bytes: on most ABIs a padding must + be added at end of the structures, while it is not required + on i386. + + Such ABI disagreement will make an x86_64 kernel try to write past + the struct c4iw_create_cq_resp buffer provided by an i386 + userspace binary. As struct c4iw_create_cq_resp is likely + on stack, see function c4iw_create_cq(), side effects are + expected. + + On kernel side, this structure was added for kernel v2.6.35-rc1 + by following commit. + + Commit cfdda9d764362ab77b11a410bb928400e6520d57 + Author: Steve Wise + Date: Wed Apr 21 15:30:06 2010 -0700 + + RDMA/cxgb4: Add driver for Chelsio T4 RNIC + + If boundary check is implemented on kernel side, the x86_64 kernel + will refuse to write past the i386 userspace provided buffer and the + uverbs will fail. + + To fix these issues, this patch adds an explicit padding at end + of structure so that i386 and others ABI share the same structure + layout. This patch makes c4iw_create_cq() check for a value in the + padding field to detect newer kernel using the field for a future + purpose (only activated in debug). + + With this patch, libcxgb4 will work against older kernel and + newer patched kernel. + + Link: http://marc.info/?i=cover.1399216475.git.ydroneaud@opteya.com + + Signed-off-by: Yann Droneaud + Signed-off-by: Steve Wise + +commit 4f334446f63e3a34006f504f7c89075423c412b4 +Author: Steve Wise +Date: Tue Mar 11 11:47:19 2014 -0500 + + Spin release 1.3.3. + + Signed-off-by: Steve Wise + +commit 98cea522707232b99ff5c07dd9f57937aa8a7d91 +Author: Steve Wise +Date: Tue Mar 11 11:44:16 2014 -0500 + + Zero the status_page_size before calling get_context. + + Signed-off-by: Steve Wise + +commit a373e16a94524e20492301b0e97f53930133739b +Author: Steve Wise +Date: Tue Feb 18 12:07:19 2014 -0600 + + Spin release 1.3.2. + + Signed-off-by: Steve Wise + +commit a2f25730971e8b76033e283f03e79ef4c5dbc4bc +Author: Steve Wise +Date: Tue Feb 18 11:29:50 2014 -0600 + + Fixed compilation error with debug enabled. + + Signed-off-by: Steve Wise + +commit f484e0f4c5a4cb249f86a050efd659be37a51204 +Author: Steve Wise +Date: Tue Feb 18 11:24:06 2014 -0600 + + Use V_PIDX_T5() for T5 devices in ring_db funcs. + + Signed-off-by: Steve Wise + +commit 32b74074808da51e5918295bfc63d347548478a0 +Author: Steve Wise +Date: Tue Feb 18 11:24:05 2014 -0600 + + Call wc_wmb() needed after DB writes. + + Need to do an sfence after botht he WC and regular PIDX DB write. + Otherwise the host might reorder things and cause work request corruption + (seen with NFSRDMA). + + Signed-off-by: Steve Wise + +commit c078eed091a32b930f5bbdf0a12a3be0d0a79cf0 +Author: Steve Wise +Date: Tue Feb 18 11:23:57 2014 -0600 + + Call rmb() after reading valid gen bit. + + Some HW platforms can reorder read operations, so we must rmb() after + we see a valid gen bit in a CQE but before we read any other fields + from the CQE. + + Signed-off-by: Steve Wise + +commit 7b482dcdbbd187fd8372f744157ac2b323d32f45 +Author: Steve Wise +Date: Tue Feb 18 11:12:06 2014 -0600 + + Update copyrights. + + Signed-off-by: Steve Wise + +commit f74316373c0b2a2bd2872ae38f7be516a10503c9 +Author: Steve Wise +Date: Tue Feb 18 11:12:06 2014 -0600 + + Refresh t4 fw/hw reg files. + + Signed-off-by: Steve Wise + +commit 1b8434f22deb30f700246dd2f474eaa2512e4867 +Author: Steve Wise +Date: Tue Feb 18 11:12:03 2014 -0600 + + Add common device id table and chip types. + + This will make it easier to merge in new devices. + +commit 18e5bc32bbe7e19eb9ea5a34d8b2f7d1e6355105 +Author: Steve Wise +Date: Tue Feb 18 10:25:33 2014 -0600 + + Remove dead SIM code. + + Signed-off-by: Steve Wise + +commit c8c793385de1d3e9c1edeb7b13cbc964049b8362 +Author: Steve Wise +Date: Tue Feb 18 10:23:05 2014 -0600 + + Remove dead raw qp code. + + Signed-off-by: Steve Wise + +commit 9302c092d46e4c40cbf6b2189aeda08e5ca3fea4 +Author: Steve Wise +Date: Tue Feb 18 10:17:52 2014 -0600 + + iw_cxgb4/libcxgb4: swsq "signaled" state needs to mind sq_sig_all. + + When a qp is created, the ULP can request that all sq wrs be signaled. + The swsqe entries need to take this into account when marking the entry + as signaled. + + This bug will cause read request CQEs to be silently discarded, and can + cause flush problems because the swsqe entry will be mismarked for qps + created with sq_sig_all set in the qp init attributes. + + Signed-off-by: Steve Wise + +commit 48c6633d4a6510a8c1832ac800f45c2099eb28b4 +Author: Steve Wise +Date: Tue Feb 18 10:17:52 2014 -0600 + + never consume a pending wr in sq flush. + + There is a race when moving a QP from RTS->CLOSING where a SQ work + request could be posted after the FW receives the RDMA_RI/FINI WR. + The SQ work request will never get processed, and should be completed + with FLUSHED status. Function c4iw_flush_sq(), however was dropping + the oldest SQ work request when in CLOSING or IDLE states, instead of + completing the pending work request. If that oldest pending work request + was actually complete and has a CQE in the CQ, then when that CQE is + proceessed in poll_cq, we'll BUG_ON() due to the inconsistent SQ/CQ state. + + This is a very small timing hole and has only been hit once so far. + + c4iw_flush_sq() MUST always flush all non-completed WRs with FLUSHED + status regardless of the QP state. + + Signed-off-by: Steve Wise + +commit 1a3a3e8e8da7463e59b74d5c5396e7bd5e303cd4 +Author: Steve Wise +Date: Tue Feb 18 10:11:35 2014 -0600 + + unmap status page when freeing the context. + + Signed-off-by: Steve Wise + +commit 81e83780e44af2ff25c2572b15fe7e8b8cc6e134 +Author: Steve Wise +Date: Tue Feb 18 10:05:54 2014 -0600 + + DB Drop Avoidance, Version 2. + + Add support for the device status page mapped per device that is used + to enable/disable user db usage. + + Signed-off-by: Steve Wise + +commit 5830447cef866432c4d3e65f7e58c51a0c687798 +Author: Steve Wise +Date: Tue Feb 18 09:40:39 2014 -0600 + + Fix DEBUG code in c4iw_flush_hw_cq(). + + Signed-off-by: Steve Wise + +commit 127bc437797ca34e14b261fa653c1d0524d07272 +Author: Steve Wise +Date: Tue Feb 18 09:40:38 2014 -0600 + + T4 onchip workaround: do the 16 4B MA writes just before DB ring. + + This is a merge of sw repo changesets 1576, 2149, and 2246. + + Signed-off-by: Steve Wise + +commit ac38281728d12a91725aa67e0273dc26976598fb +Author: Steve Wise +Date: Fri Jul 19 09:37:10 2013 -0500 + + Spin release 1.3.1. + + Signed-off-by: Steve Wise + +commit 272fcac194318e13f563b46463726cc03ae83dbe +Author: Steve Wise +Date: Fri Jul 19 09:36:35 2013 -0500 + + Update copyright. + + Signed-off-by: Steve Wise + +commit ba3183d18168f764700ded52651033a79d2a9a86 +Author: Steve Wise +Date: Mon Jun 10 14:10:02 2013 -0500 + + get rid of hard coded queue iqs. + + Since we now get the number of queues available from the driver, + we shouldn't be using the hard coded defines anymore. + + Signed-off-by: Steve Wise + +commit 2095e0a04bc5357da1b9d346e00d52cf7c236cf6 +Author: Steve Wise +Date: Mon Jun 10 14:09:35 2013 -0500 + + update configure.in + + Signed-off-by: Steve Wise + +commit a7a4de4f37a60ffbd8addd8f9ab5505adb86c63f +Author: Steve Wise +Date: Mon Jun 10 14:09:34 2013 -0500 + + Mind the sq_sig_all/sq_sig_type QP attributes. + + Signed-off-by: Steve Wise + +commit 4a485c8dc1c7c70ab85c708bb4c530eef385424d +Author: Steve Wise +Date: Mon Jun 10 14:09:34 2013 -0500 + + always do GTS write if cidx_inc == M_CIDXINC. + + When polling, we do a GTS update if the accumulated cidx_inc == the cq + depth / 16. This works around a T4 bug. However, if the cq is large + enough, cq depth / 16 exceeds the size of the field in the GTS word. + So we also need to update if cidx_inc hits M_CIDXINC to avoid overflowing + the field. + + Signed-off-by: Steve Wise + +commit a276f65add45933cf8b16bb09361786cf1932c4b +Author: Steve Wise +Date: Mon Jun 10 14:09:34 2013 -0500 + + fixed bug where sq.udb was getting overwritten. + + There was an erroneous statement in create_rc_qp() which caused the + sq.udb va to be overwritten with the rq.udb va only for on-chip queues. + This error only affected unmapping of that mapped va when destroying + a qp. In the presence of multiple threads creating/destroying qps, the + erroneously unmapped va could have been assigned to another qp mapping. + This causes intermittent seg faults as libcxgb4 tries to access memory + that has been unmapped in error. + + Signed-off-by: Steve Wise + +commit 1cb6249cf722e265d8e2364de0ee5b0d59a8e4cd +Author: Steve Wise +Date: Mon Jun 10 14:09:34 2013 -0500 + + flush problem with unsignaled wrs. + + c4iw_flush_sq() should only flush wrs that have not already been + flushed. Since we already track where in the sq we've flushed via + sq.cidx_flush, just start at that point and flush any remaining. This bug + only caused a problem in the presence of unsignaled work requests. + + Signed-off-by: Steve Wise + +commit 4132e3434d8ffc2b92055649f42c56be77111216 +Author: Steve Wise +Date: Mon Jun 10 14:09:31 2013 -0500 + + clean up queue dump logic. + + Signed-off-by: Steve Wise + +commit a5e390613548f1dc62d9fe142b6a30a943fc56cf +Author: Steve Wise +Date: Tue Jun 4 12:09:21 2013 -0500 + + accounting for unsignled sq wrs fails to deal with wrap. + + When determining how many wrs are completed with a signaled cqe, + correctly deal with queue wraps. + + Signed-off-by: Steve Wise + +commit 0c1906cec82443e2323dc69dd5c23ae4314087c0 +Author: Steve Wise +Date: Tue Jun 4 12:09:19 2013 -0500 + + Handle qp flushes with pending sw cqes. + + The flush and out of order completion logic has a bug: If out of order + completions are flushed but not yet polled by the consumer and the qp + is then flushed, we end up inserting duplicate completions. + + Signed-off-by: Steve Wise + +commit 26a19bf6d020dbaab8c6cf13396b39a64f952dba +Author: Steve Wise +Date: Tue Jun 4 11:57:00 2013 -0500 + + fixed false uninitialized var warning. + + Signed-off-by: Steve Wise + +commit 119e11e72d20a07a806c3385b8cfa6de93f7d114 +Author: Steve Wise +Date: Thu Mar 28 15:15:39 2013 -0500 + + Spin release 1.3.0 + + Signed-off-by: Steve Wise + +commit a4a0d3fe768ffa33a75ab3df4bd8c678e7f7180b +Author: Steve Wise +Date: Thu Mar 28 15:15:38 2013 -0500 + + Remove aclocal.m4. + + Signed-off-by: Steve Wise + +commit 3c22ddca7cf627d62d06b0ff374fa04192a8cc4c +Author: Steve Wise +Date: Thu Mar 28 15:15:37 2013 -0500 + + libcxgb4: unmap the correct udb/ugts address. + + The various db and gts variables holding the mapped bar2 pointer + get incremented at creation time as a normal part of object creation. + However this causes the wrong address to get unmapped when the object is + destroyed. The result is a mapping leak because the munmap() fails. + So align them back to their proper page boundary when calling munmap(). + + Singed-off-by: Steve Wise + +commit 9b2d3af5735e4067b83cde79e08a37142e8fb895 +Author: Steve Wise +Date: Thu Mar 28 15:15:35 2013 -0500 + + Query device to get the max supported stags, qps, and cqs. + + Signed-off-by: Steve Wise + +commit e8a595da9129d650caf162b7103368af03e07fcc +Author: Steve Wise +Date: Thu Mar 28 15:15:33 2013 -0500 + + Add T5 support. + + This commit is composed of a series of patches to enable T5 support. I + folded them into one commit for simplicity. Plus intermittent patches + caused problems/regressions/etc, so its cleaner to have 1 commit to enable + the new device. + + Signed-off-by: Vipul Pandya + Signed-off-by: Steve Wise + +commit 7cb73aba54eb47d6902c9a3f952c0e37500cac8f +Author: Steve Wise +Date: Mon Mar 4 10:28:32 2013 -0600 + + zero out r3 and r4 fields of fw_ri_send_wr messages. + + Signed-off-by: Steve Wise + +commit f61c762e82b3e6e1c27496eecaf2bf8d00f009e3 +Author: Steve Wise +Date: Mon Mar 4 10:21:39 2013 -0600 + + Add new T4 device IDs. + + Signed-off-by: Steve Wise + +commit c66a627e1e964bad794e9dc40e9a39dc6977aa1e +Author: Steve Wise +Date: Mon Mar 4 10:08:59 2013 -0600 + + flush bug can cause application crash + + This fixes a problem in the flush logic that could occur if the + current position is near the end of the queue and the 'count' being + retired plus this position was greater than the queue size. In this + case the index wasn't being wrapped and the associated swcqe pointer + would point past the end of the CQ. + + Asserts were added to check other possible wrap-error paths. + + This bug was causing mbw to occasionally crash when flushing the qp. + + Signed-off-by: Steve Wise + +commit c5cdab8ad79cecc996d735011b210729fcc95ecd +Author: Steve Wise +Date: Mon Mar 4 10:08:58 2013 -0600 + + Silently eat unsignaled read response cqes. + + Terminator HW always generates read response cqes. We need to silently + eat them vs returning them to the user. The perftest benchmark ib_read_bw + relies on unsignaled work requests and will crash with this fix. + + Signed-off-by: Steve Wise + +commit 1eefdaae19110deae2c20a08ea53cab451fc00bb +Author: Steve Wise +Date: Fri Feb 8 13:51:37 2013 -0600 + + Remove useless dma_addr_t define. + + Signed-off-by: Steve Wise + +commit c551f4632cfcd284ad82d1d9b36d1449d109a5de +Author: Steve Wise +Date: Fri Feb 8 13:51:00 2013 -0600 + + Disable strict aliasing warnings. + + Signed-off-by: Steve Wise + +commit 695a5a4be21f44d49999c83e6ac0699ce90d97c7 +Author: Steve Wise +Date: Wed Nov 9 09:50:32 2011 -0600 + + Spin release 1.2.0. + + Signed-off-by: Steve Wise + +commit 721cfb11ca5697d017bc60167805aea9bbb13ba0 +Author: Vipul Pandya +Date: Mon Nov 7 15:08:45 2011 +0530 + + libcxgb4: Reset flush_cidx before incrementing cidx. + + Signed-off-by: Vipul Pandya + +commit db4fe38c7ee2b3ad9dc8c33f2b54f0c8cdf8b4d2 +Author: Vipul Pandya +Date: Mon Nov 7 15:06:29 2011 +0530 + + libcxgb4: Fix multi-flush logic path....again + + Signed-off-by: Vipul Pandya + +commit 19198bdc2f7feb05babcc2a544ae8b48e4943c41 +Author: Vipul Pandya +Date: Mon Nov 7 15:02:57 2011 +0530 + + libcxgb4: Reset cidx_flush if a active queue starts getting hw cqes + + Signed-off-by: Vipul Pandya + +commit 98545f3a8cbe1670efad080cf908db42269f76ff +Author: Vipul Pandya +Date: Mon Nov 7 14:56:44 2011 +0530 + + libcxgb4: Support for flushing a CQ bound to multiple QPs + + Signed-off-by: Vipul Pandya + +commit 86ba968706b3dc8cb232a303201bb03a2d919c88 +Author: Vipul Pandya +Date: Mon Nov 7 13:06:43 2011 +0530 + + libcxgb4: Checks iw_cxgb4 ABI version to know door bell drop recovery support + + Store iw_cxgb4 ABI version in a global state. Read that global state in + t4_wq_db_enabled to know if iw_cxgb4 driver supports door bell drop recovery. + + Signed-off-by: Vipul Pandya + +commit 2b6563ed5b377dac56c218b809d387089d70312d +Author: Vipul Pandya +Date: Sun Oct 23 16:50:16 2011 +0530 + + libcxgb4: fixed compilation warnings + + Signed-off-by: Vipul Pandya + +commit c5c120969c22a04d34adc566085192afc99d0db9 +Author: Vipul Pandya +Date: Fri Oct 21 19:05:20 2011 +0530 + + libcxgb4: Bug Fix#4410 - Fix 3 segfaults + + This patch fixes 3 segfaults with below signatures: + ---- + 1) + Program received signal SIGSEGV, Segmentation fault. + [Switching to Thread 0x7ffff7fef710 (LWP 22624)] + 0x00007ffff75613e4 in create_read_req_cqe (wq=0x7fffe800ada0, + hw_cqe=0x7ffff7fc7880, read_cqe=0x7ffff7fee860) at src/cq.c:162 + 162 read_cqe->u.rdma.u.scqe.cidx = wq->sq.oldest_read->idx; + (gdb) bt + hw_cqe=0x7ffff7fc7880, read_cqe=0x7ffff7fee860) at src/cq.c:162 + attr=0x7ffff7feeae0, attr_mask=1) at src/verbs.c:691 + src/verbs.c:721 + + 2) + Program received signal SIGSEGV, Segmentation fault. + [Switching to Thread 0x7ffff6e07710 (LWP 22218)] + 0x00007ffff71563e4 in create_read_req_cqe (wq=0x7fffe800ada0, + hw_cqe=0x7ffff7fc7880, read_cqe=0x7ffff6e02b70) at src/cq.c:162 + 162 read_cqe->u.rdma.u.scqe.cidx = wq->sq.oldest_read->idx; + (gdb) bt + hw_cqe=0x7ffff7fc7880, read_cqe=0x7ffff6e02b70) at src/cq.c:162 + src/verbs.c:887 + + 3) + (gdb) bt + wc=0x7ffff51378d0) at src/cq.c:776 + evd_ptr=, wc_ptr=) + at /usr/include/infiniband/verbs.h:957 + ---- + + Signed-off-by: Vipul Pandya + +commit 075adec1159606303b40f4b29ef3cea7ab780ac2 +Author: Vipul Pandya +Date: Fri Oct 21 18:59:16 2011 +0530 + + libcxgb4: return -ENOSYS in c4iw_resize_cq(). + + I fixed a "bug" in c4iw_resize_cq() in an earlier commit which regressed + us. c4iw_resize_cq() was returning 0 always even though we don't support + resizing the CQ. So I change libcxgb4 to return whatever errno is + returned by the kernel driver. However, because the driver didn't set + the uverbs capabilities for resize_cq, uverbs returned EINVAL. The OMPI + code checks for -ENOSYS and handles providers that don't support it. + If, however, ibv_resize_cq() returns any other error, OMPI bails out. + So we need to return -ENOSYS. + + I didn't see this error, however, running NP192 OMPI/IMB all night long. + So it must only try to resize for small jobs and thus I missed the + regression. + + Signed-off-by: Vipul Pandya + +commit 320285a3a3a93a614e24a78f7a68780d7791e3c5 +Author: Vipul Pandya +Date: Fri Oct 21 18:53:47 2011 +0530 + + libcxgb4: Don't flush unsignaled WRs if the QP closed normally + + - add query_qp support in driver to query the qp state before flushing. + + - fixed flush logic (again). + + - don't flush unsignaled WRs is QP had a normal close. + + - support up to 64K QIDs. + + Signed-off-by: Vipul Pandya + +commit 4c98bebe97aeef1c5cda2f071eb9c1d4fa29c37e +Author: Vipul Pandya +Date: Fri Oct 21 17:58:38 2011 +0530 + + libcxgb4: Correctly flush unsignaled WRs followed by a signaled WR. + + The cq flush logic was not accounting for unsignaled SQ WRs followed by + a signaled WR. The result was too many flushed CQEs causing application + faults or assert() failures in libcxgb4 because the SQ state is corrupted. + + Signed-off-by: Vipul Pandya + +commit 8196f85bdefb1511d6d834240a92fdaf815834b8 +Author: Vipul Pandya +Date: Fri Oct 21 17:31:03 2011 +0530 + + libcxgb4: Remove auto generated ltmain.sh file. + + Signed-off-by: Vipul Pandya + +commit 230d12f42d143eeb53d8c4935ba27620c13e6165 +Author: Vipul Pandya +Date: Fri Oct 21 17:20:37 2011 +0530 + + libcxgb4: Add debug code to dump state on a stall condition. + + Signed-off-by: Vipul Pandya + +commit 2df0677b22aebb7a22d0e8ca11beb90250b363c7 +Author: Vipul Pandya +Date: Fri Oct 21 15:04:46 2011 +0530 + + libcxgb4: don't write host idx values when wq is in error. + + This fixes a regression introduced by the db recovery changes. The host + idx shadow fields at the end of the wq should only be written if the wq + is not in error. Otherwise, a seg fault can occur. + + Signed-off-by: Vipul Pandya + +commit 4eaf4b9added6ca660ef2f9363b24d754185fddf +Author: Vipul Pandya +Date: Thu Oct 20 19:55:57 2011 +0530 + + libcxgb4: cq debug changes + + - turn on cq overflow detection by default + + - shadow cq->cidx in the cq status page + + Signed-off-by: Vipul Pandya + +commit b15d02248dd1029706d07fa229767d8b68d16c65 +Author: Vipul Pandya +Date: Thu Oct 20 19:43:07 2011 +0530 + + libcxgb4: DB Drop Recovery for RDMA and LLD queues. + + Signed-off-by: Vipul Pandya + +commit b2c7499eab73cf28cbd9cf86f6ea134e2450cdd3 +Author: Vipul Pandya +Date: Sun Oct 23 12:59:24 2011 +0530 + + libcxgb4: put queue idx values in status page for debug. + + Signed-off-by: Vipul Pandya + +commit 60a30673a4072b6727e7266f7782607ddcbc8de7 +Author: Vipul Pandya +Date: Thu Oct 20 18:07:13 2011 +0530 + + libcxgb4: DB Overflow Avoidance. + + - when user dbs are disabled, call into the kernel driver via modify_qp() + to ring the dbs. + + Signed-off-by: Vipul Pandya + +commit c8651d01a2d69d83caff8c01b32be0b23624d8da +Author: Steve Wise +Date: Thu Mar 10 09:45:00 2011 -0600 + + Spin release 1.1.1. + + Signed-off-by: Steve Wise + +commit ace467085deb7327522faeb19e20e13d691f66a2 +Author: Steve Wise +Date: Thu Mar 10 09:34:11 2011 -0600 + + Flush MA FIFO for on-chip queues. + + Signed-off-by: Steve Wise + +commit 7cb87f46c1784c791d29646104ab355ed920747d +Author: Steve Wise +Date: Thu Mar 10 09:27:57 2011 -0600 + + increase the frequency of CIDX-INC updates. + + Heavy IMB loads reveal that my current algorithm of doing CIDX-INC + GTS writes every 1/2 the CQ depth was not sufficient. This patch + increases the frequency to 1/16. + + Signed-off-by: Steve Wise + +commit 7652d71daadda0c3aba9b96311ea623a1e324d77 +Author: Steve Wise +Date: Wed Sep 15 16:57:04 2010 -0500 + + Spin release 1.1.0. + + Signed-off-by: Steve Wise + +commit ed05d22592bc96987635b2c255a99663f286b812 +Author: Steve Wise +Date: Wed Sep 15 16:56:51 2010 -0500 + + Support all T4 device IDs. + + Signed-off-by: Steve Wise + +commit b051a2ea9dc7b6ffa08f955e60b331e42fec8672 +Author: Steve Wise +Date: Wed Sep 15 15:54:35 2010 -0500 + + Support ABI 0 and 1 versions of the iwarp driver. + + Signed-off-by: Steve Wise + +commit 62f1363bb716e2283f9e2b885e5f02a6d5c692d1 +Author: Steve Wise +Date: Wed Sep 15 14:06:17 2010 -0500 + + Bump the slots per SQ to 5 to allow up to 128MB fast registers. + + Signed-off-by: Steve Wise + +commit d51e041839254d656cc260dba3f26a7c9d73aa56 +Author: Steve Wise +Date: Wed Sep 15 14:06:16 2010 -0500 + + Raw QP implementation + + Signed-off-by: Steve Wise + +commit 8f55539d0b8aea70084edf31687e590cf5a57221 +Author: Steve Wise +Date: Wed Sep 15 14:03:55 2010 -0500 + + Add compile-time user mode rdma stats. + + Signed-off-by: Steve Wise + +commit 2e3531bbd91d7a6f057b3503132aef5e64adb548 +Author: Steve Wise +Date: Wed Sep 15 13:57:03 2010 -0500 + + Support on-chip SQs. + + Signed-off-by: Steve Wise + +commit 65bb173b86c2e0a9ff5f877e4d3951cb8daa6e97 +Author: Steve Wise +Date: Wed Sep 15 13:54:44 2010 -0500 + + Work around TERM CQE hw bug. + + Signed-off-by: Steve Wise + +commit 6bb37d1f72652d4ed0c1972bc673f4418cc7a856 +Author: Steve Wise +Date: Wed Sep 15 13:54:44 2010 -0500 + + Zero out padding in iSGLs. + + Signed-off-by: Steve Wise + +commit aad128404c494ec4779055b5e550c2d7de7d5ca9 +Author: Steve Wise +Date: Thu Jul 22 14:58:51 2010 -0500 + + Spin release 1.0.4 + + Signed-off-by: Steve Wise + +commit 07ac253a8a479fd59fe654baf5a94ffc1de13765 +Author: Steve Wise +Date: Thu Jul 22 14:57:27 2010 -0500 + + Do GTS/CIDX_INC writes in the poll path to avoid drops. + + With T4 asic, we still see the CIDX_INC overflow/drops. + + Signed-off-by: Steve Wise + +commit 3394198639f811c86ab519c43197a9b724435cb0 +Author: Steve Wise +Date: Thu Jul 22 14:56:53 2010 -0500 + + Support T420 and T440 cards. + + Signed-off-by: Steve Wise + +commit 311dd1c8ec3e38287895053dce52dfef5ed5f0b1 +Author: Steve Wise +Date: Fri Jun 11 10:40:53 2010 -0500 + + Spin release 1.0.3. + + Signed-off-by: Steve Wise + +commit a62d7cf38f7b6c731486ff969ee7e3a4238ebc3f +Author: Steve Wise +Date: Fri Jun 11 10:37:17 2010 -0500 + + Support variable sized work requests. + + T4 EQ entries are in multiples of 64B. Currently the RDMA SQ and RQ + use fixed sized entries composed of 4 EQ entries for the SQ and 2 EQ + entries for the RQ. For optimial latency with small IO, we need to + change this so the HW only needs to DMA the EQ entries actually used by + a given work request. + + Implementation: + + - add wq_pidx counter to track where we are in the EQ. cidx/pidx are + used for the sw sq/rq tracking and flow control. + + - the variable part of work requests is the SGL. Add new functions to + build the SGL and/or immediate data directly in the EQ memory wrapping + when needed. + + - adjust the min burst size for the EQ contexts to 64B. + +commit 3be829d117a8ca7957370b09b477fe551de0cea5 +Author: Steve Wise +Date: Thu May 20 15:52:59 2010 -0500 + + Spin release 1.0.2. + + Signed-off-by: Steve Wise + +commit dc1ea232e8ece4ba53d2496befad14bd433e2e3e +Author: Steve Wise +Date: Thu May 20 15:48:37 2010 -0500 + + only insert sq qid in lookup tables. + + Signed-off-by: Steve Wise + +commit 00c60fd47b71dac42d864662567701e2618ff45d +Author: Steve Wise +Date: Thu May 20 15:47:37 2010 -0500 + + Update some driver limits. + + Signed-off-by: Steve Wise + +commit f25661e19d728a0a33a221c0646a9fce9b160f8b +Author: Steve Wise +Date: Thu May 20 15:46:38 2010 -0500 + + Fix cq arm overflow. + + - wrap cq->cqidx_inc based on cq size + - optimize t4_arm_cq() logic + + Signed-off-by: Steve Wise + +commit 8c224aca8f1acd219010e46da538ae4c9a4f9d1a *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 02:17:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D84CFF99; Wed, 29 Oct 2014 02:17:50 +0000 (UTC) Received: from mail-la0-x231.google.com (mail-la0-x231.google.com [IPv6:2a00:1450:4010:c03::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7FCCFAD7; Wed, 29 Oct 2014 02:17:49 +0000 (UTC) Received: by mail-la0-f49.google.com with SMTP id ge10so1703176lab.22 for ; Tue, 28 Oct 2014 19:17:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=G1NmCA2VsNfAUmDMKaPSEUNMwRnXbVSL5y7rqFLI71U=; b=ZBbdaLXbUfjHUTkUBNWNNJhoV8O9iedtbO3RL2g0HifZIsHD+GggbJQGiTmW6zAlHo gaQdz31goZFetlC3RZjqW+P1qRM3Zxc7x44J3RIupddX9m6wmg6/rbBsByYMs58kN0Th oDFWIe9VV7S6mHiBATLCDBH4NHlA+RuyA6jq+I3qtq9YIKCxABuupUq856nbm3w8FnbM zjt0huwPm6HhpQvmR+FznKmA3aCJfk/IQQtF2gvuDdxYaiowlONqrJrpq7NDfjgkxRjZ mZjVxBhRpdQUa368bNlY5jsL9r4OKAvtqstBPLWPmqv+FHCIXpZAE8HslttsnDGVFA+E haSw== MIME-Version: 1.0 X-Received: by 10.112.150.68 with SMTP id ug4mr8032550lbb.82.1414549067357; Tue, 28 Oct 2014 19:17:47 -0700 (PDT) Sender: crodr001@gmail.com Received: by 10.112.84.197 with HTTP; Tue, 28 Oct 2014 19:17:47 -0700 (PDT) Received: by 10.112.84.197 with HTTP; Tue, 28 Oct 2014 19:17:47 -0700 (PDT) In-Reply-To: <201410282214.s9SMEWFD007584@svn.freebsd.org> References: <201410282214.s9SMEWFD007584@svn.freebsd.org> Date: Tue, 28 Oct 2014 19:17:47 -0700 X-Google-Sender-Auth: jnIVlJvpOGq3PYy9qF9UPk5hV4Y Message-ID: Subject: Re: svn commit: r273802 - in head/bin/sh: . tests/parameters From: Craig Rodrigues To: Jilles Tjoelker Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, jenkins-admin@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 02:17:51 -0000 Hi, The tests started failing after this commit. Can you take a look? https://jenkins.freebsd.org/jenkins/job/FreeBSD_HEAD-tests2/143/console -- Craig On Oct 28, 2014 3:14 PM, "Jilles Tjoelker" wrote: > Author: jilles > Date: Tue Oct 28 22:14:31 2014 > New Revision: 273802 > URL: https://svnweb.freebsd.org/changeset/base/273802 > > Log: > Treat IFS separators in "$*" as quoted. > > This makes a difference if IFS starts with *, ?, [ or a CTL* byte. > > Added: > head/bin/sh/tests/parameters/positional6.0 (contents, props changed) > head/bin/sh/tests/parameters/positional7.0 (contents, props changed) > Modified: > head/bin/sh/expand.c > head/bin/sh/tests/parameters/Makefile > > Modified: head/bin/sh/expand.c > > ============================================================================== > --- head/bin/sh/expand.c Tue Oct 28 21:06:04 2014 (r273801) > +++ head/bin/sh/expand.c Tue Oct 28 22:14:31 2014 (r273802) > @@ -878,7 +878,7 @@ varvalue(const char *name, int quoted, i > int num; > char *p; > int i; > - char sep; > + char sep[2]; > char **ap; > > switch (*name) { > @@ -912,15 +912,18 @@ varvalue(const char *name, int quoted, i > /* FALLTHROUGH */ > case '*': > if (ifsset()) > - sep = ifsval()[0]; > + sep[0] = ifsval()[0]; > else > - sep = ' '; > + sep[0] = ' '; > + sep[1] = '\0'; > for (ap = shellparam.p ; (p = *ap++) != NULL ; ) { > strtodest(p, flag, subtype, quoted); > if (!*ap) > break; > - if (sep || (flag & EXP_FULL && !quoted && **ap != > '\0')) > - STPUTC(sep, expdest); > + if (sep[0]) > + strtodest(sep, flag, subtype, quoted); > + else if (flag & EXP_FULL && !quoted && **ap != > '\0') > + STPUTC('\0', expdest); > } > return; > default: > > Modified: head/bin/sh/tests/parameters/Makefile > > ============================================================================== > --- head/bin/sh/tests/parameters/Makefile Tue Oct 28 21:06:04 2014 > (r273801) > +++ head/bin/sh/tests/parameters/Makefile Tue Oct 28 22:14:31 2014 > (r273802) > @@ -18,6 +18,8 @@ FILES+= positional2.0 > FILES+= positional3.0 > FILES+= positional4.0 > FILES+= positional5.0 > +FILES+= positional6.0 > +FILES+= positional7.0 > FILES+= pwd1.0 > FILES+= pwd2.0 > > > Added: head/bin/sh/tests/parameters/positional6.0 > > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/bin/sh/tests/parameters/positional6.0 Tue Oct 28 22:14:31 2014 > (r273802) > @@ -0,0 +1,7 @@ > +# $FreeBSD$ > + > +IFS=? > +set p r > +v=pqrs > +r=${v#"$*"} > +[ "$r" = pqrs ] > > Added: head/bin/sh/tests/parameters/positional7.0 > > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/bin/sh/tests/parameters/positional7.0 Tue Oct 28 22:14:31 2014 > (r273802) > @@ -0,0 +1,8 @@ > +# $FreeBSD$ > + > +set -- / '' > +IFS=* > +set -- "$*" > +IFS=: > +args="$*" > +[ "$#:$args" = "1:/*" ] > > From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 02:23:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2BB6B1DF; Wed, 29 Oct 2014 02:23:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D89AB9C; Wed, 29 Oct 2014 02:23:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9T2Nom5026482; Wed, 29 Oct 2014 02:23:50 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9T2NoKh026481; Wed, 29 Oct 2014 02:23:50 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201410290223.s9T2NoKh026481@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Wed, 29 Oct 2014 02:23:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273808 - head/sys/dev/safe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 02:23:51 -0000 Author: jmg Date: Wed Oct 29 02:23:50 2014 New Revision: 273808 URL: https://svnweb.freebsd.org/changeset/base/273808 Log: make this compile on arm... bus_size_t is not size_t, and it has different sizes on different arches... Modified: head/sys/dev/safe/safe.c Modified: head/sys/dev/safe/safe.c ============================================================================== --- head/sys/dev/safe/safe.c Wed Oct 29 01:54:37 2014 (r273807) +++ head/sys/dev/safe/safe.c Wed Oct 29 02:23:50 2014 (r273808) @@ -1811,8 +1811,8 @@ safe_dma_malloc( BUS_DMA_NOWAIT, &dma->dma_map); if (r != 0) { device_printf(sc->sc_dev, "safe_dma_malloc: " - "bus_dmammem_alloc failed; size %zu, error %u\n", - size, r); + "bus_dmammem_alloc failed; size %ju, error %u\n", + (uintmax_t)size, r); goto fail_1; } From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 03:14:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 722E8CB2; Wed, 29 Oct 2014 03:14:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E67E1C2; Wed, 29 Oct 2014 03:14:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9T3EVE8050786; Wed, 29 Oct 2014 03:14:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9T3EUFT050781; Wed, 29 Oct 2014 03:14:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410290314.s9T3EUFT050781@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 29 Oct 2014 03:14:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273809 - in head/sys/cam: ctl scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 03:14:31 -0000 Author: mav Date: Wed Oct 29 03:14:29 2014 New Revision: 273809 URL: https://svnweb.freebsd.org/changeset/base/273809 Log: Implement better handling for ENOSPC error for both CTL and CAM. This makes VMWare VAAI Thin Provisioning Stun primitive activate, pausing the virtual machine, when backing storage (ZFS pool) is getting overflowed. MFC after: 1 week Sponsored by: iXsystems, Inc. Modified: head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_error.c head/sys/cam/ctl/ctl_error.h head/sys/cam/scsi/scsi_all.c Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Wed Oct 29 02:23:50 2014 (r273808) +++ head/sys/cam/ctl/ctl_backend_block.c Wed Oct 29 03:14:29 2014 (r273809) @@ -501,6 +501,8 @@ ctl_be_block_biodone(struct bio *bio) if (beio->num_errors > 0) { if (error == EOPNOTSUPP) { ctl_set_invalid_opcode(&io->scsiio); + } else if (error == ENOSPC) { + ctl_set_space_alloc_fail(&io->scsiio); } else if (beio->bio_cmd == BIO_FLUSH) { /* XXX KDM is there is a better error here? */ ctl_set_internal_failure(&io->scsiio, @@ -711,14 +713,12 @@ ctl_be_block_dispatch_file(struct ctl_be char path_str[32]; ctl_scsi_path_string(io, path_str, sizeof(path_str)); - /* - * XXX KDM ZFS returns ENOSPC when the underlying - * filesystem fills up. What kind of SCSI error should we - * return for that? - */ printf("%s%s command returned errno %d\n", path_str, (beio->bio_cmd == BIO_READ) ? "READ" : "WRITE", error); - ctl_set_medium_error(&io->scsiio); + if (error == ENOSPC) { + ctl_set_space_alloc_fail(&io->scsiio); + } else + ctl_set_medium_error(&io->scsiio); ctl_complete_beio(beio); return; } @@ -804,7 +804,10 @@ ctl_be_block_dispatch_zvol(struct ctl_be * return the I/O to the user. */ if (error != 0) { - ctl_set_medium_error(&io->scsiio); + if (error == ENOSPC) { + ctl_set_space_alloc_fail(&io->scsiio); + } else + ctl_set_medium_error(&io->scsiio); ctl_complete_beio(beio); return; } Modified: head/sys/cam/ctl/ctl_error.c ============================================================================== --- head/sys/cam/ctl/ctl_error.c Wed Oct 29 02:23:50 2014 (r273808) +++ head/sys/cam/ctl/ctl_error.c Wed Oct 29 03:14:29 2014 (r273809) @@ -806,6 +806,18 @@ ctl_set_task_aborted(struct ctl_scsiio * } void +ctl_set_space_alloc_fail(struct ctl_scsiio *ctsio) +{ + /* "Space allocation failed write protect" */ + ctl_set_sense(ctsio, + /*current_error*/ 1, + /*sense_key*/ SSD_KEY_DATA_PROTECT, + /*asc*/ 0x27, + /*ascq*/ 0x07, + SSD_ELEM_NONE); +} + +void ctl_set_success(struct ctl_scsiio *ctsio) { struct scsi_sense_data *sense; Modified: head/sys/cam/ctl/ctl_error.h ============================================================================== --- head/sys/cam/ctl/ctl_error.h Wed Oct 29 02:23:50 2014 (r273808) +++ head/sys/cam/ctl/ctl_error.h Wed Oct 29 03:14:29 2014 (r273809) @@ -81,6 +81,7 @@ void ctl_set_reservation_conflict(struct void ctl_set_queue_full(struct ctl_scsiio *ctsio); void ctl_set_busy(struct ctl_scsiio *ctsio); void ctl_set_task_aborted(struct ctl_scsiio *ctsio); +void ctl_set_space_alloc_fail(struct ctl_scsiio *ctsio); void ctl_set_success(struct ctl_scsiio *ctsio); #endif /* _CTL_ERROR_H_ */ Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Wed Oct 29 02:23:50 2014 (r273808) +++ head/sys/cam/scsi/scsi_all.c Wed Oct 29 03:14:29 2014 (r273809) @@ -1733,7 +1733,7 @@ static struct asc_table_entry asc_table[ { SST(0x27, 0x06, SS_RDEF, /* XXX TBD */ "Conditional write protect") }, /* D B */ - { SST(0x27, 0x07, SS_RDEF, /* XXX TBD */ + { SST(0x27, 0x07, SS_FATAL | ENOSPC, "Space allocation failed write protect") }, /* DTLPWROMAEBKVF */ { SST(0x28, 0x00, SS_FATAL | ENXIO, From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 04:00:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 45C575FF; Wed, 29 Oct 2014 04:00:45 +0000 (UTC) Received: from mail-pa0-x234.google.com (mail-pa0-x234.google.com [IPv6:2607:f8b0:400e:c03::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EDE6984C; Wed, 29 Oct 2014 04:00:44 +0000 (UTC) Received: by mail-pa0-f52.google.com with SMTP id fa1so2270987pad.11 for ; Tue, 28 Oct 2014 21:00:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=gEff82FUqm3onV+1S6bncPWJdS9kmYTBYNv3VcEa82s=; b=gfl8gJsf5yTx+hPYH1+nxrgT2+CB2QJX+XFRX95m2W99kcctEvKIohqWPC4rf+dpxy TlKFvEuWLBkkkFERNd3kx+gX/U4ozFPXa61AWNisNJic2eG+/WoWqRpdOEGCl3y7JG0O 5VAzTmRSmEug1NhWcvVT8nzo2oL4w7mD0OKlD8I/giXmGrvvmEJeRvNCZy+188Ngp+C+ 78cgCZyGMKdEvXjrSm68d0xP6CJwBFUIPLFXGxO30dE45Wx9ArJlvIXr3gztAmOozjB2 yF/YLQ81fdvHlBaGagJ0g9/3yOdazKQh2Irr6ezzsjJ7xx7pZrwk2veU21IOqyLJr23W nrPA== X-Received: by 10.70.43.229 with SMTP id z5mr852568pdl.25.1414555244572; Tue, 28 Oct 2014 21:00:44 -0700 (PDT) Received: from [192.168.242.58] (c-67-182-131-225.hsd1.wa.comcast.net. [67.182.131.225]) by mx.google.com with ESMTPSA id y7sm2653224pbt.83.2014.10.28.21.00.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Oct 2014 21:00:43 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_A1BED174-FC8E-458E-A5D6-999F22DADF3B"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273802 - in head/bin/sh: . tests/parameters From: Garrett Cooper In-Reply-To: Date: Tue, 28 Oct 2014 21:00:40 -0700 Message-Id: <56D198A5-FAC2-44F9-8057-E10B5DA3066E@gmail.com> References: <201410282214.s9SMEWFD007584@svn.freebsd.org> To: Craig Rodrigues X-Mailer: Apple Mail (2.1878.6) Cc: Jilles Tjoelker , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, jenkins-admin@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 04:00:45 -0000 --Apple-Mail=_A1BED174-FC8E-458E-A5D6-999F22DADF3B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Oct 28, 2014, at 19:17, Craig Rodrigues wrote: > Hi, >=20 > The tests started failing after this commit. Can you take a look? >=20 > = https://jenkins.freebsd.org/jenkins/job/FreeBSD_HEAD-tests2/143/console Hi Craig, It=92s my fault with not fully testing out the fix in r273803. = I=92m fixing my logic inversion after I fully test out the fix. Sorry :(.. --Apple-Mail=_A1BED174-FC8E-458E-A5D6-999F22DADF3B Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJUUGZoAAoJEMZr5QU6S73erVkIAI1d8XKYsEKqK0dg/TpxEf2o 3VKXUzbNYHMNgeuda1v2DalHyDtwypNsjtxkJu0n9LKhkaSL/HSifY2aWfSR3Tb2 MjIIlOcLJyD4WmSIpc+grjc8fzgmMbnQwmqZUnYznTAgsLikpPP2geVizGUKuRab 2AR8+MDJwGQXIxuVeHJLrcfrmnExCr83SbudMWrpgSvLxJoeMaXzIFr80SxQcCK3 Adb3dkCAPMDDLdBysy2mxCLfqrSRZvfKZMDaAfSxjmAV6JJhbLDkaByZD4yRV7GU SrgbqlH/HMsMhECY/CYCkVpq1fFenZxJhZ9Vrn1YMyROG975HPxOqkvWsbJ6TB4= =trOY -----END PGP SIGNATURE----- --Apple-Mail=_A1BED174-FC8E-458E-A5D6-999F22DADF3B-- From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 04:32:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 16528A5E; Wed, 29 Oct 2014 04:32:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 02B75B4E; Wed, 29 Oct 2014 04:32:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9T4WknG087361; Wed, 29 Oct 2014 04:32:46 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9T4Wkdg087360; Wed, 29 Oct 2014 04:32:46 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410290432.s9T4Wkdg087360@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 29 Oct 2014 04:32:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273810 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 04:32:47 -0000 Author: ngie Date: Wed Oct 29 04:32:46 2014 New Revision: 273810 URL: https://svnweb.freebsd.org/changeset/base/273810 Log: Fix the logic inversion in the previous commit by ensuring that the matched expression (:M) is empty, not the not matched (:N) is empty. The former case means we have not found the TEST_SUBDIR value in SUBDIR Reported by: rodrigc X-MFC with: r273803 Pointyhat to: me (did not use a clean install root) Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/bsd.test.mk Modified: head/share/mk/bsd.test.mk ============================================================================== --- head/share/mk/bsd.test.mk Wed Oct 29 03:14:29 2014 (r273809) +++ head/share/mk/bsd.test.mk Wed Oct 29 04:32:46 2014 (r273810) @@ -55,7 +55,7 @@ _TESTS= .include .for ts in ${TESTS_SUBDIRS} -.if empty(SUBDIR:N${ts}) +.if empty(SUBDIR:M${ts}) SUBDIR+= ${ts} .endif .endfor From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 04:33:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A756DBBA; Wed, 29 Oct 2014 04:33:49 +0000 (UTC) Received: from mail-pa0-x230.google.com (mail-pa0-x230.google.com [IPv6:2607:f8b0:400e:c03::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5AA84B5E; Wed, 29 Oct 2014 04:33:49 +0000 (UTC) Received: by mail-pa0-f48.google.com with SMTP id ey11so2305792pad.35 for ; Tue, 28 Oct 2014 21:33:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=Ms9HLLjXYgIF10rU31IC8yjbdxS/4iHs+Kootsd5Bes=; b=QLxow4BaciKL6Thi9C0uXxNQpizQ9+kMo/DcwZoNGcK9jy5e6FiMkqL+7cpUgbCQRZ Exc6RRNXRXtwbprtt7xzm5+sCgkUgmQl4lM31BhvfYUPczfnLU9AV6oBCGeyg0R3GrCv dd3oZZajADqmpLVc38I2qmsPm8A9Xj++OwILEet3L13J2C0Z4BWhBewC64I2XH92UrNY wRz/6unOHQ5nSMaHAtMM9RvgxNSUy/N28l5v4IO3Q+0EYDvZ0hfp28pAeQ1J04hAtYZj 27a8jSTkW6/zvizMaDC1tu10HyUelo2frzrwt4pJXE3J6zP5VKpM8WvDQMWm1Gu6CAoc 86og== X-Received: by 10.68.235.103 with SMTP id ul7mr7928848pbc.63.1414557228875; Tue, 28 Oct 2014 21:33:48 -0700 (PDT) Received: from [192.168.242.58] (c-67-182-131-225.hsd1.wa.comcast.net. [67.182.131.225]) by mx.google.com with ESMTPSA id qg7sm3046187pac.13.2014.10.28.21.33.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Oct 2014 21:33:48 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_550A6C29-4928-4C64-9A0C-C89E125BD4A3"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273802 - in head/bin/sh: . tests/parameters From: Garrett Cooper In-Reply-To: <56D198A5-FAC2-44F9-8057-E10B5DA3066E@gmail.com> Date: Tue, 28 Oct 2014 21:33:43 -0700 Message-Id: <7D698484-C425-406F-B740-F8C01C7AD9E3@gmail.com> References: <201410282214.s9SMEWFD007584@svn.freebsd.org> <56D198A5-FAC2-44F9-8057-E10B5DA3066E@gmail.com> To: Craig Rodrigues X-Mailer: Apple Mail (2.1878.6) Cc: Jilles Tjoelker , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, jenkins-admin@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 04:33:49 -0000 --Apple-Mail=_550A6C29-4928-4C64-9A0C-C89E125BD4A3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Oct 28, 2014, at 21:00, Garrett Cooper wrote: > On Oct 28, 2014, at 19:17, Craig Rodrigues = wrote: >=20 >> Hi, >>=20 >> The tests started failing after this commit. Can you take a look? >>=20 >> = https://jenkins.freebsd.org/jenkins/job/FreeBSD_HEAD-tests2/143/console >=20 > Hi Craig, > It=92s my fault with not fully testing out the fix in r273803. = I=92m fixing my logic inversion after I fully test out the fix. Fixed in r273810. Thank you! --Apple-Mail=_550A6C29-4928-4C64-9A0C-C89E125BD4A3 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJUUG4pAAoJEMZr5QU6S73eSlMH/AuhK77DtZQBf8UIPQGEXtSb r/gtpTMdht1AfJo/siXBMiWU7c1PZRSDNyKq63slnoNPSnKzWaaUS1NKswo0RyO9 Sr6Ru5DLiN+ANUgkutp9OiMr7TailvgrTFoB3DOiKPxcfp9Gbo3wN+8x5JNfxY7j 3GPHPPJSdd8I3KmOnEflrbrfAUvPJVQIANL19iTEHPCjzdxiqpJu2xaRLB+HD+rP vbOhDZKpXxxahDh6xrHLTg22UC6jzIaVjtnsDivlCXnYPH9mG1VGu90XktcgeeS9 1obvmUs0Cx3lE8fuZYX6jqInPKUpYhl/L9bBxgrhEcm++wj0NbFvYUTS+cFhwWY= =Hi2R -----END PGP SIGNATURE----- --Apple-Mail=_550A6C29-4928-4C64-9A0C-C89E125BD4A3-- From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 06:24:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A9F41C6B; Wed, 29 Oct 2014 06:24:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D73874B; Wed, 29 Oct 2014 06:24:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9T6ODfU038595; Wed, 29 Oct 2014 06:24:13 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9T6OD1a038594; Wed, 29 Oct 2014 06:24:13 GMT (envelope-from np@FreeBSD.org) Message-Id: <201410290624.s9T6OD1a038594@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 29 Oct 2014 06:24:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273811 - head/contrib/ofed/librdmacm/examples X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 06:24:13 -0000 Author: np Date: Wed Oct 29 06:24:12 2014 New Revision: 273811 URL: https://svnweb.freebsd.org/changeset/base/273811 Log: rping: make sure that the CQ event thread can never poll a CQ after it has been destroyed. Submitted by: Hariprasad at Chelsio dot com Sponsored by: Chelsio Communications Modified: head/contrib/ofed/librdmacm/examples/rping.c Modified: head/contrib/ofed/librdmacm/examples/rping.c ============================================================================== --- head/contrib/ofed/librdmacm/examples/rping.c Wed Oct 29 04:32:46 2014 (r273810) +++ head/contrib/ofed/librdmacm/examples/rping.c Wed Oct 29 06:24:12 2014 (r273811) @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -280,10 +279,10 @@ static int rping_cq_event_handler(struct ret = 0; if (wc.status) { - fprintf(stderr, "cq completion failed status %d\n", - wc.status); if (wc.status != IBV_WC_WR_FLUSH_ERR) - ret = -1; + fprintf(stderr, "cq completion failed status %d\n", + wc.status); + ret = -1; goto error; } @@ -800,10 +799,9 @@ static void *rping_persistent_server_thr rping_test_server(cb); rdma_disconnect(cb->child_cm_id); + pthread_join(cb->cqthread, NULL); rping_free_buffers(cb); rping_free_qp(cb); - pthread_cancel(cb->cqthread); - pthread_join(cb->cqthread, NULL); rdma_destroy_id(cb->child_cm_id); free_cb(cb); return NULL; @@ -888,6 +886,7 @@ static int rping_run_server(struct rping rping_test_server(cb); rdma_disconnect(cb->child_cm_id); + pthread_join(cb->cqthread, NULL); rdma_destroy_id(cb->child_cm_id); err2: rping_free_buffers(cb); @@ -1053,9 +1052,16 @@ static int rping_run_client(struct rping goto err2; } - rping_test_client(cb); + ret = rping_test_client(cb); + if (ret) { + fprintf(stderr, "rping client failed: %d\n", ret); + goto err3; + } + ret = 0; +err3: rdma_disconnect(cb->cm_id); err2: + pthread_join(cb->cqthread, NULL); rping_free_buffers(cb); err1: rping_free_qp(cb); From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 06:34:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AE21DE49 for ; Wed, 29 Oct 2014 06:34:34 +0000 (UTC) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7316881A for ; Wed, 29 Oct 2014 06:34:33 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 3B0D74497 for ; Wed, 29 Oct 2014 02:34:27 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Wed, 29 Oct 2014 02:34:27 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.fm; h= x-sasl-enc:in-reply-to:references:mime-version :content-transfer-encoding:content-type:subject:from:date:to :message-id; s=mesmtp; bh=XfbpDkTbkC3kPje9EhHBa8RAkbw=; b=Acok+g ON+eZA6X0v28OWC1aK5nCk3vjYUYxKDZN5Ziqktf7N389GcvDSIJ9YXC/cu/a/Hg zeCvY/ELIJBSEU19gDyp6bleC6psjzaP0ICcJckirK6A847irxXJffiI71SlWHF8 HvsGs6WN0jltyxyYGcutL2yUHGwoJNB4V1J+w= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:in-reply-to:references :mime-version:content-transfer-encoding:content-type:subject :from:date:to:message-id; s=smtpout; bh=XfbpDkTbkC3kPje9EhHBa8RA kbw=; b=poR22f6akbFmsfwOG48lQ9i81vQLJgXgQ72/MNlqx/bQ8zK0YpnX6Jmv NG/IJE135+u+sdDXSfvs11BOTHaKiJR7+BqhMDTdOJy6tkTujmlOKs4kHiax2LDw 9ch2Bw/B1X0koTDOQbLomVXlq1O1laRiKt5u0gLthImeTuhM2R8= X-Sasl-enc: hEmVplrFijZBRo4P7NUPLmqOBExbxoTs1nHRlFAGo0y6 1414564466 Received: from [192.168.0.110] (unknown [174.24.231.159]) by mail.messagingengine.com (Postfix) with ESMTPA id C39416800A8; Wed, 29 Oct 2014 02:34:25 -0400 (EDT) User-Agent: K-9 Mail for Android In-Reply-To: <201410290624.s9T6OD1a038594@svn.freebsd.org> References: <201410290624.s9T6OD1a038594@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: svn commit: r273811 - head/contrib/ofed/librdmacm/examples From: Anthony Cornehl Date: Tue, 28 Oct 2014 23:34:11 -0700 To: Navdeep Parhar , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 06:34:34 -0000 On October 28, 2014 11:24:13 PM PDT, Navdeep Parhar wrote: >Author: np >Date: Wed Oct 29 06:24:12 2014 >New Revision: 273811 >URL: https://svnweb.freebsd.org/changeset/base/273811 > >Log: > rping: make sure that the CQ event thread can never poll a CQ after it > has been destroyed. > > Submitted by: Hariprasad at Chelsio dot com > Sponsored by: Chelsio Communications > Is this change present upstream? We really should be tracking the originating repositories when making changes in OFED packages, but the kernel and userspace is several years out of date from what OFED is tracking currently. [1] http://git.openfabrics.org/?p=~shefty/librdmacm.git;a=summary >Modified: > head/contrib/ofed/librdmacm/examples/rping.c > >Modified: head/contrib/ofed/librdmacm/examples/rping.c >============================================================================== >--- head/contrib/ofed/librdmacm/examples/rping.c Wed Oct 29 04:32:46 >2014 (r273810) >+++ head/contrib/ofed/librdmacm/examples/rping.c Wed Oct 29 06:24:12 >2014 (r273811) >@@ -40,7 +40,6 @@ > #include > #include > #include >-#include > #include > #include > #include >@@ -280,10 +279,10 @@ static int rping_cq_event_handler(struct > ret = 0; > > if (wc.status) { >- fprintf(stderr, "cq completion failed status %d\n", >- wc.status); > if (wc.status != IBV_WC_WR_FLUSH_ERR) >- ret = -1; >+ fprintf(stderr, "cq completion failed status %d\n", >+ wc.status); >+ ret = -1; > goto error; > } > >@@ -800,10 +799,9 @@ static void *rping_persistent_server_thr > > rping_test_server(cb); > rdma_disconnect(cb->child_cm_id); >+ pthread_join(cb->cqthread, NULL); > rping_free_buffers(cb); > rping_free_qp(cb); >- pthread_cancel(cb->cqthread); >- pthread_join(cb->cqthread, NULL); > rdma_destroy_id(cb->child_cm_id); > free_cb(cb); > return NULL; >@@ -888,6 +886,7 @@ static int rping_run_server(struct rping > > rping_test_server(cb); > rdma_disconnect(cb->child_cm_id); >+ pthread_join(cb->cqthread, NULL); > rdma_destroy_id(cb->child_cm_id); > err2: > rping_free_buffers(cb); >@@ -1053,9 +1052,16 @@ static int rping_run_client(struct rping > goto err2; > } > >- rping_test_client(cb); >+ ret = rping_test_client(cb); >+ if (ret) { >+ fprintf(stderr, "rping client failed: %d\n", ret); >+ goto err3; >+ } >+ ret = 0; >+err3: > rdma_disconnect(cb->cm_id); > err2: >+ pthread_join(cb->cqthread, NULL); > rping_free_buffers(cb); > err1: > rping_free_qp(cb); >_______________________________________________ >svn-src-head@freebsd.org mailing list >http://lists.freebsd.org/mailman/listinfo/svn-src-head >To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 06:38:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CB540FA6; Wed, 29 Oct 2014 06:38:08 +0000 (UTC) Received: from mail-pd0-x229.google.com (mail-pd0-x229.google.com [IPv6:2607:f8b0:400e:c02::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 92B01836; Wed, 29 Oct 2014 06:38:08 +0000 (UTC) Received: by mail-pd0-f169.google.com with SMTP id y10so2363567pdj.14 for ; Tue, 28 Oct 2014 23:38:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=pR0/T+j/3v2iBKjCXWe2hzEfOfsyrELE2Nzo/ASNR+E=; b=qbPwQxKmJmXhslwUL4z2xgqE9G6czyQOh/fX7097Bru+C5Tc+YWZawdPrk7jklLwPB 7HuWPUTwiG/+yc5gKKh5CKOB8XMQIDp4J2WkvCxSKgTlXo7e9PF+YXGnPlG6ocN6iqzQ xz0ONczzWgyD2YdK+/T1hDil8yLo80PhHvXlo5f9PYKqtf/6/wsttqRbTdo+9GoxRhM2 jJwWPEc8l1KDOHcCo3iJmWC0PLtqbnFKLnThZZ25GLniY/DjnsK6CG1K5MeqADO9Bo4V Rm3Ir+82GnNyapDkgioo7A5BEmrnT0g17bfgOEvDfWzg380PFnyfMTbS3pK2r+BSsc1k aUMQ== X-Received: by 10.70.22.195 with SMTP id g3mr8423487pdf.37.1414564688218; Tue, 28 Oct 2014 23:38:08 -0700 (PDT) Received: from ox ([24.6.44.228]) by mx.google.com with ESMTPSA id z15sm3367299pdi.6.2014.10.28.23.38.05 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 28 Oct 2014 23:38:07 -0700 (PDT) Sender: Navdeep Parhar Date: Tue, 28 Oct 2014 23:38:01 -0700 From: Navdeep Parhar To: Anthony Cornehl Subject: Re: svn commit: r273811 - head/contrib/ofed/librdmacm/examples Message-ID: <20141029063729.GA7077@ox> Mail-Followup-To: Anthony Cornehl , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201410290624.s9T6OD1a038594@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 06:38:08 -0000 On Tue, Oct 28, 2014 at 11:34:11PM -0700, Anthony Cornehl wrote: > On October 28, 2014 11:24:13 PM PDT, Navdeep Parhar wrote: > >Author: np > >Date: Wed Oct 29 06:24:12 2014 > >New Revision: 273811 > >URL: https://svnweb.freebsd.org/changeset/base/273811 > > > >Log: > > rping: make sure that the CQ event thread can never poll a CQ after it > > has been destroyed. > > > > Submitted by: Hariprasad at Chelsio dot com > > Sponsored by: Chelsio Communications > > > > Is this change present upstream? We really should be tracking the originating > repositories when making changes in OFED packages, but the kernel and > userspace is several years out of date from what OFED is tracking currently. The patch was submitted upstream. I'm sure it'll get there eventually. Navdeep > > [1] http://git.openfabrics.org/?p=~shefty/librdmacm.git;a=summary > > >Modified: > > head/contrib/ofed/librdmacm/examples/rping.c > > > >Modified: head/contrib/ofed/librdmacm/examples/rping.c > >============================================================================== > >--- head/contrib/ofed/librdmacm/examples/rping.c Wed Oct 29 04:32:46 > >2014 (r273810) > >+++ head/contrib/ofed/librdmacm/examples/rping.c Wed Oct 29 06:24:12 > >2014 (r273811) > >@@ -40,7 +40,6 @@ > > #include > > #include > > #include > >-#include > > #include > > #include > > #include > >@@ -280,10 +279,10 @@ static int rping_cq_event_handler(struct > > ret = 0; > > > > if (wc.status) { > >- fprintf(stderr, "cq completion failed status %d\n", > >- wc.status); > > if (wc.status != IBV_WC_WR_FLUSH_ERR) > >- ret = -1; > >+ fprintf(stderr, "cq completion failed status %d\n", > >+ wc.status); > >+ ret = -1; > > goto error; > > } > > > >@@ -800,10 +799,9 @@ static void *rping_persistent_server_thr > > > > rping_test_server(cb); > > rdma_disconnect(cb->child_cm_id); > >+ pthread_join(cb->cqthread, NULL); > > rping_free_buffers(cb); > > rping_free_qp(cb); > >- pthread_cancel(cb->cqthread); > >- pthread_join(cb->cqthread, NULL); > > rdma_destroy_id(cb->child_cm_id); > > free_cb(cb); > > return NULL; > >@@ -888,6 +886,7 @@ static int rping_run_server(struct rping > > > > rping_test_server(cb); > > rdma_disconnect(cb->child_cm_id); > >+ pthread_join(cb->cqthread, NULL); > > rdma_destroy_id(cb->child_cm_id); > > err2: > > rping_free_buffers(cb); > >@@ -1053,9 +1052,16 @@ static int rping_run_client(struct rping > > goto err2; > > } > > > >- rping_test_client(cb); > >+ ret = rping_test_client(cb); > >+ if (ret) { > >+ fprintf(stderr, "rping client failed: %d\n", ret); > >+ goto err3; > >+ } > >+ ret = 0; > >+err3: > > rdma_disconnect(cb->cm_id); > > err2: > >+ pthread_join(cb->cqthread, NULL); > > rping_free_buffers(cb); > > err1: > > rping_free_qp(cb); > >_______________________________________________ > >svn-src-head@freebsd.org mailing list > >http://lists.freebsd.org/mailman/listinfo/svn-src-head > >To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > > > From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 06:47:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 004E9247 for ; Wed, 29 Oct 2014 06:47:46 +0000 (UTC) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE5F6909 for ; Wed, 29 Oct 2014 06:47:46 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id C7FA128CA for ; Wed, 29 Oct 2014 02:47:45 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Wed, 29 Oct 2014 02:47:45 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.fm; h= x-sasl-enc:in-reply-to:references:mime-version :content-transfer-encoding:content-type:subject:from:date:to:cc :message-id; s=mesmtp; bh=xCjs35M3ryBbz8xpnLt2283NzCA=; b=OhC1ei lec2C+uSM4CtE+9Ok8Icmde4Cyx7Hnei0bYgEr8d0sFzjlcmJzW3HLKqo0nypzDj MiYwKSrXJJKHjSTuyBmMbNJyaoYbSZJJuUmvR9YJBqNJc27rdYwZ5I2EF9GtpyIN /UwmeBVRmwE01PcGOPYnUUrPoJlfdgycEQEmA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:in-reply-to:references :mime-version:content-transfer-encoding:content-type:subject :from:date:to:cc:message-id; s=smtpout; bh=xCjs35M3ryBbz8xpnLt22 83NzCA=; b=X9tX+ri1Rwtm34NOotFEkbFMhWoAtNR8Dv1W0lIT3816zwYrJYZeb MySpF21Em3ygEJ5G1B0oguHTXokdmm3j+6PGQJVzDqy5Gds1gdSdrSTPfgJpm4Y+ rZVIbsL9dfNPfbeISg/WNwDqONU556AdApTiTobXMpReA/i9uXoRkg= X-Sasl-enc: AA5yk2K6euDYYmFH5rjr0Squ2A4biLMls1aPosrm+9l7 1414565264 Received: from [192.168.0.110] (unknown [174.24.231.159]) by mail.messagingengine.com (Postfix) with ESMTPA id 6619E6800EC; Wed, 29 Oct 2014 02:47:43 -0400 (EDT) User-Agent: K-9 Mail for Android In-Reply-To: <20141029063729.GA7077@ox> References: <201410290624.s9T6OD1a038594@svn.freebsd.org> <20141029063729.GA7077@ox> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: svn commit: r273811 - head/contrib/ofed/librdmacm/examples From: Anthony Cornehl Date: Tue, 28 Oct 2014 23:47:29 -0700 To: Navdeep Parhar Message-ID: <2773FEBA-554C-4035-A27B-0F1DEBB98ED3@fastmail.fm> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 06:47:47 -0000 On October 28, 2014 11:38:01 PM PDT, Navdeep Parhar wrote: >On Tue, Oct 28, 2014 at 11:34:11PM -0700, Anthony Cornehl wrote: >> On October 28, 2014 11:24:13 PM PDT, Navdeep Parhar >wrote: >> >Author: np >> >Date: Wed Oct 29 06:24:12 2014 >> >New Revision: 273811 >> >URL: https://svnweb.freebsd.org/changeset/base/273811 >> > >> >Log: >> > rping: make sure that the CQ event thread can never poll a CQ after >it >> > has been destroyed. >> > >> > Submitted by: Hariprasad at Chelsio dot com >> > Sponsored by: Chelsio Communications >> > >> >> Is this change present upstream? We really should be tracking the >originating >> repositories when making changes in OFED packages, but the kernel and >> userspace is several years out of date from what OFED is tracking >currently. > >The patch was submitted upstream. I'm sure it'll get there eventually. > >Navdeep > Awesome! Thanks for fixing this. >> >> [1] http://git.openfabrics.org/?p=~shefty/librdmacm.git;a=summary >> >> >Modified: >> > head/contrib/ofed/librdmacm/examples/rping.c >> > >> >Modified: head/contrib/ofed/librdmacm/examples/rping.c >> >>============================================================================== >> >--- head/contrib/ofed/librdmacm/examples/rping.c Wed Oct 29 04:32:46 >> >2014 (r273810) >> >+++ head/contrib/ofed/librdmacm/examples/rping.c Wed Oct 29 06:24:12 >> >2014 (r273811) >> >@@ -40,7 +40,6 @@ >> > #include >> > #include >> > #include >> >-#include >> > #include >> > #include >> > #include >> >@@ -280,10 +279,10 @@ static int rping_cq_event_handler(struct >> > ret = 0; >> > >> > if (wc.status) { >> >- fprintf(stderr, "cq completion failed status %d\n", >> >- wc.status); >> > if (wc.status != IBV_WC_WR_FLUSH_ERR) >> >- ret = -1; >> >+ fprintf(stderr, "cq completion failed status %d\n", >> >+ wc.status); >> >+ ret = -1; >> > goto error; >> > } >> > >> >@@ -800,10 +799,9 @@ static void *rping_persistent_server_thr >> > >> > rping_test_server(cb); >> > rdma_disconnect(cb->child_cm_id); >> >+ pthread_join(cb->cqthread, NULL); >> > rping_free_buffers(cb); >> > rping_free_qp(cb); >> >- pthread_cancel(cb->cqthread); >> >- pthread_join(cb->cqthread, NULL); >> > rdma_destroy_id(cb->child_cm_id); >> > free_cb(cb); >> > return NULL; >> >@@ -888,6 +886,7 @@ static int rping_run_server(struct rping >> > >> > rping_test_server(cb); >> > rdma_disconnect(cb->child_cm_id); >> >+ pthread_join(cb->cqthread, NULL); >> > rdma_destroy_id(cb->child_cm_id); >> > err2: >> > rping_free_buffers(cb); >> >@@ -1053,9 +1052,16 @@ static int rping_run_client(struct rping >> > goto err2; >> > } >> > >> >- rping_test_client(cb); >> >+ ret = rping_test_client(cb); >> >+ if (ret) { >> >+ fprintf(stderr, "rping client failed: %d\n", ret); >> >+ goto err3; >> >+ } >> >+ ret = 0; >> >+err3: >> > rdma_disconnect(cb->cm_id); >> > err2: >> >+ pthread_join(cb->cqthread, NULL); >> > rping_free_buffers(cb); >> > err1: >> > rping_free_qp(cb); >> >_______________________________________________ >> >svn-src-head@freebsd.org mailing list >> >http://lists.freebsd.org/mailman/listinfo/svn-src-head >> >To unsubscribe, send any mail to >"svn-src-head-unsubscribe@freebsd.org" >> >> >> From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 09:26:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2988A65D; Wed, 29 Oct 2014 09:26:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0ACFAB25; Wed, 29 Oct 2014 09:26:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9T9QvaT023398; Wed, 29 Oct 2014 09:26:57 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9T9Qu4E023387; Wed, 29 Oct 2014 09:26:56 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410290926.s9T9Qu4E023387@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 29 Oct 2014 09:26:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273813 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 09:26:58 -0000 Author: trasz Date: Wed Oct 29 09:26:55 2014 New Revision: 273813 URL: https://svnweb.freebsd.org/changeset/base/273813 Log: Add discovery-filter. This makes it possible to restrict which targets are returned during discovery based on initiator portal, name, and CHAP credentials. Reviewed by: mav@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/ctl.conf.5 head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/discovery.c head/usr.sbin/ctld/login.c head/usr.sbin/ctld/parse.y head/usr.sbin/ctld/token.l Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Wed Oct 29 09:06:05 2014 (r273812) +++ head/usr.sbin/ctld/ctl.conf.5 Wed Oct 29 09:26:55 2014 (r273813) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2014 +.Dd October 29, 2014 .Dt CTL.CONF 5 .Os .Sh NAME @@ -175,6 +175,43 @@ Another predefined .Qq Ar no-authentication , may be used to permit discovery without authentication. +.It Ic discovery-filter Ar filter +Determines which targets are returned during discovery. +Filter can be either +.Qq Ar none , +.Qq Ar portal , +.Qq Ar portal-name , +or +.Qq Ar portal-name-auth . +When set to +.Qq Ar none , +discovery will return all targets assigned to that portal group. +When set to +.Qq Ar portal , +discovery will not return targets that cannot be accessed by the +initiator because of their +.Sy initiator-portal . +When set to +.Qq Ar portal-name , +the check will include both +.Sy initiator-portal +and +.Sy initiator-name . +When set to +.Qq Ar portal-name-auth , +the check will include +.Sy initiator-portal , +.Sy initiator-name , +and authentication credentials, ie. if the target does not require +CHAP authentication, or if CHAP user and secret used during discovery +match CHAP user and secret required to access the target. +Note that when using +.Qq Ar portal-name-auth , +targets that require CHAP authentication will only be returned if +.Sy discovery-auth-group +requires CHAP. +The default is +.Qq Ar none . .It Ic listen Ar address An IPv4 or IPv6 address and port to listen on for incoming connections. .\".It Ic listen-iser Ar address Modified: head/usr.sbin/ctld/ctld.c ============================================================================== --- head/usr.sbin/ctld/ctld.c Wed Oct 29 09:06:05 2014 (r273812) +++ head/usr.sbin/ctld/ctld.c Wed Oct 29 09:26:55 2014 (r273813) @@ -979,6 +979,53 @@ isns_deregister(struct isns *isns) set_timeout(0, false); } +static int +portal_group_set_filter(struct portal_group *pg, int filter) +{ + + if (pg->pg_discovery_filter == PG_FILTER_UNKNOWN) { + pg->pg_discovery_filter = filter; + return (0); + } + + if (pg->pg_discovery_filter == filter) + return (0); + + return (1); +} + +int +portal_group_set_filter_str(struct portal_group *pg, const char *str) +{ + int error, filter; + + if (strcmp(str, "none") == 0) { + filter = PG_FILTER_NONE; + } else if (strcmp(str, "portal") == 0) { + filter = PG_FILTER_PORTAL; + } else if (strcmp(str, "portal-name") == 0) { + filter = PG_FILTER_PORTAL_NAME; + } else if (strcmp(str, "portal-name-auth") == 0) { + filter = PG_FILTER_PORTAL_NAME_AUTH; + } else { + log_warnx("invalid discovery-filter \"%s\" for portal-group " + "\"%s\"; valid values are \"none\", \"portal\", " + "\"portal-name\", and \"portal-name-auth\"", + str, pg->pg_name); + return (1); + } + + error = portal_group_set_filter(pg, filter); + if (error != 0) { + log_warnx("cannot set discovery-filter to \"%s\" for " + "portal-group \"%s\"; already has a different " + "value", str, pg->pg_name); + return (1); + } + + return (error); +} + static bool valid_hex(const char ch) { @@ -1478,6 +1525,9 @@ conf_verify(struct conf *conf) assert(pg->pg_discovery_auth_group != NULL); } + if (pg->pg_discovery_filter == PG_FILTER_UNKNOWN) + pg->pg_discovery_filter = PG_FILTER_NONE; + TAILQ_FOREACH(targ, &conf->conf_targets, t_next) { if (targ->t_portal_group == pg) break; Modified: head/usr.sbin/ctld/ctld.h ============================================================================== --- head/usr.sbin/ctld/ctld.h Wed Oct 29 09:06:05 2014 (r273812) +++ head/usr.sbin/ctld/ctld.h Wed Oct 29 09:26:55 2014 (r273813) @@ -103,11 +103,18 @@ struct portal { int p_socket; }; +#define PG_FILTER_UNKNOWN 0 +#define PG_FILTER_NONE 1 +#define PG_FILTER_PORTAL 2 +#define PG_FILTER_PORTAL_NAME 3 +#define PG_FILTER_PORTAL_NAME_AUTH 4 + struct portal_group { TAILQ_ENTRY(portal_group) pg_next; struct conf *pg_conf; char *pg_name; struct auth_group *pg_discovery_auth_group; + int pg_discovery_filter; bool pg_unassigned; TAILQ_HEAD(, portal) pg_portals; @@ -200,6 +207,8 @@ struct connection { int conn_immediate_data; int conn_header_digest; int conn_data_digest; + const char *conn_user; + struct chap *conn_chap; }; struct pdu { @@ -290,6 +299,8 @@ struct portal_group *portal_group_find(c const char *name); int portal_group_add_listen(struct portal_group *pg, const char *listen, bool iser); +int portal_group_set_filter_str(struct portal_group *pg, + const char *filter); int isns_new(struct conf *conf, const char *addr); void isns_delete(struct isns *is); Modified: head/usr.sbin/ctld/discovery.c ============================================================================== --- head/usr.sbin/ctld/discovery.c Wed Oct 29 09:06:05 2014 (r273812) +++ head/usr.sbin/ctld/discovery.c Wed Oct 29 09:26:55 2014 (r273813) @@ -201,6 +201,65 @@ discovery_add_target(struct keys *respon } } +static bool +discovery_target_filtered_out(const struct connection *conn, + const struct target *targ) +{ + const struct auth_group *ag; + const struct portal_group *pg; + const struct auth *auth; + int error; + + ag = targ->t_auth_group; + pg = conn->conn_portal->p_portal_group; + + assert(pg->pg_discovery_auth_group != PG_FILTER_UNKNOWN); + + if (pg->pg_discovery_filter >= PG_FILTER_PORTAL && + auth_portal_check(ag, &conn->conn_initiator_sa) != 0) { + log_debugx("initiator does not match initiator portals " + "allowed for target \"%s\"; skipping", targ->t_name); + return (true); + } + + if (pg->pg_discovery_filter >= PG_FILTER_PORTAL_NAME && + auth_name_check(ag, conn->conn_initiator_name) != 0) { + log_debugx("initiator does not match initiator names " + "allowed for target \"%s\"; skipping", targ->t_name); + return (true); + } + + if (pg->pg_discovery_filter >= PG_FILTER_PORTAL_NAME_AUTH && + ag->ag_type != AG_TYPE_NO_AUTHENTICATION) { + if (conn->conn_chap == NULL) { + assert(pg->pg_discovery_auth_group->ag_type == + AG_TYPE_NO_AUTHENTICATION); + + log_debugx("initiator didn't authenticate, but target " + "\"%s\" requires CHAP; skipping", targ->t_name); + return (true); + } + + assert(conn->conn_user != NULL); + auth = auth_find(ag, conn->conn_user); + if (auth == NULL) { + log_debugx("CHAP user \"%s\" doesn't match target " + "\"%s\"; skipping", conn->conn_user, targ->t_name); + return (true); + } + + error = chap_authenticate(conn->conn_chap, auth->a_secret); + if (error != 0) { + log_debugx("password for CHAP user \"%s\" doesn't " + "match target \"%s\"; skipping", + conn->conn_user, targ->t_name); + return (true); + } + } + + return (false); +} + void discovery(struct connection *conn) { @@ -232,6 +291,10 @@ discovery(struct connection *conn) targ->t_name); continue; } + if (discovery_target_filtered_out(conn, targ)) { + /* Ignore this target. */ + continue; + } discovery_add_target(response_keys, targ); } } else { @@ -239,8 +302,13 @@ discovery(struct connection *conn) if (targ == NULL) { log_debugx("initiator requested information on unknown " "target \"%s\"; returning nothing", send_targets); - } else - discovery_add_target(response_keys, targ); + } else { + if (discovery_target_filtered_out(conn, targ)) { + /* Ignore this target. */ + } else { + discovery_add_target(response_keys, targ); + } + } } keys_save(response_keys, response); Modified: head/usr.sbin/ctld/login.c ============================================================================== --- head/usr.sbin/ctld/login.c Wed Oct 29 09:06:05 2014 (r273812) +++ head/usr.sbin/ctld/login.c Wed Oct 29 09:26:55 2014 (r273813) @@ -441,7 +441,12 @@ login_chap(struct connection *conn, stru "transitioning to Negotiation Phase", auth->a_user); login_send_chap_success(request, auth); pdu_delete(request); - chap_delete(chap); + + /* + * Leave username and CHAP information for discovery(). + */ + conn->conn_user = auth->a_user; + conn->conn_chap = chap; } static void Modified: head/usr.sbin/ctld/parse.y ============================================================================== --- head/usr.sbin/ctld/parse.y Wed Oct 29 09:06:05 2014 (r273812) +++ head/usr.sbin/ctld/parse.y Wed Oct 29 09:26:55 2014 (r273813) @@ -58,10 +58,10 @@ extern void yyrestart(FILE *); %} %token ALIAS AUTH_GROUP AUTH_TYPE BACKEND BLOCKSIZE CHAP CHAP_MUTUAL -%token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP INITIATOR_NAME -%token INITIATOR_PORTAL LISTEN LISTEN_ISER LUN MAXPROC OPENING_BRACKET -%token OPTION PATH PIDFILE PORTAL_GROUP SERIAL SIZE STR TARGET TIMEOUT -%token ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT +%token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP DISCOVERY_FILTER +%token INITIATOR_NAME INITIATOR_PORTAL LISTEN LISTEN_ISER LUN MAXPROC +%token OPENING_BRACKET OPTION PATH PIDFILE PORTAL_GROUP SERIAL SIZE STR +%token TARGET TIMEOUT ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT %union { @@ -327,6 +327,8 @@ portal_group_entries: portal_group_entry: portal_group_discovery_auth_group | + portal_group_discovery_filter + | portal_group_listen | portal_group_listen_iser @@ -352,6 +354,17 @@ portal_group_discovery_auth_group: DISCO } ; +portal_group_discovery_filter: DISCOVERY_FILTER STR + { + int error; + + error = portal_group_set_filter_str(portal_group, $2); + free($2); + if (error != 0) + return (1); + } + ; + portal_group_listen: LISTEN STR { int error; Modified: head/usr.sbin/ctld/token.l ============================================================================== --- head/usr.sbin/ctld/token.l Wed Oct 29 09:06:05 2014 (r273812) +++ head/usr.sbin/ctld/token.l Wed Oct 29 09:26:55 2014 (r273813) @@ -58,6 +58,7 @@ chap-mutual { return CHAP_MUTUAL; } debug { return DEBUG; } device-id { return DEVICE_ID; } discovery-auth-group { return DISCOVERY_AUTH_GROUP; } +discovery-filter { return DISCOVERY_FILTER; } initiator-name { return INITIATOR_NAME; } initiator-portal { return INITIATOR_PORTAL; } listen { return LISTEN; } From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 09:36:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2E2E3D52; Wed, 29 Oct 2014 09:36:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10E5CC3E; Wed, 29 Oct 2014 09:36:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9T9a3QZ028163; Wed, 29 Oct 2014 09:36:03 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9T9a39F028158; Wed, 29 Oct 2014 09:36:03 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410290936.s9T9a39F028158@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 29 Oct 2014 09:36:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273816 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 09:36:04 -0000 Author: trasz Date: Wed Oct 29 09:36:02 2014 New Revision: 273816 URL: https://svnweb.freebsd.org/changeset/base/273816 Log: Simplify code; no functional changes. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/parse.y Modified: head/usr.sbin/ctld/ctld.c ============================================================================== --- head/usr.sbin/ctld/ctld.c Wed Oct 29 09:32:36 2014 (r273815) +++ head/usr.sbin/ctld/ctld.c Wed Oct 29 09:36:02 2014 (r273816) @@ -522,25 +522,10 @@ auth_group_find(const struct conf *conf, return (NULL); } -static int -auth_group_set_type(struct auth_group *ag, int type) -{ - - if (ag->ag_type == AG_TYPE_UNKNOWN) { - ag->ag_type = type; - return (0); - } - - if (ag->ag_type == type) - return (0); - - return (1); -} - int -auth_group_set_type_str(struct auth_group *ag, const char *str) +auth_group_set_type(struct auth_group *ag, const char *str) { - int error, type; + int type; if (strcmp(str, "none") == 0) { type = AG_TYPE_NO_AUTHENTICATION; @@ -560,20 +545,22 @@ auth_group_set_type_str(struct auth_grou return (1); } - error = auth_group_set_type(ag, type); - if (error != 0) { - if (ag->ag_name != NULL) + if (ag->ag_type != AG_TYPE_UNKNOWN && ag->ag_type != type) { + if (ag->ag_name != NULL) { log_warnx("cannot set auth-type to \"%s\" for " "auth-group \"%s\"; already has a different " "type", str, ag->ag_name); - else + } else { log_warnx("cannot set auth-type to \"%s\" for target " "\"%s\"; already has a different type", str, ag->ag_target->t_name); + } return (1); } - return (error); + ag->ag_type = type; + + return (0); } static struct portal * @@ -979,25 +966,10 @@ isns_deregister(struct isns *isns) set_timeout(0, false); } -static int -portal_group_set_filter(struct portal_group *pg, int filter) -{ - - if (pg->pg_discovery_filter == PG_FILTER_UNKNOWN) { - pg->pg_discovery_filter = filter; - return (0); - } - - if (pg->pg_discovery_filter == filter) - return (0); - - return (1); -} - int -portal_group_set_filter_str(struct portal_group *pg, const char *str) +portal_group_set_filter(struct portal_group *pg, const char *str) { - int error, filter; + int filter; if (strcmp(str, "none") == 0) { filter = PG_FILTER_NONE; @@ -1015,15 +987,17 @@ portal_group_set_filter_str(struct porta return (1); } - error = portal_group_set_filter(pg, filter); - if (error != 0) { + if (pg->pg_discovery_filter != PG_FILTER_UNKNOWN && + pg->pg_discovery_filter != filter) { log_warnx("cannot set discovery-filter to \"%s\" for " "portal-group \"%s\"; already has a different " "value", str, pg->pg_name); return (1); } - return (error); + pg->pg_discovery_filter = filter; + + return (0); } static bool Modified: head/usr.sbin/ctld/ctld.h ============================================================================== --- head/usr.sbin/ctld/ctld.h Wed Oct 29 09:32:36 2014 (r273815) +++ head/usr.sbin/ctld/ctld.h Wed Oct 29 09:36:02 2014 (r273816) @@ -266,7 +266,7 @@ struct auth_group *auth_group_new(struct void auth_group_delete(struct auth_group *ag); struct auth_group *auth_group_find(const struct conf *conf, const char *name); -int auth_group_set_type_str(struct auth_group *ag, +int auth_group_set_type(struct auth_group *ag, const char *type); const struct auth *auth_new_chap(struct auth_group *ag, @@ -299,7 +299,7 @@ struct portal_group *portal_group_find(c const char *name); int portal_group_add_listen(struct portal_group *pg, const char *listen, bool iser); -int portal_group_set_filter_str(struct portal_group *pg, +int portal_group_set_filter(struct portal_group *pg, const char *filter); int isns_new(struct conf *conf, const char *addr); Modified: head/usr.sbin/ctld/parse.y ============================================================================== --- head/usr.sbin/ctld/parse.y Wed Oct 29 09:32:36 2014 (r273815) +++ head/usr.sbin/ctld/parse.y Wed Oct 29 09:36:02 2014 (r273816) @@ -238,7 +238,7 @@ auth_group_auth_type: AUTH_TYPE STR { int error; - error = auth_group_set_type_str(auth_group, $2); + error = auth_group_set_type(auth_group, $2); free($2); if (error != 0) return (1); @@ -358,7 +358,7 @@ portal_group_discovery_filter: DISCOVERY { int error; - error = portal_group_set_filter_str(portal_group, $2); + error = portal_group_set_filter(portal_group, $2); free($2); if (error != 0) return (1); @@ -480,7 +480,7 @@ target_auth_type: AUTH_TYPE STR } target->t_auth_group->ag_target = target; } - error = auth_group_set_type_str(target->t_auth_group, $2); + error = auth_group_set_type(target->t_auth_group, $2); free($2); if (error != 0) return (1); From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 09:56:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8545059C; Wed, 29 Oct 2014 09:56:11 +0000 (UTC) Received: from mail-lb0-x22e.google.com (mail-lb0-x22e.google.com [IPv6:2a00:1450:4010:c04::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 744B5EA7; Wed, 29 Oct 2014 09:56:10 +0000 (UTC) Received: by mail-lb0-f174.google.com with SMTP id z11so164601lbi.5 for ; Wed, 29 Oct 2014 02:56:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=kl5CEm5o6cLSWA6UMF3miXYMPGpHL15xYKMHUiQXij4=; b=wIcIM0kpWfdaS7L0TQQ2tODKLmMyAMZJjPzbAzGPOadG1c8KuWVd6sUzVezwQrutDB zpDy7b7Qj8LbGMK7rEf0W/wAuydjauJpVfVYjPUtQa3aQEnAstNyGKrlghWzXJFuN+Mq EwB2xEyUbxWj908fyJOTRjQN/XihLKgCK2mDoKeyYjgjzDnjgwu4o5NK6rT4Qu7kCxhy BQtmI34cMCknVnBJ+NfaPIEuo//JfsTZKPluR51WtMrHYMuI3g/FOw0U5xqsx/eShJH7 OaJ1BbQjaYOTCRxYqpTrmkqHiEWIM9UTdWpWG26C+seZnTMGRgQh2Y717vV5xrDlfuKy iWXg== X-Received: by 10.112.97.175 with SMTP id eb15mr10199989lbb.12.1414576568364; Wed, 29 Oct 2014 02:56:08 -0700 (PDT) Received: from brick.home (adbe233.neoplus.adsl.tpnet.pl. [79.184.4.233]) by mx.google.com with ESMTPSA id je9sm1731711lbc.3.2014.10.29.02.56.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Oct 2014 02:56:07 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Wed, 29 Oct 2014 10:56:04 +0100 From: Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= To: Navdeep Parhar Subject: Re: svn commit: r273806 - in head/contrib/ofed: libcxgb4 libcxgb4/src usr.lib usr.lib/libcxgb4 Message-ID: <20141029095604.GA81110@brick.home> Mail-Followup-To: Navdeep Parhar , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201410290115.s9T1FnTv094112@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410290115.s9T1FnTv094112@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 09:56:11 -0000 On 1029T0115, Navdeep Parhar wrote: > Author: np > Date: Wed Oct 29 01:15:48 2014 > New Revision: 273806 > URL: https://svnweb.freebsd.org/changeset/base/273806 > > Log: > Userspace library for Chelsio's Terminator 5 based iWARP RNICs (pretty > much every T5 card that does _not_ have "-SO" in its name is RDMA > capable). Yay! This means we could add iSER without using the ICL_PROXY hack. Well, assuming it's possible to "hand off" RDMA connection from userspace to the kernel. Is it? From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 12:10:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 539DA4FF; Wed, 29 Oct 2014 12:10:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25EA0ECA; Wed, 29 Oct 2014 12:10:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9TCAegd001825; Wed, 29 Oct 2014 12:10:40 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9TCAdOp001823; Wed, 29 Oct 2014 12:10:39 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410291210.s9TCAdOp001823@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 29 Oct 2014 12:10:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273820 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 12:10:40 -0000 Author: trasz Date: Wed Oct 29 12:10:39 2014 New Revision: 273820 URL: https://svnweb.freebsd.org/changeset/base/273820 Log: Make it possible to optionally use semicolon to separate statements. This makes it possible to format stuff like this: target xxx { lun 0 { path /foo/bar; size 4G; } } MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/parse.y head/usr.sbin/ctld/token.l Modified: head/usr.sbin/ctld/parse.y ============================================================================== --- head/usr.sbin/ctld/parse.y Wed Oct 29 11:47:04 2014 (r273819) +++ head/usr.sbin/ctld/parse.y Wed Oct 29 12:10:39 2014 (r273820) @@ -60,7 +60,7 @@ extern void yyrestart(FILE *); %token ALIAS AUTH_GROUP AUTH_TYPE BACKEND BLOCKSIZE CHAP CHAP_MUTUAL %token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP DISCOVERY_FILTER %token INITIATOR_NAME INITIATOR_PORTAL LISTEN LISTEN_ISER LUN MAXPROC -%token OPENING_BRACKET OPTION PATH PIDFILE PORTAL_GROUP SERIAL SIZE STR +%token OPENING_BRACKET OPTION PATH PIDFILE PORTAL_GROUP SEMICOLON SERIAL SIZE STR %token TARGET TIMEOUT ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT %union @@ -75,6 +75,8 @@ extern void yyrestart(FILE *); statements: | statements statement + | + statements statement SEMICOLON ; statement: @@ -220,6 +222,8 @@ auth_group_name: STR auth_group_entries: | auth_group_entries auth_group_entry + | + auth_group_entries auth_group_entry SEMICOLON ; auth_group_entry: @@ -322,6 +326,8 @@ portal_group_name: STR portal_group_entries: | portal_group_entries portal_group_entry + | + portal_group_entries portal_group_entry SEMICOLON ; portal_group_entry: @@ -406,6 +412,8 @@ target_name: STR target_entries: | target_entries target_entry + | + target_entries target_entry SEMICOLON ; target_entry: @@ -653,6 +661,8 @@ lun_number: STR lun_entries: | lun_entries lun_entry + | + lun_entries lun_entry SEMICOLON ; lun_entry: Modified: head/usr.sbin/ctld/token.l ============================================================================== --- head/usr.sbin/ctld/token.l Wed Oct 29 11:47:04 2014 (r273819) +++ head/usr.sbin/ctld/token.l Wed Oct 29 12:10:39 2014 (r273820) @@ -83,6 +83,7 @@ timeout { return TIMEOUT; } \} { return CLOSING_BRACKET; } #.*$ /* ignore comments */; \n { lineno++; } +; { return SEMICOLON; } [ \t]+ /* ignore whitespace */; . { yylval.str = strdup(yytext); return STR; } %% From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 12:12:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 641B2664; Wed, 29 Oct 2014 12:12:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FE13EDD; Wed, 29 Oct 2014 12:12:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9TCCSZY003204; Wed, 29 Oct 2014 12:12:28 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9TCCSt4003203; Wed, 29 Oct 2014 12:12:28 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410291212.s9TCCSt4003203@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 29 Oct 2014 12:12:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273821 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 12:12:28 -0000 Author: trasz Date: Wed Oct 29 12:12:27 2014 New Revision: 273821 URL: https://svnweb.freebsd.org/changeset/base/273821 Log: Keep the token list sorted. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/parse.y Modified: head/usr.sbin/ctld/parse.y ============================================================================== --- head/usr.sbin/ctld/parse.y Wed Oct 29 12:10:39 2014 (r273820) +++ head/usr.sbin/ctld/parse.y Wed Oct 29 12:12:27 2014 (r273821) @@ -59,9 +59,9 @@ extern void yyrestart(FILE *); %token ALIAS AUTH_GROUP AUTH_TYPE BACKEND BLOCKSIZE CHAP CHAP_MUTUAL %token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP DISCOVERY_FILTER -%token INITIATOR_NAME INITIATOR_PORTAL LISTEN LISTEN_ISER LUN MAXPROC -%token OPENING_BRACKET OPTION PATH PIDFILE PORTAL_GROUP SEMICOLON SERIAL SIZE STR -%token TARGET TIMEOUT ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT +%token INITIATOR_NAME INITIATOR_PORTAL ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT +%token LISTEN LISTEN_ISER LUN MAXPROC OPENING_BRACKET OPTION +%token PATH PIDFILE PORTAL_GROUP SEMICOLON SERIAL SIZE STR TARGET TIMEOUT %union { From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 12:22:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 12922B35; Wed, 29 Oct 2014 12:22:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F301BFF2; Wed, 29 Oct 2014 12:22:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9TCMW6n008022; Wed, 29 Oct 2014 12:22:32 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9TCMWhW008020; Wed, 29 Oct 2014 12:22:32 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410291222.s9TCMWhW008020@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 29 Oct 2014 12:22:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273822 - in head: usr.bin/iscsictl usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 12:22:33 -0000 Author: trasz Date: Wed Oct 29 12:22:32 2014 New Revision: 273822 URL: https://svnweb.freebsd.org/changeset/base/273822 Log: Fix iscsictl(8) and ctld(8) to correctly handle Windows newlines (CRLF) in iscsi.conf and ctl.conf. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/iscsictl/token.l head/usr.sbin/ctld/token.l Modified: head/usr.bin/iscsictl/token.l ============================================================================== --- head/usr.bin/iscsictl/token.l Wed Oct 29 12:12:27 2014 (r273821) +++ head/usr.bin/iscsictl/token.l Wed Oct 29 12:22:32 2014 (r273822) @@ -90,6 +90,7 @@ chapDigest { return IGNORED; } = { return EQUALS; } ; { return SEMICOLON; } #.*$ /* ignore comments */; +\r\n { lineno++; } \n { lineno++; } [ \t]+ /* ignore whitespace */; . { yylval.str = strdup(yytext); return STR; } Modified: head/usr.sbin/ctld/token.l ============================================================================== --- head/usr.sbin/ctld/token.l Wed Oct 29 12:12:27 2014 (r273821) +++ head/usr.sbin/ctld/token.l Wed Oct 29 12:22:32 2014 (r273822) @@ -82,6 +82,7 @@ timeout { return TIMEOUT; } \{ { return OPENING_BRACKET; } \} { return CLOSING_BRACKET; } #.*$ /* ignore comments */; +\r\n { lineno++; } \n { lineno++; } ; { return SEMICOLON; } [ \t]+ /* ignore whitespace */; From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 15:52:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2485395F; Wed, 29 Oct 2014 15:52:40 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 73D76CA9; Wed, 29 Oct 2014 15:52:39 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9TFqUQ3092805 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 29 Oct 2014 17:52:30 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9TFqUQ3092805 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9TFqUW1092804; Wed, 29 Oct 2014 17:52:30 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 29 Oct 2014 17:52:30 +0200 From: Konstantin Belousov To: Bruce Evans Subject: Re: svn commit: r273784 - in head/sys: amd64/ia32 compat/freebsd32 i386/i386 kern net Message-ID: <20141029155230.GE53947@kib.kiev.ua> References: <201410281528.s9SFSLs2013764@svn.freebsd.org> <20141029042007.N2423@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141029042007.N2423@besplex.bde.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, jhb@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 15:52:40 -0000 On Wed, Oct 29, 2014 at 06:26:42AM +1100, Bruce Evans wrote: > On Tue, 28 Oct 2014, Konstantin Belousov wrote: > > > Log: > > Replace some calls to fuword() by fueword() with proper error checking. > > I just noticed some more API design errors. The pointer type for new > APIs should be [qualifed] wordsize_t *, not [qualified] void *. Using > void * reduces type safety for almost no benefits. The casuword() > family already doesn't use void *. casuword() has very limited use, it was invented for umtx, and used only there. That said, I tend to agree with somewhat implicit note that base argument for fuword() and family should be vm_offset_t. Still, lets move by small steps. Below is the patch to add volatile qualifier to base, and remove __DEVOLATILE() from kern_umtx.c. I converted suword() as well, since I do not see why the same arguments which support change for fuword() are not applicable to suword(). The intr variants are left alone. Patch was only compile-tested on x86. diff --git a/share/man/man9/fetch.9 b/share/man/man9/fetch.9 index 7e13cbc..1d46784 100644 --- a/share/man/man9/fetch.9 +++ b/share/man/man9/fetch.9 @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 21, 2014 +.Dd October 29, 2014 .Dt FETCH 9 .Os .Sh NAME @@ -53,21 +53,21 @@ .In sys/types.h .In sys/systm.h .Ft int -.Fn fubyte "const void *base" +.Fn fubyte "volatile const void *base" .Ft long -.Fn fuword "const void *base" +.Fn fuword "volatile const void *base" .Ft int -.Fn fuword16 "void *base" +.Fn fuword16 "volatile const void *base" .Ft int32_t -.Fn fuword32 "const void *base" +.Fn fuword32 "volatile const void *base" .Ft int64_t -.Fn fuword64 "const void *base" +.Fn fuword64 "volatile const void *base" .Ft long -.Fn fueword "const void *base" "long *val" +.Fn fueword "volatile const void *base" "long *val" .Ft int32_t -.Fn fueword32 "const void *base" "int32_t *val" +.Fn fueword32 "volatile const void *base" "int32_t *val" .Ft int64_t -.Fn fueword64 "const void *base" "int64_t *val" +.Fn fueword64 "volatile const void *base" "int64_t *val" .In sys/resourcevar.h .Ft int .Fn fuswintr "void *base" diff --git a/share/man/man9/store.9 b/share/man/man9/store.9 index d333eff..cc442f2 100644 --- a/share/man/man9/store.9 +++ b/share/man/man9/store.9 @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 5, 2009 +.Dd October 29, 2014 .Dt STORE 9 .Os .Sh NAME @@ -48,15 +48,15 @@ .In sys/time.h .In sys/systm.h .Ft int -.Fn subyte "void *base" "int byte" +.Fn subyte "volatile void *base" "int byte" .Ft int -.Fn suword "void *base" "long word" +.Fn suword "volatile void *base" "long word" .Ft int -.Fn suword16 "void *base" "int word" +.Fn suword16 "volatile void *base" "int word" .Ft int -.Fn suword32 "void *base" "int32_t word" +.Fn suword32 "volatile void *base" "int32_t word" .Ft int -.Fn suword64 "void *base" "int64_t word" +.Fn suword64 "volatile void *base" "int64_t word" .In sys/resourcevar.h .Ft int .Fn suswintr "void *base" "int word" @@ -64,6 +64,8 @@ The .Nm functions are designed to copy small amounts of data to user-space. +If write is successful, it is performed atomically. +The data written must be naturally aligned. .Pp The .Nm diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index 58e76bc..33fdf71 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -942,7 +942,7 @@ do_lock_normal(struct thread *td, struct umutex *m, uint32_t flags, * can fault on any access. */ for (;;) { - rv = fueword32(__DEVOLATILE(void *, &m->m_owner), &owner); + rv = fueword32(&m->m_owner, &owner); if (rv == -1) return (EFAULT); if (mode == _UMUTEX_WAIT) { @@ -1057,7 +1057,7 @@ do_unlock_normal(struct thread *td, struct umutex *m, uint32_t flags) /* * Make sure we own this mtx. */ - error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), &owner); + error = fueword32(&m->m_owner, &owner); if (error == -1) return (EFAULT); @@ -1115,7 +1115,7 @@ do_wake_umutex(struct thread *td, struct umutex *m) int error; int count; - error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), &owner); + error = fueword32(&m->m_owner, &owner); if (error == -1) return (EFAULT); @@ -1192,8 +1192,7 @@ do_wake2_umutex(struct thread *td, struct umutex *m, uint32_t flags) * any memory. */ if (count > 1) { - error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), - &owner); + error = fueword32(&m->m_owner, &owner); if (error == -1) error = EFAULT; while (error == 0 && (owner & UMUTEX_CONTESTED) == 0) { @@ -1211,8 +1210,7 @@ do_wake2_umutex(struct thread *td, struct umutex *m, uint32_t flags) break; } } else if (count == 1) { - error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), - &owner); + error = fueword32(&m->m_owner, &owner); if (error == -1) error = EFAULT; while (error == 0 && (owner & ~UMUTEX_CONTESTED) != 0 && @@ -1776,7 +1774,7 @@ do_unlock_pi(struct thread *td, struct umutex *m, uint32_t flags) /* * Make sure we own this mtx. */ - error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), &owner); + error = fueword32(&m->m_owner, &owner); if (error == -1) return (EFAULT); @@ -2008,7 +2006,7 @@ do_unlock_pp(struct thread *td, struct umutex *m, uint32_t flags) /* * Make sure we own this mtx. */ - error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), &owner); + error = fueword32(&m->m_owner, &owner); if (error == -1) return (EFAULT); @@ -2040,8 +2038,7 @@ do_unlock_pp(struct thread *td, struct umutex *m, uint32_t flags) * to lock the mutex, it is necessary because thread priority * has to be adjusted for such mutex. */ - error = suword32(__DEVOLATILE(uint32_t *, &m->m_owner), - UMUTEX_CONTESTED); + error = suword32(&m->m_owner, UMUTEX_CONTESTED); umtxq_lock(&key); if (error == 0) @@ -2116,8 +2113,7 @@ do_set_ceiling(struct thread *td, struct umutex *m, uint32_t ceiling, if (owner == UMUTEX_CONTESTED) { suword32(&m->m_ceilings[0], ceiling); - suword32(__DEVOLATILE(uint32_t *, &m->m_owner), - UMUTEX_CONTESTED); + suword32(&m->m_owner, UMUTEX_CONTESTED); error = 0; break; } @@ -2263,10 +2259,9 @@ do_cv_wait(struct thread *td, struct ucond *cv, struct umutex *m, * Set c_has_waiters to 1 before releasing user mutex, also * don't modify cache line when unnecessary. */ - error = fueword32(__DEVOLATILE(uint32_t *, &cv->c_has_waiters), - &hasw); + error = fueword32(&cv->c_has_waiters, &hasw); if (error == 0 && hasw == 0) - suword32(__DEVOLATILE(uint32_t *, &cv->c_has_waiters), 1); + suword32(&cv->c_has_waiters, 1); umtxq_unbusy_unlocked(&uq->uq_key); @@ -2296,9 +2291,7 @@ do_cv_wait(struct thread *td, struct ucond *cv, struct umutex *m, umtxq_remove(uq); if (oldlen == 1) { umtxq_unlock(&uq->uq_key); - suword32( - __DEVOLATILE(uint32_t *, - &cv->c_has_waiters), 0); + suword32(&cv->c_has_waiters, 0); umtxq_lock(&uq->uq_key); } } @@ -2333,8 +2326,7 @@ do_cv_signal(struct thread *td, struct ucond *cv) nwake = umtxq_signal(&key, 1); if (cnt <= nwake) { umtxq_unlock(&key); - error = suword32( - __DEVOLATILE(uint32_t *, &cv->c_has_waiters), 0); + error = suword32(&cv->c_has_waiters, 0); if (error == -1) error = EFAULT; umtxq_lock(&key); @@ -2363,7 +2355,7 @@ do_cv_broadcast(struct thread *td, struct ucond *cv) umtxq_signal(&key, INT_MAX); umtxq_unlock(&key); - error = suword32(__DEVOLATILE(uint32_t *, &cv->c_has_waiters), 0); + error = suword32(&cv->c_has_waiters, 0); if (error == -1) error = EFAULT; @@ -2399,8 +2391,7 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock, long fflag, struct _umtx wrflags |= URWLOCK_WRITE_WAITERS; for (;;) { - rv = fueword32(__DEVOLATILE(int32_t *, &rwlock->rw_state), - &state); + rv = fueword32(&rwlock->rw_state, &state); if (rv == -1) { umtx_key_release(&uq->uq_key); return (EFAULT); @@ -2440,8 +2431,7 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock, long fflag, struct _umtx * re-read the state, in case it changed between the try-lock above * and the check below */ - rv = fueword32(__DEVOLATILE(int32_t *, &rwlock->rw_state), - &state); + rv = fueword32(&rwlock->rw_state, &state); if (rv == -1) error = EFAULT; @@ -2499,8 +2489,7 @@ sleep: umtxq_unlock(&uq->uq_key); if (error) break; - rv = fueword32(__DEVOLATILE(int32_t *, - &rwlock->rw_state), &state); + rv = fueword32(&rwlock->rw_state, &state); if (rv == -1) { error = EFAULT; break; @@ -2517,8 +2506,7 @@ sleep: } suword32(&rwlock->rw_blocked_readers, blocked_readers-1); if (blocked_readers == 1) { - rv = fueword32(__DEVOLATILE(int32_t *, - &rwlock->rw_state), &state); + rv = fueword32(&rwlock->rw_state, &state); if (rv == -1) error = EFAULT; while (error == 0) { @@ -2569,8 +2557,7 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock, struct _umtx_time *timeo blocked_readers = 0; for (;;) { - rv = fueword32(__DEVOLATILE(int32_t *, &rwlock->rw_state), - &state); + rv = fueword32(&rwlock->rw_state, &state); if (rv == -1) { umtx_key_release(&uq->uq_key); return (EFAULT); @@ -2614,8 +2601,7 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock, struct _umtx_time *timeo * re-read the state, in case it changed between the try-lock above * and the check below */ - rv = fueword32(__DEVOLATILE(int32_t *, &rwlock->rw_state), - &state); + rv = fueword32(&rwlock->rw_state, &state); if (rv == -1) error = EFAULT; @@ -2670,8 +2656,7 @@ sleep: umtxq_unlock(&uq->uq_key); if (error) break; - rv = fueword32(__DEVOLATILE(int32_t *, - &rwlock->rw_state), &state); + rv = fueword32(&rwlock->rw_state, &state); if (rv == -1) { error = EFAULT; break; @@ -2687,8 +2672,7 @@ sleep: } suword32(&rwlock->rw_blocked_writers, blocked_writers-1); if (blocked_writers == 1) { - rv = fueword32(__DEVOLATILE(int32_t *, - &rwlock->rw_state), &state); + rv = fueword32(&rwlock->rw_state, &state); if (rv == -1) { umtxq_unbusy_unlocked(&uq->uq_key); error = EFAULT; @@ -2748,7 +2732,7 @@ do_rw_unlock(struct thread *td, struct urwlock *rwlock) if (error != 0) return (error); - error = fueword32(__DEVOLATILE(int32_t *, &rwlock->rw_state), &state); + error = fueword32(&rwlock->rw_state, &state); if (error == -1) { error = EFAULT; goto out; @@ -2856,7 +2840,7 @@ do_sem_wait(struct thread *td, struct _usem *sem, struct _umtx_time *timeout) umtxq_unlock(&uq->uq_key); rv = casueword32(&sem->_has_waiters, 0, &count1, 1); if (rv == 0) - rv = fueword32(__DEVOLATILE(uint32_t *, &sem->_count), &count); + rv = fueword32(&sem->_count, &count); if (rv == -1 || count != 0) { umtxq_lock(&uq->uq_key); umtxq_unbusy(&uq->uq_key); @@ -2911,8 +2895,7 @@ do_sem_wake(struct thread *td, struct _usem *sem) */ if (cnt == 1) { umtxq_unlock(&key); - error = suword32( - __DEVOLATILE(uint32_t *, &sem->_has_waiters), 0); + error = suword32(&sem->_has_waiters, 0); umtxq_lock(&key); if (error == -1) error = EFAULT; @@ -2946,7 +2929,7 @@ do_sem2_wait(struct thread *td, struct _usem2 *sem, struct _umtx_time *timeout) umtxq_busy(&uq->uq_key); umtxq_insert(uq); umtxq_unlock(&uq->uq_key); - rv = fueword32(__DEVOLATILE(uint32_t *, &sem->_count), &count); + rv = fueword32(&sem->_count, &count); if (rv == -1) { umtxq_lock(&uq->uq_key); umtxq_unbusy(&uq->uq_key); @@ -3024,8 +3007,7 @@ do_sem2_wake(struct thread *td, struct _usem2 *sem) */ if (cnt == 1) { umtxq_unlock(&key); - rv = fueword32(__DEVOLATILE(uint32_t *, &sem->_count), - &count); + rv = fueword32(&sem->_count, &count); while (rv != -1 && count & USEM_HAS_WAITERS) rv = casueword32(&sem->_count, count, &count, count & ~USEM_HAS_WAITERS); diff --git a/sys/kern/subr_uio.c b/sys/kern/subr_uio.c index f2bbb0c..87892fd 100644 --- a/sys/kern/subr_uio.c +++ b/sys/kern/subr_uio.c @@ -453,7 +453,7 @@ copyout_unmap(struct thread *td, vm_offset_t addr, size_t sz) */ int -fueword(const void *base, long *val) +fueword(volatile const void *base, long *val) { long res; @@ -465,7 +465,7 @@ fueword(const void *base, long *val) } int -fueword32(const void *base, int32_t *val) +fueword32(volatile const void *base, int32_t *val) { int32_t res; @@ -478,7 +478,7 @@ fueword32(const void *base, int32_t *val) #ifdef _LP64 int -fueword64(const void *base, int64_t *val) +fueword64(volatile const void *base, int64_t *val) { int32_t res; @@ -516,7 +516,7 @@ casueword(volatile u_long *p, u_long oldval, u_long *oldvalp, u_long newval) } #else /* NO_FUEWORD */ int32_t -fuword32(const void *addr) +fuword32(volatile const void *addr) { int rv; int32_t val; @@ -527,7 +527,7 @@ fuword32(const void *addr) #ifdef _LP64 int64_t -fuword64(const void *addr) +fuword64(volatile const void *addr) { int rv; int64_t val; @@ -538,7 +538,7 @@ fuword64(const void *addr) #endif /* _LP64 */ long -fuword(const void *addr) +fuword(volatile const void *addr) { long val; int rv; diff --git a/sys/powerpc/powerpc/copyinout.c b/sys/powerpc/powerpc/copyinout.c index a337c8b..ddaf33f 100644 --- a/sys/powerpc/powerpc/copyinout.c +++ b/sys/powerpc/powerpc/copyinout.c @@ -281,7 +281,7 @@ copyinstr(const void *udaddr, void *kaddr, size_t len, size_t *done) } int -subyte(void *addr, int byte) +subyte(volatile void *addr, int byte) { struct thread *td; pmap_t pm; @@ -309,7 +309,7 @@ subyte(void *addr, int byte) #ifdef __powerpc64__ int -suword32(void *addr, int word) +suword32(volatile void *addr, int word) { struct thread *td; pmap_t pm; @@ -337,7 +337,7 @@ suword32(void *addr, int word) #endif int -suword(void *addr, long word) +suword(volatile void *addr, long word) { struct thread *td; pmap_t pm; @@ -365,20 +365,20 @@ suword(void *addr, long word) #ifdef __powerpc64__ int -suword64(void *addr, int64_t word) +suword64(volatile void *addr, int64_t word) { return (suword(addr, (long)word)); } #else int -suword32(void *addr, int32_t word) +suword32(volatile void *addr, int32_t word) { return (suword(addr, (long)word)); } #endif int -fubyte(const void *addr) +fubyte(volatile const void *addr) { struct thread *td; pmap_t pm; @@ -406,7 +406,7 @@ fubyte(const void *addr) } int -fuword16(const void *addr) +fuword16(volatile const void *addr) { struct thread *td; pmap_t pm; @@ -433,7 +433,7 @@ fuword16(const void *addr) } int -fueword32(const void *addr, int32_t *val) +fueword32(volatile const void *addr, int32_t *val) { struct thread *td; pmap_t pm; @@ -461,7 +461,7 @@ fueword32(const void *addr, int32_t *val) #ifdef __powerpc64__ int -fueword64(const void *addr, int64_t *val) +fueword64(volatile const void *addr, int64_t *val) { struct thread *td; pmap_t pm; @@ -489,7 +489,7 @@ fueword64(const void *addr, int64_t *val) #endif int -fueword(const void *addr, long *val) +fueword(volatile const void *addr, long *val) { struct thread *td; pmap_t pm; diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 6e5ee61..47156fb 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -252,19 +252,19 @@ int copyout(const void * __restrict kaddr, void * __restrict udaddr, int copyout_nofault(const void * __restrict kaddr, void * __restrict udaddr, size_t len) __nonnull(1) __nonnull(2); -int fubyte(const void *base); -long fuword(const void *base); -int fuword16(const void *base); -int32_t fuword32(const void *base); -int64_t fuword64(const void *base); -int fueword(const void *base, long *val); -int fueword32(const void *base, int32_t *val); -int fueword64(const void *base, int64_t *val); -int subyte(void *base, int byte); -int suword(void *base, long word); -int suword16(void *base, int word); -int suword32(void *base, int32_t word); -int suword64(void *base, int64_t word); +int fubyte(volatile const void *base); +long fuword(volatile const void *base); +int fuword16(volatile const void *base); +int32_t fuword32(volatile const void *base); +int64_t fuword64(volatile const void *base); +int fueword(volatile const void *base, long *val); +int fueword32(volatile const void *base, int32_t *val); +int fueword64(volatile const void *base, int64_t *val); +int subyte(volatile void *base, int byte); +int suword(volatile void *base, long word); +int suword16(volatile void *base, int word); +int suword32(volatile void *base, int32_t word); +int suword64(volatile void *base, int64_t word); uint32_t casuword32(volatile uint32_t *base, uint32_t oldval, uint32_t newval); u_long casuword(volatile u_long *p, u_long oldval, u_long newval); int casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp, From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 16:02:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7A3C6FFE; Wed, 29 Oct 2014 16:02:25 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 514A6DF7; Wed, 29 Oct 2014 16:02:25 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D3517B9B4; Wed, 29 Oct 2014 12:02:23 -0400 (EDT) From: John Baldwin To: Konstantin Belousov Subject: Re: svn commit: r273784 - in head/sys: amd64/ia32 compat/freebsd32 i386/i386 kern net Date: Wed, 29 Oct 2014 12:00:49 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <201410281528.s9SFSLs2013764@svn.freebsd.org> <20141029042007.N2423@besplex.bde.org> <20141029155230.GE53947@kib.kiev.ua> In-Reply-To: <20141029155230.GE53947@kib.kiev.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201410291200.49330.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 29 Oct 2014 12:02:23 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 16:02:25 -0000 On Wednesday, October 29, 2014 11:52:30 am Konstantin Belousov wrote: > On Wed, Oct 29, 2014 at 06:26:42AM +1100, Bruce Evans wrote: > > On Tue, 28 Oct 2014, Konstantin Belousov wrote: > > > > > Log: > > > Replace some calls to fuword() by fueword() with proper error checking. > > > > I just noticed some more API design errors. The pointer type for new > > APIs should be [qualifed] wordsize_t *, not [qualified] void *. Using > > void * reduces type safety for almost no benefits. The casuword() > > family already doesn't use void *. > casuword() has very limited use, it was invented for umtx, and used > only there. That said, I tend to agree with somewhat implicit note > that base argument for fuword() and family should be vm_offset_t. I think Bruce is suggesting 'volatile long *' or 'volatile int32_t *' rather than vm_offset_t. > Still, lets move by small steps. Below is the patch to add volatile > qualifier to base, and remove __DEVOLATILE() from kern_umtx.c. I > converted suword() as well, since I do not see why the same arguments > which support change for fuword() are not applicable to suword(). > > The intr variants are left alone. > > Patch was only compile-tested on x86. This looks good to me, thanks! -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 16:55:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CEB56DF9; Wed, 29 Oct 2014 16:55:30 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 412F2686; Wed, 29 Oct 2014 16:55:30 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9TGtOIe006678 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 29 Oct 2014 18:55:24 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9TGtOIe006678 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9TGtOYD006676; Wed, 29 Oct 2014 18:55:24 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 29 Oct 2014 18:55:24 +0200 From: Konstantin Belousov To: Bruce Evans Subject: Re: svn commit: r273129 - head/sys/kern Message-ID: <20141029165523.GF53947@kib.kiev.ua> References: <201410151238.s9FCcRMe018200@svn.freebsd.org> <20141028040935.M3114@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141028040935.M3114@besplex.bde.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 16:55:30 -0000 On Tue, Oct 28, 2014 at 04:28:37AM +1100, Bruce Evans wrote: > @diff -u2 dd.c~ dd.c > @--- dd.c~ Wed Apr 7 20:20:48 2004 > @+++ dd.c Wed Apr 7 20:20:49 2004 > @@@ -247,21 +245,18 @@ > @ io->flags |= ISTRUNC; > @ if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) { > @- if (ioctl(io->fd, FIODTYPE, &type) == -1) { > @+ if (ioctl(io->fd, FIODTYPE, &type) == -1) > @ err(1, "%s", io->name); > @- } else { > @+ else { > @ if (type & D_TAPE) > @ io->flags |= ISTAPE; > @ else if (type & (D_DISK | D_MEM)) > @- io->flags |= ISSEEK; > @- if (S_ISCHR(sb.st_mode) && (type & D_TAPE) == 0) > @+ io->flags |= ISSEEKABLE; > @+ if (S_ISCHR(sb.st_mode)) > @ io->flags |= ISCHR; > @ } > @- return; > @- } > @- errno = 0; > @- if (lseek(io->fd, (off_t)0, SEEK_CUR) == -1 && errno == ESPIPE) > @- io->flags |= ISPIPE; > @- else > @- io->flags |= ISSEEK; > @+ } else if (lseek(io->fd, (off_t)0, SEEK_CUR) == 0) > @+ io->flags |= ISSEEKABLE; > @+ else if (errno == ESPIPE) > @+ io->flags |= ISPIPE; /* XXX fixed in 4.4BSD */ > @ } > @ Ok, I tried to de-obfuscate and restore the patch above. diff --git a/bin/dd/dd.c b/bin/dd/dd.c index 8ae11a7..aadc7da 100644 --- a/bin/dd/dd.c +++ b/bin/dd/dd.c @@ -257,7 +257,7 @@ getfdtype(IO *io) err(1, "%s", io->name); if (S_ISREG(sb.st_mode)) io->flags |= ISTRUNC; - if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) { + if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) { if (ioctl(io->fd, FIODTYPE, &type) == -1) { err(1, "%s", io->name); } else { @@ -265,16 +265,14 @@ getfdtype(IO *io) io->flags |= ISTAPE; else if (type & (D_DISK | D_MEM)) io->flags |= ISSEEK; - if (S_ISCHR(sb.st_mode) && (type & D_TAPE) == 0) + if (S_ISCHR(sb.st_mode)) io->flags |= ISCHR; } - return; - } - errno = 0; - if (lseek(io->fd, (off_t)0, SEEK_CUR) == -1 && errno == ESPIPE) - io->flags |= ISPIPE; - else + } else if (lseek(io->fd, (off_t)0, SEEK_CUR) == 0) { io->flags |= ISSEEK; + } else if (errno == ESPIPE) { + io->flags |= ISPIPE; + } } static void From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 16:58:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 464BAEE; Wed, 29 Oct 2014 16:58:46 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC1946B2; Wed, 29 Oct 2014 16:58:45 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9TGwfhK007556 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 29 Oct 2014 18:58:41 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9TGwfhK007556 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9TGwfXp007555; Wed, 29 Oct 2014 18:58:41 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 29 Oct 2014 18:58:40 +0200 From: Konstantin Belousov To: John Baldwin Subject: Re: svn commit: r273784 - in head/sys: amd64/ia32 compat/freebsd32 i386/i386 kern net Message-ID: <20141029165840.GG53947@kib.kiev.ua> References: <201410281528.s9SFSLs2013764@svn.freebsd.org> <20141029042007.N2423@besplex.bde.org> <20141029155230.GE53947@kib.kiev.ua> <201410291200.49330.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410291200.49330.jhb@freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 16:58:46 -0000 On Wed, Oct 29, 2014 at 12:00:49PM -0400, John Baldwin wrote: > On Wednesday, October 29, 2014 11:52:30 am Konstantin Belousov wrote: > > On Wed, Oct 29, 2014 at 06:26:42AM +1100, Bruce Evans wrote: > > > I just noticed some more API design errors. The pointer type for new > > > APIs should be [qualifed] wordsize_t *, not [qualified] void *. Using > > > void * reduces type safety for almost no benefits. The casuword() > > > family already doesn't use void *. > > casuword() has very limited use, it was invented for umtx, and used > > only there. That said, I tend to agree with somewhat implicit note > > that base argument for fuword() and family should be vm_offset_t. > > I think Bruce is suggesting 'volatile long *' or 'volatile int32_t *' > rather than vm_offset_t. In main text, yes. But there was a small note, and I better like the vm_offset_t thing than normal pointers to different address space. In fact, something like Linux' __user annotation + vm_offset_t, which would put it extremely explicit that the address cannot be used as pointer at all. But we do not have anything 'dimentional' which would allow to prevent mixing __user and normal pointers. Some day Intel may release CPUs with SMAP. From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 18:01:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 987506E2; Wed, 29 Oct 2014 18:01:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79A57DEE; Wed, 29 Oct 2014 18:01:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9TI1AKd068711; Wed, 29 Oct 2014 18:01:10 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9TI1Ap0068710; Wed, 29 Oct 2014 18:01:10 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410291801.s9TI1Ap0068710@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 29 Oct 2014 18:01:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273834 - head/usr.sbin/etcupdate X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 18:01:10 -0000 Author: jhb Date: Wed Oct 29 18:01:09 2014 New Revision: 273834 URL: https://svnweb.freebsd.org/changeset/base/273834 Log: Rework the EXAMPLES section to be a bit clearer. - Add an example of using etcupdate diff. - Create a subsection on bootstrapping that is below the simple examples. This should make it clearer that 'etcupdate extract' is a one-time operation and not part of the common workflow. It also adds more suggestions on when bootstrapping is needed and additional steps to make future merges simpler. Reviewed by: adrian MFC after: 3 days Modified: head/usr.sbin/etcupdate/etcupdate.8 Modified: head/usr.sbin/etcupdate/etcupdate.8 ============================================================================== --- head/usr.sbin/etcupdate/etcupdate.8 Wed Oct 29 17:04:09 2014 (r273833) +++ head/usr.sbin/etcupdate/etcupdate.8 Wed Oct 29 18:01:09 2014 (r273834) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 9, 2013 +.Dd October 29, 2014 .Dt ETCUPDATE 8 .Os .Sh NAME @@ -608,12 +608,11 @@ Default log file. .Sh EXIT STATUS .Ex -std .Sh EXAMPLES -If the source tree matches the currently installed world, -then the following can be used to bootstrap -.Nm -so that it can be used for future upgrades: +To compare the files in +.Pa /etc +with the stock versions: .Pp -.Dl "etcupdate extract" +.Dl "etcupdate diff" .Pp To merge changes after an upgrade via the buildworld and installworld process: .Pp @@ -622,6 +621,59 @@ To merge changes after an upgrade via th To resolve any conflicts generated during a merge: .Pp .Dl "etcupdate resolve" +.Ss Bootstrapping +The +.Nm +utility may need to be bootstrapped before it can be used. +The +.Cm diff +command will fail with an error about a missing reference tree if +bootstrapping is needed. +.Pp +Bootstrapping +.Nm +requires a source tree that matches the currently installed world. +The easiest way to ensure this is to bootstrap +.Nm +before updating the source tree to start the next world upgrade cycle. +First, +generate a reference tree: +.Pp +.Dl "etcupdate extract" +.Pp +Second, +use the +.Cm diff +command to compare the reference tree to your current files in +.Pa /etc . +Undesired differences should be removed using an editor, +.Xr patch 1 , +or by copying files from the reference tree +.Po +located at +.Pa /var/db/etcupdate/current +by default +.Pc +. +.Pp +If the tree at +.Pa /usr/src +is already newer than the currently installed world, +a new tree matching the currently installed world can be checked out to +a temporary location. +The reference tree for +.Nm +can then be generated via: +.Pp +.Dl "etcupdate extract -s /path/to/tree" +.Pp +The +.Cm diff +command can be used as above to remove undesired differences. +Afterwards, +the changes in the tree at +.Pa /usr/src +can be merged via a regular merge. .Sh DIAGNOSTICS The following warning messages may be generated during a merge. Note that several of these warnings cover obscure cases that should occur From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 18:24:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0D7981B5; Wed, 29 Oct 2014 18:24:02 +0000 (UTC) Received: from mail-pa0-x22b.google.com (mail-pa0-x22b.google.com [IPv6:2607:f8b0:400e:c03::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CA11C16D; Wed, 29 Oct 2014 18:24:01 +0000 (UTC) Received: by mail-pa0-f43.google.com with SMTP id eu11so3689594pac.30 for ; Wed, 29 Oct 2014 11:24:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=ermiyGwcu4PyhHO5Jz+dht5vB94uP744TRSDa71igKA=; b=nb87sFqd5Pz6SYYgZYlsFpIkm3RE6WjBehnHWeeIHUI5L8Uyi9s8ayzpZ0GYxpuD7z s7A0jeVWnA78oDJBmIz6pWlAgcP/u4LpcR6S5N7rFdrZsP8fXfecRWENsqG50m5KhJAF jBuZDZ5BO3BgLX32XALTWKCh6Q6tFx3RjQ5bfANOmeui+9agBTFyZt0Ou6mtoz9jnhu/ UP5/l7ITb51vCJZ/ij3nW6I8/O69t+BYLN53ykSRze7cpCnACXgLMx4WSvrqtSnsHpeh lpyJRGkh24N2jXGfE3lRdu7PZ88QflrJ161Qhn3deug6Ry56fxz1pNNZNQYUuZpBgPu5 iVIw== X-Received: by 10.68.195.68 with SMTP id ic4mr12282455pbc.44.1414607041334; Wed, 29 Oct 2014 11:24:01 -0700 (PDT) Received: from ox ([24.6.44.228]) by mx.google.com with ESMTPSA id no8sm4954100pdb.63.2014.10.29.11.23.59 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 29 Oct 2014 11:24:00 -0700 (PDT) Sender: Navdeep Parhar Date: Wed, 29 Oct 2014 11:23:54 -0700 From: Navdeep Parhar To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r273806 - in head/contrib/ofed: libcxgb4 libcxgb4/src usr.lib usr.lib/libcxgb4 Message-ID: <20141029182354.GA8965@ox> Mail-Followup-To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201410290115.s9T1FnTv094112@svn.freebsd.org> <20141029095604.GA81110@brick.home> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20141029095604.GA81110@brick.home> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 18:24:02 -0000 On Wed, Oct 29, 2014 at 10:56:04AM +0100, Edward Tomasz NapieraÅ‚a wrote: > On 1029T0115, Navdeep Parhar wrote: > > Author: np > > Date: Wed Oct 29 01:15:48 2014 > > New Revision: 273806 > > URL: https://svnweb.freebsd.org/changeset/base/273806 > > > > Log: > > Userspace library for Chelsio's Terminator 5 based iWARP RNICs (pretty > > much every T5 card that does _not_ have "-SO" in its name is RDMA > > capable). > > Yay! This means we could add iSER without using the ICL_PROXY hack. > Well, assuming it's possible to "hand off" RDMA connection from userspace > to the kernel. Is it? Yes, this should be doable. The connection is just another TCP endpoint tracked like all others in the kernel. By the way, iSER is an unnecessary layer if you're using a T5 NIC. It'll work, sure, but you'll run iSER/RDMA/TOE when you could simply run iSCSI/TOE with full zero copy everywhere. Comes out to the same result with a much simpler stack. I think iSER makes sense for gear that does RDMA but not iSCSI natively. Regards, Navdeep From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 19:21:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CD0B9E61; Wed, 29 Oct 2014 19:21:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9BA89AC; Wed, 29 Oct 2014 19:21:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9TJLKcN005879; Wed, 29 Oct 2014 19:21:20 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9TJLKpg005878; Wed, 29 Oct 2014 19:21:20 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201410291921.s9TJLKpg005878@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 29 Oct 2014 19:21:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273835 - head/usr.bin/top X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 19:21:20 -0000 Author: jkim Date: Wed Oct 29 19:21:19 2014 New Revision: 273835 URL: https://svnweb.freebsd.org/changeset/base/273835 Log: Replace a magic number with the proper definition. This change actually fixes broken state field after r273266, i.e., "CPU-1" was displayed in place of "RUN". Modified: head/usr.bin/top/machine.c Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Wed Oct 29 18:01:09 2014 (r273834) +++ head/usr.bin/top/machine.c Wed Oct 29 19:21:19 2014 (r273835) @@ -941,7 +941,7 @@ format_next_process(caddr_t handle, char /* generate "STATE" field */ switch (state = pp->ki_stat) { case SRUN: - if (smpmode && pp->ki_oncpu != 0xff) + if (smpmode && pp->ki_oncpu != NOCPU) sprintf(status, "CPU%d", pp->ki_oncpu); else strcpy(status, "RUN"); @@ -1100,7 +1100,7 @@ format_next_process(caddr_t handle, char /* format this entry */ if (smpmode) { - if (state == SRUN && pp->ki_oncpu != 0xff) + if (state == SRUN && pp->ki_oncpu != NOCPU) cpu = pp->ki_oncpu; else cpu = pp->ki_lastcpu; From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 19:31:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DF6D1108; Wed, 29 Oct 2014 19:31:45 +0000 (UTC) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 8C331A30; Wed, 29 Oct 2014 19:31:45 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id D7B37422056; Thu, 30 Oct 2014 06:11:10 +1100 (AEDT) Date: Thu, 30 Oct 2014 06:11:09 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov Subject: Re: svn commit: r273129 - head/sys/kern In-Reply-To: <20141029165523.GF53947@kib.kiev.ua> Message-ID: <20141030054402.G2929@besplex.bde.org> References: <201410151238.s9FCcRMe018200@svn.freebsd.org> <20141028040935.M3114@besplex.bde.org> <20141029165523.GF53947@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=fvDlOjIf c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=vxL5pm7eCyaE4jrGXQAA:9 a=fIJQodi46wkFxh06:21 a=yVTk0KWOF527Rs97:21 a=CjuIK1q_8ugA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 19:31:46 -0000 On Wed, 29 Oct 2014, Konstantin Belousov wrote: > On Tue, Oct 28, 2014 at 04:28:37AM +1100, Bruce Evans wrote: >> @diff -u2 dd.c~ dd.c >> @--- dd.c~ Wed Apr 7 20:20:48 2004 >> @+++ dd.c Wed Apr 7 20:20:49 2004 >> @@@ -247,21 +245,18 @@ >> @ io->flags |= ISTRUNC; >> @ if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) { >> @- if (ioctl(io->fd, FIODTYPE, &type) == -1) { >> @+ if (ioctl(io->fd, FIODTYPE, &type) == -1) >> @ err(1, "%s", io->name); >> @- } else { >> @+ else { >> @ if (type & D_TAPE) >> @ io->flags |= ISTAPE; >> @ else if (type & (D_DISK | D_MEM)) >> @- io->flags |= ISSEEK; >> @- if (S_ISCHR(sb.st_mode) && (type & D_TAPE) == 0) >> @+ io->flags |= ISSEEKABLE; >> @+ if (S_ISCHR(sb.st_mode)) >> @ io->flags |= ISCHR; >> @ } >> @- return; >> @- } >> @- errno = 0; >> @- if (lseek(io->fd, (off_t)0, SEEK_CUR) == -1 && errno == ESPIPE) >> @- io->flags |= ISPIPE; >> @- else >> @- io->flags |= ISSEEK; >> @+ } else if (lseek(io->fd, (off_t)0, SEEK_CUR) == 0) >> @+ io->flags |= ISSEEKABLE; >> @+ else if (errno == ESPIPE) >> @+ io->flags |= ISPIPE; /* XXX fixed in 4.4BSD */ >> @ } >> @ > > Ok, I tried to de-obfuscate and restore the patch above. The patch came out not very readable for some reason. > diff --git a/bin/dd/dd.c b/bin/dd/dd.c > index 8ae11a7..aadc7da 100644 > --- a/bin/dd/dd.c > +++ b/bin/dd/dd.c > @@ -257,7 +257,7 @@ getfdtype(IO *io) > err(1, "%s", io->name); > if (S_ISREG(sb.st_mode)) > io->flags |= ISTRUNC; > - if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) { > + if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) { > if (ioctl(io->fd, FIODTYPE, &type) == -1) { > err(1, "%s", io->name); > } else { > @@ -265,16 +265,14 @@ getfdtype(IO *io) > io->flags |= ISTAPE; > else if (type & (D_DISK | D_MEM)) > io->flags |= ISSEEK; > - if (S_ISCHR(sb.st_mode) && (type & D_TAPE) == 0) > + if (S_ISCHR(sb.st_mode)) > io->flags |= ISCHR; > } > - return; > - } > - errno = 0; > - if (lseek(io->fd, (off_t)0, SEEK_CUR) == -1 && errno == ESPIPE) > - io->flags |= ISPIPE; > - else > + } else if (lseek(io->fd, (off_t)0, SEEK_CUR) == 0) { > io->flags |= ISSEEK; > + } else if (errno == ESPIPE) { > + io->flags |= ISPIPE; > + } > } > > static void That came out not very readable too. I don't like it much. Now I don't see what I was doing with the lseek() changes, except to improve the spelling (SEEK -> SEEKABLE). The XXX comment was in 4.4BSD. I restored it, but now I think removing it was correct, and the other FreeBSD changes near the lseek() call are improvements too. Another try, starting with -current sources. It doesn't touch the lseek() code, but changes more before that, to return early and reduce indentation after that, and never fail: % diff -u2 dd.c~ dd.c % --- dd.c~ 2014-08-06 20:12:52.000000000 +0000 % +++ dd.c 2014-10-29 18:36:03.979133000 +0000 % @@ -255,18 +255,16 @@ % % if (fstat(io->fd, &sb) == -1) % - err(1, "%s", io->name); % + return; Unlikely error. Treat it is null type. % if (S_ISREG(sb.st_mode)) % io->flags |= ISTRUNC; % if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) { % + if (S_ISCHR(sb.st_mode)) % + io->flags |= ISCHR; Default for next return. Note that block devices aren't supported, so the ISBLK() check and the second ISCHR() check are redundant. I keep them for compatibility. % if (ioctl(io->fd, FIODTYPE, &type) == -1) { % - err(1, "%s", io->name); % - } else { % - if (type & D_TAPE) % - io->flags |= ISTAPE; % - else if (type & (D_DISK | D_MEM)) % - io->flags |= ISSEEK; % - if (S_ISCHR(sb.st_mode) && (type & D_TAPE) == 0) % - io->flags |= ISCHR; % - } % + return; Actually, ISBLK() is possible. Then since block devices aren't supported, the ioctl should fail, and we again return with a null type. % + if (type & D_TAPE) % + io->flags |= ISTAPE; % + else if (type & (D_DISK | D_MEM)) % + io->flags |= ISSEEK; Re-indent and simplify a little. The only change in the non-failure cases is to not use tangled logic to avoid setting ISCHR for tape devices. So tape devices are ISCHR | ISTAPE now, and still not ISSEEK. ISTAPE is only used in a couple of places, and it is easy to see that having ISCHR also set doesn't affect the behaviour of ISTAPE. % return; % } After here there is a seek test. We get here for irregular regular files in procfs. Hopefully the seek test will fail for them. The seek test isn't very good, but it is better than unconditionally setting ISSEEK for regular files. We could also try falling through to here to do the seek test for cdevs, but it is know to give wrong results like succeeding on keyboards so it is best to only set ISSEEK for devices that are known to be seekable. I now see a small improvement in the seek test. Just remove its errno stuff, and trust the syscall to return -1 on error. This depends on -1 being an impossible seek offset. POSIX requires this, but we make it possible so that /dev/mem can be seeked to address 0xFFFFFFFFFFFFFFFF on 64-bit arches. We do this for any cdev but no other file types. Since we returned earlier for cdevs, this case can't happen here. Bruce From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 20:08:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 31428178; Wed, 29 Oct 2014 20:08:12 +0000 (UTC) Received: from f10.opsec.eu (f10.opsec.eu [IPv6:2001:14f8:200:4::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E38BFE4B; Wed, 29 Oct 2014 20:08:11 +0000 (UTC) Received: from pi by f10.opsec.eu with local (Exim 4.84 (FreeBSD)) (envelope-from ) id 1XjZXJ-000NiZ-0l; Wed, 29 Oct 2014 21:08:05 +0100 Date: Wed, 29 Oct 2014 21:08:05 +0100 From: Kurt Jaeger To: Kurt Jaeger Subject: Re: svn commit: r273734 - head/bin/dd Message-ID: <20141029200805.GD42752@f10.opsec.eu> References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141027153957.GZ1877@kib.kiev.ua> <20141027155427.GM1492@f10.opsec.eu> <86vbn4egjt.fsf@nine.des.no> <86r3xseepw.fsf@nine.des.no> <20141028141426.GA42752@f10.opsec.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141028141426.GA42752@f10.opsec.eu> Cc: Konstantin Belousov , Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= , svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-head@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 20:08:12 -0000 Hi! https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191263 > Right now the submitter tests on 32bit and if time permits, I'll > experiment on ARM as well. The submitter has provided a new patch, he tested it and, I tested it on - 10.0p10 amd64 - 10.1-RC3-i386 - 10.1-RC3-armv6 (raspberry-pi) All looks fine (I hope). Would some kind soul from the much more experienced src-committers please take up the PR, do some more testing and commit it ? Thanks very much! -- pi@FreeBSD.org +49 171 3101372 6 years to go ! From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 20:13:14 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 574D84B6; Wed, 29 Oct 2014 20:13:14 +0000 (UTC) Received: from mail-ig0-x235.google.com (mail-ig0-x235.google.com [IPv6:2607:f8b0:4001:c05::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1B43DF16; Wed, 29 Oct 2014 20:13:14 +0000 (UTC) Received: by mail-ig0-f181.google.com with SMTP id l13so4167397iga.14 for ; Wed, 29 Oct 2014 13:13:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=XX2/oRpuoealHADJfoz6NzpmSYjBjfe7uw42W4yfjfA=; b=xSeYzssyeoqFQeVfS1GBse3Qr27lgUPkH4PALezY/jMz0hSe6Ctj2bEwnM2YO5ryny dmZQeu3ukRqsDamlbwn3PX6V1/fvRf58ZF/gbi3oFAB9Akb7I26uRXkLUDN7HZvZxoQv Zie9xyHiNExj6YB343il1YScd3aPXuD5ROPjbfTw+46EiTDMM1+DWhiloO9hfOWoM9+V mFLtQTDBI60b/bp4lKEOvvTfVbbLdz+Aenqr0r0i/UPsZW0xD2ES5g0614Z0Up9DNvPF w6Kf7wBRMAx4Xfy/WmzZypl34Qx1y0/7WK5xBpJOBtzN879+hkx5lh2+ahxfsZQUL4PE rWoQ== MIME-Version: 1.0 X-Received: by 10.107.12.222 with SMTP id 91mr5571673iom.71.1414613593536; Wed, 29 Oct 2014 13:13:13 -0700 (PDT) Received: by 10.50.193.135 with HTTP; Wed, 29 Oct 2014 13:13:13 -0700 (PDT) In-Reply-To: <20141029200805.GD42752@f10.opsec.eu> References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141027153957.GZ1877@kib.kiev.ua> <20141027155427.GM1492@f10.opsec.eu> <86vbn4egjt.fsf@nine.des.no> <86r3xseepw.fsf@nine.des.no> <20141028141426.GA42752@f10.opsec.eu> <20141029200805.GD42752@f10.opsec.eu> Date: Wed, 29 Oct 2014 13:13:13 -0700 Message-ID: Subject: Re: svn commit: r273734 - head/bin/dd From: NGie Cooper To: Kurt Jaeger Content-Type: text/plain; charset=UTF-8 Cc: Konstantin Belousov , =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "svn-src-head@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 20:13:14 -0000 On Wed, Oct 29, 2014 at 1:08 PM, Kurt Jaeger wrote: > Hi! > > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191263 > >> Right now the submitter tests on 32bit and if time permits, I'll >> experiment on ARM as well. > > The submitter has provided a new patch, he tested it and, I tested it on > - 10.0p10 amd64 > - 10.1-RC3-i386 > - 10.1-RC3-armv6 (raspberry-pi) > > All looks fine (I hope). > > Would some kind soul from the much more experienced src-committers > please take up the PR, do some more testing and commit it ? > > Thanks very much! I'll work on integrating in bin/dd/tests from NetBSD too soon with some of the changes that I have from my github branch (they pass on amd64/i386 at least). The NetBSD tests deal with some of the edgecases with overflow output, etc. Cheers, From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 20:18:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 84E9E9B5; Wed, 29 Oct 2014 20:18:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71AB9F6A; Wed, 29 Oct 2014 20:18:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9TKIcRs034079; Wed, 29 Oct 2014 20:18:38 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9TKIcg1034078; Wed, 29 Oct 2014 20:18:38 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201410292018.s9TKIcg1034078@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Oct 2014 20:18:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273837 - head/lib/libutil X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 20:18:38 -0000 Author: dim Date: Wed Oct 29 20:18:37 2014 New Revision: 273837 URL: https://svnweb.freebsd.org/changeset/base/273837 Log: Fix a clang 3.5 warning about abs(3) being given an argument of type quad_t in setusercontext(). While here, sanitize the clamping of the priority value, and use the correct type for the return value of login_getcapnum(). Reviewed by: kib MFC after: 3 days Modified: head/lib/libutil/login_class.c Modified: head/lib/libutil/login_class.c ============================================================================== --- head/lib/libutil/login_class.c Wed Oct 29 19:44:34 2014 (r273836) +++ head/lib/libutil/login_class.c Wed Oct 29 20:18:37 2014 (r273837) @@ -424,7 +424,7 @@ setlogincontext(login_cap_t *lc, const s int setusercontext(login_cap_t *lc, const struct passwd *pwd, uid_t uid, unsigned int flags) { - quad_t p; + rlim_t p; mode_t mymask; login_cap_t *llc = NULL; struct sigaction sa, prevsa; @@ -449,16 +449,16 @@ setusercontext(login_cap_t *lc, const st if (p > PRIO_MAX) { rtp.type = RTP_PRIO_IDLE; - rtp.prio = p - PRIO_MAX - 1; - p = (rtp.prio > RTP_PRIO_MAX) ? 31 : p; + p -= PRIO_MAX + 1; + rtp.prio = p > RTP_PRIO_MAX ? RTP_PRIO_MAX : p; if (rtprio(RTP_SET, 0, &rtp)) syslog(LOG_WARNING, "rtprio '%s' (%s): %m", pwd ? pwd->pw_name : "-", lc ? lc->lc_class : LOGIN_DEFCLASS); } else if (p < PRIO_MIN) { rtp.type = RTP_PRIO_REALTIME; - rtp.prio = abs(p - PRIO_MIN + RTP_PRIO_MAX); - p = (rtp.prio > RTP_PRIO_MAX) ? 1 : p; + p -= PRIO_MIN - RTP_PRIO_MAX; + rtp.prio = p < RTP_PRIO_MIN ? RTP_PRIO_MIN : p; if (rtprio(RTP_SET, 0, &rtp)) syslog(LOG_WARNING, "rtprio '%s' (%s): %m", pwd ? pwd->pw_name : "-", From owner-svn-src-head@FreeBSD.ORG Wed Oct 29 22:22:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E5373AB1; Wed, 29 Oct 2014 22:22:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1C276D; Wed, 29 Oct 2014 22:22:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9TMMOEr098830; Wed, 29 Oct 2014 22:22:24 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9TMMOHk098829; Wed, 29 Oct 2014 22:22:24 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410292222.s9TMMOHk098829@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 29 Oct 2014 22:22:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273839 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2014 22:22:25 -0000 Author: delphij Date: Wed Oct 29 22:22:24 2014 New Revision: 273839 URL: https://svnweb.freebsd.org/changeset/base/273839 Log: .a's are installed in /usr/lib, don't delete them. Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Oct 29 22:17:45 2014 (r273838) +++ head/ObsoleteFiles.inc Wed Oct 29 22:22:24 2014 (r273839) @@ -51,7 +51,6 @@ OLD_FILES+=usr/share/man/man9/sleepq_cat # 20140917: hv_kvpd rc.d script removed in favor of devd configuration OLD_FILES+=etc/rc.d/hv_kvpd # 20140917: libnv was accidentally being installed to /usr/lib instead of /lib -OLD_LIBS+=usr/lib/libnv.a OLD_LIBS+=usr/lib/libnv.so.0 # 20140829: rc.d/kerberos removed OLD_FILES+=etc/rc.d/kerberos From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 05:10:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2DEA1E5D; Thu, 30 Oct 2014 05:10:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19F02ED0; Thu, 30 Oct 2014 05:10:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9U5AXiv088399; Thu, 30 Oct 2014 05:10:33 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9U5AXkX088397; Thu, 30 Oct 2014 05:10:33 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410300510.s9U5AXkX088397@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 30 Oct 2014 05:10:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273842 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 05:10:34 -0000 Author: mjg Date: Thu Oct 30 05:10:33 2014 New Revision: 273842 URL: https://svnweb.freebsd.org/changeset/base/273842 Log: filedesc: get rid of atomic_load_acq_int from fget_unlocked A read barrier was necessary because fd table pointer and table size were updated separately, opening a window where fget_unlocked could read new size and old pointer. This patch puts both these fields into one dedicated structure, pointer to which is later atomically updated. As such, fget_unlocked only needs data a dependency barrier which is a noop on all supported architectures. Reviewed by: kib (previous version) MFC after: 2 weeks Modified: head/sys/kern/kern_descrip.c head/sys/sys/filedesc.h Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Wed Oct 29 23:10:48 2014 (r273841) +++ head/sys/kern/kern_descrip.c Thu Oct 30 05:10:33 2014 (r273842) @@ -150,7 +150,7 @@ static int getmaxfd(struct proc *p); * the process exits. */ struct freetable { - struct filedescent *ft_table; + struct fdescenttbl *ft_table; SLIST_ENTRY(freetable) ft_next; }; @@ -158,10 +158,16 @@ struct freetable { * Initial allocation: a filedesc structure + the head of SLIST used to * keep track of old ofiles + enough space for NDFILE descriptors. */ + +struct fdescenttbl0 { + int fdt_nfiles; + struct filedescent fdt_ofiles[NDFILE]; +}; + struct filedesc0 { struct filedesc fd_fd; SLIST_HEAD(, freetable) fd_free; - struct filedescent fd_dfiles[NDFILE]; + struct fdescenttbl0 fd_dfiles; NDSLOTTYPE fd_dmap[NDSLOTS(NDFILE)]; }; @@ -1516,8 +1522,8 @@ fdgrowtable(struct filedesc *fdp, int nf { struct filedesc0 *fdp0; struct freetable *ft; - struct filedescent *ntable; - struct filedescent *otable; + struct fdescenttbl *ntable; + struct fdescenttbl *otable; int nnfiles, onfiles; NDSLOTTYPE *nmap, *omap; @@ -1527,7 +1533,7 @@ fdgrowtable(struct filedesc *fdp, int nf /* save old values */ onfiles = fdp->fd_nfiles; - otable = fdp->fd_ofiles; + otable = fdp->fd_files; omap = fdp->fd_map; /* compute the size of the new table */ @@ -1537,17 +1543,20 @@ fdgrowtable(struct filedesc *fdp, int nf return; /* - * Allocate a new table. We need enough space for the - * file entries themselves and the struct freetable we will use + * Allocate a new table. We need enough space for the number of + * entries, file entries themselves and the struct freetable we will use * when we decommission the table and place it on the freelist. * We place the struct freetable in the middle so we don't have * to worry about padding. */ - ntable = malloc(nnfiles * sizeof(ntable[0]) + sizeof(struct freetable), + ntable = malloc(offsetof(struct fdescenttbl, fdt_ofiles) + + nnfiles * sizeof(ntable->fdt_ofiles[0]) + + sizeof(struct freetable), M_FILEDESC, M_ZERO | M_WAITOK); - /* copy the old data over and point at the new tables */ - memcpy(ntable, otable, onfiles * sizeof(*otable)); - fdp->fd_ofiles = ntable; + /* copy the old data */ + ntable->fdt_nfiles = nnfiles; + memcpy(ntable->fdt_ofiles, otable->fdt_ofiles, + onfiles * sizeof(ntable->fdt_ofiles[0])); /* * Allocate a new map only if the old is not large enough. It will @@ -1563,13 +1572,11 @@ fdgrowtable(struct filedesc *fdp, int nf } /* - * In order to have a valid pattern for fget_unlocked() - * fdp->fd_nfiles must be the last member to be updated, otherwise - * fget_unlocked() consumers may reference a new, higher value for - * fdp->fd_nfiles before to access the fdp->fd_ofiles array, - * resulting in OOB accesses. + * Make sure that ntable is correctly initialized before we replace + * fd_files poiner. Otherwise fget_unlocked() may see inconsistent + * data. */ - atomic_store_rel_int(&fdp->fd_nfiles, nnfiles); + atomic_store_rel_ptr((volatile void *)&fdp->fd_files, (uintptr_t)ntable); /* * Do not free the old file table, as some threads may still @@ -1581,7 +1588,7 @@ fdgrowtable(struct filedesc *fdp, int nf * which must not be freed. */ if (onfiles > NDFILE) { - ft = (struct freetable *)&otable[onfiles]; + ft = (struct freetable *)&otable->fdt_ofiles[onfiles]; fdp0 = (struct filedesc0 *)fdp; ft->ft_table = otable; SLIST_INSERT_HEAD(&fdp0->fd_free, ft, ft_next); @@ -1813,8 +1820,8 @@ fdinit(struct filedesc *fdp) newfdp->fd_fd.fd_refcnt = 1; newfdp->fd_fd.fd_holdcnt = 1; newfdp->fd_fd.fd_cmask = CMASK; - newfdp->fd_fd.fd_ofiles = newfdp->fd_dfiles; - newfdp->fd_fd.fd_nfiles = NDFILE; + newfdp->fd_dfiles.fdt_nfiles = NDFILE; + newfdp->fd_fd.fd_files = (struct fdescenttbl *)&newfdp->fd_dfiles; newfdp->fd_fd.fd_map = newfdp->fd_dmap; newfdp->fd_fd.fd_lastfile = -1; return (&newfdp->fd_fd); @@ -2054,10 +2061,10 @@ fdescfree(struct thread *td) } } - if (fdp->fd_nfiles > NDFILE) - free(fdp->fd_ofiles, M_FILEDESC); if (NDSLOTS(fdp->fd_nfiles) > NDSLOTS(NDFILE)) free(fdp->fd_map, M_FILEDESC); + if (fdp->fd_nfiles > NDFILE) + free(fdp->fd_files, M_FILEDESC); if (cdir != NULL) vrele(cdir); @@ -2305,6 +2312,7 @@ fget_unlocked(struct filedesc *fdp, int #ifdef CAPABILITIES struct filedescent fde; #endif + struct fdescenttbl *fdt; struct file *fp; u_int count; #ifdef CAPABILITIES @@ -2313,11 +2321,8 @@ fget_unlocked(struct filedesc *fdp, int int error; #endif - /* - * Avoid reads reordering and then a first access to the - * fdp->fd_ofiles table which could result in OOB operation. - */ - if (fd < 0 || fd >= atomic_load_acq_int(&fdp->fd_nfiles)) + fdt = fdp->fd_files; + if (fd < 0 || fd >= fdt->fdt_nfiles) return (EBADF); /* * Fetch the descriptor locklessly. We avoid fdrop() races by @@ -2329,15 +2334,15 @@ fget_unlocked(struct filedesc *fdp, int */ for (;;) { #ifdef CAPABILITIES - seq = seq_read(fd_seq(fdp, fd)); - fde = fdp->fd_ofiles[fd]; - if (!seq_consistent(fd_seq(fdp, fd), seq)) { + seq = seq_read(fd_seq(fdt, fd)); + fde = fdt->fdt_ofiles[fd]; + if (!seq_consistent(fd_seq(fdt, fd), seq)) { cpu_spinwait(); continue; } fp = fde.fde_file; #else - fp = fdp->fd_ofiles[fd].fde_file; + fp = fdt->fdt_ofiles[fd].fde_file; #endif if (fp == NULL) return (EBADF); @@ -2355,18 +2360,23 @@ fget_unlocked(struct filedesc *fdp, int } #endif count = fp->f_count; - if (count == 0) + if (count == 0) { + fdt = fdp->fd_files; continue; + } /* - * Use an acquire barrier to prevent caching of fd_ofiles - * so it is refreshed for verification. + * Use an acquire barrier to force re-reading of fdt so it is + * refreshed for verification. */ - if (atomic_cmpset_acq_int(&fp->f_count, count, count + 1) != 1) + if (atomic_cmpset_acq_int(&fp->f_count, count, count + 1) == 0) { + fdt = fdp->fd_files; continue; + } + fdt = fdp->fd_files; #ifdef CAPABILITIES - if (seq_consistent_nomb(fd_seq(fdp, fd), seq)) + if (seq_consistent_nomb(fd_seq(fdt, fd), seq)) #else - if (fp == fdp->fd_ofiles[fd].fde_file) + if (fp == fdt->fdt_ofiles[fd].fde_file) #endif break; fdrop(fp, curthread); Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Wed Oct 29 23:10:48 2014 (r273841) +++ head/sys/sys/filedesc.h Thu Oct 30 05:10:33 2014 (r273842) @@ -62,6 +62,12 @@ struct filedescent { #define fde_nioctls fde_caps.fc_nioctls #define fde_change_size (offsetof(struct filedescent, fde_seq)) +struct fdescenttbl { + int fdt_nfiles; /* number of open files allocated */ + struct filedescent fdt_ofiles[0]; /* open files */ +}; +#define fd_seq(fdt, fd) (&(fdt)->fdt_ofiles[(fd)].fde_seq) + /* * This structure is used for the management of descriptors. It may be * shared by multiple processes. @@ -69,11 +75,10 @@ struct filedescent { #define NDSLOTTYPE u_long struct filedesc { - struct filedescent *fd_ofiles; /* open files */ + struct fdescenttbl *fd_files; /* open files table */ struct vnode *fd_cdir; /* current directory */ struct vnode *fd_rdir; /* root directory */ struct vnode *fd_jdir; /* jail root directory */ - int fd_nfiles; /* number of open files allocated */ NDSLOTTYPE *fd_map; /* bitmap of free fds */ int fd_lastfile; /* high-water mark of fd_ofiles */ int fd_freefile; /* approx. next free file */ @@ -85,7 +90,6 @@ struct filedesc { int fd_holdleaderscount; /* block fdfree() for shared close() */ int fd_holdleaderswakeup; /* fdfree() needs wakeup */ }; -#define fd_seq(fdp, fd) (&(fdp)->fd_ofiles[(fd)].fde_seq) /* * Structure to keep track of (process leader, struct fildedesc) tuples. @@ -105,6 +109,8 @@ struct filedesc_to_leader { struct filedesc_to_leader *fdl_prev; struct filedesc_to_leader *fdl_next; }; +#define fd_nfiles fd_files->fdt_nfiles +#define fd_ofiles fd_files->fdt_ofiles /* * Per-process open flags. From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 05:21:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BB000154; Thu, 30 Oct 2014 05:21:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8113EC; Thu, 30 Oct 2014 05:21:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9U5LDk8093002; Thu, 30 Oct 2014 05:21:13 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9U5LDjD093001; Thu, 30 Oct 2014 05:21:13 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410300521.s9U5LDjD093001@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 30 Oct 2014 05:21:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273843 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 05:21:13 -0000 Author: mjg Date: Thu Oct 30 05:21:12 2014 New Revision: 273843 URL: https://svnweb.freebsd.org/changeset/base/273843 Log: filedesc: microoptimize fget_unlocked by retrying obtaining reference count without restarting whole lookup Restart is only needed when fp was closed by current process, which is a much rarer event than ref/deref by some other thread. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Oct 30 05:10:33 2014 (r273842) +++ head/sys/kern/kern_descrip.c Thu Oct 30 05:21:12 2014 (r273843) @@ -2359,6 +2359,7 @@ fget_unlocked(struct filedesc *fdp, int } } #endif + retry: count = fp->f_count; if (count == 0) { fdt = fdp->fd_files; @@ -2368,10 +2369,8 @@ fget_unlocked(struct filedesc *fdp, int * Use an acquire barrier to force re-reading of fdt so it is * refreshed for verification. */ - if (atomic_cmpset_acq_int(&fp->f_count, count, count + 1) == 0) { - fdt = fdp->fd_files; - continue; - } + if (atomic_cmpset_acq_int(&fp->f_count, count, count + 1) == 0) + goto retry; fdt = fdp->fd_files; #ifdef CAPABILITIES if (seq_consistent_nomb(fd_seq(fdt, fd), seq)) From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 06:54:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B274FC3; Thu, 30 Oct 2014 06:54:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F896BE5; Thu, 30 Oct 2014 06:54:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9U6sQxI038131; Thu, 30 Oct 2014 06:54:26 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9U6sQdb038130; Thu, 30 Oct 2014 06:54:26 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201410300654.s9U6sQdb038130@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Thu, 30 Oct 2014 06:54:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273844 - head/usr.bin/hexdump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 06:54:26 -0000 Author: jmg Date: Thu Oct 30 06:54:25 2014 New Revision: 273844 URL: https://svnweb.freebsd.org/changeset/base/273844 Log: fix spelling of offset since that is what is used in the body... Modified: head/usr.bin/hexdump/hexdump.1 Modified: head/usr.bin/hexdump/hexdump.1 ============================================================================== --- head/usr.bin/hexdump/hexdump.1 Thu Oct 30 05:21:12 2014 (r273843) +++ head/usr.bin/hexdump/hexdump.1 Thu Oct 30 06:54:25 2014 (r273844) @@ -28,7 +28,7 @@ .\" @(#)hexdump.1 8.2 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd February 18, 2010 +.Dd October 29, 2014 .Dt HEXDUMP 1 .Os .Sh NAME @@ -41,7 +41,7 @@ .Op Fl f Ar format_file .Op Fl n Ar length .Bk -words -.Op Fl s Ar skip +.Op Fl s Ar offset .Ek .Ar .Nm hd @@ -50,7 +50,7 @@ .Op Fl f Ar format_file .Op Fl n Ar length .Bk -words -.Op Fl s Ar skip +.Op Fl s Ar offset .Ek .Ar .Sh DESCRIPTION From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 07:21:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 40F818CA; Thu, 30 Oct 2014 07:21:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E895F1B; Thu, 30 Oct 2014 07:21:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9U7LdWL051393; Thu, 30 Oct 2014 07:21:39 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9U7Ld6Z051392; Thu, 30 Oct 2014 07:21:39 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410300721.s9U7Ld6Z051392@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 30 Oct 2014 07:21:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273845 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 07:21:39 -0000 Author: mjg Date: Thu Oct 30 07:21:38 2014 New Revision: 273845 URL: https://svnweb.freebsd.org/changeset/base/273845 Log: filedesc: make sure to force table reload in fget_unlocked when count == 0 This is a fixup to r273843. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Oct 30 06:54:25 2014 (r273844) +++ head/sys/kern/kern_descrip.c Thu Oct 30 07:21:38 2014 (r273845) @@ -2362,7 +2362,12 @@ fget_unlocked(struct filedesc *fdp, int retry: count = fp->f_count; if (count == 0) { - fdt = fdp->fd_files; + /* + * Force a reload. Other thread could reallocate the + * table before this fd was closed, so it possible that + * there is a stale fp pointer in cached version. + */ + fdt = *(struct fdescenttbl * volatile *)&(fdp->fd_files); continue; } /* From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 08:05:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C96E159B; Thu, 30 Oct 2014 08:05:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAB37390; Thu, 30 Oct 2014 08:05:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9U85qL1071203; Thu, 30 Oct 2014 08:05:52 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9U85qJQ071202; Thu, 30 Oct 2014 08:05:52 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410300805.s9U85qJQ071202@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 30 Oct 2014 08:05:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273848 - head/sbin/mount_nfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 08:05:52 -0000 Author: trasz Date: Thu Oct 30 08:05:51 2014 New Revision: 273848 URL: https://svnweb.freebsd.org/changeset/base/273848 Log: Get rid of obsolete code in mount_nfs(8). Reviewed by: rmacklem@ Sponsored by: The FreeBSD Foundation Modified: head/sbin/mount_nfs/mount_nfs.c Modified: head/sbin/mount_nfs/mount_nfs.c ============================================================================== --- head/sbin/mount_nfs/mount_nfs.c Thu Oct 30 08:04:48 2014 (r273847) +++ head/sbin/mount_nfs/mount_nfs.c Thu Oct 30 08:05:51 2014 (r273848) @@ -130,7 +130,6 @@ enum tryret { TRYRET_LOCALERR /* Local failure. */ }; -static int fallback_mount(struct iovec *iov, int iovlen); static int sec_name_to_num(char *sec); static char *sec_num_to_name(int num); static int getnfsargs(char *, struct iovec **iov, int *iovlen); @@ -150,7 +149,6 @@ main(int argc, char *argv[]) int c; struct iovec *iov; int num, iovlen; - int osversion; char *name, *p, *spec, *fstype; char mntpath[MAXPATHLEN], errmsg[255]; char hostname[MAXHOSTNAMELEN + 1], *gssname, gssn[MAXHOSTNAMELEN + 50]; @@ -443,21 +441,8 @@ main(int argc, char *argv[]) build_iovec(&iov, &iovlen, "fspath", mntpath, (size_t)-1); build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); - /* - * XXX: - * Backwards compatibility routines for older kernels. - * Remove this and fallback_mount() code when we do not need to support - * NFS mounts against older kernels which still need - * struct nfs_args to be passed in via nmount(). - */ - osversion = getosreldate(); - if (osversion >= 702100) { - if (nmount(iov, iovlen, 0)) - err(1, "%s, %s", mntpath, errmsg); - } else { - if (fallback_mount(iov, iovlen)) - err(1, "%s, %s", mntpath, errmsg); - } + if (nmount(iov, iovlen, 0)) + err(1, "%s, %s", mntpath, errmsg); exit(0); } @@ -491,206 +476,6 @@ copyopt(struct iovec **newiov, int *newi build_iovec(newiov, newiovlen, name, value, len); } -/* - * XXX: This function is provided for backwards - * compatibility with older kernels which did not support - * passing NFS mount options to nmount() as individual - * parameters. It should be eventually be removed. - */ -static int -fallback_mount(struct iovec *iov, int iovlen) -{ - struct nfs_args args = { - .version = NFS_ARGSVERSION, - .addr = NULL, - .addrlen = sizeof (struct sockaddr_in), - .sotype = SOCK_STREAM, - .proto = 0, - .fh = NULL, - .fhsize = 0, - .flags = NFSMNT_RESVPORT, - .wsize = NFS_WSIZE, - .rsize = NFS_RSIZE, - .readdirsize = NFS_READDIRSIZE, - .timeo = 10, - .retrans = NFS_RETRANS, - .maxgrouplist = NFS_MAXGRPS, - .readahead = NFS_DEFRAHEAD, - .wcommitsize = 0, /* was: NQ_DEFLEASE */ - .deadthresh = NFS_MAXDEADTHRESH, /* was: NQ_DEADTHRESH */ - .hostname = NULL, - /* args version 4 */ - .acregmin = NFS_MINATTRTIMO, - .acregmax = NFS_MAXATTRTIMO, - .acdirmin = NFS_MINDIRATTRTIMO, - .acdirmax = NFS_MAXDIRATTRTIMO, - }; - int ret; - char *opt; - struct iovec *newiov; - int newiovlen; - - if (findopt(iov, iovlen, "dumbtimer", NULL, NULL) == 0) - args.flags |= NFSMNT_DUMBTIMR; - if (findopt(iov, iovlen, "noconn", NULL, NULL) == 0) - args.flags |= NFSMNT_NOCONN; - if (findopt(iov, iovlen, "conn", NULL, NULL) == 0) - args.flags |= NFSMNT_NOCONN; - if (findopt(iov, iovlen, "nolockd", NULL, NULL) == 0) - args.flags |= NFSMNT_NOLOCKD; - if (findopt(iov, iovlen, "lockd", NULL, NULL) == 0) - args.flags &= ~NFSMNT_NOLOCKD; - if (findopt(iov, iovlen, "intr", NULL, NULL) == 0) - args.flags |= NFSMNT_INT; - if (findopt(iov, iovlen, "rdirplus", NULL, NULL) == 0) - args.flags |= NFSMNT_RDIRPLUS; - if (findopt(iov, iovlen, "resvport", NULL, NULL) == 0) - args.flags |= NFSMNT_RESVPORT; - if (findopt(iov, iovlen, "noresvport", NULL, NULL) == 0) - args.flags &= ~NFSMNT_RESVPORT; - if (findopt(iov, iovlen, "soft", NULL, NULL) == 0) - args.flags |= NFSMNT_SOFT; - if (findopt(iov, iovlen, "hard", NULL, NULL) == 0) - args.flags &= ~NFSMNT_SOFT; - if (findopt(iov, iovlen, "mntudp", NULL, NULL) == 0) - args.sotype = SOCK_DGRAM; - if (findopt(iov, iovlen, "udp", NULL, NULL) == 0) - args.sotype = SOCK_DGRAM; - if (findopt(iov, iovlen, "tcp", NULL, NULL) == 0) - args.sotype = SOCK_STREAM; - if (findopt(iov, iovlen, "nfsv3", NULL, NULL) == 0) - args.flags |= NFSMNT_NFSV3; - if (findopt(iov, iovlen, "readdirsize", &opt, NULL) == 0) { - if (opt == NULL) { - errx(1, "illegal readdirsize"); - } - ret = sscanf(opt, "%d", &args.readdirsize); - if (ret != 1 || args.readdirsize <= 0) { - errx(1, "illegal readdirsize: %s", opt); - } - args.flags |= NFSMNT_READDIRSIZE; - } - if (findopt(iov, iovlen, "readahead", &opt, NULL) == 0) { - if (opt == NULL) { - errx(1, "illegal readahead"); - } - ret = sscanf(opt, "%d", &args.readahead); - if (ret != 1 || args.readahead <= 0) { - errx(1, "illegal readahead: %s", opt); - } - args.flags |= NFSMNT_READAHEAD; - } - if (findopt(iov, iovlen, "wsize", &opt, NULL) == 0) { - if (opt == NULL) { - errx(1, "illegal wsize"); - } - ret = sscanf(opt, "%d", &args.wsize); - if (ret != 1 || args.wsize <= 0) { - errx(1, "illegal wsize: %s", opt); - } - args.flags |= NFSMNT_WSIZE; - } - if (findopt(iov, iovlen, "rsize", &opt, NULL) == 0) { - if (opt == NULL) { - errx(1, "illegal rsize"); - } - ret = sscanf(opt, "%d", &args.rsize); - if (ret != 1 || args.rsize <= 0) { - errx(1, "illegal wsize: %s", opt); - } - args.flags |= NFSMNT_RSIZE; - } - if (findopt(iov, iovlen, "retrans", &opt, NULL) == 0) { - if (opt == NULL) { - errx(1, "illegal retrans"); - } - ret = sscanf(opt, "%d", &args.retrans); - if (ret != 1 || args.retrans <= 0) { - errx(1, "illegal retrans: %s", opt); - } - args.flags |= NFSMNT_RETRANS; - } - if (findopt(iov, iovlen, "acregmin", &opt, NULL) == 0) { - ret = sscanf(opt, "%d", &args.acregmin); - if (ret != 1 || args.acregmin < 0) { - errx(1, "illegal acregmin: %s", opt); - } - args.flags |= NFSMNT_ACREGMIN; - } - if (findopt(iov, iovlen, "acregmax", &opt, NULL) == 0) { - ret = sscanf(opt, "%d", &args.acregmax); - if (ret != 1 || args.acregmax < 0) { - errx(1, "illegal acregmax: %s", opt); - } - args.flags |= NFSMNT_ACREGMAX; - } - if (findopt(iov, iovlen, "acdirmin", &opt, NULL) == 0) { - ret = sscanf(opt, "%d", &args.acdirmin); - if (ret != 1 || args.acdirmin < 0) { - errx(1, "illegal acdirmin: %s", opt); - } - args.flags |= NFSMNT_ACDIRMIN; - } - if (findopt(iov, iovlen, "acdirmax", &opt, NULL) == 0) { - ret = sscanf(opt, "%d", &args.acdirmax); - if (ret != 1 || args.acdirmax < 0) { - errx(1, "illegal acdirmax: %s", opt); - } - args.flags |= NFSMNT_ACDIRMAX; - } - if (findopt(iov, iovlen, "wcommitsize", &opt, NULL) == 0) { - ret = sscanf(opt, "%d", &args.wcommitsize); - if (ret != 1 || args.wcommitsize < 0) { - errx(1, "illegal wcommitsize: %s", opt); - } - args.flags |= NFSMNT_WCOMMITSIZE; - } - if (findopt(iov, iovlen, "deadthresh", &opt, NULL) == 0) { - ret = sscanf(opt, "%d", &args.deadthresh); - if (ret != 1 || args.deadthresh <= 0) { - errx(1, "illegal deadthresh: %s", opt); - } - args.flags |= NFSMNT_DEADTHRESH; - } - if (findopt(iov, iovlen, "timeout", &opt, NULL) == 0) { - ret = sscanf(opt, "%d", &args.timeo); - if (ret != 1 || args.timeo <= 0) { - errx(1, "illegal timeout: %s", opt); - } - args.flags |= NFSMNT_TIMEO; - } - if (findopt(iov, iovlen, "maxgroups", &opt, NULL) == 0) { - ret = sscanf(opt, "%d", &args.maxgrouplist); - if (ret != 1 || args.timeo <= 0) { - errx(1, "illegal maxgroups: %s", opt); - } - args.flags |= NFSMNT_MAXGRPS; - } - if (findopt(iov, iovlen, "addr", &opt, - &args.addrlen) == 0) { - args.addr = (struct sockaddr *) opt; - } - if (findopt(iov, iovlen, "fh", &opt, &args.fhsize) == 0) { - args.fh = opt; - } - if (findopt(iov, iovlen, "hostname", &args.hostname, - NULL) == 0) { - } - if (args.hostname == NULL) { - errx(1, "Invalid hostname"); - } - - newiov = NULL; - newiovlen = 0; - - build_iovec(&newiov, &newiovlen, "nfs_args", &args, sizeof(args)); - copyopt(&newiov, &newiovlen, iov, iovlen, "fstype"); - copyopt(&newiov, &newiovlen, iov, iovlen, "fspath"); - copyopt(&newiov, &newiovlen, iov, iovlen, "errmsg"); - - return nmount(newiov, newiovlen, 0); -} - static int sec_name_to_num(char *sec) { From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 08:50:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0AD90773; Thu, 30 Oct 2014 08:50:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA3939FC; Thu, 30 Oct 2014 08:50:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9U8o2AG090629; Thu, 30 Oct 2014 08:50:02 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9U8o2s6090624; Thu, 30 Oct 2014 08:50:02 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410300850.s9U8o2s6090624@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 30 Oct 2014 08:50:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273849 - in head: sbin/mount_nfs sys/fs/nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 08:50:03 -0000 Author: trasz Date: Thu Oct 30 08:50:01 2014 New Revision: 273849 URL: https://svnweb.freebsd.org/changeset/base/273849 Log: Add support for "timeo", "actimeo", "noac", and "proto" options to mount_nfs(8). They are implemented on Linux, OS X, and Solaris, and thus can be expected to appear in automounter maps. Reviewed by: rmacklem@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sbin/mount_nfs/mount_nfs.8 head/sbin/mount_nfs/mount_nfs.c head/sys/fs/nfsclient/nfs_clvfsops.c Modified: head/sbin/mount_nfs/mount_nfs.8 ============================================================================== --- head/sbin/mount_nfs/mount_nfs.8 Thu Oct 30 08:05:51 2014 (r273848) +++ head/sbin/mount_nfs/mount_nfs.8 Thu Oct 30 08:50:01 2014 (r273849) @@ -28,7 +28,7 @@ .\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd August 5, 2014 +.Dd October 30, 2014 .Dt MOUNT_NFS 8 .Os .Sh NAME @@ -118,6 +118,8 @@ for regular files, and 30 -> 60 seconds The algorithm to calculate the timeout is based on the age of the file. The older the file, the longer the cache is considered valid, subject to the limits above. +.It Cm actimeo Ns = Ns Aq Ar seconds +Set four cache timeouts above to specified value. .It Cm allgssname This option can be used along with .Fl o Cm gssname @@ -211,6 +213,8 @@ NFS Version 4 protocol. This option is only meaningful when used with the .Cm minorversion option. +.It Cm noac +Disable attribute caching. .It Cm noconn For UDP mount points, do not do a .Xr connect 2 . @@ -282,6 +286,15 @@ use a reserved socket port number (see b .It Cm port Ns = Ns Aq Ar port_number Use specified port number for NFS requests. The default is to query the portmapper for the NFS port. +.It Cm proto Ns = Ns Aq Ar protocol +Specify transport protocol version to use. +Currently, they are: +.Bd -literal +udp - Use UDP over IPv4 +tcp - Use TCP over IPv4 +udp6 - Use UDP over IPv6 +tcp6 - Use TCP over IPv6 +.Ed .It Cm rdirplus Used with NFSV3 to specify that the \fBReaddirPlus\fR RPC should be used. @@ -369,6 +382,9 @@ value if there is a low retransmit rate option should be specified when using this option to manually tune the timeout interval.) +.It Cm timeo Ns = Ns Aq Ar value +Alias for +.Cm timeout . .It Cm udp Use UDP transport. .It Cm vers Ns = Ns Aq Ar vers_number Modified: head/sbin/mount_nfs/mount_nfs.c ============================================================================== --- head/sbin/mount_nfs/mount_nfs.c Thu Oct 30 08:05:51 2014 (r273848) +++ head/sbin/mount_nfs/mount_nfs.c Thu Oct 30 08:50:01 2014 (r273849) @@ -282,6 +282,35 @@ main(int argc, char *argv[]) err(1, "asprintf"); } else if (strcmp(opt, "principal") == 0) { got_principal = 1; + } else if (strcmp(opt, "proto") == 0) { + pass_flag_to_nmount=0; + if (strcmp(val, "tcp") == 0) { + nfsproto = IPPROTO_TCP; + opflags |= OF_NOINET6; + build_iovec(&iov, &iovlen, + "tcp", NULL, 0); + } else if (strcmp(val, "udp") == 0) { + mnttcp_ok = 0; + nfsproto = IPPROTO_UDP; + opflags |= OF_NOINET6; + build_iovec(&iov, &iovlen, + "udp", NULL, 0); + } else if (strcmp(val, "tcp6") == 0) { + nfsproto = IPPROTO_TCP; + opflags |= OF_NOINET4; + build_iovec(&iov, &iovlen, + "tcp", NULL, 0); + } else if (strcmp(val, "udp6") == 0) { + mnttcp_ok = 0; + nfsproto = IPPROTO_UDP; + opflags |= OF_NOINET4; + build_iovec(&iov, &iovlen, + "udp", NULL, 0); + } else { + errx(1, + "illegal proto value -- %s", + val); + } } else if (strcmp(opt, "sec") == 0) { /* * Don't add this option to Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Thu Oct 30 08:05:51 2014 (r273848) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Thu Oct 30 08:50:01 2014 (r273849) @@ -722,15 +722,15 @@ nfs_decode_args(struct mount *mp, struct } static const char *nfs_opts[] = { "from", "nfs_args", - "noatime", "noexec", "suiddir", "nosuid", "nosymfollow", "union", + "noac", "noatime", "noexec", "suiddir", "nosuid", "nosymfollow", "union", "noclusterr", "noclusterw", "multilabel", "acls", "force", "update", "async", "noconn", "nolockd", "conn", "lockd", "intr", "rdirplus", "readdirsize", "soft", "hard", "mntudp", "tcp", "udp", "wsize", "rsize", - "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "resvport", - "readahead", "hostname", "timeout", "addr", "fh", "nfsv3", "sec", - "principal", "nfsv4", "gssname", "allgssname", "dirpath", "minorversion", - "nametimeo", "negnametimeo", "nocto", "noncontigwr", "pnfs", - "wcommitsize", + "retrans", "actimeo", "acregmin", "acregmax", "acdirmin", "acdirmax", + "resvport", "readahead", "hostname", "timeo", "timeout", "addr", "fh", + "nfsv3", "sec", "principal", "nfsv4", "gssname", "allgssname", "dirpath", + "minorversion", "nametimeo", "negnametimeo", "nocto", "noncontigwr", + "pnfs", "wcommitsize", NULL }; /* @@ -815,6 +815,12 @@ nfs_mount(struct mount *mp) } /* Handle the new style options. */ + if (vfs_getopt(mp->mnt_optnew, "noac", NULL, NULL) == 0) { + args.acdirmin = args.acdirmax = + args.acregmin = args.acregmax = 0; + args.flags |= NFSMNT_ACDIRMIN | NFSMNT_ACDIRMAX | + NFSMNT_ACREGMIN | NFSMNT_ACREGMAX; + } if (vfs_getopt(mp->mnt_optnew, "noconn", NULL, NULL) == 0) args.flags |= NFSMNT_NOCONN; if (vfs_getopt(mp->mnt_optnew, "conn", NULL, NULL) == 0) @@ -930,6 +936,18 @@ nfs_mount(struct mount *mp) } args.flags |= NFSMNT_RETRANS; } + if (vfs_getopt(mp->mnt_optnew, "actimeo", (void **)&opt, NULL) == 0) { + ret = sscanf(opt, "%d", &args.acregmin); + if (ret != 1 || args.acregmin < 0) { + vfs_mount_error(mp, "illegal actimeo: %s", + opt); + error = EINVAL; + goto out; + } + args.acdirmin = args.acdirmax = args.acregmax = args.acregmin; + args.flags |= NFSMNT_ACDIRMIN | NFSMNT_ACDIRMAX | + NFSMNT_ACREGMIN | NFSMNT_ACREGMAX; + } if (vfs_getopt(mp->mnt_optnew, "acregmin", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.acregmin); if (ret != 1 || args.acregmin < 0) { @@ -979,6 +997,16 @@ nfs_mount(struct mount *mp) } args.flags |= NFSMNT_WCOMMITSIZE; } + if (vfs_getopt(mp->mnt_optnew, "timeo", (void **)&opt, NULL) == 0) { + ret = sscanf(opt, "%d", &args.timeo); + if (ret != 1 || args.timeo <= 0) { + vfs_mount_error(mp, "illegal timeo: %s", + opt); + error = EINVAL; + goto out; + } + args.flags |= NFSMNT_TIMEO; + } if (vfs_getopt(mp->mnt_optnew, "timeout", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.timeo); if (ret != 1 || args.timeo <= 0) { From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 08:53:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E47A190E; Thu, 30 Oct 2014 08:53:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D06DAAA4; Thu, 30 Oct 2014 08:53:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9U8rwbr094879; Thu, 30 Oct 2014 08:53:58 GMT (envelope-from jch@FreeBSD.org) Received: (from jch@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9U8rvD0094873; Thu, 30 Oct 2014 08:53:57 GMT (envelope-from jch@FreeBSD.org) Message-Id: <201410300853.s9U8rvD0094873@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jch set sender to jch@FreeBSD.org using -f From: Julien Charbon Date: Thu, 30 Oct 2014 08:53:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273850 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 08:53:59 -0000 Author: jch Date: Thu Oct 30 08:53:56 2014 New Revision: 273850 URL: https://svnweb.freebsd.org/changeset/base/273850 Log: Fix a race condition in TCP timewait between tcp_tw_2msl_reuse() and tcp_tw_2msl_scan(). This race condition drives unplanned timewait timeout cancellation. Also simplify implementation by holding inpcb reference and removing tcptw reference counting. Differential Revision: https://reviews.freebsd.org/D826 Submitted by: Marc De la Gueronniere Submitted by: jch Reviewed By: jhb (mentor), adrian, rwatson Sponsored by: Verisign, Inc. MFC after: 2 weeks X-MFC-With: r264321 Modified: head/sys/netinet/tcp_timer.c head/sys/netinet/tcp_timer.h head/sys/netinet/tcp_timewait.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/tcp_var.h Modified: head/sys/netinet/tcp_timer.c ============================================================================== --- head/sys/netinet/tcp_timer.c Thu Oct 30 08:50:01 2014 (r273849) +++ head/sys/netinet/tcp_timer.c Thu Oct 30 08:53:56 2014 (r273850) @@ -243,7 +243,7 @@ tcp_slowtimo(void) VNET_LIST_RLOCK_NOSLEEP(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); - tcp_tw_2msl_scan(); + (void) tcp_tw_2msl_scan(0); CURVNET_RESTORE(); } VNET_LIST_RUNLOCK_NOSLEEP(); Modified: head/sys/netinet/tcp_timer.h ============================================================================== --- head/sys/netinet/tcp_timer.h Thu Oct 30 08:50:01 2014 (r273849) +++ head/sys/netinet/tcp_timer.h Thu Oct 30 08:53:56 2014 (r273850) @@ -178,8 +178,7 @@ extern int tcp_fast_finwait2_recycle; void tcp_timer_init(void); void tcp_timer_2msl(void *xtp); struct tcptw * - tcp_tw_2msl_reuse(void); /* XXX temporary? */ -void tcp_tw_2msl_scan(void); + tcp_tw_2msl_scan(int reuse); /* XXX temporary? */ void tcp_timer_keep(void *xtp); void tcp_timer_persist(void *xtp); void tcp_timer_rexmt(void *xtp); Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Thu Oct 30 08:50:01 2014 (r273849) +++ head/sys/netinet/tcp_timewait.c Thu Oct 30 08:53:56 2014 (r273850) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include @@ -101,6 +100,11 @@ static int maxtcptw; * currently in the TIME_WAIT state. The queue pointers, including the * queue pointers in each tcptw structure, are protected using the global * timewait lock, which must be held over queue iteration and modification. + * + * Rules on tcptw usage: + * - a inpcb is always freed _after_ its tcptw + * - a tcptw relies on its inpcb reference counting for memory stability + * - a tcptw is dereferenceable only while its inpcb is locked */ static VNET_DEFINE(TAILQ_HEAD(, tcptw), twq_2msl); #define V_twq_2msl VNET(twq_2msl) @@ -124,32 +128,6 @@ static void tcp_tw_2msl_reset(struct tcp static void tcp_tw_2msl_stop(struct tcptw *, int); static int tcp_twrespond(struct tcptw *, int); -/* - * tw_pcbref() bumps the reference count on an tw in order to maintain - * stability of an tw pointer despite the tw lock being released. - */ -static void -tw_pcbref(struct tcptw *tw) -{ - - KASSERT(tw->tw_refcount > 0, ("%s: refcount 0", __func__)); - refcount_acquire(&tw->tw_refcount); -} - -/* - * Drop a refcount on an tw elevated using tw_pcbref(). - */ -static int -tw_pcbrele(struct tcptw *tw) -{ - - KASSERT(tw->tw_refcount > 0, ("%s: refcount 0", __func__)); - if (!refcount_release(&tw->tw_refcount)) - return (0); - uma_zfree(V_tcptw_zone, tw); - return (1); -} - static int tcptw_auto_size(void) { @@ -279,8 +257,11 @@ tcp_twstart(struct tcpcb *tp) * Reached limit on total number of TIMEWAIT connections * allowed. Remove a connection from TIMEWAIT queue in LRU * fashion to make room for this connection. + * + * pcbinfo lock is needed here to prevent deadlock as + * two inpcb locks can be acquired simultaneously. */ - tw = tcp_tw_2msl_reuse(); + tw = tcp_tw_2msl_scan(1); if (tw == NULL) { tp = tcp_close(tp); if (tp != NULL) @@ -288,8 +269,12 @@ tcp_twstart(struct tcpcb *tp) return; } } + /* + * The tcptw will hold a reference on its inpcb until tcp_twclose + * is called + */ tw->tw_inpcb = inp; - refcount_init(&tw->tw_refcount, 1); + in_pcbref(inp); /* Reference from tw */ /* * Recover last window size sent. @@ -479,7 +464,6 @@ tcp_twclose(struct tcptw *tw, int reuse) INP_INFO_WLOCK_ASSERT(&V_tcbinfo); /* in_pcbfree() */ INP_WLOCK_ASSERT(inp); - tw->tw_inpcb = NULL; tcp_tw_2msl_stop(tw, reuse); inp->inp_ppcb = NULL; in_pcbdrop(inp); @@ -509,8 +493,13 @@ tcp_twclose(struct tcptw *tw, int reuse) */ INP_WUNLOCK(inp); } - } else + } else { + /* + * The socket has been already cleaned-up for us, only free the + * inpcb. + */ in_pcbfree(inp); + } TCPSTAT_INC(tcps_closed); } @@ -641,71 +630,94 @@ tcp_tw_2msl_reset(struct tcptw *tw, int static void tcp_tw_2msl_stop(struct tcptw *tw, int reuse) { + struct ucred *cred; + struct inpcb *inp; + int released; INP_INFO_WLOCK_ASSERT(&V_tcbinfo); TW_WLOCK(V_tw_lock); + inp = tw->tw_inpcb; + tw->tw_inpcb = NULL; + TAILQ_REMOVE(&V_twq_2msl, tw, tw_2msl); - crfree(tw->tw_cred); + cred = tw->tw_cred; tw->tw_cred = NULL; TW_WUNLOCK(V_tw_lock); + if (cred != NULL) + crfree(cred); + + released = in_pcbrele_wlocked(inp); + KASSERT(!released, ("%s: inp should not be released here", __func__)); + if (!reuse) - tw_pcbrele(tw); + uma_zfree(V_tcptw_zone, tw); } struct tcptw * -tcp_tw_2msl_reuse(void) +tcp_tw_2msl_scan(int reuse) { struct tcptw *tw; + struct inpcb *inp; - INP_INFO_WLOCK_ASSERT(&V_tcbinfo); - - TW_WLOCK(V_tw_lock); - tw = TAILQ_FIRST(&V_twq_2msl); - if (tw == NULL) { - TW_WUNLOCK(V_tw_lock); - return NULL; +#ifdef INVARIANTS + if (reuse) { + /* + * pcbinfo lock is needed in reuse case to prevent deadlock + * as two inpcb locks can be acquired simultaneously: + * - the inpcb transitioning to TIME_WAIT state in + * tcp_tw_start(), + * - the inpcb closed by tcp_twclose(). + */ + INP_INFO_WLOCK_ASSERT(&V_tcbinfo); } - TW_WUNLOCK(V_tw_lock); - - INP_WLOCK(tw->tw_inpcb); - tcp_twclose(tw, 1); - - return (tw); -} - -void -tcp_tw_2msl_scan(void) -{ - struct tcptw *tw; +#endif for (;;) { TW_RLOCK(V_tw_lock); tw = TAILQ_FIRST(&V_twq_2msl); - if (tw == NULL || tw->tw_time - ticks > 0) { + if (tw == NULL || (!reuse && (tw->tw_time - ticks) > 0)) { TW_RUNLOCK(V_tw_lock); break; } - tw_pcbref(tw); + KASSERT(tw->tw_inpcb != NULL, ("%s: tw->tw_inpcb == NULL", + __func__)); + + inp = tw->tw_inpcb; + in_pcbref(inp); TW_RUNLOCK(V_tw_lock); - /* Close timewait state */ if (INP_INFO_TRY_WLOCK(&V_tcbinfo)) { - if (tw_pcbrele(tw)) { + + INP_WLOCK(inp); + tw = intotw(inp); + if (in_pcbrele_wlocked(inp)) { + KASSERT(tw == NULL, ("%s: held last inp " + "reference but tw not NULL", __func__)); INP_INFO_WUNLOCK(&V_tcbinfo); continue; } - KASSERT(tw->tw_inpcb != NULL, - ("%s: tw->tw_inpcb == NULL", __func__)); - INP_WLOCK(tw->tw_inpcb); - tcp_twclose(tw, 0); + if (tw == NULL) { + /* tcp_twclose() has already been called */ + INP_WUNLOCK(inp); + INP_INFO_WUNLOCK(&V_tcbinfo); + continue; + } + + tcp_twclose(tw, reuse); INP_INFO_WUNLOCK(&V_tcbinfo); + if (reuse) + return tw; } else { - /* INP_INFO lock is busy; continue later. */ - tw_pcbrele(tw); + /* INP_INFO lock is busy, continue later. */ + INP_WLOCK(inp); + if (!in_pcbrele_wlocked(inp)) + INP_WUNLOCK(inp); break; } } + + return NULL; } Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Thu Oct 30 08:50:01 2014 (r273849) +++ head/sys/netinet/tcp_usrreq.c Thu Oct 30 08:53:56 2014 (r273850) @@ -183,6 +183,21 @@ tcp_detach(struct socket *so, struct inp * present until timewait ends. * * XXXRW: Would it be cleaner to free the tcptw here? + * + * Astute question indeed, from twtcp perspective there are + * three cases to consider: + * + * #1 tcp_detach is called at tcptw creation time by + * tcp_twstart, then do not discard the newly created tcptw + * and leave inpcb present until timewait ends + * #2 tcp_detach is called at timewait end (or reuse) by + * tcp_twclose, then the tcptw has already been discarded + * and inpcb is freed here + * #3 tcp_detach is called() after timewait ends (or reuse) + * (e.g. by soclose), then tcptw has already been discarded + * and inpcb is freed here + * + * In all three cases the tcptw should not be freed here. */ if (inp->inp_flags & INP_DROPPED) { KASSERT(tp == NULL, ("tcp_detach: INP_TIMEWAIT && " Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Thu Oct 30 08:50:01 2014 (r273849) +++ head/sys/netinet/tcp_var.h Thu Oct 30 08:53:56 2014 (r273850) @@ -358,7 +358,6 @@ struct tcptw { u_int t_starttime; int tw_time; TAILQ_ENTRY(tcptw) tw_2msl; - u_int tw_refcount; /* refcount */ }; #define intotcpcb(ip) ((struct tcpcb *)(ip)->inp_ppcb) @@ -651,7 +650,7 @@ struct tcpcb * tcp_close(struct tcpcb *); void tcp_discardcb(struct tcpcb *); void tcp_twstart(struct tcpcb *); -void tcp_twclose(struct tcptw *_tw, int _reuse); +void tcp_twclose(struct tcptw *, int); void tcp_ctlinput(int, struct sockaddr *, void *); int tcp_ctloutput(struct socket *, struct sockopt *); struct tcpcb * From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 09:06:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 62885CF4; Thu, 30 Oct 2014 09:06:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CED8BAB; Thu, 30 Oct 2014 09:06:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9U96r90001784; Thu, 30 Oct 2014 09:06:53 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9U96rfv001783; Thu, 30 Oct 2014 09:06:53 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410300906.s9U96rfv001783@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 30 Oct 2014 09:06:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273851 - head/sbin/mount_nfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 09:06:53 -0000 Author: trasz Date: Thu Oct 30 09:06:52 2014 New Revision: 273851 URL: https://svnweb.freebsd.org/changeset/base/273851 Log: Note that the "timeout" nfs option is in tenths of a second. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sbin/mount_nfs/mount_nfs.8 Modified: head/sbin/mount_nfs/mount_nfs.8 ============================================================================== --- head/sbin/mount_nfs/mount_nfs.8 Thu Oct 30 08:53:56 2014 (r273850) +++ head/sbin/mount_nfs/mount_nfs.8 Thu Oct 30 09:06:52 2014 (r273851) @@ -370,7 +370,8 @@ LAN and WAN configurations compared to U Some old NFS servers do not support this method; UDP mounts may be required for interoperability. .It Cm timeout Ns = Ns Aq Ar value -Set the initial retransmit timeout to the specified value. +Set the initial retransmit timeout to the specified value, +expressed in tenths of a second. May be useful for fine tuning UDP mounts over internetworks with high packet loss rates or an overloaded server. Try increasing the interval if From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 09:25:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E971C213; Thu, 30 Oct 2014 09:25:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5A1ED8E; Thu, 30 Oct 2014 09:25:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9U9P34w012733; Thu, 30 Oct 2014 09:25:03 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9U9P32v012732; Thu, 30 Oct 2014 09:25:03 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410300925.s9U9P32v012732@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 30 Oct 2014 09:25:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273852 - head/sys/fs/nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 09:25:04 -0000 Author: trasz Date: Thu Oct 30 09:25:03 2014 New Revision: 273852 URL: https://svnweb.freebsd.org/changeset/base/273852 Log: Fix handling of "conn" mount_nfs(8) option. Reviewed by: rmacklem@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/nfsclient/nfs_clvfsops.c Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Thu Oct 30 09:06:52 2014 (r273851) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Thu Oct 30 09:25:03 2014 (r273852) @@ -824,7 +824,7 @@ nfs_mount(struct mount *mp) if (vfs_getopt(mp->mnt_optnew, "noconn", NULL, NULL) == 0) args.flags |= NFSMNT_NOCONN; if (vfs_getopt(mp->mnt_optnew, "conn", NULL, NULL) == 0) - args.flags |= NFSMNT_NOCONN; + args.flags &= ~NFSMNT_NOCONN; if (vfs_getopt(mp->mnt_optnew, "nolockd", NULL, NULL) == 0) args.flags |= NFSMNT_NOLOCKD; if (vfs_getopt(mp->mnt_optnew, "lockd", NULL, NULL) == 0) From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 10:30:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A5BBB413; Thu, 30 Oct 2014 10:30:11 +0000 (UTC) Received: from mail-lb0-x230.google.com (mail-lb0-x230.google.com [IPv6:2a00:1450:4010:c04::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C4871650; Thu, 30 Oct 2014 10:30:10 +0000 (UTC) Received: by mail-lb0-f176.google.com with SMTP id z11so2085515lbi.35 for ; Thu, 30 Oct 2014 03:30:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=6nqHwn2cID5jXY7kvram0Q2WrNCKZY/7CXkutnn41Lo=; b=GVFTK4As/Q3KVkUHBe7LNvGpX2cEAqxwvNqMCVUeTYkKx/TR2jSWHG75tsAebM24D7 IimQXEp6wVs28QgJqE7ho0rn9O37+JDfdVQKmzXR2pMSAZUX8Y2+bzQ0IDy+JT2XNknD ZbJFl1vsVTafR7876c3jAbh9490NnOB5jAC11GHR9zlwWESI/qy8n/xXHtGhsemuaBf6 JJO7qxTwcMAL2YFgyDJvy2oi/85FUTJWOwTNtZuXF0KrscjPDrxWW/j1eJnfrvgpkwVi YRNa2agVLWgivD5N/dlViWSfXgtWNnYADbS8ueH+PAxR0Wh+Qt/R8dxZq+vjueL4JN3i 5J4Q== X-Received: by 10.152.20.72 with SMTP id l8mr17963355lae.43.1414665008596; Thu, 30 Oct 2014 03:30:08 -0700 (PDT) Received: from brick.home (adgb135.neoplus.adsl.tpnet.pl. [79.184.131.135]) by mx.google.com with ESMTPSA id w10sm3039070lae.24.2014.10.30.03.30.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Oct 2014 03:30:07 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Thu, 30 Oct 2014 11:30:04 +0100 From: Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r273806 - in head/contrib/ofed: libcxgb4 libcxgb4/src usr.lib usr.lib/libcxgb4 Message-ID: <20141030103004.GA2687@brick.home> Mail-Followup-To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201410290115.s9T1FnTv094112@svn.freebsd.org> <20141029095604.GA81110@brick.home> <20141029182354.GA8965@ox> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20141029182354.GA8965@ox> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 10:30:11 -0000 On 1029T1123, Navdeep Parhar wrote: > On Wed, Oct 29, 2014 at 10:56:04AM +0100, Edward Tomasz NapieraÅ‚a wrote: > > On 1029T0115, Navdeep Parhar wrote: > > > Author: np > > > Date: Wed Oct 29 01:15:48 2014 > > > New Revision: 273806 > > > URL: https://svnweb.freebsd.org/changeset/base/273806 > > > > > > Log: > > > Userspace library for Chelsio's Terminator 5 based iWARP RNICs (pretty > > > much every T5 card that does _not_ have "-SO" in its name is RDMA > > > capable). > > > > Yay! This means we could add iSER without using the ICL_PROXY hack. > > Well, assuming it's possible to "hand off" RDMA connection from userspace > > to the kernel. Is it? > > Yes, this should be doable. The connection is just another TCP endpoint > tracked like all others in the kernel. :-) > By the way, iSER is an unnecessary layer if you're using a T5 NIC. > It'll work, sure, but you'll run iSER/RDMA/TOE when you could simply run > iSCSI/TOE with full zero copy everywhere. Comes out to the same result > with a much simpler stack. I think iSER makes sense for gear that does > RDMA but not iSCSI natively. True. IMHO the biggest difference is that iWARP is universal, ie. the NIC doesn't need to have any iSCSI-specific functionality. On the other hand, iSER cannot talk to non-iSER, while iSCSI offload in your NICs talks ordinary iSCSI on the wire. From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 10:49:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 58B21803; Thu, 30 Oct 2014 10:49:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39B39862; Thu, 30 Oct 2014 10:49:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9UAnrUe051084; Thu, 30 Oct 2014 10:49:53 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9UAnpkK051071; Thu, 30 Oct 2014 10:49:51 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410301049.s9UAnpkK051071@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 30 Oct 2014 10:49:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273853 - head/lib/libc/posix1e X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 10:49:53 -0000 Author: trasz Date: Thu Oct 30 10:49:50 2014 New Revision: 273853 URL: https://svnweb.freebsd.org/changeset/base/273853 Log: Make it clear that ACL flags are NFSv4-only. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/lib/libc/posix1e/acl_add_flag_np.3 head/lib/libc/posix1e/acl_clear_flags_np.3 head/lib/libc/posix1e/acl_delete_flag_np.3 head/lib/libc/posix1e/acl_get_flag_np.3 head/lib/libc/posix1e/acl_get_flagset_np.3 head/lib/libc/posix1e/acl_set_entry_type_np.3 head/lib/libc/posix1e/acl_set_flagset_np.3 Modified: head/lib/libc/posix1e/acl_add_flag_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_add_flag_np.3 Thu Oct 30 09:25:03 2014 (r273852) +++ head/lib/libc/posix1e/acl_add_flag_np.3 Thu Oct 30 10:49:50 2014 (r273853) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 25, 2009 +.Dd October 30, 2014 .Dt ACL_ADD_FLAG_NP 3 .Os .Sh NAME @@ -42,7 +42,7 @@ The .Fn acl_add_flag_np function -is a non-portable call that adds the flags contained in +is a non-portable call that adds the NFSv4 ACL flags contained in .Fa flags to the flagset .Fa flagset_d . Modified: head/lib/libc/posix1e/acl_clear_flags_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_clear_flags_np.3 Thu Oct 30 09:25:03 2014 (r273852) +++ head/lib/libc/posix1e/acl_clear_flags_np.3 Thu Oct 30 10:49:50 2014 (r273853) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 25, 2009 +.Dd October 30, 2014 .Dt ACL_CLEAR_FLAGS_NP 3 .Os .Sh NAME @@ -42,7 +42,7 @@ The .Fn acl_clear_flags_np function -is a non-portable call that clears all flags from flagset +is a non-portable call that clears all NFSv4 ACL flags from flagset .Fa flagset_d . .Sh RETURN VALUES .Rv -std acl_clear_flags_np Modified: head/lib/libc/posix1e/acl_delete_flag_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_delete_flag_np.3 Thu Oct 30 09:25:03 2014 (r273852) +++ head/lib/libc/posix1e/acl_delete_flag_np.3 Thu Oct 30 10:49:50 2014 (r273853) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 10, 2001 +.Dd October 30, 2014 .Dt ACL_DELETE_FLAG_NP 3 .Os .Sh NAME @@ -42,7 +42,7 @@ The .Fn acl_delete_flag_np function -is a non-portable call that removes specific flags from flagset +is a non-portable call that removes specific NFSv4 ACL flags from flagset .Fa flags . .Sh RETURN VALUES .Rv -std acl_delete_flag_np Modified: head/lib/libc/posix1e/acl_get_flag_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_get_flag_np.3 Thu Oct 30 09:25:03 2014 (r273852) +++ head/lib/libc/posix1e/acl_get_flag_np.3 Thu Oct 30 10:49:50 2014 (r273853) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 25, 2009 +.Dd October 30, 2014 .Dt ACL_GET_FLAG_NP 3 .Os .Sh NAME @@ -42,7 +42,7 @@ The .Fn acl_get_flag_np function -is a non-portable function that checks if a flag is set in +is a non-portable function that checks if a NFSv4 ACL flag is set in a flagset. .Sh RETURN VALUES If the flag in Modified: head/lib/libc/posix1e/acl_get_flagset_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_get_flagset_np.3 Thu Oct 30 09:25:03 2014 (r273852) +++ head/lib/libc/posix1e/acl_get_flagset_np.3 Thu Oct 30 10:49:50 2014 (r273853) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 25, 2009 +.Dd October 30, 2014 .Dt ACL_GET_FLAGSET_NP 3 .Os .Sh NAME @@ -44,7 +44,7 @@ The function is a non-portable call that returns via .Fa flagset_np_p -a descriptor to the flagset in the ACL entry +a descriptor to the flagset in the NFSv4 ACL entry .Fa entry_d . Subsequent operations using the returned flagset operate on the flagset within the ACL entry. Modified: head/lib/libc/posix1e/acl_set_entry_type_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_set_entry_type_np.3 Thu Oct 30 09:25:03 2014 (r273852) +++ head/lib/libc/posix1e/acl_set_entry_type_np.3 Thu Oct 30 10:49:50 2014 (r273853) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 25, 2009 +.Dd October 30, 2014 .Dt ACL_SET_ENTRY_TYPE_NP 3 .Os .Sh NAME @@ -42,7 +42,7 @@ The .Fn acl_set_entry_type_np function -is a non-portable call that sets the type of the ACL entry +is a non-portable call that sets the type of the NFSv4 ACL entry .Fa entry_d to the value referred to by .Fa entry_type . Modified: head/lib/libc/posix1e/acl_set_flagset_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_set_flagset_np.3 Thu Oct 30 09:25:03 2014 (r273852) +++ head/lib/libc/posix1e/acl_set_flagset_np.3 Thu Oct 30 10:49:50 2014 (r273853) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 25, 2009 +.Dd October 30, 2014 .Dt ACL_SET_FLAGSET_NP 3 .Os .Sh NAME @@ -42,7 +42,7 @@ The .Fn acl_set_flagset_np function -is a non-portable call that sets the flags of ACL entry +is a non-portable call that sets the flags of NFSv4 ACL entry .Fa entry_d with the flags contained in .Fa flagset_d . From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 10:56:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 253C79D2; Thu, 30 Oct 2014 10:56:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBB4193C; Thu, 30 Oct 2014 10:56:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9UAucno055396; Thu, 30 Oct 2014 10:56:38 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9UAucZ7055395; Thu, 30 Oct 2014 10:56:38 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410301056.s9UAucZ7055395@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 30 Oct 2014 10:56:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273854 - head/lib/libc/posix1e X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 10:56:39 -0000 Author: trasz Date: Thu Oct 30 10:56:38 2014 New Revision: 273854 URL: https://svnweb.freebsd.org/changeset/base/273854 Log: Update acl(3) to expand on NFSv4 ACL support. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/lib/libc/posix1e/acl.3 Modified: head/lib/libc/posix1e/acl.3 ============================================================================== --- head/lib/libc/posix1e/acl.3 Thu Oct 30 10:49:50 2014 (r273853) +++ head/lib/libc/posix1e/acl.3 Thu Oct 30 10:56:38 2014 (r273854) @@ -27,12 +27,12 @@ .\" .\" $FreeBSD$ .\" -.Dd November 12, 2013 +.Dd October 30, 2014 .Dt ACL 3 .Os .Sh NAME .Nm acl -.Nd introduction to the POSIX.1e ACL security API +.Nd introduction to the POSIX.1e/NFSv4 ACL security API .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -42,13 +42,15 @@ .Fx permits file systems to export Access Control Lists via the VFS, and provides a library for userland access to and manipulation of these ACLs. -Not all file systems provide support for ACLs, and some may require that +.Fx +supports POSIX.1e and NFSv4 ACLs, but +not all file systems provide support for ACLs, and some may require that ACL support be explicitly enabled by the administrator. The library calls include routines to allocate, duplicate, retrieve, set, and validate ACLs associated with file objects. As well as the POSIX.1e routines, there are a number of non-portable -extensions defined that allow for alternative ACL semantics than the -POSIX.1e semantics, such as NFSv4, AFS, NTFS, Coda, and NWFS semantics. +extensions defined that allow for ACL semantics alternative to +POSIX.1e, such as NFSv4. Where routines are non-standard, they are suffixed with _np to indicate that they are not portable. .Pp @@ -292,6 +294,8 @@ POSIX.1e support was introduced in .Fx 5.0 was the first version to include a complete ACL implementation based on extended attributes for the UFS and UFS2 file systems. +NFSv4 ACL support was introduced in +.Fx 8.0 . .Pp The .Xr getfacl 1 From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 10:59:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AE833B3A; Thu, 30 Oct 2014 10:59:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B0DD956; Thu, 30 Oct 2014 10:59:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9UAxwTi055813; Thu, 30 Oct 2014 10:59:58 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9UAxwAg055812; Thu, 30 Oct 2014 10:59:58 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410301059.s9UAxwAg055812@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 30 Oct 2014 10:59:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273855 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 10:59:58 -0000 Author: ae Date: Thu Oct 30 10:59:57 2014 New Revision: 273855 URL: https://svnweb.freebsd.org/changeset/base/273855 Log: Fix mbuf leak in IPv6 multicast code. When multicast capable interface goes away, it leaves multicast groups, this leads to generate MLD reports, but MLD code does deffered send and MLD reports are queued in the in6_multi's in6m_scq ifq. The problem is that in6_multi structures are freed when interface leaves multicast groups and thread that does deffered send will not take these queued packets. PR: 194577 MFC after: 1 week Sponsored by: Yandex LLC Modified: head/sys/netinet6/in6_mcast.c Modified: head/sys/netinet6/in6_mcast.c ============================================================================== --- head/sys/netinet6/in6_mcast.c Thu Oct 30 10:56:38 2014 (r273854) +++ head/sys/netinet6/in6_mcast.c Thu Oct 30 10:59:57 2014 (r273855) @@ -526,6 +526,9 @@ in6m_release_locked(struct in6_multi *in in6m_purge(inm); + /* Free state-change requests that might be queued. */ + _IF_DRAIN(&inm->in6m_scq); + free(inm, M_IP6MADDR); if_delmulti_ifma(ifma); From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 11:27:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 836E1296; Thu, 30 Oct 2014 11:27:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 64DBEC40; Thu, 30 Oct 2014 11:27:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9UBR4Ke069566; Thu, 30 Oct 2014 11:27:04 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9UBR3Rn069564; Thu, 30 Oct 2014 11:27:03 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201410301127.s9UBR3Rn069564@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Thu, 30 Oct 2014 11:27:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273856 - head/sys/dev/agp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 11:27:04 -0000 Author: tijl Date: Thu Oct 30 11:27:03 2014 New Revision: 273856 URL: https://svnweb.freebsd.org/changeset/base/273856 Log: Add two new functions to the AGP driver KPI to bind/unbind arbitrary sets of pages into the GTT. Reviewed by: kib MFC after: 1 month Modified: head/sys/dev/agp/agp.c head/sys/dev/agp/agpvar.h Modified: head/sys/dev/agp/agp.c ============================================================================== --- head/sys/dev/agp/agp.c Thu Oct 30 10:59:57 2014 (r273855) +++ head/sys/dev/agp/agp.c Thu Oct 30 11:27:03 2014 (r273856) @@ -996,3 +996,76 @@ void agp_memory_info(device_t dev, void mi->ami_offset = mem->am_offset; mi->ami_is_bound = mem->am_is_bound; } + +int +agp_bind_pages(device_t dev, vm_page_t *pages, vm_size_t size, + vm_offset_t offset) +{ + struct agp_softc *sc; + vm_offset_t i, j, k, pa; + vm_page_t m; + int error; + + if ((size & (AGP_PAGE_SIZE - 1)) != 0 || + (offset & (AGP_PAGE_SIZE - 1)) != 0) + return (EINVAL); + + sc = device_get_softc(dev); + + mtx_lock(&sc->as_lock); + for (i = 0; i < size; i += PAGE_SIZE) { + m = pages[OFF_TO_IDX(i)]; + + /* + * Install entries in the GATT, making sure that if + * AGP_PAGE_SIZE < PAGE_SIZE and size is not + * aligned to PAGE_SIZE, we don't modify too many GATT + * entries. + */ + for (j = 0; j < PAGE_SIZE && i + j < size; j += AGP_PAGE_SIZE) { + pa = VM_PAGE_TO_PHYS(m) + j; + AGP_DPF("binding offset %#jx to pa %#jx\n", + (uintmax_t)offset + i + j, (uintmax_t)pa); + error = AGP_BIND_PAGE(dev, offset + i + j, pa); + if (error) { + /* + * Bail out. Reverse all the mappings. + */ + for (k = 0; k < i + j; k += AGP_PAGE_SIZE) + AGP_UNBIND_PAGE(dev, offset + k); + + mtx_unlock(&sc->as_lock); + return (error); + } + } + } + + agp_flush_cache(); + AGP_FLUSH_TLB(dev); + + mtx_unlock(&sc->as_lock); + return (0); +} + +int +agp_unbind_pages(device_t dev, vm_size_t size, vm_offset_t offset) +{ + struct agp_softc *sc; + vm_offset_t i; + + if ((size & (AGP_PAGE_SIZE - 1)) != 0 || + (offset & (AGP_PAGE_SIZE - 1)) != 0) + return (EINVAL); + + sc = device_get_softc(dev); + + mtx_lock(&sc->as_lock); + for (i = 0; i < size; i += AGP_PAGE_SIZE) + AGP_UNBIND_PAGE(dev, offset + i); + + agp_flush_cache(); + AGP_FLUSH_TLB(dev); + + mtx_unlock(&sc->as_lock); + return (0); +} Modified: head/sys/dev/agp/agpvar.h ============================================================================== --- head/sys/dev/agp/agpvar.h Thu Oct 30 10:59:57 2014 (r273855) +++ head/sys/dev/agp/agpvar.h Thu Oct 30 11:27:03 2014 (r273856) @@ -122,6 +122,19 @@ int agp_unbind_memory(device_t dev, void */ void agp_memory_info(device_t dev, void *handle, struct agp_memory_info *mi); +/* + * Bind a set of pages at a given offset within the AGP aperture. + * Returns EINVAL if the given size or offset is not at an AGP page boundary. + */ +int agp_bind_pages(device_t dev, vm_page_t *pages, vm_size_t size, + vm_offset_t offset); + +/* + * Unbind a set of pages from the AGP aperture. + * Returns EINVAL if the given size or offset is not at an AGP page boundary. + */ +int agp_unbind_pages(device_t dev, vm_size_t size, vm_offset_t offset); + #define AGP_NORMAL_MEMORY 0 #define AGP_USER_TYPES (1 << 16) From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 11:34:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C996F481; Thu, 30 Oct 2014 11:34:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6349D22; Thu, 30 Oct 2014 11:34:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9UBY81i073849; Thu, 30 Oct 2014 11:34:08 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9UBY8LY073848; Thu, 30 Oct 2014 11:34:08 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410301134.s9UBY8LY073848@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 30 Oct 2014 11:34:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273857 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 11:34:08 -0000 Author: ae Date: Thu Oct 30 11:34:07 2014 New Revision: 273857 URL: https://svnweb.freebsd.org/changeset/base/273857 Log: Move ifq drain into in6m_purge(). Suggested by: bms MFC after: 1 week Sponsored by: Yandex LLC Modified: head/sys/netinet6/in6_mcast.c Modified: head/sys/netinet6/in6_mcast.c ============================================================================== --- head/sys/netinet6/in6_mcast.c Thu Oct 30 11:27:03 2014 (r273856) +++ head/sys/netinet6/in6_mcast.c Thu Oct 30 11:34:07 2014 (r273857) @@ -526,9 +526,6 @@ in6m_release_locked(struct in6_multi *in in6m_purge(inm); - /* Free state-change requests that might be queued. */ - _IF_DRAIN(&inm->in6m_scq); - free(inm, M_IP6MADDR); if_delmulti_ifma(ifma); @@ -1076,6 +1073,8 @@ in6m_purge(struct in6_multi *inm) free(ims, M_IP6MSOURCE); inm->in6m_nsrc--; } + /* Free state-change requests that might be queued. */ + _IF_DRAIN(&inm->in6m_scq); } /* From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 11:34:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 814715C2 for ; Thu, 30 Oct 2014 11:34:30 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D1F5D29 for ; Thu, 30 Oct 2014 11:34:30 +0000 (UTC) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 64815207BC for ; Thu, 30 Oct 2014 07:34:29 -0400 (EDT) Received: from web6 ([10.202.2.216]) by compute6.internal (MEProxy); Thu, 30 Oct 2014 07:34:29 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.net; h= message-id:x-sasl-enc:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=mesmtp; bh=4mb//SXTalTR6gapDaNTy3invFo=; b=PM6z 2vjlcvnGDdsV2rbQk0il56LRhFVYVsZIQoNAKsR6TULSReAg8Cw0VDlpYUxGqOXj SmouV8cs42qPYrhmgZKnJ+1PTKMHdcHMqay6+XBiDf/XTYJHGxG41/OoI49BCQYl nM7Bb77U4CT+VYxuPFdnB7r+XxaGG56fplbyWOs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:x-sasl-enc:from:to :mime-version:content-transfer-encoding:content-type:in-reply-to :references:subject:date; s=smtpout; bh=4mb//SXTalTR6gapDaNTy3in vFo=; b=oavS6+VeDdacSqhFMXssz1tVFMUSlPSify2+dnCEmmDlM2Ghg1aGsBrl WngJuMa9XEM75h+l6K20Hxi6TVzxcKpC0MQ8wgA3L/JR2Ln9G/DOrdGz/nVHS/3f MNikkzN4v7FNZUhHeH4mwBprWbPYWT6WACy5huNh02yHyCH9f/0= Received: by web6.nyi.internal (Postfix, from userid 99) id 3A62B59472; Thu, 30 Oct 2014 07:34:29 -0400 (EDT) Message-Id: <1414668869.979804.185070381.0D4C866C@webmail.messagingengine.com> X-Sasl-Enc: ZcL4GH+JsAMCish7GYR5qss3M3f4+c0xtrjG4kqeQCO5 1414668869 From: Bruce Simpson To: "Andrey V. Elsukov" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-c51dec4f In-Reply-To: <201410301059.s9UAxwAg055812@svn.freebsd.org> References: <201410301059.s9UAxwAg055812@svn.freebsd.org> Subject: Re: svn commit: r273855 - head/sys/netinet6 Date: Thu, 30 Oct 2014 11:34:29 +0000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 11:34:30 -0000 Hello, This is a really inconvenient time for me (I am up against a deadline) but I am not 100% comfortable with this change. On Thu, 30 Oct 2014, at 10:59, Andrey V. Elsukov wrote: > Log: > Fix mbuf leak in IPv6 multicast code. > When multicast capable interface goes away, it leaves multicast groups, > this leads to generate MLD reports, but MLD code does deffered send and > MLD reports are queued in the in6_multi's in6m_scq ifq. The problem is > that in6_multi structures are freed when interface leaves multicast > groups > and thread that does deffered send will not take these queued packets. A few comments: 1) Stylistic -- a change of this kind should probably be part of inm_purge() itself because it modifies state which is private to the group membership. 2) Logical -- The patch forces pending (queued) state change record fragments to be freed when the parent interface is taken down. Unfortunately, those are pending for a reason; there has been a state change, and MLD needs to communicate it upstream to on-link routers (and snooping switches). So - there is a risk with this approach that upstream MLD listener (e.g. router, switch) will be inconsistent, at least until the next General Query. A better approach might be to force an INCLUDE {} to be sent for the group (there are other parts of the code which try to do this for similar events), but if the parent interface has already been taken down, all bets are off. As of writing - The FreeBSD networking stack doesn't provide any hints either way about the nature of the teardown. Perhaps need to be a distinction between use cases where a hasty teardown is unlikely to have operational impact (e.g. an ephemeral VPN session between two nodes which is point-to-point in nature, and not generally used for forwarding traffic), and cases where it may impact other users (e.g. an MLD membership residing on a wireless interface, which might result in unwanted multicast traffic being relayed to an 802.11 ESS). -- BMS (sent via webmail) From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 12:44:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5BF6D321; Thu, 30 Oct 2014 12:44:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D19F6DD; Thu, 30 Oct 2014 12:44:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9UCilKG008811; Thu, 30 Oct 2014 12:44:47 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9UCiljl008810; Thu, 30 Oct 2014 12:44:47 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410301244.s9UCiljl008810@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 30 Oct 2014 12:44:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273858 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 12:44:47 -0000 Author: ae Date: Thu Oct 30 12:44:46 2014 New Revision: 273858 URL: https://svnweb.freebsd.org/changeset/base/273858 Log: Remove redundant code. if_detach already did these steps. Also, now we didn't keep routes to link-local addresses. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/netinet6/in6_ifattach.c Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Thu Oct 30 11:34:07 2014 (r273857) +++ head/sys/netinet6/in6_ifattach.c Thu Oct 30 12:44:46 2014 (r273858) @@ -775,12 +775,7 @@ in6_ifattach(struct ifnet *ifp, struct i void in6_ifdetach(struct ifnet *ifp) { - struct in6_ifaddr *ia; struct ifaddr *ifa, *next; - struct radix_node_head *rnh; - struct rtentry *rt; - struct sockaddr_in6 sin6; - struct in6_multi_mship *imm; if (ifp->if_afdata[AF_INET6] == NULL) return; @@ -788,46 +783,15 @@ in6_ifdetach(struct ifnet *ifp) /* remove neighbor management table */ nd6_purge(ifp); - /* nuke any of IPv6 addresses we have */ + /* + * nuke any of IPv6 addresses we have + * XXX: all addresses should be already removed + */ TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; in6_purgeaddr(ifa); } - - /* undo everything done by in6_ifattach(), just in case */ - TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { - if (ifa->ifa_addr->sa_family != AF_INET6 - || !IN6_IS_ADDR_LINKLOCAL(&satosin6(&ifa->ifa_addr)->sin6_addr)) { - continue; - } - - ia = (struct in6_ifaddr *)ifa; - - /* - * leave from multicast groups we have joined for the interface - */ - while ((imm = LIST_FIRST(&ia->ia6_memberships)) != NULL) { - LIST_REMOVE(imm, i6mm_chain); - in6_leavegroup(imm); - } - - /* Remove link-local from the routing table. */ - if (ia->ia_flags & IFA_ROUTE) - (void)rtinit(&ia->ia_ifa, RTM_DELETE, ia->ia_flags); - - /* remove from the linked list */ - IF_ADDR_WLOCK(ifp); - TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_WUNLOCK(ifp); - ifa_free(ifa); /* if_addrhead */ - - IN6_IFADDR_WLOCK(); - TAILQ_REMOVE(&V_in6_ifaddrhead, ia, ia_link); - IN6_IFADDR_WUNLOCK(); - ifa_free(ifa); - } - in6_pcbpurgeif0(&V_udbinfo, ifp); in6_pcbpurgeif0(&V_ulitecbinfo, ifp); in6_pcbpurgeif0(&V_ripcbinfo, ifp); @@ -843,31 +807,6 @@ in6_ifdetach(struct ifnet *ifp) * (Or can we just delay calling nd6_purge until at this point?) */ nd6_purge(ifp); - - /* - * Remove route to link-local allnodes multicast (ff02::1). - * These only get automatically installed for the default FIB. - */ - bzero(&sin6, sizeof(sin6)); - sin6.sin6_len = sizeof(struct sockaddr_in6); - sin6.sin6_family = AF_INET6; - sin6.sin6_addr = in6addr_linklocal_allnodes; - if (in6_setscope(&sin6.sin6_addr, ifp, NULL)) - /* XXX: should not fail */ - return; - /* XXX grab lock first to avoid LOR */ - rnh = rt_tables_get_rnh(RT_DEFAULT_FIB, AF_INET6); - if (rnh != NULL) { - RADIX_NODE_HEAD_LOCK(rnh); - rt = in6_rtalloc1((struct sockaddr *)&sin6, 0, RTF_RNH_LOCKED, - RT_DEFAULT_FIB); - if (rt) { - if (rt->rt_ifp == ifp) - rt_expunge(rnh, rt); - RTFREE_LOCKED(rt); - } - RADIX_NODE_HEAD_UNLOCK(rnh); - } } int From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 14:05:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B344E70C; Thu, 30 Oct 2014 14:05:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F990ECB; Thu, 30 Oct 2014 14:05:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9UE5ng2046897; Thu, 30 Oct 2014 14:05:49 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9UE5nUO046896; Thu, 30 Oct 2014 14:05:49 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410301405.s9UE5nUO046896@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 30 Oct 2014 14:05:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273861 - head/sbin/mount_nfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 14:05:49 -0000 Author: trasz Date: Thu Oct 30 14:05:48 2014 New Revision: 273861 URL: https://svnweb.freebsd.org/changeset/base/273861 Log: Remove two functions unused after r273848. Would be nice if clang or at least scan-build yelled about it. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sbin/mount_nfs/mount_nfs.c Modified: head/sbin/mount_nfs/mount_nfs.c ============================================================================== --- head/sbin/mount_nfs/mount_nfs.c Thu Oct 30 13:59:28 2014 (r273860) +++ head/sbin/mount_nfs/mount_nfs.c Thu Oct 30 14:05:48 2014 (r273861) @@ -477,35 +477,6 @@ main(int argc, char *argv[]) } static int -findopt(struct iovec *iov, int iovlen, const char *name, - char **valuep, int *lenp) -{ - int i; - - for (i = 0; i < iovlen/2; i++, iov += 2) { - if (strcmp(name, iov[0].iov_base) == 0) { - if (valuep) - *valuep = iov[1].iov_base; - if (lenp) - *lenp = iov[1].iov_len; - return (0); - } - } - return (ENOENT); -} - -static void -copyopt(struct iovec **newiov, int *newiovlen, - struct iovec *iov, int iovlen, const char *name) -{ - char *value; - int len; - - if (findopt(iov, iovlen, name, &value, &len) == 0) - build_iovec(newiov, newiovlen, name, value, len); -} - -static int sec_name_to_num(char *sec) { if (!strcmp(sec, "krb5")) From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 14:26:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 23FADCB7; Thu, 30 Oct 2014 14:26:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05320135; Thu, 30 Oct 2014 14:26:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9UEQcu1056782; Thu, 30 Oct 2014 14:26:38 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9UEQbKE056775; Thu, 30 Oct 2014 14:26:37 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201410301426.s9UEQbKE056775@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Thu, 30 Oct 2014 14:26:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273862 - in head/sys/dev/drm2: . radeon ttm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 14:26:39 -0000 Author: tijl Date: Thu Oct 30 14:26:36 2014 New Revision: 273862 URL: https://svnweb.freebsd.org/changeset/base/273862 Log: Port the TTM AGP backend to the FreeBSD agp driver and enable AGP support in the radeonkms driver. Note: In PCI mode virtual addresses on the graphics card that map to system RAM are translated to physical addresses by the graphics card itself. In AGP mode address translation is done by the AGP chipset so fictitious addresses appear on the system bus. For the CPU cache management to work correctly when the CPU accesses this memory it needs to use the same fictitious addresses (and let the chipset translate them) instead of using the physical addresses directly. Reviewed by: kib MFC after: 1 month Modified: head/sys/dev/drm2/drm_agpsupport.c head/sys/dev/drm2/radeon/radeon.h head/sys/dev/drm2/radeon/radeon_device.c head/sys/dev/drm2/radeon/radeon_ttm.c head/sys/dev/drm2/ttm/ttm_agp_backend.c head/sys/dev/drm2/ttm/ttm_bo_driver.h head/sys/dev/drm2/ttm/ttm_page_alloc.c Modified: head/sys/dev/drm2/drm_agpsupport.c ============================================================================== --- head/sys/dev/drm2/drm_agpsupport.c Thu Oct 30 14:05:48 2014 (r273861) +++ head/sys/dev/drm2/drm_agpsupport.c Thu Oct 30 14:26:36 2014 (r273862) @@ -396,7 +396,7 @@ void *drm_agp_allocate_memory(size_t pag if (!agpdev) return NULL; - return agp_alloc_memory(agpdev, type, pages << AGP_PAGE_SHIFT); + return agp_alloc_memory(agpdev, type, pages << PAGE_SHIFT); } int drm_agp_free_memory(void *handle) Modified: head/sys/dev/drm2/radeon/radeon.h ============================================================================== --- head/sys/dev/drm2/radeon/radeon.h Thu Oct 30 14:05:48 2014 (r273861) +++ head/sys/dev/drm2/radeon/radeon.h Thu Oct 30 14:26:36 2014 (r273862) @@ -1618,6 +1618,7 @@ struct radeon_device { bool need_dma32; bool accel_working; bool fictitious_range_registered; + bool fictitious_agp_range_registered; struct radeon_surface_reg surface_regs[RADEON_GEM_MAX_SURFACES]; const struct firmware *me_fw; /* all family ME firmware */ const struct firmware *pfp_fw; /* r6/700 PFP firmware */ Modified: head/sys/dev/drm2/radeon/radeon_device.c ============================================================================== --- head/sys/dev/drm2/radeon/radeon_device.c Thu Oct 30 14:05:48 2014 (r273861) +++ head/sys/dev/drm2/radeon/radeon_device.c Thu Oct 30 14:26:36 2014 (r273862) @@ -1014,6 +1014,7 @@ int radeon_device_init(struct radeon_dev rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024; rdev->accel_working = false; rdev->fictitious_range_registered = false; + rdev->fictitious_agp_range_registered = false; /* set up ring ids */ for (i = 0; i < RADEON_NUM_RINGS; i++) { rdev->ring[i].idx = i; @@ -1168,6 +1169,24 @@ int radeon_device_init(struct radeon_dev return (-r); } rdev->fictitious_range_registered = true; +#if __OS_HAS_AGP + if (rdev->flags & RADEON_IS_AGP) { + DRM_INFO("%s: Taking over the fictitious range 0x%jx-0x%jx\n", + __func__, (uintmax_t)rdev->mc.agp_base, + (uintmax_t)rdev->mc.agp_base + rdev->mc.gtt_size); + r = vm_phys_fictitious_reg_range( + rdev->mc.agp_base, + rdev->mc.agp_base + rdev->mc.gtt_size, + VM_MEMATTR_WRITE_COMBINING); + if (r != 0) { + DRM_ERROR("Failed to register fictitious range " + "0x%jx-0x%jx (%d).\n", (uintmax_t)rdev->mc.agp_base, + (uintmax_t)rdev->mc.agp_base + rdev->mc.gtt_size, r); + return (-r); + } + rdev->fictitious_agp_range_registered = true; + } +#endif if ((radeon_testing & 1)) { radeon_test_moves(rdev); @@ -1205,6 +1224,13 @@ void radeon_device_fini(struct radeon_de rdev->mc.aper_base, rdev->mc.aper_base + rdev->mc.visible_vram_size); } +#if __OS_HAS_AGP + if (rdev->fictitious_agp_range_registered) { + vm_phys_fictitious_unreg_range( + rdev->mc.agp_base, + rdev->mc.agp_base + rdev->mc.gtt_size); + } +#endif radeon_fini(rdev); #ifdef DUMBBELL_WIP Modified: head/sys/dev/drm2/radeon/radeon_ttm.c ============================================================================== --- head/sys/dev/drm2/radeon/radeon_ttm.c Thu Oct 30 14:05:48 2014 (r273861) +++ head/sys/dev/drm2/radeon/radeon_ttm.c Thu Oct 30 14:26:36 2014 (r273862) @@ -560,12 +560,10 @@ static struct ttm_tt *radeon_ttm_tt_crea rdev = radeon_get_rdev(bdev); #if __OS_HAS_AGP -#ifdef DUMBBELL_WIP if (rdev->flags & RADEON_IS_AGP) { return ttm_agp_tt_create(bdev, rdev->ddev->agp->agpdev, size, page_flags, dummy_read_page); } -#endif /* DUMBBELL_WIP */ #endif gtt = malloc(sizeof(struct radeon_ttm_tt), @@ -610,11 +608,9 @@ static int radeon_ttm_tt_populate(struct rdev = radeon_get_rdev(ttm->bdev); #if __OS_HAS_AGP -#ifdef DUMBBELL_WIP if (rdev->flags & RADEON_IS_AGP) { return ttm_agp_tt_populate(ttm); } -#endif /* DUMBBELL_WIP */ #endif #ifdef CONFIG_SWIOTLB @@ -660,12 +656,10 @@ static void radeon_ttm_tt_unpopulate(str rdev = radeon_get_rdev(ttm->bdev); #if __OS_HAS_AGP -#ifdef DUMBBELL_WIP if (rdev->flags & RADEON_IS_AGP) { ttm_agp_tt_unpopulate(ttm); return; } -#endif /* DUMBBELL_WIP */ #endif #ifdef CONFIG_SWIOTLB Modified: head/sys/dev/drm2/ttm/ttm_agp_backend.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_agp_backend.c Thu Oct 30 14:05:48 2014 (r273861) +++ head/sys/dev/drm2/ttm/ttm_agp_backend.c Thu Oct 30 14:26:36 2014 (r273862) @@ -41,7 +41,8 @@ __FBSDID("$FreeBSD$"); struct ttm_agp_backend { struct ttm_tt ttm; - struct agp_memory *mem; + vm_offset_t offset; + vm_page_t *pages; device_t bridge; }; @@ -51,31 +52,23 @@ static int ttm_agp_bind(struct ttm_tt *t { struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm); struct drm_mm_node *node = bo_mem->mm_node; - struct agp_memory *mem; - int ret, cached = (bo_mem->placement & TTM_PL_FLAG_CACHED); + int ret; unsigned i; - mem = agp_alloc_memory(agp_be->bridge, AGP_USER_MEMORY, ttm->num_pages); - if (unlikely(mem == NULL)) - return -ENOMEM; - - mem->page_count = 0; for (i = 0; i < ttm->num_pages; i++) { vm_page_t page = ttm->pages[i]; if (!page) page = ttm->dummy_read_page; - mem->pages[mem->page_count++] = page; + agp_be->pages[i] = page; } - agp_be->mem = mem; - - mem->is_flushed = 1; - mem->type = (cached) ? AGP_USER_CACHED_MEMORY : AGP_USER_MEMORY; - ret = agp_bind_memory(mem, node->start); + agp_be->offset = node->start * PAGE_SIZE; + ret = -agp_bind_pages(agp_be->bridge, agp_be->pages, + ttm->num_pages << PAGE_SHIFT, agp_be->offset); if (ret) - pr_err("AGP Bind memory failed\n"); + printf("[TTM] AGP Bind memory failed\n"); return ret; } @@ -84,22 +77,16 @@ static int ttm_agp_unbind(struct ttm_tt { struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm); - if (agp_be->mem) { - if (agp_be->mem->is_bound) - return agp_unbind_memory(agp_be->mem); - agp_free_memory(agp_be->mem); - agp_be->mem = NULL; - } - return 0; + return -agp_unbind_pages(agp_be->bridge, ttm->num_pages << PAGE_SHIFT, + agp_be->offset); } static void ttm_agp_destroy(struct ttm_tt *ttm) { struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm); - if (agp_be->mem) - ttm_agp_unbind(ttm); ttm_tt_fini(ttm); + free(agp_be->pages, M_TTM_AGP); free(agp_be, M_TTM_AGP); } @@ -118,14 +105,18 @@ struct ttm_tt *ttm_agp_tt_create(struct agp_be = malloc(sizeof(*agp_be), M_TTM_AGP, M_WAITOK | M_ZERO); - agp_be->mem = NULL; agp_be->bridge = bridge; agp_be->ttm.func = &ttm_agp_func; if (ttm_tt_init(&agp_be->ttm, bdev, size, page_flags, dummy_read_page)) { + free(agp_be, M_TTM_AGP); return NULL; } + agp_be->offset = 0; + agp_be->pages = malloc(agp_be->ttm.num_pages * sizeof(*agp_be->pages), + M_TTM_AGP, M_WAITOK); + return &agp_be->ttm; } Modified: head/sys/dev/drm2/ttm/ttm_bo_driver.h ============================================================================== --- head/sys/dev/drm2/ttm/ttm_bo_driver.h Thu Oct 30 14:05:48 2014 (r273861) +++ head/sys/dev/drm2/ttm/ttm_bo_driver.h Thu Oct 30 14:26:36 2014 (r273862) @@ -990,9 +990,8 @@ extern vm_memattr_t ttm_io_prot(uint32_t extern const struct ttm_mem_type_manager_func ttm_bo_manager_func; -#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) +#if __OS_HAS_AGP #define TTM_HAS_AGP -#include /** * ttm_agp_tt_create @@ -1009,7 +1008,7 @@ extern const struct ttm_mem_type_manager * bind and unbind memory backing a ttm_tt. */ extern struct ttm_tt *ttm_agp_tt_create(struct ttm_bo_device *bdev, - struct agp_bridge_data *bridge, + device_t bridge, unsigned long size, uint32_t page_flags, struct vm_page *dummy_read_page); int ttm_agp_tt_populate(struct ttm_tt *ttm); Modified: head/sys/dev/drm2/ttm/ttm_page_alloc.c ============================================================================== --- head/sys/dev/drm2/ttm/ttm_page_alloc.c Thu Oct 30 14:05:48 2014 (r273861) +++ head/sys/dev/drm2/ttm/ttm_page_alloc.c Thu Oct 30 14:26:36 2014 (r273862) @@ -45,10 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef TTM_HAS_AGP -#include -#endif - #define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(vm_page_t)) #define SMALL_ALLOCATION 16 #define FREE_ALL_PAGES (~0U) @@ -220,46 +216,34 @@ static struct ttm_pool_manager *_manager static int set_pages_array_wb(vm_page_t *pages, int addrinarray) { - vm_page_t m; +#ifdef TTM_HAS_AGP int i; - for (i = 0; i < addrinarray; i++) { - m = pages[i]; -#ifdef TTM_HAS_AGP - unmap_page_from_agp(m); + for (i = 0; i < addrinarray; i++) + pmap_page_set_memattr(pages[i], VM_MEMATTR_WRITE_BACK); #endif - pmap_page_set_memattr(m, VM_MEMATTR_WRITE_BACK); - } return 0; } static int set_pages_array_wc(vm_page_t *pages, int addrinarray) { - vm_page_t m; +#ifdef TTM_HAS_AGP int i; - for (i = 0; i < addrinarray; i++) { - m = pages[i]; -#ifdef TTM_HAS_AGP - map_page_into_agp(pages[i]); + for (i = 0; i < addrinarray; i++) + pmap_page_set_memattr(pages[i], VM_MEMATTR_WRITE_COMBINING); #endif - pmap_page_set_memattr(m, VM_MEMATTR_WRITE_COMBINING); - } return 0; } static int set_pages_array_uc(vm_page_t *pages, int addrinarray) { - vm_page_t m; +#ifdef TTM_HAS_AGP int i; - for (i = 0; i < addrinarray; i++) { - m = pages[i]; -#ifdef TTM_HAS_AGP - map_page_into_agp(pages[i]); + for (i = 0; i < addrinarray; i++) + pmap_page_set_memattr(pages[i], VM_MEMATTR_UNCACHEABLE); #endif - pmap_page_set_memattr(m, VM_MEMATTR_UNCACHEABLE); - } return 0; } From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 14:36:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A53B2ED5; Thu, 30 Oct 2014 14:36:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91E71225; Thu, 30 Oct 2014 14:36:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9UEaSHW061651; Thu, 30 Oct 2014 14:36:28 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9UEaSHC061650; Thu, 30 Oct 2014 14:36:28 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201410301436.s9UEaSHC061650@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Thu, 30 Oct 2014 14:36:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273863 - head/sys/dev/agp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 14:36:28 -0000 Author: tijl Date: Thu Oct 30 14:36:27 2014 New Revision: 273863 URL: https://svnweb.freebsd.org/changeset/base/273863 Log: Avoid possible overflow in agp_generic_alloc_memory. MFC after: 1 week Modified: head/sys/dev/agp/agp.c Modified: head/sys/dev/agp/agp.c ============================================================================== --- head/sys/dev/agp/agp.c Thu Oct 30 14:26:36 2014 (r273862) +++ head/sys/dev/agp/agp.c Thu Oct 30 14:36:27 2014 (r273863) @@ -485,7 +485,7 @@ agp_generic_alloc_memory(device_t dev, i if ((size & (AGP_PAGE_SIZE - 1)) != 0) return 0; - if (sc->as_allocated + size > sc->as_maxmem) + if (size > sc->as_maxmem - sc->as_allocated) return 0; if (type != 0) { From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 14:43:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [8.8.178.116]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E7B272E4; Thu, 30 Oct 2014 14:43:11 +0000 (UTC) Received: from butcher-nb.yandex.net (hub.freebsd.org [IPv6:2001:1900:2254:206c::16:88]) by mx2.freebsd.org (Postfix) with ESMTP id C82651900; Thu, 30 Oct 2014 14:43:10 +0000 (UTC) Message-ID: <54524E7A.1020802@FreeBSD.org> Date: Thu, 30 Oct 2014 17:43:06 +0300 From: "Andrey V. Elsukov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Bruce Simpson , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r273855 - head/sys/netinet6 References: <201410301059.s9UAxwAg055812@svn.freebsd.org> <1414668869.979804.185070381.0D4C866C@webmail.messagingengine.com> In-Reply-To: <1414668869.979804.185070381.0D4C866C@webmail.messagingengine.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 14:43:12 -0000 On 30.10.2014 14:34, Bruce Simpson wrote: > Hello, > > This is a really inconvenient time for me (I am up against a deadline) > but I am not 100% comfortable with this change. > > On Thu, 30 Oct 2014, at 10:59, Andrey V. Elsukov wrote: >> Log: >> Fix mbuf leak in IPv6 multicast code. >> When multicast capable interface goes away, it leaves multicast groups, >> this leads to generate MLD reports, but MLD code does deffered send and >> MLD reports are queued in the in6_multi's in6m_scq ifq. The problem is >> that in6_multi structures are freed when interface leaves multicast >> groups >> and thread that does deffered send will not take these queued packets. > > A few comments: > > 1) Stylistic -- a change of this kind should probably be part of > inm_purge() itself because it modifies state which is private to the > group membership. > > 2) Logical -- The patch forces pending (queued) state change record > fragments to be freed when the parent interface is taken down. > Unfortunately, those are pending for a reason; there has been a state > change, and MLD needs to communicate it upstream to on-link routers (and > snooping switches). > > So - there is a risk with this approach that upstream MLD listener (e.g. > router, switch) will be inconsistent, at least until the next General > Query. I'm not quite sure, but I think that the leak happened only when interface disappeared. In case when system just leaves the group, MLD code takes reference to in6_multi and releases it when fasttimo handler dispatches packets. When interface is disappearing, in6_ifdetach() calls in6_purgemaddrs(), where all references to in6_multi released again. Now in6m_release_locked() will drain queue when in6_multi has no more references. -- WBR, Andrey V. Elsukov From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 14:47:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 825554A7; Thu, 30 Oct 2014 14:47:23 +0000 (UTC) Received: from mail-wi0-x22a.google.com (mail-wi0-x22a.google.com [IPv6:2a00:1450:400c:c05::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A4DB234D; Thu, 30 Oct 2014 14:47:22 +0000 (UTC) Received: by mail-wi0-f170.google.com with SMTP id q5so1364316wiv.5 for ; Thu, 30 Oct 2014 07:47:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=z50LIWR5Ws2ed1nI3cws1iEWthar1FxACcFOy/CCJkY=; b=QcFCb5oxVqFW/m4hqDkdA6+lzjSalg0ZMo2eFwAXJxYLm8FJEvVTfqXm1ijakWCxHp xpHxlNS1ofw08rSJmn5W+D0ffFFnkSlESzffgxzLjo8QtNefJswLjAIbLkSr+LiL8dS8 gNE+ftvdPQVYNJmwTIV3H6XdWZAPfdPc6bsGrBZeVxxOdiIAjtEqoqXZhnlZIeCIlQYa ply5Zf4RYxdZKrlExSQh/4PVJHz+G5dT49m15BqvqZU4/pmYrKvuXHxb1A+1PH/FAHjg DhkELOEX54RpoguVDSedomhJjqxuYwFBLE4PaQ/RohF62k9mEIQuD169PjIQDzN7tJ3l fQ4Q== MIME-Version: 1.0 X-Received: by 10.180.9.103 with SMTP id y7mr2723535wia.5.1414680440582; Thu, 30 Oct 2014 07:47:20 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.216.53.68 with HTTP; Thu, 30 Oct 2014 07:47:20 -0700 (PDT) In-Reply-To: <201410301405.s9UE5nUO046896@svn.freebsd.org> References: <201410301405.s9UE5nUO046896@svn.freebsd.org> Date: Thu, 30 Oct 2014 18:47:20 +0400 X-Google-Sender-Auth: 3WvVv-ZdnWZK5PGg4hoOjtc-PgU Message-ID: Subject: Re: svn commit: r273861 - head/sbin/mount_nfs From: Sergey Kandaurov To: Edward Tomasz Napierala Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 14:47:23 -0000 On 30 October 2014 17:05, Edward Tomasz Napierala wrote: > Author: trasz > Date: Thu Oct 30 14:05:48 2014 > New Revision: 273861 > URL: https://svnweb.freebsd.org/changeset/base/273861 > > Log: > Remove two functions unused after r273848. Would be nice if clang > or at least scan-build yelled about it. It does but with WARNS=3, -Wunused-function is disabled. -- wbr, pluknet From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 15:52:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9CD71571; Thu, 30 Oct 2014 15:52:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7DEBFC46; Thu, 30 Oct 2014 15:52:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9UFq2bQ098956; Thu, 30 Oct 2014 15:52:02 GMT (envelope-from ambrisko@FreeBSD.org) Received: (from ambrisko@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9UFq1WV098951; Thu, 30 Oct 2014 15:52:01 GMT (envelope-from ambrisko@FreeBSD.org) Message-Id: <201410301552.s9UFq1WV098951@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ambrisko set sender to ambrisko@FreeBSD.org using -f From: Doug Ambrisko Date: Thu, 30 Oct 2014 15:52:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273865 - in head: sbin/fsck_msdosfs sys/boot/amd64/boot1.efi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 15:52:02 -0000 Author: ambrisko Date: Thu Oct 30 15:52:01 2014 New Revision: 273865 URL: https://svnweb.freebsd.org/changeset/base/273865 Log: Make UEFI booting of 4Kn disks work: - convert boot1.efi to corrrectly calculate the lba for what the media reports and convert the size based on what FreeBSD uses. The existing code would use the 512 byte lba and convert the size using 4K byte size. - make fsck_msdosfs read the boot block as 4K so the read doesn't fail on a 4Kn drive since FreeBSD will error out parition reads of a block. Make the bpbBytesPerSec check a multiple of 512 since it can be 512 or 4K depending on the disk. This allows fsck to pass checking the EFI partition on a 4Kn disk. To create the EFI file system I used: newfs_msdos -F 32 -S 4096 -c 1 -m 0xf8 This works for booting 512 and 4Kn disks. Caveat is that loader.efi cannot read the 4Kn EFI partition. This isn't critical right now since boot1.efi will read loader.efi from the ufs partition. It looks like loader.efi can be fixed via making some of the 512 bytes reads more flexible. loader.efi doesn't have trouble reading the ufs partition. This is probably a simple fix. I now have FreeBSD installed on a system with 4Kn drives and tested the same code works on 512. MFC after: 1 week Modified: head/sbin/fsck_msdosfs/boot.c head/sbin/fsck_msdosfs/dosfs.h head/sys/boot/amd64/boot1.efi/boot1.c Modified: head/sbin/fsck_msdosfs/boot.c ============================================================================== --- head/sbin/fsck_msdosfs/boot.c Thu Oct 30 15:41:25 2014 (r273864) +++ head/sbin/fsck_msdosfs/boot.c Thu Oct 30 15:52:01 2014 (r273865) @@ -181,7 +181,7 @@ readboot(int dosfs, struct bootblock *bo boot->bpbResSectors + boot->bpbFATs * boot->FATsecs - CLUST_FIRST * boot->bpbSecPerClust; - if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE != 0) { + if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE_REAL != 0) { pfatal("Invalid sector size: %u", boot->bpbBytesPerSec); return FSFATAL; } Modified: head/sbin/fsck_msdosfs/dosfs.h ============================================================================== --- head/sbin/fsck_msdosfs/dosfs.h Thu Oct 30 15:41:25 2014 (r273864) +++ head/sbin/fsck_msdosfs/dosfs.h Thu Oct 30 15:52:01 2014 (r273865) @@ -30,7 +30,9 @@ #ifndef DOSFS_H #define DOSFS_H -#define DOSBOOTBLOCKSIZE 512 +/* support 4Kn disk reads */ +#define DOSBOOTBLOCKSIZE_REAL 512 +#define DOSBOOTBLOCKSIZE 4096 typedef u_int32_t cl_t; /* type holding a cluster number */ Modified: head/sys/boot/amd64/boot1.efi/boot1.c ============================================================================== --- head/sys/boot/amd64/boot1.efi/boot1.c Thu Oct 30 15:41:25 2014 (r273864) +++ head/sys/boot/amd64/boot1.efi/boot1.c Thu Oct 30 15:52:01 2014 (r273865) @@ -168,9 +168,12 @@ static int dskread(void *buf, u_int64_t lba, int nblk) { EFI_STATUS status; + int size; + lba = lba / (bootdev->Media->BlockSize / DEV_BSIZE); + size = nblk * DEV_BSIZE; status = bootdev->ReadBlocks(bootdev, bootdev->Media->MediaId, lba, - nblk * bootdev->Media->BlockSize, buf); + size, buf); if (EFI_ERROR(status)) return (-1); From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 16:06:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D1AE98F5; Thu, 30 Oct 2014 16:06:00 +0000 (UTC) Received: from mail-wg0-x22e.google.com (mail-wg0-x22e.google.com [IPv6:2a00:1450:400c:c00::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F3EC7D72; Thu, 30 Oct 2014 16:05:59 +0000 (UTC) Received: by mail-wg0-f46.google.com with SMTP id x13so6019457wgg.5 for ; Thu, 30 Oct 2014 09:05:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=kFnNidkO9mgcO10DmgkIfIOCEaiQywCHqpedEJSEkvw=; b=FHN1jlXIVtwOCTg1c17XuRJ4NOTfX5RTNraTIKq7QNKoI0vAdJFAQ3uDN6M5NjBzZV MLQcg/M1euEyXvkLsFViu3XxnwKtb+wiIJvVmPcnU2PlB2QH+8SZ6wZncKHge3gLsvbd L1/R8cifmapPUEYdZT+KmMwaWdvYPnGKOgamBc2+gvsZvYezBo1PdIAMLHbUWPw6NfXR mdcFFN55Zt6UhFmVKrZhMcdpnpojikmdsbpnJplEibsE3aO+AYMnluEpvP1FWHM/WusK 5fd9f/jyN4AwlRcm3nm69Ntsn+O9VsaS6wUVAlUkKGFMY6eQYPHxqCl/yTr2uTAml+/p +oCA== MIME-Version: 1.0 X-Received: by 10.180.83.98 with SMTP id p2mr12956404wiy.20.1414685158191; Thu, 30 Oct 2014 09:05:58 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Thu, 30 Oct 2014 09:05:58 -0700 (PDT) In-Reply-To: <54524E7A.1020802@FreeBSD.org> References: <201410301059.s9UAxwAg055812@svn.freebsd.org> <1414668869.979804.185070381.0D4C866C@webmail.messagingengine.com> <54524E7A.1020802@FreeBSD.org> Date: Thu, 30 Oct 2014 09:05:58 -0700 X-Google-Sender-Auth: 07BV6kgnY5Faqvg5MVqT0cjbQmg Message-ID: Subject: Re: svn commit: r273855 - head/sys/netinet6 From: Adrian Chadd To: "Andrey V. Elsukov" Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , Bruce Simpson , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 16:06:01 -0000 Btw - this is also a problem in the wifi stack. When you destroy an interface, do you want to make sure the STA "going away" frames go out and are ACKed before you finish tearing down the interface? We don't really have any framework / standards in place for how to put tearing down an interface on hold whilst we notify things and wait for packets to finish transmitting, so we don't bother. (I had the same issue with net80211 / ath and transmit buffers hanging around after I destroyed a VAP. They came from the "disassociate" packet being generated when the interface was being torn down.) -adrian On 30 October 2014 07:43, Andrey V. Elsukov wrote: > On 30.10.2014 14:34, Bruce Simpson wrote: >> Hello, >> >> This is a really inconvenient time for me (I am up against a deadline) >> but I am not 100% comfortable with this change. >> >> On Thu, 30 Oct 2014, at 10:59, Andrey V. Elsukov wrote: >>> Log: >>> Fix mbuf leak in IPv6 multicast code. >>> When multicast capable interface goes away, it leaves multicast groups, >>> this leads to generate MLD reports, but MLD code does deffered send and >>> MLD reports are queued in the in6_multi's in6m_scq ifq. The problem is >>> that in6_multi structures are freed when interface leaves multicast >>> groups >>> and thread that does deffered send will not take these queued packets. >> >> A few comments: >> >> 1) Stylistic -- a change of this kind should probably be part of >> inm_purge() itself because it modifies state which is private to the >> group membership. >> >> 2) Logical -- The patch forces pending (queued) state change record >> fragments to be freed when the parent interface is taken down. >> Unfortunately, those are pending for a reason; there has been a state >> change, and MLD needs to communicate it upstream to on-link routers (and >> snooping switches). >> >> So - there is a risk with this approach that upstream MLD listener (e.g. >> router, switch) will be inconsistent, at least until the next General >> Query. > > I'm not quite sure, but I think that the leak happened only when > interface disappeared. In case when system just leaves the group, MLD > code takes reference to in6_multi and releases it when fasttimo handler > dispatches packets. When interface is disappearing, in6_ifdetach() calls > in6_purgemaddrs(), where all references to in6_multi released again. Now > in6m_release_locked() will drain queue when in6_multi has no more > references. > > -- > WBR, Andrey V. Elsukov > From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 16:26:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 89D529D; Thu, 30 Oct 2014 16:26:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 76000F7A; Thu, 30 Oct 2014 16:26:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9UGQIKA014235; Thu, 30 Oct 2014 16:26:18 GMT (envelope-from jpaetzel@FreeBSD.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9UGQIJS014234; Thu, 30 Oct 2014 16:26:18 GMT (envelope-from jpaetzel@FreeBSD.org) Message-Id: <201410301626.s9UGQIJS014234@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jpaetzel set sender to jpaetzel@FreeBSD.org using -f From: Josh Paetzel Date: Thu, 30 Oct 2014 16:26:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273866 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 16:26:18 -0000 Author: jpaetzel Date: Thu Oct 30 16:26:17 2014 New Revision: 273866 URL: https://svnweb.freebsd.org/changeset/base/273866 Log: Plug memory ordering holes in buf_ring_enqueue. For at least some users this patch eliminates the races previously discussed on the mailing list. Submitted by: oleg Reviewed by: kmacy MFC after: 2 weeks Tested by: kmacy,rpaulo Modified: head/sys/sys/buf_ring.h Modified: head/sys/sys/buf_ring.h ============================================================================== --- head/sys/sys/buf_ring.h Thu Oct 30 15:52:01 2014 (r273865) +++ head/sys/sys/buf_ring.h Thu Oct 30 16:26:17 2014 (r273866) @@ -64,8 +64,7 @@ struct buf_ring { static __inline int buf_ring_enqueue(struct buf_ring *br, void *buf) { - uint32_t prod_head, prod_next; - uint32_t cons_tail; + uint32_t prod_head, prod_next, cons_tail; #ifdef DEBUG_BUFRING int i; for (i = br->br_cons_head; i != br->br_prod_head; @@ -77,16 +76,20 @@ buf_ring_enqueue(struct buf_ring *br, vo critical_enter(); do { prod_head = br->br_prod_head; + prod_next = (prod_head + 1) & br->br_prod_mask; cons_tail = br->br_cons_tail; - prod_next = (prod_head + 1) & br->br_prod_mask; - if (prod_next == cons_tail) { - br->br_drops++; - critical_exit(); - return (ENOBUFS); + rmb(); + if (prod_head == br->br_prod_head && + cons_tail == br->br_cons_tail) { + br->br_drops++; + critical_exit(); + return (ENOBUFS); + } + continue; } - } while (!atomic_cmpset_int(&br->br_prod_head, prod_head, prod_next)); + } while (!atomic_cmpset_acq_int(&br->br_prod_head, prod_head, prod_next)); #ifdef DEBUG_BUFRING if (br->br_ring[prod_head] != NULL) panic("dangling value in enqueue"); @@ -94,19 +97,13 @@ buf_ring_enqueue(struct buf_ring *br, vo br->br_ring[prod_head] = buf; /* - * The full memory barrier also avoids that br_prod_tail store - * is reordered before the br_ring[prod_head] is full setup. - */ - mb(); - - /* * If there are other enqueues in progress * that preceeded us, we need to wait for them * to complete */ while (br->br_prod_tail != prod_head) cpu_spinwait(); - br->br_prod_tail = prod_next; + atomic_store_rel_int(&br->br_prod_tail, prod_next); critical_exit(); return (0); } @@ -119,37 +116,23 @@ static __inline void * buf_ring_dequeue_mc(struct buf_ring *br) { uint32_t cons_head, cons_next; - uint32_t prod_tail; void *buf; - int success; critical_enter(); do { cons_head = br->br_cons_head; - prod_tail = br->br_prod_tail; - cons_next = (cons_head + 1) & br->br_cons_mask; - - if (cons_head == prod_tail) { + + if (cons_head == br->br_prod_tail) { critical_exit(); return (NULL); } - - success = atomic_cmpset_int(&br->br_cons_head, cons_head, - cons_next); - } while (success == 0); + } while (!atomic_cmpset_acq_int(&br->br_cons_head, cons_head, cons_next)); buf = br->br_ring[cons_head]; #ifdef DEBUG_BUFRING br->br_ring[cons_head] = NULL; #endif - - /* - * The full memory barrier also avoids that br_ring[cons_read] - * load is reordered after br_cons_tail is set. - */ - mb(); - /* * If there are other dequeues in progress * that preceeded us, we need to wait for them @@ -158,7 +141,7 @@ buf_ring_dequeue_mc(struct buf_ring *br) while (br->br_cons_tail != cons_head) cpu_spinwait(); - br->br_cons_tail = cons_next; + atomic_store_rel_int(&br->br_cons_tail, cons_next); critical_exit(); return (buf); From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 16:36:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E4C608A4; Thu, 30 Oct 2014 16:36:40 +0000 (UTC) Received: from mail-pa0-x230.google.com (mail-pa0-x230.google.com [IPv6:2607:f8b0:400e:c03::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A9AEA130; Thu, 30 Oct 2014 16:36:40 +0000 (UTC) Received: by mail-pa0-f48.google.com with SMTP id ey11so5800326pad.21 for ; Thu, 30 Oct 2014 09:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=a+tVQqbQJcxMyKZdkdH0Be/IXQwWqRVqBxs+FjP2j6w=; b=tO2VRPgjAHKmkeHM7VEC6LU6+WsYpB1KyhyiX7d+7jAQE1xEks3cC1ip3dLvhHRVFa JuwMSTr9YZvl1onseyryT3GEDihFIBTxoqV0kb9SNIlA/STyYvoGP0tgP9fo8ux2mxXW 3qredzPU5tKH0Co3ChKgj0Axy4n6w2lr1CJchpZZM8JWpNUuHPFmfiBdG0nFtrmEv+w7 ySFQ0f1gElVVdjyfdIJffbMjI/efKn3DQ0WL9JPTYXpujOKm/3OIuS4fixxQwvII9c3q KUYvxI1DBRXEZQZD70nGmEx6wuBd9P8B/Fs708Sad3jNkWkAkn3wptIgf/x3X1n0A3nb znqw== X-Received: by 10.66.150.164 with SMTP id uj4mr18704811pab.14.1414687000082; Thu, 30 Oct 2014 09:36:40 -0700 (PDT) Received: from ?IPv6:2601:8:ab80:7d6:8d37:6352:ed8b:4617? ([2601:8:ab80:7d6:8d37:6352:ed8b:4617]) by mx.google.com with ESMTPSA id c8sm7597409pds.48.2014.10.30.09.36.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 Oct 2014 09:36:39 -0700 (PDT) References: <201410301626.s9UGQIJS014234@svn.freebsd.org> Mime-Version: 1.0 (1.0) In-Reply-To: <201410301626.s9UGQIJS014234@svn.freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <5EDC9AC8-D9DE-4C78-86CB-3A64E558633B@gmail.com> X-Mailer: iPhone Mail (12B411) From: Garrett Cooper Subject: Re: svn commit: r273866 - head/sys/sys Date: Thu, 30 Oct 2014 09:36:39 -0700 To: Josh Paetzel Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 16:36:41 -0000 > On Oct 30, 2014, at 09:26, Josh Paetzel wrote: > > Author: jpaetzel > Date: Thu Oct 30 16:26:17 2014 > New Revision: 273866 > URL: https://svnweb.freebsd.org/changeset/base/273866 > > Log: > Plug memory ordering holes in buf_ring_enqueue. For at least some > users this patch eliminates the races previously discussed on the > mailing list. Hi Josh! Do you have a link to the discussion thread you can provide? Thank you! From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 16:57:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CB28320B; Thu, 30 Oct 2014 16:57:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B71E4382; Thu, 30 Oct 2014 16:57:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9UGvvpj029468; Thu, 30 Oct 2014 16:57:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9UGvvA9029467; Thu, 30 Oct 2014 16:57:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410301657.s9UGvvA9029467@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 30 Oct 2014 16:57:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273867 - head/sys/ofed/drivers/net/mlx4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 16:57:57 -0000 Author: hselasky Date: Thu Oct 30 16:57:56 2014 New Revision: 273867 URL: https://svnweb.freebsd.org/changeset/base/273867 Log: Fix compile warning by removing unused variable. MFC: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/net/mlx4/mcg.c Modified: head/sys/ofed/drivers/net/mlx4/mcg.c ============================================================================== --- head/sys/ofed/drivers/net/mlx4/mcg.c Thu Oct 30 16:26:17 2014 (r273866) +++ head/sys/ofed/drivers/net/mlx4/mcg.c Thu Oct 30 16:57:56 2014 (r273867) @@ -39,9 +39,6 @@ #include "mlx4.h" - -static const u8 zero_gid[16]; /* automatically initialized to 0 */ - int mlx4_get_mgm_entry_size(struct mlx4_dev *dev) { return 1 << dev->oper_log_mgm_entry_size; From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 17:06:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B46986EF; Thu, 30 Oct 2014 17:06:16 +0000 (UTC) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 76E8E662; Thu, 30 Oct 2014 17:06:16 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id C56591FE022; Thu, 30 Oct 2014 18:06:13 +0100 (CET) Message-ID: <5452700E.7090406@selasky.org> Date: Thu, 30 Oct 2014 18:06:22 +0100 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r273867 - head/sys/ofed/drivers/net/mlx4 References: <201410301657.s9UGvvA9029467@svn.freebsd.org> In-Reply-To: <201410301657.s9UGvvA9029467@svn.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 17:06:16 -0000 On 10/30/14 17:57, Hans Petter Selasky wrote: > Log: > Fix compile warning by removing unused variable. > > MFC: 3 days > Sponsored by: Mellanox Technologies ^^^ should be "MFC after:" --HPS From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 17:58:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 89821B32; Thu, 30 Oct 2014 17:58:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 75E56CD4; Thu, 30 Oct 2014 17:58:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9UHww23057291; Thu, 30 Oct 2014 17:58:58 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9UHww31057290; Thu, 30 Oct 2014 17:58:58 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410301758.s9UHww31057290@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 30 Oct 2014 17:58:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273871 - head/sys/i386/i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 17:58:58 -0000 Author: jhb Date: Thu Oct 30 17:58:57 2014 New Revision: 273871 URL: https://svnweb.freebsd.org/changeset/base/273871 Log: Skip the smap sysctl instead of panicing if no kernel metadata can be found. Submitted by: bde MFC after: 3 days Modified: head/sys/i386/i386/machdep.c Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Thu Oct 30 17:14:51 2014 (r273870) +++ head/sys/i386/i386/machdep.c Thu Oct 30 17:58:57 2014 (r273871) @@ -3428,6 +3428,8 @@ smap_sysctl_handler(SYSCTL_HANDLER_ARGS) kmdp = preload_search_by_type("elf kernel"); if (kmdp == NULL) kmdp = preload_search_by_type("elf32 kernel"); + if (kmdp == NULL) + return (0); smapbase = (struct bios_smap *)preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_SMAP); if (smapbase == NULL) From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 18:09:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 55A1CF50; Thu, 30 Oct 2014 18:09:17 +0000 (UTC) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 95C67DE8; Thu, 30 Oct 2014 18:09:16 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id B1ABED41F86; Fri, 31 Oct 2014 05:09:07 +1100 (AEDT) Date: Fri, 31 Oct 2014 05:09:03 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Doug Ambrisko Subject: Re: svn commit: r273865 - in head: sbin/fsck_msdosfs sys/boot/amd64/boot1.efi In-Reply-To: <201410301552.s9UFq1WV098951@svn.freebsd.org> Message-ID: <20141031042846.V2490@besplex.bde.org> References: <201410301552.s9UFq1WV098951@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=BdjhjNd2 c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=yY24FRAextMSWnk6TNUA:9 a=CjuIK1q_8ugA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 18:09:17 -0000 On Thu, 30 Oct 2014, Doug Ambrisko wrote: > Log: > Make UEFI booting of 4Kn disks work: > - convert boot1.efi to corrrectly calculate the lba for what the > media reports and convert the size based on what FreeBSD uses. > The existing code would use the 512 byte lba and convert the > size using 4K byte size. > - make fsck_msdosfs read the boot block as 4K so the read doesn't > fail on a 4Kn drive since FreeBSD will error out parition reads > of a block. Make the bpbBytesPerSec check a multiple of 512 since > it can be 512 or 4K depending on the disk. This allows fsck to > pass checking the EFI partition on a 4Kn disk. > Modified: head/sbin/fsck_msdosfs/boot.c > ============================================================================== > --- head/sbin/fsck_msdosfs/boot.c Thu Oct 30 15:41:25 2014 (r273864) > +++ head/sbin/fsck_msdosfs/boot.c Thu Oct 30 15:52:01 2014 (r273865) > @@ -181,7 +181,7 @@ readboot(int dosfs, struct bootblock *bo > boot->bpbResSectors + boot->bpbFATs * boot->FATsecs - > CLUST_FIRST * boot->bpbSecPerClust; > > - if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE != 0) { > + if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE_REAL != 0) { > pfatal("Invalid sector size: %u", boot->bpbBytesPerSec); > return FSFATAL; > } > > Modified: head/sbin/fsck_msdosfs/dosfs.h > ============================================================================== > --- head/sbin/fsck_msdosfs/dosfs.h Thu Oct 30 15:41:25 2014 (r273864) > +++ head/sbin/fsck_msdosfs/dosfs.h Thu Oct 30 15:52:01 2014 (r273865) > @@ -30,7 +30,9 @@ > #ifndef DOSFS_H > #define DOSFS_H > > -#define DOSBOOTBLOCKSIZE 512 > +/* support 4Kn disk reads */ > +#define DOSBOOTBLOCKSIZE_REAL 512 > +#define DOSBOOTBLOCKSIZE 4096 > > typedef u_int32_t cl_t; /* type holding a cluster number */ This affects almost everywhere DOSBOOTBLOCKSIZE is used. You only adjusted one place. The others are: % boot.c: u_char fsinfo[2 * DOSBOOTBLOCKSIZE]; fsinfo is more incorrectly sized than before. The change allows i/o of fsinfo[] to work with 4K-sectors, but writes of it now clobber the area beyond what is reserved for it with 512-sectors. fsinfo actually has size 2 * 512, not 2 * sector_size, so reads and writes of it need to be padded if the sector size is larger than 1024. Old versions of msdosfs got fsinfo stuff wrong by laying it out naturally for sector_sized sectors, but its layout is coded for 512-sectors, so there are further complications. % boot.c: u_char backup[DOSBOOTBLOCKSIZE]; Probably OK. % boot.c: if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE != 0) { Adjusted. % boot.c: u_char fsinfo[2 * DOSBOOTBLOCKSIZE]; Another fsinfo[] for writing. This is the dangerous one. It might work OK by read/modify write of the larger size provided the modifications are limited to the real fsinfo. I use the following fixes: % Index: boot.c % =================================================================== % RCS file: /home/ncvs/src/sbin/fsck_msdosfs/boot.c,v % retrieving revision 1.6 % diff -u -2 -r1.6 boot.c % --- boot.c 31 Jan 2008 13:16:29 -0000 1.6 % +++ boot.c 3 Jul 2010 16:53:33 -0000 % @@ -48,4 +48,6 @@ % #include "fsutil.h" % % +#define IOSIZE 65536 % + % int % readboot(dosfs, boot) % @@ -53,18 +55,48 @@ % struct bootblock *boot; % { % + u_char ioblock[IOSIZE]; % + u_char iofsinfo[IOSIZE]; % + u_char iobackup[IOSIZE]; % u_char block[DOSBOOTBLOCKSIZE]; % u_char fsinfo[2 * DOSBOOTBLOCKSIZE]; % u_char backup[DOSBOOTBLOCKSIZE]; % + u_char *infop; % + size_t iosize; % + u_int secsize; % int ret = FSOK; % % - if (read(dosfs, block, sizeof block) < sizeof block) { % + /* Search for an i/o size that works. */ % + for (iosize = IOSIZE; iosize >= DOSBOOTBLOCKSIZE; iosize >>= 1) { % + if (lseek(dosfs, (off_t)0, SEEK_SET) == 0 && % + read(dosfs, ioblock, iosize) == (ssize_t)iosize) % + break; % + } % + if (iosize < DOSBOOTBLOCKSIZE) { % perror("could not read boot block"); % return FSFATAL; % } % + memcpy(block, ioblock, sizeof block); Probe for a working size. This stuff is also buggy in ffs utilities and the kernel ffs and msdosfs. Most or all of these do a probe, but assume that 8K-blocks work. I needed better for a DCD-RW that does 2K-reads but only 32K-writes. Support for 4K- and 8K- blocks is only enough for reading the DVD. I only fixed this for fsck_msdosfs, as in this patch. Kernel msdosfs works on the DVD since it only assumes that 8K-blocks work for reading. fsck_msdosfs also assumed that 512-blocks works for writing at least fsinfo[]. % % - if (block[510] != 0x55 || block[511] != 0xaa) { % - pfatal("Invalid signature in boot block: %02x%02x", block[511], block[510]); % + /* % + * Preliminary decode to determine where the signature might be. % + * It is supposed to be at the end of a 512-block, but we used to % + * put it at the end of a sector. Accept the latter so as to fix % + * it someday. % + */ % + secsize = block[11] + (block[12] << 8); % + if (secsize < sizeof block || secsize > IOSIZE) { % + perror("Preposterous or unsupported sector size"); % return FSFATAL; % } % + if (block[510] != 0x55 || block[511] != 0xaa) { % + if (ioblock[secsize - 2] != 0x55 || % + ioblock[secsize - 1] != 0xaa) { % + pfatal("Invalid signature in boot block: %02x%02x", % + block[511], block[510]); % + return FSFATAL; % + } % + pwarn( % + "Invalid primary signature in boot block -- using secondary\n"); % + } % % memset(boot, 0, sizeof *boot); Allow misplaced signatures. % @@ -107,11 +139,12 @@ % boot->Backup = block[50] + (block[51] << 8); % % + iosize = (secsize >= sizeof fsinfo) ? secsize : sizeof fsinfo; % if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET) % != boot->FSInfo * boot->BytesPerSec % - || read(dosfs, fsinfo, sizeof fsinfo) % - != sizeof fsinfo) { % + || read(dosfs, iofsinfo, iosize) != (ssize_t)iosize) { % perror("could not read fsinfo block"); % return FSFATAL; % } % + memcpy(fsinfo, iofsinfo, sizeof fsinfo); % if (memcmp(fsinfo, "RRaA", 4) % || memcmp(fsinfo + 0x1e4, "rrAa", 4) % @@ -124,4 +157,22 @@ % || fsinfo[0x3fe] != 0x55 % || fsinfo[0x3ff] != 0xaa) { % + infop = &iofsinfo[secsize - DOSBOOTBLOCKSIZE]; % + if (memcmp(fsinfo, "RRaA", 4) == 0 && % + memcmp(infop + 0x1e4, "rrAa", 4) == 0 && % + infop[0x1fc] == 0 && % + infop[0x1fd] == 0 && % + infop[0x1fe] == 0x55 && % + infop[0x1ff] == 0xaa) { % + pwarn( % + "Invalid signature in fsinfo block -- using secondary\n"); % + /* % + * Silently fix up the actual fsinfo data % + * (just 2 32-bit words) since this data % + * is advisory and the indentation is % + * already too painful to ask about this. % + */ % + memcpy(fsinfo + 0x1e8, infop + 0x1e8, 8); % + goto over; % + } % pwarn("Invalid signature in fsinfo block\n"); % if (ask(0, "Fix")) { % @@ -134,12 +185,14 @@ % fsinfo[0x3fe] = 0x55; % fsinfo[0x3ff] = 0xaa; % + memcpy(iofsinfo, fsinfo, sizeof fsinfo); % if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET) % != boot->FSInfo * boot->BytesPerSec % - || write(dosfs, fsinfo, sizeof fsinfo) % - != sizeof fsinfo) { % + || write(dosfs, iofsinfo, iosize) % + != (ssize_t)iosize) { % perror("Unable to write FSInfo"); % return FSFATAL; % } % ret = FSBOOTMOD; % +over: ; % } else % boot->FSInfo = 0; Allow misplaced signatures (and data?) in fsinfo. newfs_msdos used to produce them. % @@ -107,11 +139,12 @@ % boot->Backup = block[50] + (block[51] << 8); % % + iosize = (secsize >= sizeof fsinfo) ? secsize : sizeof fsinfo; % if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET) % != boot->FSInfo * boot->BytesPerSec % - || read(dosfs, fsinfo, sizeof fsinfo) % - != sizeof fsinfo) { % + || read(dosfs, iofsinfo, iosize) != (ssize_t)iosize) { % perror("could not read fsinfo block"); % return FSFATAL; % } % + memcpy(fsinfo, iofsinfo, sizeof fsinfo); % if (memcmp(fsinfo, "RRaA", 4) % || memcmp(fsinfo + 0x1e4, "rrAa", 4) % @@ -124,4 +157,22 @@ % || fsinfo[0x3fe] != 0x55 % || fsinfo[0x3ff] != 0xaa) { % + infop = &iofsinfo[secsize - DOSBOOTBLOCKSIZE]; % + if (memcmp(fsinfo, "RRaA", 4) == 0 && % + memcmp(infop + 0x1e4, "rrAa", 4) == 0 && % + infop[0x1fc] == 0 && % + infop[0x1fd] == 0 && % + infop[0x1fe] == 0x55 && % + infop[0x1ff] == 0xaa) { % + pwarn( % + "Invalid signature in fsinfo block -- using secondary\n"); % + /* % + * Silently fix up the actual fsinfo data % + * (just 2 32-bit words) since this data % @@ -156,8 +209,9 @@ % if (lseek(dosfs, boot->Backup * boot->BytesPerSec, SEEK_SET) % != boot->Backup * boot->BytesPerSec % - || read(dosfs, backup, sizeof backup) != sizeof backup) { % + || read(dosfs, iobackup, secsize) != (ssize_t)secsize) { % perror("could not read backup bootblock"); % return FSFATAL; % } % + memcpy(backup, iobackup, sizeof backup); % backup[65] = block[65]; /* XXX */ % if (memcmp(block + 11, backup + 11, 79)) { The backup boot block can be read directly, but I still do some re-blocking for it for some reason. % @@ -235,12 +299,18 @@ % struct bootblock *boot; % { % + u_char iofsinfo[IOSIZE]; % u_char fsinfo[2 * DOSBOOTBLOCKSIZE]; Here DOSBOOTBLOCKSIZE is an obfuscated spelling of 512 or IBM_PC_SECTOR_SIZE_IN_1982 though fsinfo didn't exist until 10(?) years later. (512 was advanced for the time. I used systems with mainly 256-byte sectors and some 128-byte sectors. Having both on the same disk was most complicated.) % + size_t iosize; % + u_int secsize; % % + secsize = boot->BytesPerSec; % + iosize = (secsize >= sizeof fsinfo) ? secsize : sizeof fsinfo; % if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET) % != boot->FSInfo * boot->BytesPerSec % - || read(dosfs, fsinfo, sizeof fsinfo) != sizeof fsinfo) { % + || read(dosfs, iofsinfo, iosize) != (ssize_t)iosize) { % perror("could not read fsinfo block"); % return FSFATAL; % } % + memcpy(fsinfo, iofsinfo, sizeof fsinfo); % fsinfo[0x1e8] = (u_char)boot->FSFree; % fsinfo[0x1e9] = (u_char)(boot->FSFree >> 8); % @@ -251,8 +321,8 @@ % fsinfo[0x1ee] = (u_char)(boot->FSNext >> 16); % fsinfo[0x1ef] = (u_char)(boot->FSNext >> 24); % + memcpy(iofsinfo, fsinfo, sizeof fsinfo); % if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET) % != boot->FSInfo * boot->BytesPerSec % - || write(dosfs, fsinfo, sizeof fsinfo) % - != sizeof fsinfo) { % + || write(dosfs, iofsinfo, iosize) != (ssize_t)iosize) { % perror("Unable to write FSInfo"); % return FSFATAL; I hardly tested fixing or writing back fsinfo. It is only advisory, so it can be replaced by garbage without much loss. fsck_msdosfs doesn't really understand it, and has bugs like asking whether to fix it but only writing the fixes accidentally if it needs to write for other reasons. Bruce From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 21:21:59 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 473F786A; Thu, 30 Oct 2014 21:21:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F35460F; Thu, 30 Oct 2014 21:21:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ULLxi8055652; Thu, 30 Oct 2014 21:21:59 GMT (envelope-from markm@FreeBSD.org) Received: (from markm@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ULLsEw055630; Thu, 30 Oct 2014 21:21:54 GMT (envelope-from markm@FreeBSD.org) Message-Id: <201410302121.s9ULLsEw055630@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markm set sender to markm@FreeBSD.org using -f From: Mark Murray Date: Thu, 30 Oct 2014 21:21:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 21:21:59 -0000 Author: markm Date: Thu Oct 30 21:21:53 2014 New Revision: 273872 URL: https://svnweb.freebsd.org/changeset/base/273872 Log: This is the much-discussed major upgrade to the random(4) device, known to you all as /dev/random. This code has had an extensive rewrite and a good series of reviews, both by the author and other parties. This means a lot of code has been simplified. Pluggable structures for high-rate entropy generators are available, and it is most definitely not the case that /dev/random can be driven by only a hardware souce any more. This has been designed out of the device. Hardware sources are stirred into the CSPRNG (Yarrow, Fortuna) like any other entropy source. Pluggable modules may be written by third parties for additional sources. The harvesting structures and consequently the locking have been simplified. Entropy harvesting is done in a more general way (the documentation for this will follow). There is some GREAT entropy to be had in the UMA allocator, but it is disabled for now as messing with that is likely to annoy many people. The venerable (but effective) Yarrow algorithm, which is no longer supported by its authors now has an alternative, Fortuna. For now, Yarrow is retained as the default algorithm, but this may be changed using a kernel option. It is intended to make Fortuna the default algorithm for 11.0. Interested parties are encouraged to read ISBN 978-0-470-47424-2 "Cryptography Engineering" By Ferguson, Schneier and Kohno for Fortuna's gory details. Heck, read it anyway. Many thanks to Arthur Mesh who did early grunt work, and who got caught in the crossfire rather more than he deserved to. My thanks also to folks who helped me thresh this out on whiteboards and in the odd "Hallway track", or otherwise. My Nomex pants are on. Let the feedback commence! Reviewed by: trasz,des(partial),imp(partial?),rwatson(partial?) Approved by: so(des) Added: head/sys/dev/random/build.sh (contents, props changed) head/sys/dev/random/fortuna.c (contents, props changed) head/sys/dev/random/fortuna.h (contents, props changed) head/sys/dev/random/uint128.h (contents, props changed) head/sys/dev/random/unit_test.c (contents, props changed) head/sys/dev/random/unit_test.h (contents, props changed) head/sys/modules/padlock_rng/ head/sys/modules/padlock_rng/Makefile (contents, props changed) head/sys/modules/rdrand_rng/ head/sys/modules/rdrand_rng/Makefile (contents, props changed) Deleted: head/etc/rc.d/initrandom head/sys/dev/random/harvest.c head/sys/dev/random/rwfile.c head/sys/dev/random/rwfile.h Modified: head/etc/defaults/rc.conf head/etc/rc.d/Makefile head/etc/rc.d/geli head/etc/rc.d/postrandom head/etc/rc.d/random head/libexec/save-entropy/save-entropy.sh head/share/examples/kld/random_adaptor/random_adaptor_example.c head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/dev/glxsb/glxsb.c head/sys/dev/random/dummy_rng.c head/sys/dev/random/hash.c head/sys/dev/random/hash.h head/sys/dev/random/ivy.c head/sys/dev/random/live_entropy_sources.c head/sys/dev/random/live_entropy_sources.h head/sys/dev/random/nehemiah.c head/sys/dev/random/random_adaptors.c head/sys/dev/random/random_adaptors.h head/sys/dev/random/random_harvestq.c head/sys/dev/random/random_harvestq.h head/sys/dev/random/randomdev.c head/sys/dev/random/randomdev.h head/sys/dev/random/randomdev_soft.c head/sys/dev/random/randomdev_soft.h head/sys/dev/random/yarrow.c head/sys/dev/random/yarrow.h head/sys/kern/init_main.c head/sys/kern/kern_intr.c head/sys/kern/subr_bus.c head/sys/modules/Makefile head/sys/modules/random/Makefile head/sys/net/if_ethersubr.c head/sys/net/if_tun.c head/sys/netgraph/ng_iface.c head/sys/sys/random.h head/sys/vm/uma_core.c Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Thu Oct 30 17:58:57 2014 (r273871) +++ head/etc/defaults/rc.conf Thu Oct 30 21:21:53 2014 (r273872) @@ -645,7 +645,7 @@ update_motd="YES" # update version info entropy_file="/entropy" # Set to NO to disable caching entropy through reboots. # /var/db/entropy-file is preferred if / is not avail. entropy_dir="/var/db/entropy" # Set to NO to disable caching entropy via cron. -entropy_save_sz="2048" # Size of the entropy cache files. +entropy_save_sz="4096" # Size of the entropy cache files. entropy_save_num="8" # Number of entropy cache files to save. harvest_interrupt="YES" # Entropy device harvests interrupt randomness harvest_ethernet="YES" # Entropy device harvests ethernet randomness Modified: head/etc/rc.d/Makefile ============================================================================== --- head/etc/rc.d/Makefile Thu Oct 30 17:58:57 2014 (r273871) +++ head/etc/rc.d/Makefile Thu Oct 30 21:21:53 2014 (r273872) @@ -57,7 +57,6 @@ FILES= DAEMON \ hostid_save \ hostname \ inetd \ - initrandom \ ip6addrctl \ ipfilter \ ipfs \ Modified: head/etc/rc.d/geli ============================================================================== --- head/etc/rc.d/geli Thu Oct 30 17:58:57 2014 (r273871) +++ head/etc/rc.d/geli Thu Oct 30 21:21:53 2014 (r273872) @@ -28,7 +28,7 @@ # # PROVIDE: disks -# REQUIRE: initrandom +# REQUIRE: random # KEYWORD: nojail . /etc/rc.subr Modified: head/etc/rc.d/postrandom ============================================================================== --- head/etc/rc.d/postrandom Thu Oct 30 17:58:57 2014 (r273871) +++ head/etc/rc.d/postrandom Thu Oct 30 21:21:53 2014 (r273872) @@ -4,7 +4,7 @@ # # PROVIDE: postrandom -# REQUIRE: initrandom random FILESYSTEMS +# REQUIRE: random FILESYSTEMS # BEFORE: LOGIN # KEYWORD: nojail Modified: head/etc/rc.d/random ============================================================================== --- head/etc/rc.d/random Thu Oct 30 17:58:57 2014 (r273871) +++ head/etc/rc.d/random Thu Oct 30 21:21:53 2014 (r273872) @@ -4,7 +4,7 @@ # # PROVIDE: random -# REQUIRE: initrandom FILESYSTEMS +# REQUIRE: FILESYSTEMS # BEFORE: netif # KEYWORD: nojail shutdown Modified: head/libexec/save-entropy/save-entropy.sh ============================================================================== --- head/libexec/save-entropy/save-entropy.sh Thu Oct 30 17:58:57 2014 (r273871) +++ head/libexec/save-entropy/save-entropy.sh Thu Oct 30 21:21:53 2014 (r273872) @@ -53,7 +53,7 @@ case ${entropy_dir} in ;; esac -entropy_save_sz=${entropy_save_sz:-2048} +entropy_save_sz=${entropy_save_sz:-4096} entropy_save_num=${entropy_save_num:-8} if [ ! -d "${entropy_dir}" ]; then Modified: head/share/examples/kld/random_adaptor/random_adaptor_example.c ============================================================================== --- head/share/examples/kld/random_adaptor/random_adaptor_example.c Thu Oct 30 17:58:57 2014 (r273871) +++ head/share/examples/kld/random_adaptor/random_adaptor_example.c Thu Oct 30 21:21:53 2014 (r273872) @@ -35,17 +35,20 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include +#include +#include +#include -static int random_example_read(void *, int); - -struct random_adaptor random_example = { - .ident = "Example RNG", - .source = RANDOM_PURE_BOGUS, /* Make sure this is in - * sys/random.h and is unique */ - .read = random_example_read, +static void live_random_example_init(void); +static void live_random_example_deinit(void); +static u_int live_random_example_read(void *, u_int); + +struct random_adaptor live_random_example = { + .les_ident = "Example RNG", + .les_source = RANDOM_PURE_BOGUS, /* Make sure this is in + * sys/random.h and is unique */ + .les_read = live_random_example_read, }; /* @@ -58,8 +61,26 @@ getRandomNumber(void) return 4; /* chosen by fair dice roll, guaranteed to be random */ } -static int -random_example_read(void *buf, int c) +static void +live_random_example_init(void) +{ + + /* Do initialisation stuff here */ +} + +static void +live_random_example_deinit(void) +{ + + /* Do de-initialisation stuff here */ +} + +/* get bytes of random stuff into . You may presume + * that is a multiple of 2^n, with n>=3. A typical value + * is c=16. + */ +static u_int +live_random_example_read(void *buf, u_int c) { uint8_t *b; int count; @@ -69,22 +90,23 @@ random_example_read(void *buf, int c) for (count = 0; count < c; count++) b[count] = getRandomNumber(); - printf("returning %d bytes of pure randomness\n", c); + /* printf("returning %d bytes of pure randomness\n", c); */ return (c); } +/* ARGSUSED */ static int -random_example_modevent(module_t mod, int type, void *unused) +live_random_example_modevent(module_t mod __unused, int type, void *unused __unused) { int error = 0; switch (type) { case MOD_LOAD: - live_entropy_source_register(&random_example); + live_entropy_source_register(&live_random_example); break; case MOD_UNLOAD: - live_entropy_source_deregister(&random_example); + live_entropy_source_deregister(&live_random_example); break; case MOD_SHUTDOWN: @@ -98,4 +120,6 @@ random_example_modevent(module_t mod, in return (error); } -LIVE_ENTROPY_SRC_MODULE(live_entropy_source_example, random_example_modevent, 1); +DEV_MODULE(live_random_example, live_random_example_modevent, NULL); +MODULE_VERSION(live_random_example, 1); +MODULE_DEPEND(live_random_example, randomdev, 1, 1, 1); Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Thu Oct 30 17:58:57 2014 (r273871) +++ head/sys/conf/NOTES Thu Oct 30 21:21:53 2014 (r273872) @@ -2993,10 +2993,10 @@ options BROOKTREE_ALLOC_PAGES=(217*4+1) options MAXFILES=999 # Random number generator -options RANDOM_YARROW # Yarrow RNG -##options RANDOM_FORTUNA # Fortuna RNG - not yet implemented +# Only ONE of the below two may be used; they are mutually exclusive. +options RANDOM_YARROW # Yarrow CSPRNG (Default) +#options RANDOM_FORTUNA # Fortuna CSPRNG options RANDOM_DEBUG # Debugging messages -options RANDOM_RWFILE # Read and write entropy cache # Module to enable execution of application via emulators like QEMU options IMAGACT_BINMISC Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Oct 30 17:58:57 2014 (r273871) +++ head/sys/conf/files Thu Oct 30 21:21:53 2014 (r273872) @@ -2132,16 +2132,15 @@ rt2860.fw optional rt2860fw | ralfw \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "rt2860.fw" -dev/random/harvest.c standard -dev/random/dummy_rng.c standard +dev/random/randomdev.c standard dev/random/random_adaptors.c standard -dev/random/live_entropy_sources.c optional random -dev/random/random_harvestq.c optional random -dev/random/randomdev.c optional random +dev/random/dummy_rng.c standard +dev/random/live_entropy_sources.c standard +dev/random/random_harvestq.c standard dev/random/randomdev_soft.c optional random dev/random/yarrow.c optional random +dev/random/fortuna.c optional random dev/random/hash.c optional random -dev/random/rwfile.c optional random dev/rc/rc.c optional rc dev/re/if_re.c optional re dev/rl/if_rl.c optional rl pci Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Thu Oct 30 17:58:57 2014 (r273871) +++ head/sys/conf/options Thu Oct 30 21:21:53 2014 (r273872) @@ -930,4 +930,3 @@ RCTL opt_global.h RANDOM_YARROW opt_random.h RANDOM_FORTUNA opt_random.h RANDOM_DEBUG opt_random.h -RANDOM_RWFILE opt_random.h Modified: head/sys/dev/glxsb/glxsb.c ============================================================================== --- head/sys/dev/glxsb/glxsb.c Thu Oct 30 17:58:57 2014 (r273871) +++ head/sys/dev/glxsb/glxsb.c Thu Oct 30 21:21:53 2014 (r273872) @@ -476,7 +476,7 @@ glxsb_rnd(void *v) if (status & SB_RNS_TRNG_VALID) { value = bus_read_4(sc->sc_sr, SB_RANDOM_NUM); /* feed with one uint32 */ - random_harvest(&value, 4, 32/2, RANDOM_PURE_GLXSB); + random_harvest(&value, sizeof(value), 32/2, RANDOM_PURE_GLXSB); } callout_reset(&sc->sc_rngco, sc->sc_rnghz, glxsb_rnd, sc); Added: head/sys/dev/random/build.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/random/build.sh Thu Oct 30 21:21:53 2014 (r273872) @@ -0,0 +1,24 @@ +# $FreeBSD$ +# +# Basic script to build crude unit tests. +# +cc -g -O0 -pthread -DRANDOM_DEBUG -DRANDOM_YARROW \ + -I../.. -lstdthreads -Wall \ + unit_test.c \ + yarrow.c \ + hash.c \ + ../../crypto/rijndael/rijndael-api-fst.c \ + ../../crypto/rijndael/rijndael-alg-fst.c \ + ../../crypto/sha2/sha2.c \ + ../../crypto/sha2/sha256c.c \ + -o yunit_test +cc -g -O0 -pthread -DRANDOM_DEBUG -DRANDOM_FORTUNA \ + -I../.. -lstdthreads -Wall \ + unit_test.c \ + fortuna.c \ + hash.c \ + ../../crypto/rijndael/rijndael-api-fst.c \ + ../../crypto/rijndael/rijndael-alg-fst.c \ + ../../crypto/sha2/sha2.c \ + ../../crypto/sha2/sha256c.c \ + -o funit_test Modified: head/sys/dev/random/dummy_rng.c ============================================================================== --- head/sys/dev/random/dummy_rng.c Thu Oct 30 17:58:57 2014 (r273871) +++ head/sys/dev/random/dummy_rng.c Thu Oct 30 21:21:53 2014 (r273872) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2013 Arthur Mesh + * Copyright (c) 2013 Mark R V Murray * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,98 +28,92 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_random.h" + #include +#include #include #include +#include #include -#include #include -#include +#include #include -#include -#include #include - -static struct mtx dummy_random_mtx; - -/* Used to fake out unused random calls in random_adaptor */ -static void -random_null_func(void) -{ -} +#include static int -dummy_random_poll(int events __unused, struct thread *td __unused) +dummy_random_zero(void) { return (0); } -static int -dummy_random_block(int flag) +static void +dummy_random(void) { - int error = 0; - - mtx_lock(&dummy_random_mtx); - - /* Blocking logic */ - while (!error) { - if (flag & O_NONBLOCK) - error = EWOULDBLOCK; - else { - printf("random: dummy device blocking on read.\n"); - error = msleep(&dummy_random_block, - &dummy_random_mtx, - PUSER | PCATCH, "block", 0); - } - } - mtx_unlock(&dummy_random_mtx); - - return (error); } +/* ARGSUSED */ static void dummy_random_init(void) { - mtx_init(&dummy_random_mtx, "sleep mtx for dummy_random", - NULL, MTX_DEF); -} - -static void -dummy_random_deinit(void) -{ +#ifdef RANDOM_DEBUG + printf("random: %s\n", __func__); +#endif - mtx_destroy(&dummy_random_mtx); + randomdev_init_reader(dummy_random_read_phony); } -struct random_adaptor dummy_random = { - .ident = "Dummy entropy device that always blocks", - .init = dummy_random_init, - .deinit = dummy_random_deinit, - .block = dummy_random_block, - .poll = dummy_random_poll, - .read = (random_read_func_t *)random_null_func, - .reseed = (random_reseed_func_t *)random_null_func, - .seeded = 0, /* This device can never be seeded */ - .priority = 1, /* Bottom priority, so goes to last position */ -}; - -static int -dummy_random_modevent(module_t mod __unused, int type, void *unused __unused) +/* This is used only by the internal read_random(9) call, and then only + * if no entropy processor is loaded. + * + * Make a token effort to provide _some_ kind of output. No warranty of + * the quality of this output is made, mainly because its lousy. + * + * This is only used by the internal read_random(9) call when no other + * adaptor is active. + * + * It has external scope due to the way things work in + * randomdev_[de]init_reader() that the rest of the world doesn't need to + * know about. + * + * Caveat Emptor. + */ +u_int +dummy_random_read_phony(uint8_t *buf, u_int count) { + /* If no entropy device is loaded, don't spam the console with warnings */ + static int warned = 0; + u_long randval; + size_t size, i; + + if (!warned) { + log(LOG_WARNING, "random device not loaded/active; using insecure pseudo-random number generator\n"); + warned = 1; + } - switch (type) { - case MOD_LOAD: - random_adaptor_register("dummy", &dummy_random); - EVENTHANDLER_INVOKE(random_adaptor_attach, - &dummy_random); + /* srandom() is called in kern/init_main.c:proc0_post() */ - return (0); + /* Fill buf[] with random(9) output */ + for (i = 0; i < count; i += sizeof(randval)) { + randval = random(); + size = MIN(count - i, sizeof(randval)); + memcpy(buf + i, &randval, (size_t)size); } - return (EINVAL); + return (count); } -RANDOM_ADAPTOR_MODULE(dummy, dummy_random_modevent, 1); +struct random_adaptor randomdev_dummy = { + .ra_ident = "Dummy", + .ra_priority = 1, /* Bottom priority, so goes to last position */ + .ra_reseed = dummy_random, + .ra_seeded = (random_adaptor_seeded_func_t *)dummy_random_zero, + .ra_read = (random_adaptor_read_func_t *)dummy_random_zero, + .ra_write = (random_adaptor_write_func_t *)dummy_random_zero, + .ra_init = dummy_random_init, + .ra_deinit = dummy_random, +}; Added: head/sys/dev/random/fortuna.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/random/fortuna.c Thu Oct 30 21:21:53 2014 (r273872) @@ -0,0 +1,433 @@ +/*- + * Copyright (c) 2013-2014 Mark R V Murray + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#ifdef _KERNEL +#include "opt_random.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#else /* !_KERNEL */ +#include +#include +#include +#include +#include +#include +#include + +#include "unit_test.h" + +#include +#include + +#include +#include +#include +#endif /* _KERNEL */ + +#if !defined(RANDOM_YARROW) && !defined(RANDOM_FORTUNA) +#define RANDOM_YARROW +#elif defined(RANDOM_YARROW) && defined(RANDOM_FORTUNA) +#error "Must define either RANDOM_YARROW or RANDOM_FORTUNA" +#endif + +#if defined(RANDOM_FORTUNA) + +#define NPOOLS 32 +#define MINPOOLSIZE 64 +#define DEFPOOLSIZE 256 +#define MAXPOOLSIZE 65536 + +/* This algorithm (and code) presumes that KEYSIZE is twice as large as BLOCKSIZE */ +CTASSERT(BLOCKSIZE == sizeof(uint128_t)); +CTASSERT(KEYSIZE == 2*BLOCKSIZE); + +/* This is the beastie that needs protecting. It contains all of the + * state that we are excited about. + * Exactly one is instantiated. + */ +static struct fortuna_state { + /* P_i */ + struct pool { + u_int length; + struct randomdev_hash hash; + } pool[NPOOLS]; + + /* ReseedCnt */ + u_int reseedcount; + + /* C - 128 bits */ + union { + uint8_t byte[BLOCKSIZE]; + uint128_t whole; + } counter; + + /* K */ + struct randomdev_key key; + + /* Extras */ + u_int minpoolsize; + + /* Extras for the OS */ + +#ifdef _KERNEL + /* For use when 'pacing' the reseeds */ + sbintime_t lasttime; +#endif +} fortuna_state; + +/* The random_reseed_mtx mutex protects seeding and polling/blocking. */ +static mtx_t random_reseed_mtx; + +static struct fortuna_start_cache { + uint8_t junk[PAGE_SIZE]; + size_t length; + struct randomdev_hash hash; +} fortuna_start_cache; + +#ifdef _KERNEL +static struct sysctl_ctx_list random_clist; +RANDOM_CHECK_UINT(minpoolsize, MINPOOLSIZE, MAXPOOLSIZE); +#endif + +void +random_fortuna_init_alg(void) +{ + int i; +#ifdef _KERNEL + struct sysctl_oid *random_fortuna_o; +#endif + + memset(fortuna_start_cache.junk, 0, sizeof(fortuna_start_cache.junk)); + fortuna_start_cache.length = 0U; + randomdev_hash_init(&fortuna_start_cache.hash); + + /* Set up a lock for the reseed process */ +#ifdef _KERNEL + mtx_init(&random_reseed_mtx, "reseed mutex", NULL, MTX_DEF); +#else /* !_KERNEL */ + mtx_init(&random_reseed_mtx, mtx_plain); +#endif /* _KERNEL */ + +#ifdef _KERNEL + /* Fortuna parameters. Do not adjust these unless you have + * have a very good clue about what they do! + */ + random_fortuna_o = SYSCTL_ADD_NODE(&random_clist, + SYSCTL_STATIC_CHILDREN(_kern_random), + OID_AUTO, "fortuna", CTLFLAG_RW, 0, + "Fortuna Parameters"); + + SYSCTL_ADD_PROC(&random_clist, + SYSCTL_CHILDREN(random_fortuna_o), OID_AUTO, + "minpoolsize", CTLTYPE_UINT|CTLFLAG_RW, + &fortuna_state.minpoolsize, DEFPOOLSIZE, + random_check_uint_minpoolsize, "IU", + "Minimum pool size necessary to cause a reseed automatically"); + + fortuna_state.lasttime = 0U; +#endif + + fortuna_state.minpoolsize = DEFPOOLSIZE; + + /* F&S - InitializePRNG() */ + + /* F&S - P_i = \epsilon */ + for (i = 0; i < NPOOLS; i++) { + randomdev_hash_init(&fortuna_state.pool[i].hash); + fortuna_state.pool[i].length = 0U; + } + + /* F&S - ReseedCNT = 0 */ + fortuna_state.reseedcount = 0U; + + /* F&S - InitializeGenerator() */ + + /* F&S - C = 0 */ + uint128_clear(&fortuna_state.counter.whole); + + /* F&S - K = 0 */ + memset(&fortuna_state.key, 0, sizeof(fortuna_state.key)); +} + +void +random_fortuna_deinit_alg(void) +{ + + mtx_destroy(&random_reseed_mtx); + memset(&fortuna_state, 0, sizeof(fortuna_state)); +} + +/* F&S - AddRandomEvent() */ +/* Process a single stochastic event off the harvest queue */ +void +random_fortuna_process_event(struct harvest_event *event) +{ + u_int pl; + + /* We must be locked for all this as plenty of state gets messed with */ + mtx_lock(&random_reseed_mtx); + + /* Accumulate the event into the appropriate pool + * where each event carries the destination information + */ + /* F&S - P_i = P_i| */ + /* The hash_init and hash_finish are done in random_fortuna_read() below */ + pl = event->he_destination % NPOOLS; + randomdev_hash_iterate(&fortuna_state.pool[pl].hash, event, sizeof(*event)); + /* No point in counting above the outside maximum */ + fortuna_state.pool[pl].length += event->he_size; + fortuna_state.pool[pl].length = MIN(fortuna_state.pool[pl].length, MAXPOOLSIZE); + + /* Done with state-messing */ + mtx_unlock(&random_reseed_mtx); +} + +/* F&S - Reseed() */ +/* Reseed Mutex is held */ +static void +reseed(uint8_t *junk, u_int length) +{ + struct randomdev_hash context; + uint8_t hash[KEYSIZE], temp[KEYSIZE]; + + KASSERT(fortuna_state.minpoolsize > 0, ("random: Fortuna threshold = 0")); +#ifdef _KERNEL + mtx_assert(&random_reseed_mtx, MA_OWNED); +#endif + + /* F&S - temp = H(K|s) */ + randomdev_hash_init(&context); + randomdev_hash_iterate(&context, &fortuna_state.key, sizeof(fortuna_state.key)); + randomdev_hash_iterate(&context, junk, length); + randomdev_hash_finish(&context, temp); + + /* F&S - hash = H(temp) */ + randomdev_hash_init(&context); + randomdev_hash_iterate(&context, temp, KEYSIZE); + randomdev_hash_finish(&context, hash); + + /* F&S - K = hash */ + randomdev_encrypt_init(&fortuna_state.key, temp); + memset(temp, 0, sizeof(temp)); + memset(hash, 0, sizeof(hash)); + + /* Unblock the device if it was blocked due to being unseeded */ + if (uint128_is_zero(fortuna_state.counter.whole)) + random_adaptor_unblock(); + /* F&S - C = C + 1 */ + uint128_increment(&fortuna_state.counter.whole); +} + +/* F&S - GenerateBlocks() */ +/* Reseed Mutex is held, and buf points to a whole number of blocks. */ +static __inline void +random_fortuna_genblocks(uint8_t *buf, u_int blockcount) +{ + u_int i; + + for (i = 0u; i < blockcount; i++) { + /* F&S - r = r|E(K,C) */ + randomdev_encrypt(&fortuna_state.key, fortuna_state.counter.byte, buf, BLOCKSIZE); + buf += BLOCKSIZE; + + /* F&S - C = C + 1 */ + uint128_increment(&fortuna_state.counter.whole); + } +} + +/* F&S - PseudoRandomData() */ +/* Reseed Mutex is held, and buf points to a whole number of blocks. */ +static __inline void +random_fortuna_genrandom(uint8_t *buf, u_int bytecount) +{ + static uint8_t temp[BLOCKSIZE*(KEYSIZE/BLOCKSIZE)]; + u_int blockcount; + + /* F&S - assert(n < 2^20) */ + KASSERT((bytecount <= (1 << 20)), ("invalid single read request to fortuna of %d bytes", bytecount)); + + /* F&S - r = first-n-bytes(GenerateBlocks(ceil(n/16))) */ + blockcount = (bytecount + BLOCKSIZE - 1)/BLOCKSIZE; + random_fortuna_genblocks(buf, blockcount); + + /* F&S - K = GenerateBlocks(2) */ + random_fortuna_genblocks(temp, KEYSIZE/BLOCKSIZE); + randomdev_encrypt_init(&fortuna_state.key, temp); + memset(temp, 0, sizeof(temp)); +} + +/* F&S - RandomData() */ +/* Used to return processed entropy from the PRNG */ +/* The argument buf points to a whole number of blocks. */ +void +random_fortuna_read(uint8_t *buf, u_int bytecount) +{ +#ifdef _KERNEL + sbintime_t thistime; +#endif + struct randomdev_hash context; + uint8_t s[NPOOLS*KEYSIZE], temp[KEYSIZE]; + int i; + u_int seedlength; + + /* We must be locked for all this as plenty of state gets messed with */ + mtx_lock(&random_reseed_mtx); + + /* if buf == NULL and bytecount == 0 then this is the pre-read. */ + /* if buf == NULL and bytecount != 0 then this is the post-read; ignore. */ + if (buf == NULL) { + if (bytecount == 0) { + if (fortuna_state.pool[0].length >= fortuna_state.minpoolsize +#ifdef _KERNEL + /* F&S - Use 'getsbinuptime()' to prevent reseed-spamming. */ + && ((thistime = getsbinuptime()) - fortuna_state.lasttime > hz/10) +#endif + ) { +#ifdef _KERNEL + fortuna_state.lasttime = thistime; +#endif + + seedlength = 0U; + /* F&S - ReseedCNT = ReseedCNT + 1 */ + fortuna_state.reseedcount++; + /* s = \epsilon by default */ + for (i = 0; i < NPOOLS; i++) { + /* F&S - if Divides(ReseedCnt, 2^i) ... */ + if ((fortuna_state.reseedcount % (1 << i)) == 0U) { + seedlength += KEYSIZE; + /* F&S - temp = (P_i) */ + randomdev_hash_finish(&fortuna_state.pool[i].hash, temp); + /* F&S - P_i = \epsilon */ + randomdev_hash_init(&fortuna_state.pool[i].hash); + fortuna_state.pool[i].length = 0U; + /* F&S - s = s|H(temp) */ + randomdev_hash_init(&context); + randomdev_hash_iterate(&context, temp, KEYSIZE); + randomdev_hash_finish(&context, s + i*KEYSIZE); + } + else + break; + } +#ifdef RANDOM_DEBUG + printf("random: active reseed: reseedcount [%d] ", fortuna_state.reseedcount); + for (i = 0; i < NPOOLS; i++) + printf(" %d", fortuna_state.pool[i].length); + printf("\n"); +#endif + /* F&S */ + reseed(s, seedlength); + + /* Clean up */ + memset(s, 0, seedlength); + seedlength = 0U; + memset(temp, 0, sizeof(temp)); + memset(&context, 0, sizeof(context)); + } + } + } + /* if buf != NULL do a regular read. */ + else + random_fortuna_genrandom(buf, bytecount); + + mtx_unlock(&random_reseed_mtx); +} + +/* Internal function to hand external entropy to the PRNG */ +void +random_fortuna_write(uint8_t *buf, u_int count) +{ + uint8_t temp[KEYSIZE]; + int i; + uintmax_t timestamp; + + timestamp = get_cyclecount(); + randomdev_hash_iterate(&fortuna_start_cache.hash, ×tamp, sizeof(timestamp)); + randomdev_hash_iterate(&fortuna_start_cache.hash, buf, count); + timestamp = get_cyclecount(); + randomdev_hash_iterate(&fortuna_start_cache.hash, ×tamp, sizeof(timestamp)); + randomdev_hash_finish(&fortuna_start_cache.hash, temp); + for (i = 0; i < KEYSIZE; i++) + fortuna_start_cache.junk[(fortuna_start_cache.length + i)%PAGE_SIZE] ^= temp[i]; + fortuna_start_cache.length += KEYSIZE; + +#ifdef RANDOM_DEBUG + printf("random: %s - ", __func__); + for (i = 0; i < KEYSIZE; i++) + printf("%02X", temp[i]); + printf("\n"); +#endif + + memset(temp, 0, KEYSIZE); + + /* We must be locked for all this as plenty of state gets messed with */ + mtx_lock(&random_reseed_mtx); + + randomdev_hash_init(&fortuna_start_cache.hash); + + reseed(fortuna_start_cache.junk, MIN(PAGE_SIZE, fortuna_start_cache.length)); + memset(fortuna_start_cache.junk, 0, sizeof(fortuna_start_cache.junk)); + + mtx_unlock(&random_reseed_mtx); +} + +void +random_fortuna_reseed(void) +{ + + /* CWOT */ +} + +int +random_fortuna_seeded(void) +{ + + return (!uint128_is_zero(fortuna_state.counter.whole)); +} + +#endif /* RANDOM_FORTUNA */ Added: head/sys/dev/random/fortuna.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/random/fortuna.h Thu Oct 30 21:21:53 2014 (r273872) @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 2013 Mark R V Murray + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef SYS_DEV_RANDOM_FORTUNA_H_INCLUDED +#define SYS_DEV_RANDOM_FORTUNA_H_INCLUDED + +#ifdef _KERNEL +typedef struct mtx mtx_t; +#endif + +void random_fortuna_init_alg(void); +void random_fortuna_deinit_alg(void); +void random_fortuna_read(uint8_t *, u_int); +void random_fortuna_write(uint8_t *, u_int); +void random_fortuna_reseed(void); +int random_fortuna_seeded(void); +void random_fortuna_process_event(struct harvest_event *event); + +#endif Modified: head/sys/dev/random/hash.c ============================================================================== --- head/sys/dev/random/hash.c Thu Oct 30 17:58:57 2014 (r273871) +++ head/sys/dev/random/hash.c Thu Oct 30 21:21:53 2014 (r273872) @@ -28,18 +28,33 @@ #include __FBSDID("$FreeBSD$"); +#ifdef _KERNEL #include #include +#else /* !_KERNEL */ +#include +#include +#include +#include +#include +#include +#include +#include "unit_test.h" +#endif /* _KERNEL */ #include #include #include +/* This code presumes that KEYSIZE is twice as large as BLOCKSIZE */ +CTASSERT(KEYSIZE == 2*BLOCKSIZE); + /* Initialise the hash */ void randomdev_hash_init(struct randomdev_hash *context) { + SHA256_Init(&context->sha); } @@ -47,6 +62,7 @@ randomdev_hash_init(struct randomdev_has void randomdev_hash_iterate(struct randomdev_hash *context, void *data, size_t size) { + SHA256_Update(&context->sha, data, size); } @@ -56,6 +72,7 @@ randomdev_hash_iterate(struct randomdev_ void randomdev_hash_finish(struct randomdev_hash *context, void *buf) { + SHA256_Final(buf, &context->sha); } @@ -66,6 +83,7 @@ randomdev_hash_finish(struct randomdev_h void randomdev_encrypt_init(struct randomdev_key *context, void *data) { + rijndael_cipherInit(&context->cipher, MODE_CBC, NULL); rijndael_makeKey(&context->key, DIR_ENCRYPT, KEYSIZE*8, data); } @@ -75,7 +93,8 @@ randomdev_encrypt_init(struct randomdev_ * a multiple of BLOCKSIZE. */ void -randomdev_encrypt(struct randomdev_key *context, void *d_in, void *d_out, unsigned length) +randomdev_encrypt(struct randomdev_key *context, void *d_in, void *d_out, u_int length) { + rijndael_blockEncrypt(&context->cipher, &context->key, d_in, length*8, d_out); } Modified: head/sys/dev/random/hash.h ============================================================================== --- head/sys/dev/random/hash.h Thu Oct 30 17:58:57 2014 (r273871) +++ head/sys/dev/random/hash.h Thu Oct 30 21:21:53 2014 (r273872) @@ -45,6 +45,6 @@ void randomdev_hash_init(struct randomde void randomdev_hash_iterate(struct randomdev_hash *, void *, size_t); void randomdev_hash_finish(struct randomdev_hash *, void *); void randomdev_encrypt_init(struct randomdev_key *, void *); -void randomdev_encrypt(struct randomdev_key *context, void *, void *, unsigned); +void randomdev_encrypt(struct randomdev_key *context, void *, void *, u_int); #endif Modified: head/sys/dev/random/ivy.c ============================================================================== --- head/sys/dev/random/ivy.c Thu Oct 30 17:58:57 2014 (r273871) +++ head/sys/dev/random/ivy.c Thu Oct 30 21:21:53 2014 (r273872) @@ -35,11 +35,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include -#include #include #include @@ -47,18 +47,17 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include #include +#include #define RETRY_COUNT 10 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 22:02:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F0385CB1; Thu, 30 Oct 2014 22:02:18 +0000 (UTC) Received: from mail-pa0-x232.google.com (mail-pa0-x232.google.com [IPv6:2607:f8b0:400e:c03::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B60C79BC; Thu, 30 Oct 2014 22:02:18 +0000 (UTC) Received: by mail-pa0-f50.google.com with SMTP id eu11so6383674pac.9 for ; Thu, 30 Oct 2014 15:02:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=I992PKFa96mO5HMzoKUsBjaT9V7mxMgiALHm7pYDNR4=; b=e22QAKsd2OSVnmdtAqQWfWhhxiVwqdCBaudTIOSDPSzG0P9s+NPLT9JJNElYINR66O MmZJ9P7U9jOLP6xOBnpYM0bC1TV4nvjLBfmQZ+/3S9mpNhNnaOtCOumsUe1bHQqvNRGt da2aOyT/cRoLf7eSdQQg2E0sxIemaEUKWqx38ndaSzSXn44rMOWottS2DwWThyabe3g8 YKOcvOl0zISunskYOuFZfrEh4pL2jRTwIwHnWldpyUFVQAtqTaHhBariciEkkJeFP/BZ h2uMGHBrcvAyG5vgg/PO3XHJuAuUNV4bOP3D6vk+T0oHgunq+SM/O8rmhM/0NApRPnL4 NV5Q== MIME-Version: 1.0 X-Received: by 10.70.133.72 with SMTP id pa8mr19979523pdb.59.1414706538240; Thu, 30 Oct 2014 15:02:18 -0700 (PDT) Received: by 10.70.9.132 with HTTP; Thu, 30 Oct 2014 15:02:18 -0700 (PDT) In-Reply-To: <201410261942.s9QJgjch081623@svn.freebsd.org> References: <201410261942.s9QJgjch081623@svn.freebsd.org> Date: Thu, 30 Oct 2014 18:02:18 -0400 Message-ID: Subject: Re: svn commit: r273707 - in head/sys: compat/freebsd32 kern kgssapi netinet nfs nlm sys From: Benjamin Kaduk To: Mateusz Guzik Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 22:02:19 -0000 On Sun, Oct 26, 2014 at 3:42 PM, Mateusz Guzik wrote: > Author: mjg > Date: Sun Oct 26 19:42:44 2014 > New Revision: 273707 > URL: https://svnweb.freebsd.org/changeset/base/273707 > > Log: > Avoid dynamic syscall overhead for statically compiled modules. > > --- head/sys/sys/sysent.h Sun Oct 26 19:03:06 2014 (r273706) > +++ head/sys/sys/sysent.h Sun Oct 26 19:42:44 2014 (r273707) > @@ -242,10 +248,10 @@ struct syscall_helper_data { > } > > int syscall_register(int *offset, struct sysent *new_sysent, > - struct sysent *old_sysent); > + struct sysent *old_sysent, int flags); > Should __FreeBSD_version have been bumped for the KPI change? I am getting pkg-fallout mail that net/openafs fails to build, now. -Ben From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 22:07:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 88873F33; Thu, 30 Oct 2014 22:07:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 748919F4; Thu, 30 Oct 2014 22:07:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9UM7Uw8075120; Thu, 30 Oct 2014 22:07:30 GMT (envelope-from jmmv@FreeBSD.org) Received: (from jmmv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9UM7UUD075119; Thu, 30 Oct 2014 22:07:30 GMT (envelope-from jmmv@FreeBSD.org) Message-Id: <201410302207.s9UM7UUD075119@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jmmv set sender to jmmv@FreeBSD.org using -f From: Julio Merino Date: Thu, 30 Oct 2014 22:07:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273873 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 22:07:30 -0000 Author: jmmv Date: Thu Oct 30 22:07:29 2014 New Revision: 273873 URL: https://svnweb.freebsd.org/changeset/base/273873 Log: Use the right depend file for each program. bsd.progs.mk generates a separate depend file for every program being built, but then it does not properly tell each submake to use those individual files. Properly propagate the depend file to use. Discovered while preparing the update of atf to 0.21 and noticing that the test programs were not being relinked to the new library. This change is "make tinderbox" clean. Modified: head/share/mk/bsd.progs.mk Modified: head/share/mk/bsd.progs.mk ============================================================================== --- head/share/mk/bsd.progs.mk Thu Oct 30 21:21:53 2014 (r273872) +++ head/share/mk/bsd.progs.mk Thu Oct 30 22:07:29 2014 (r273873) @@ -90,12 +90,16 @@ x.$p= PROG_CXX=$p $p ${p}_p: .PHONY .MAKE (cd ${.CURDIR} && ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS= \ - SUBDIR= PROG=$p ${x.$p}) + SUBDIR= PROG=$p \ + DEPENDFILE=.depend.$p .MAKE.DEPENDFILE=.depend.$p \ + ${x.$p}) .for t in ${PROGS_TARGETS:O:u} $p.$t: .PHONY .MAKE (cd ${.CURDIR} && ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS= \ - SUBDIR= PROG=$p ${x.$p} ${@:E}) + SUBDIR= PROG=$p \ + DEPENDFILE=.depend.$p .MAKE.DEPENDFILE=.depend.$p \ + ${x.$p} ${@:E}) .endfor .endfor From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 22:18:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 074152CB; Thu, 30 Oct 2014 22:18:50 +0000 (UTC) Received: from c.mail.sonic.net (c.mail.sonic.net [64.142.111.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9F19AD4; Thu, 30 Oct 2014 22:18:49 +0000 (UTC) Received: from aurora.physics.berkeley.edu (aurora.Physics.Berkeley.EDU [128.32.117.67]) (authenticated bits=0) by c.mail.sonic.net (8.14.9/8.14.9) with ESMTP id s9UMIenU021663 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 30 Oct 2014 15:18:41 -0700 Message-ID: <5452B940.1090609@freebsd.org> Date: Thu, 30 Oct 2014 15:18:40 -0700 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Doug Ambrisko , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r273865 - in head: sbin/fsck_msdosfs sys/boot/amd64/boot1.efi References: <201410301552.s9UFq1WV098951@svn.freebsd.org> In-Reply-To: <201410301552.s9UFq1WV098951@svn.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Sonic-CAuth: UmFuZG9tSVZnTPuQG0D/ijmDfOCi8A8ruBFO5wSSymW02lkfHCSoiH01fLNO9+CQOOcSzf8NKC2uVKXYVPtkXIIWrujFzh6n1XntWfA3xXk= X-Sonic-ID: C;4j6Us4Jg5BG90IkFBSAIFQ== M;HK4ItIJg5BG90IkFBSAIFQ== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 22:18:50 -0000 You may want to change the generation of boot1.efifat to have a 4096 byte sector size. We also need to find out if all EFI BIOSes can deal with 4096-byte FAT filesystems on 512-byte disks. -Nathan On 10/30/14 08:52, Doug Ambrisko wrote: > Author: ambrisko > Date: Thu Oct 30 15:52:01 2014 > New Revision: 273865 > URL: https://svnweb.freebsd.org/changeset/base/273865 > > Log: > Make UEFI booting of 4Kn disks work: > - convert boot1.efi to corrrectly calculate the lba for what the > media reports and convert the size based on what FreeBSD uses. > The existing code would use the 512 byte lba and convert the > size using 4K byte size. > - make fsck_msdosfs read the boot block as 4K so the read doesn't > fail on a 4Kn drive since FreeBSD will error out parition reads > of a block. Make the bpbBytesPerSec check a multiple of 512 since > it can be 512 or 4K depending on the disk. This allows fsck to > pass checking the EFI partition on a 4Kn disk. > > To create the EFI file system I used: > newfs_msdos -F 32 -S 4096 -c 1 -m 0xf8 > This works for booting 512 and 4Kn disks. > > Caveat is that loader.efi cannot read the 4Kn EFI partition. This isn't > critical right now since boot1.efi will read loader.efi from the ufs > partition. It looks like loader.efi can be fixed via making some of the > 512 bytes reads more flexible. loader.efi doesn't have trouble reading > the ufs partition. This is probably a simple fix. > > I now have FreeBSD installed on a system with 4Kn drives and tested the > same code works on 512. > > MFC after: 1 week > > Modified: > head/sbin/fsck_msdosfs/boot.c > head/sbin/fsck_msdosfs/dosfs.h > head/sys/boot/amd64/boot1.efi/boot1.c > > Modified: head/sbin/fsck_msdosfs/boot.c > ============================================================================== > --- head/sbin/fsck_msdosfs/boot.c Thu Oct 30 15:41:25 2014 (r273864) > +++ head/sbin/fsck_msdosfs/boot.c Thu Oct 30 15:52:01 2014 (r273865) > @@ -181,7 +181,7 @@ readboot(int dosfs, struct bootblock *bo > boot->bpbResSectors + boot->bpbFATs * boot->FATsecs - > CLUST_FIRST * boot->bpbSecPerClust; > > - if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE != 0) { > + if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE_REAL != 0) { > pfatal("Invalid sector size: %u", boot->bpbBytesPerSec); > return FSFATAL; > } > > Modified: head/sbin/fsck_msdosfs/dosfs.h > ============================================================================== > --- head/sbin/fsck_msdosfs/dosfs.h Thu Oct 30 15:41:25 2014 (r273864) > +++ head/sbin/fsck_msdosfs/dosfs.h Thu Oct 30 15:52:01 2014 (r273865) > @@ -30,7 +30,9 @@ > #ifndef DOSFS_H > #define DOSFS_H > > -#define DOSBOOTBLOCKSIZE 512 > +/* support 4Kn disk reads */ > +#define DOSBOOTBLOCKSIZE_REAL 512 > +#define DOSBOOTBLOCKSIZE 4096 > > typedef u_int32_t cl_t; /* type holding a cluster number */ > > > Modified: head/sys/boot/amd64/boot1.efi/boot1.c > ============================================================================== > --- head/sys/boot/amd64/boot1.efi/boot1.c Thu Oct 30 15:41:25 2014 (r273864) > +++ head/sys/boot/amd64/boot1.efi/boot1.c Thu Oct 30 15:52:01 2014 (r273865) > @@ -168,9 +168,12 @@ static int > dskread(void *buf, u_int64_t lba, int nblk) > { > EFI_STATUS status; > + int size; > > + lba = lba / (bootdev->Media->BlockSize / DEV_BSIZE); > + size = nblk * DEV_BSIZE; > status = bootdev->ReadBlocks(bootdev, bootdev->Media->MediaId, lba, > - nblk * bootdev->Media->BlockSize, buf); > + size, buf); > > if (EFI_ERROR(status)) > return (-1); > From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 22:29:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AF3F980C; Thu, 30 Oct 2014 22:29:54 +0000 (UTC) Received: from mail-ie0-x22e.google.com (mail-ie0-x22e.google.com [IPv6:2607:f8b0:4001:c03::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 75776BE9; Thu, 30 Oct 2014 22:29:54 +0000 (UTC) Received: by mail-ie0-f174.google.com with SMTP id x19so136263ier.5 for ; Thu, 30 Oct 2014 15:29:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=5bHuJK/i9JkPRmigXtxGUAjHbQBPREfydF5+rn/HCWg=; b=sId72A17jaqbX6RZmqDBpeVc2THTgw6tOhOX66KEuax6ZTk3wQLxFmIMFe/6bToPXE 2QGi5hAIv2ASFZNBVfY/cTvCRbUtKsS8B4EAh7lY0GcKKEAZzKfIfwTRrMXi53aq7SWX MX+x3PxfjPYjUELgFylcfxQFbqJWMO5e9gmRc35OEek6GllCPUb2rRs2+ExOVMCnPVyf OUvZxs2zv25dldTL1BIjLrGzIQjx14zYX/FnjKuSoMxQyq/BHXAiYgxbxPjLScx0epJ+ DtHfxXn4iFBL7S8iOvRpu8Drz3Eez5ejLA2IYcj3tBolCzKgnlROPaSoiMrxd3icdCL7 7K2Q== MIME-Version: 1.0 X-Received: by 10.107.164.129 with SMTP id d1mr23680213ioj.37.1414708193915; Thu, 30 Oct 2014 15:29:53 -0700 (PDT) Received: by 10.50.193.135 with HTTP; Thu, 30 Oct 2014 15:29:53 -0700 (PDT) In-Reply-To: <5EDC9AC8-D9DE-4C78-86CB-3A64E558633B@gmail.com> References: <201410301626.s9UGQIJS014234@svn.freebsd.org> <5EDC9AC8-D9DE-4C78-86CB-3A64E558633B@gmail.com> Date: Thu, 30 Oct 2014 15:29:53 -0700 Message-ID: Subject: Re: svn commit: r273866 - head/sys/sys From: NGie Cooper To: Josh Paetzel Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 22:29:54 -0000 On Thu, Oct 30, 2014 at 9:36 AM, Garrett Cooper wrote: > >> On Oct 30, 2014, at 09:26, Josh Paetzel wrote: >> >> Author: jpaetzel >> Date: Thu Oct 30 16:26:17 2014 >> New Revision: 273866 >> URL: https://svnweb.freebsd.org/changeset/base/273866 >> >> Log: >> Plug memory ordering holes in buf_ring_enqueue. For at least some >> users this patch eliminates the races previously discussed on the >> mailing list. > > Hi Josh! > Do you have a link to the discussion thread you can provide? > Thank you! Josh sent me the link offline; just for the record it was http://lists.freebsd.org/pipermail/freebsd-net/2013-December/037267.html . From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 22:47:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9803CE61; Thu, 30 Oct 2014 22:47:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84A3FDC8; Thu, 30 Oct 2014 22:47:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9UMlXBk095073; Thu, 30 Oct 2014 22:47:33 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9UMlXIL095072; Thu, 30 Oct 2014 22:47:33 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410302247.s9UMlXIL095072@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 30 Oct 2014 22:47:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273875 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 22:47:33 -0000 Author: mjg Date: Thu Oct 30 22:47:32 2014 New Revision: 273875 URL: https://svnweb.freebsd.org/changeset/base/273875 Log: Bump FreeBSD_version due to syscall*_register API changes in r273707 Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Thu Oct 30 22:21:12 2014 (r273874) +++ head/sys/sys/param.h Thu Oct 30 22:47:32 2014 (r273875) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100040 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100041 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 22:50:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 171F6101; Thu, 30 Oct 2014 22:50:17 +0000 (UTC) Received: from mail-wg0-x232.google.com (mail-wg0-x232.google.com [IPv6:2a00:1450:400c:c00::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3371EDE8; Thu, 30 Oct 2014 22:50:16 +0000 (UTC) Received: by mail-wg0-f50.google.com with SMTP id z12so5273888wgg.23 for ; Thu, 30 Oct 2014 15:50:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=WToyaNnulDXkAYef5IE0fVpdIOGOzPbXPkbuWn2zt58=; b=vEI5ty8+CN4+SIG0B20WVOZsM2Td1XSI1l33F5U8FmIb6kqW62p27Zp/4IytmzM1LI cJJRgLEANkxsC3+gy5xNgdCt6EKRtm+Lu/AYSwTVYB8moHE4p21Xys488wTrnmjjK3za 3orhSTqbZK0vJKaP/JDI9rynNaCAIrE6+xy/ufVphToVlMfvSO80zizvfgx/v+CKo3VC dkImO+0kjijOVeP734SeeFR3o24AKKmew9CXa6GU/g2y61Ha7oXWoluonL0PbUcJnCLl zMwd7uEc0sDrad2BJNG4l1eBGjyZWbtZG9Yy7tBDRCgRLNDT2rIC47VV2wZubyIwrCwH WDfQ== X-Received: by 10.180.8.233 with SMTP id u9mr23220739wia.19.1414709414377; Thu, 30 Oct 2014 15:50:14 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id 10sm10192035wjs.21.2014.10.30.15.50.13 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 30 Oct 2014 15:50:13 -0700 (PDT) Date: Thu, 30 Oct 2014 23:50:11 +0100 From: Mateusz Guzik To: Benjamin Kaduk Subject: Re: svn commit: r273707 - in head/sys: compat/freebsd32 kern kgssapi netinet nfs nlm sys Message-ID: <20141030225011.GA22357@dft-labs.eu> References: <201410261942.s9QJgjch081623@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 22:50:17 -0000 On Thu, Oct 30, 2014 at 06:02:18PM -0400, Benjamin Kaduk wrote: > On Sun, Oct 26, 2014 at 3:42 PM, Mateusz Guzik wrote: > > > Author: mjg > > Date: Sun Oct 26 19:42:44 2014 > > New Revision: 273707 > > URL: https://svnweb.freebsd.org/changeset/base/273707 > > > > Log: > > Avoid dynamic syscall overhead for statically compiled modules. > > > > > > --- head/sys/sys/sysent.h Sun Oct 26 19:03:06 2014 (r273706) > > +++ head/sys/sys/sysent.h Sun Oct 26 19:42:44 2014 (r273707) > > @@ -242,10 +248,10 @@ struct syscall_helper_data { > > } > > > > int syscall_register(int *offset, struct sysent *new_sysent, > > - struct sysent *old_sysent); > > + struct sysent *old_sysent, int flags); > > > > Should __FreeBSD_version have been bumped for the KPI change? > I am getting pkg-fallout mail that net/openafs fails to build, now. > Right, bumped in https://svnweb.freebsd.org/changeset/base/273875 Thanks for reporting. -- Mateusz Guzik From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 23:12:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 025D75C8; Thu, 30 Oct 2014 23:12:56 +0000 (UTC) Received: from mail.ambrisko.com (mail.ambrisko.com [70.91.206.90]) by mx1.freebsd.org (Postfix) with ESMTP id B73FCB5; Thu, 30 Oct 2014 23:12:55 +0000 (UTC) X-Ambrisko-Me: Yes Received: from server2.ambrisko.com (HELO internal.ambrisko.com) ([192.168.1.2]) by ironport.ambrisko.com with ESMTP; 30 Oct 2014 16:16:32 -0700 Received: from ambrisko.com (localhost [127.0.0.1]) by internal.ambrisko.com (8.14.4/8.14.4) with ESMTP id s9UNCrpG051590; Thu, 30 Oct 2014 16:12:53 -0700 (PDT) (envelope-from ambrisko@ambrisko.com) Received: (from ambrisko@localhost) by ambrisko.com (8.14.4/8.14.4/Submit) id s9UNCrW1051589; Thu, 30 Oct 2014 16:12:53 -0700 (PDT) (envelope-from ambrisko) Date: Thu, 30 Oct 2014 16:12:53 -0700 From: Doug Ambrisko To: Nathan Whitehorn Subject: Re: svn commit: r273865 - in head: sbin/fsck_msdosfs sys/boot/amd64/boot1.efi Message-ID: <20141030231253.GA50728@ambrisko.com> References: <201410301552.s9UFq1WV098951@svn.freebsd.org> <5452B940.1090609@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5452B940.1090609@freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Doug Ambrisko , svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 23:12:56 -0000 On Thu, Oct 30, 2014 at 03:18:40PM -0700, Nathan Whitehorn wrote: | You may want to change the generation of boot1.efifat to have a 4096 | byte sector size. We also need to find out if all EFI BIOSes can deal | with 4096-byte FAT filesystems on 512-byte disks. Yes, there is more work in general to make this fully working. Atleast this give people a starting point. It looks like we should be able to test this with Qemu since it takes a physical sector size as an argument. Hopefully makefs can learn to do FAT32 and avoid these issues. Bruce's comments are good and I'll take a look his suggested changes. Right now I'm trying to figure out why UEFI PXE is hanging after the first file is looked up on some machines. Thanks, Doug A. | On 10/30/14 08:52, Doug Ambrisko wrote: | >Author: ambrisko | >Date: Thu Oct 30 15:52:01 2014 | >New Revision: 273865 | >URL: https://svnweb.freebsd.org/changeset/base/273865 | > | >Log: | > Make UEFI booting of 4Kn disks work: | > - convert boot1.efi to corrrectly calculate the lba for what | > the | > media reports and convert the size based on what FreeBSD uses. | > The existing code would use the 512 byte lba and convert the | > size using 4K byte size. | > - make fsck_msdosfs read the boot block as 4K so the read | > doesn't | > fail on a 4Kn drive since FreeBSD will error out parition reads | > of a block. Make the bpbBytesPerSec check a multiple of 512 since | > it can be 512 or 4K depending on the disk. This allows fsck to | > pass checking the EFI partition on a 4Kn disk. | > | > To create the EFI file system I used: | > newfs_msdos -F 32 -S 4096 -c 1 -m 0xf8 | > This works for booting 512 and 4Kn disks. | > | > Caveat is that loader.efi cannot read the 4Kn EFI partition. This isn't | > critical right now since boot1.efi will read loader.efi from the ufs | > partition. It looks like loader.efi can be fixed via making some of the | > 512 bytes reads more flexible. loader.efi doesn't have trouble reading | > the ufs partition. This is probably a simple fix. | > | > I now have FreeBSD installed on a system with 4Kn drives and tested the | > same code works on 512. | > | > MFC after: 1 week | > | >Modified: | > head/sbin/fsck_msdosfs/boot.c | > head/sbin/fsck_msdosfs/dosfs.h | > head/sys/boot/amd64/boot1.efi/boot1.c | > | >Modified: head/sbin/fsck_msdosfs/boot.c | >============================================================================== | >--- head/sbin/fsck_msdosfs/boot.c Thu Oct 30 15:41:25 2014 (r273864) | >+++ head/sbin/fsck_msdosfs/boot.c Thu Oct 30 15:52:01 2014 (r273865) | >@@ -181,7 +181,7 @@ readboot(int dosfs, struct bootblock *bo | > boot->bpbResSectors + boot->bpbFATs * boot->FATsecs - | > CLUST_FIRST * boot->bpbSecPerClust; | > | >- if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE != 0) { | >+ if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE_REAL != 0) { | > pfatal("Invalid sector size: %u", boot->bpbBytesPerSec); | > return FSFATAL; | > } | > | >Modified: head/sbin/fsck_msdosfs/dosfs.h | >============================================================================== | >--- head/sbin/fsck_msdosfs/dosfs.h Thu Oct 30 15:41:25 2014 (r273864) | >+++ head/sbin/fsck_msdosfs/dosfs.h Thu Oct 30 15:52:01 2014 (r273865) | >@@ -30,7 +30,9 @@ | > #ifndef DOSFS_H | > #define DOSFS_H | > | >-#define DOSBOOTBLOCKSIZE 512 | >+/* support 4Kn disk reads */ | >+#define DOSBOOTBLOCKSIZE_REAL 512 | >+#define DOSBOOTBLOCKSIZE 4096 | > | > typedef u_int32_t cl_t; /* type holding a cluster number */ | > | > | >Modified: head/sys/boot/amd64/boot1.efi/boot1.c | >============================================================================== | >--- head/sys/boot/amd64/boot1.efi/boot1.c Thu Oct 30 15:41:25 2014 | >(r273864) | >+++ head/sys/boot/amd64/boot1.efi/boot1.c Thu Oct 30 15:52:01 2014 | >(r273865) | >@@ -168,9 +168,12 @@ static int | > dskread(void *buf, u_int64_t lba, int nblk) | > { | > EFI_STATUS status; | >+ int size; | > | >+ lba = lba / (bootdev->Media->BlockSize / DEV_BSIZE); | >+ size = nblk * DEV_BSIZE; | > status = bootdev->ReadBlocks(bootdev, bootdev->Media->MediaId, lba, | >- nblk * bootdev->Media->BlockSize, buf); | >+ size, buf); | > | > if (EFI_ERROR(status)) | > return (-1); | > From owner-svn-src-head@FreeBSD.ORG Thu Oct 30 23:47:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BDE4E9F8; Thu, 30 Oct 2014 23:47:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA15D38F; Thu, 30 Oct 2014 23:47:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9UNlTcu026158; Thu, 30 Oct 2014 23:47:29 GMT (envelope-from hiren@FreeBSD.org) Received: (from hiren@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9UNlTY5026157; Thu, 30 Oct 2014 23:47:29 GMT (envelope-from hiren@FreeBSD.org) Message-Id: <201410302347.s9UNlTY5026157@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hiren set sender to hiren@FreeBSD.org using -f From: Hiren Panchasara Date: Thu, 30 Oct 2014 23:47:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273876 - head/sys/mips/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 23:47:29 -0000 Author: hiren Date: Thu Oct 30 23:47:28 2014 New Revision: 273876 URL: https://svnweb.freebsd.org/changeset/base/273876 Log: Use search method instead of fixed offsets for finding rootfs. This unbreaks recent images for picostation by allowing to find rootfs at correct location. Suggested by: loos MFC after: 1 month Modified: head/sys/mips/conf/PICOSTATION_M2HP.hints Modified: head/sys/mips/conf/PICOSTATION_M2HP.hints ============================================================================== --- head/sys/mips/conf/PICOSTATION_M2HP.hints Thu Oct 30 22:47:32 2014 (r273875) +++ head/sys/mips/conf/PICOSTATION_M2HP.hints Thu Oct 30 23:47:28 2014 (r273876) @@ -80,13 +80,13 @@ hint.map.1.readonly=1 hint.map.2.at="flash/spi0" hint.map.2.start=0x00050000 -hint.map.2.end=0x00130000 # 896k kernel +hint.map.2.end="search:0x00100000:0x10000:.!/bin/sh" hint.map.2.name="kernel" hint.map.2.readonly=1 hint.map.3.at="flash/spi0" -hint.map.3.start=0x130000 -hint.map.3.end=0x007b0000 # 6656k rootfs +hint.map.3.start="search:0x00100000:0x10000:.!/bin/sh" +hint.map.3.end=0x007b0000 hint.map.3.name="rootfs" hint.map.3.readonly=0 From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 03:24:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 61C26D60 for ; Fri, 31 Oct 2014 03:24:42 +0000 (UTC) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com [209.85.215.45]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D8F39BF1 for ; Fri, 31 Oct 2014 03:24:41 +0000 (UTC) Received: by mail-la0-f45.google.com with SMTP id pn19so131994lab.4 for ; Thu, 30 Oct 2014 20:24:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=ppamuKD1BoTDWSslMyUaFEf+HWc8D/aWt0zhkQEAw+A=; b=mPiX6hADiX3da/CW32aOqI3OByb1TOynvGUy85/PU3iYRgEMbVnEekJvOFQLWcxEy4 Tr1K5JKzT63xE809EBpJ8uR77DcW3mhGoN3pUhxSdwC04QHVAmZlXdruu9FIPvQJ8STH ihClCTWNBMG2SZPlwJKcx9qdPpXuTTQ9TzxZJH3GViap9ajofnEeARqKbXn78JBMVASx y2WUCFxeeuud5CsnVbr9r+PLv4OvqK8f8Rjv+zwsCP7X9ern+iFT+12kcJ3K41LaDAor YhHGSyHIGx6NIdtZdgrpmmeNkfjGQ/k0jNxyynE37JFJI2mv2jlFdHBiDO/jksC10r1u QQ5Q== X-Gm-Message-State: ALoCoQnuNt0UY8DLY43AG5UE4DEceNoQ1nCYXSZORGa4ZJ7KefW2GeYZR9AjO56O/Pqm3fCnUOLW X-Received: by 10.152.5.129 with SMTP id s1mr23500551las.59.1414725879537; Thu, 30 Oct 2014 20:24:39 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id ak7sm3913337lbc.12.2014.10.30.20.24.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Oct 2014 20:24:38 -0700 (PDT) Message-ID: <545300F6.9070306@freebsd.org> Date: Fri, 31 Oct 2014 06:24:38 +0300 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Mark Murray , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... References: <201410302121.s9ULLsEw055630@svn.freebsd.org> In-Reply-To: <201410302121.s9ULLsEw055630@svn.freebsd.org> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 03:24:42 -0000 On 31.10.2014 0:21, Mark Murray wrote: > Deleted: > head/etc/rc.d/initrandom It should be added to ObsoleteFiles.inc -- http://ache.vniz.net/ From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 04:01:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 42D572B9; Fri, 31 Oct 2014 04:01:44 +0000 (UTC) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebius.int.ru", Issuer "cell.glebius.int.ru" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BC3CBEEC; Fri, 31 Oct 2014 04:01:42 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.9/8.14.9) with ESMTP id s9V41XgD019492 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 31 Oct 2014 07:01:33 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.9/8.14.9/Submit) id s9V41X4l019491; Fri, 31 Oct 2014 07:01:33 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 31 Oct 2014 07:01:33 +0300 From: Gleb Smirnoff To: John Baldwin Subject: Re: svn commit: r273834 - head/usr.sbin/etcupdate Message-ID: <20141031040133.GF1031@FreeBSD.org> References: <201410291801.s9TI1Ap0068710@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410291801.s9TI1Ap0068710@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 04:01:44 -0000 On Wed, Oct 29, 2014 at 06:01:10PM +0000, John Baldwin wrote: J> Author: jhb J> Date: Wed Oct 29 18:01:09 2014 J> New Revision: 273834 J> URL: https://svnweb.freebsd.org/changeset/base/273834 J> J> Log: J> Rework the EXAMPLES section to be a bit clearer. J> - Add an example of using etcupdate diff. J> - Create a subsection on bootstrapping that is below the simple J> examples. This should make it clearer that 'etcupdate extract' is J> a one-time operation and not part of the common workflow. It also J> adds more suggestions on when bootstrapping is needed and additional J> steps to make future merges simpler. J> J> Reviewed by: adrian J> MFC after: 3 days Thanks a lot for clarification! -- Totus tuus, Glebius. From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 05:41:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2E51F95; Fri, 31 Oct 2014 05:41:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A5F0919; Fri, 31 Oct 2014 05:41:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9V5fRRn001797; Fri, 31 Oct 2014 05:41:27 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9V5fRll001796; Fri, 31 Oct 2014 05:41:27 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410310541.s9V5fRll001796@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 31 Oct 2014 05:41:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273878 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 05:41:28 -0000 Author: mjg Date: Fri Oct 31 05:41:27 2014 New Revision: 273878 URL: https://svnweb.freebsd.org/changeset/base/273878 Log: filedesc: tidy up fdcopy a little bit Test for file availability by fde_file != NULL instead of fdisused, this is consistent with similar checks later. Drop badfileops check. badfileops don't have DFLAG_PASSABLE set, so it was never reached in practice. fdiused is now only used in some KASSERTS, so ifdef it under INVARIANTS. No functional changes. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Oct 31 04:01:10 2014 (r273877) +++ head/sys/kern/kern_descrip.c Fri Oct 31 05:41:27 2014 (r273878) @@ -233,6 +233,7 @@ fd_last_used(struct filedesc *fdp, int s return (-1); } +#ifdef INVARIANTS static int fdisused(struct filedesc *fdp, int fd) { @@ -244,6 +245,7 @@ fdisused(struct filedesc *fdp, int fd) return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) != 0); } +#endif /* * Mark a file descriptor as used. @@ -1920,9 +1922,8 @@ fdcopy(struct filedesc *fdp) newfdp->fd_freefile = -1; for (i = 0; i <= fdp->fd_lastfile; ++i) { ofde = &fdp->fd_ofiles[i]; - if (fdisused(fdp, i) && - (ofde->fde_file->f_ops->fo_flags & DFLAG_PASSABLE) && - ofde->fde_file->f_ops != &badfileops) { + if (ofde->fde_file != NULL && + ofde->fde_file->f_ops->fo_flags & DFLAG_PASSABLE) { nfde = &newfdp->fd_ofiles[i]; *nfde = *ofde; filecaps_copy(&ofde->fde_caps, &nfde->fde_caps); From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 09:16:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D8A71478; Fri, 31 Oct 2014 09:16:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA7C7D6; Fri, 31 Oct 2014 09:16:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9V9G0tN001506; Fri, 31 Oct 2014 09:16:00 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9V9G0VT001505; Fri, 31 Oct 2014 09:16:00 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410310916.s9V9G0VT001505@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 31 Oct 2014 09:16:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273893 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 09:16:01 -0000 Author: mjg Date: Fri Oct 31 09:15:59 2014 New Revision: 273893 URL: https://svnweb.freebsd.org/changeset/base/273893 Log: filedesc: tidy up fdfree Implement fdefree_last variant and get rid of 'last' parameter. No functional changes. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Oct 31 08:14:13 2014 (r273892) +++ head/sys/kern/kern_descrip.c Fri Oct 31 09:15:59 2014 (r273893) @@ -291,18 +291,22 @@ fdunused(struct filedesc *fdp, int fd) * Avoid some work if fdp is about to be destroyed. */ static inline void -_fdfree(struct filedesc *fdp, int fd, int last) +fdefree_last(struct filedescent *fde) +{ + + filecaps_free(&fde->fde_caps); +} + +static inline void +fdfree(struct filedesc *fdp, int fd) { struct filedescent *fde; fde = &fdp->fd_ofiles[fd]; #ifdef CAPABILITIES - if (!last) - seq_write_begin(&fde->fde_seq); + seq_write_begin(&fde->fde_seq); #endif - filecaps_free(&fde->fde_caps); - if (last) - return; + fdefree_last(fde); bzero(fde, fde_change_size); fdunused(fdp, fd); #ifdef CAPABILITIES @@ -310,20 +314,6 @@ _fdfree(struct filedesc *fdp, int fd, in #endif } -static inline void -fdfree(struct filedesc *fdp, int fd) -{ - - _fdfree(fdp, fd, 0); -} - -static inline void -fdfree_last(struct filedesc *fdp, int fd) -{ - - _fdfree(fdp, fd, 1); -} - /* * System calls on descriptors. */ @@ -1956,6 +1946,7 @@ fdescfree(struct thread *td) struct filedesc *fdp; int i; struct filedesc_to_leader *fdtol; + struct filedescent *fde; struct file *fp; struct vnode *cdir, *jdir, *rdir, *vp; struct flock lf; @@ -2055,9 +2046,10 @@ fdescfree(struct thread *td) FILEDESC_XUNLOCK(fdp); for (i = 0; i <= fdp->fd_lastfile; i++) { - fp = fdp->fd_ofiles[i].fde_file; + fde = &fdp->fd_ofiles[i]; + fp = fde->fde_file; if (fp != NULL) { - fdfree_last(fdp, i); + fdefree_last(fde); (void) closef(fp, td); } } From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 09:19:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D89F26C7; Fri, 31 Oct 2014 09:19:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAB25100; Fri, 31 Oct 2014 09:19:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9V9JlXx002154; Fri, 31 Oct 2014 09:19:47 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9V9JlOd002153; Fri, 31 Oct 2014 09:19:47 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410310919.s9V9JlOd002153@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 31 Oct 2014 09:19:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273894 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 09:19:48 -0000 Author: mjg Date: Fri Oct 31 09:19:46 2014 New Revision: 273894 URL: https://svnweb.freebsd.org/changeset/base/273894 Log: filedesc: iterate over fd table only once in fdcopy While here add 'fdused_init' which does not perform unnecessary work. Drop FILEDESC_LOCK_ASSERT from fdisused and rely on callers to hold it when appropriate. This function is only used with INVARIANTS. No functional changes intended. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Oct 31 09:15:59 2014 (r273893) +++ head/sys/kern/kern_descrip.c Fri Oct 31 09:19:46 2014 (r273894) @@ -238,8 +238,6 @@ static int fdisused(struct filedesc *fdp, int fd) { - FILEDESC_LOCK_ASSERT(fdp); - KASSERT(fd >= 0 && fd < fdp->fd_nfiles, ("file descriptor %d out of range (0, %d)", fd, fdp->fd_nfiles)); @@ -251,14 +249,21 @@ fdisused(struct filedesc *fdp, int fd) * Mark a file descriptor as used. */ static void -fdused(struct filedesc *fdp, int fd) +fdused_init(struct filedesc *fdp, int fd) { - FILEDESC_XLOCK_ASSERT(fdp); - KASSERT(!fdisused(fdp, fd), ("fd=%d is already used", fd)); fdp->fd_map[NDSLOT(fd)] |= NDBIT(fd); +} + +static void +fdused(struct filedesc *fdp, int fd) +{ + + FILEDESC_XLOCK_ASSERT(fdp); + + fdused_init(fdp, fd); if (fd > fdp->fd_lastfile) fdp->fd_lastfile = fd; if (fd == fdp->fd_freefile) @@ -1912,28 +1917,23 @@ fdcopy(struct filedesc *fdp) newfdp->fd_freefile = -1; for (i = 0; i <= fdp->fd_lastfile; ++i) { ofde = &fdp->fd_ofiles[i]; - if (ofde->fde_file != NULL && - ofde->fde_file->f_ops->fo_flags & DFLAG_PASSABLE) { - nfde = &newfdp->fd_ofiles[i]; - *nfde = *ofde; - filecaps_copy(&ofde->fde_caps, &nfde->fde_caps); - fhold(nfde->fde_file); - newfdp->fd_lastfile = i; - } else { + if (ofde->fde_file == NULL || + (ofde->fde_file->f_ops->fo_flags & DFLAG_PASSABLE) == 0) { if (newfdp->fd_freefile == -1) newfdp->fd_freefile = i; + continue; } - } - newfdp->fd_cmask = fdp->fd_cmask; - FILEDESC_SUNLOCK(fdp); - FILEDESC_XLOCK(newfdp); - for (i = 0; i <= newfdp->fd_lastfile; ++i) { - if (newfdp->fd_ofiles[i].fde_file != NULL) - fdused(newfdp, i); + nfde = &newfdp->fd_ofiles[i]; + *nfde = *ofde; + filecaps_copy(&ofde->fde_caps, &nfde->fde_caps); + fhold(nfde->fde_file); + fdused_init(newfdp, i); + newfdp->fd_lastfile = i; } if (newfdp->fd_freefile == -1) newfdp->fd_freefile = i; - FILEDESC_XUNLOCK(newfdp); + newfdp->fd_cmask = fdp->fd_cmask; + FILEDESC_SUNLOCK(fdp); return (newfdp); } From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 09:25:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 35FBAB6F; Fri, 31 Oct 2014 09:25:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 21A7A1ED; Fri, 31 Oct 2014 09:25:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9V9PTLc006496; Fri, 31 Oct 2014 09:25:29 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9V9PT62006495; Fri, 31 Oct 2014 09:25:29 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410310925.s9V9PT62006495@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 31 Oct 2014 09:25:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273895 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 09:25:29 -0000 Author: mjg Date: Fri Oct 31 09:25:28 2014 New Revision: 273895 URL: https://svnweb.freebsd.org/changeset/base/273895 Log: filedesc: make fdinit return with source filedesc locked and new one sized appropriately Assert FILEDESC_XLOCK_ASSERT only for already used tables in fdgrowtable. We don't have to call it with the lock held if we are just creating new filedesc. As a side note, strictly speaking processes can have fdtables with fd_lastfile = -1, but then they cannot enter fdgrowtable. Very first file descriptor they get will be 0 and the only syscall allowing to choose fd number requires an active file descriptor. Should this ever change, we can add an 'init' (or similar) parameter to fdgrowtable. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Oct 31 09:19:46 2014 (r273894) +++ head/sys/kern/kern_descrip.c Fri Oct 31 09:25:28 2014 (r273895) @@ -1524,7 +1524,13 @@ fdgrowtable(struct filedesc *fdp, int nf int nnfiles, onfiles; NDSLOTTYPE *nmap, *omap; - FILEDESC_XLOCK_ASSERT(fdp); + /* + * If lastfile is -1 this struct filedesc was just allocated and we are + * growing it to accomodate for the one we are going to copy from. There + * is no need to have a lock on this one as it's not visible to anyone. + */ + if (fdp->fd_lastfile != -1) + FILEDESC_XLOCK_ASSERT(fdp); KASSERT(fdp->fd_nfiles > 0, ("zero-length file table")); @@ -1791,37 +1797,52 @@ finstall(struct thread *td, struct file /* * Build a new filedesc structure from another. * Copy the current, root, and jail root vnode references. + * + * If fdp is not NULL, return with it shared locked. */ struct filedesc * fdinit(struct filedesc *fdp) { - struct filedesc0 *newfdp; + struct filedesc0 *newfdp0; + struct filedesc *newfdp; - newfdp = malloc(sizeof *newfdp, M_FILEDESC, M_WAITOK | M_ZERO); - FILEDESC_LOCK_INIT(&newfdp->fd_fd); - if (fdp != NULL) { - FILEDESC_SLOCK(fdp); - newfdp->fd_fd.fd_cdir = fdp->fd_cdir; - if (newfdp->fd_fd.fd_cdir) - VREF(newfdp->fd_fd.fd_cdir); - newfdp->fd_fd.fd_rdir = fdp->fd_rdir; - if (newfdp->fd_fd.fd_rdir) - VREF(newfdp->fd_fd.fd_rdir); - newfdp->fd_fd.fd_jdir = fdp->fd_jdir; - if (newfdp->fd_fd.fd_jdir) - VREF(newfdp->fd_fd.fd_jdir); + newfdp0 = malloc(sizeof *newfdp0, M_FILEDESC, M_WAITOK | M_ZERO); + newfdp = &newfdp0->fd_fd; + + /* Create the file descriptor table. */ + FILEDESC_LOCK_INIT(newfdp); + newfdp->fd_refcnt = 1; + newfdp->fd_holdcnt = 1; + newfdp->fd_cmask = CMASK; + newfdp->fd_map = newfdp0->fd_dmap; + newfdp->fd_lastfile = -1; + newfdp->fd_files = (struct fdescenttbl *)&newfdp0->fd_dfiles; + newfdp->fd_files->fdt_nfiles = NDFILE; + + if (fdp == NULL) + return (newfdp); + + if (fdp->fd_lastfile >= newfdp->fd_nfiles) + fdgrowtable(newfdp, fdp->fd_lastfile + 1); + + FILEDESC_SLOCK(fdp); + newfdp->fd_cdir = fdp->fd_cdir; + if (newfdp->fd_cdir) + VREF(newfdp->fd_cdir); + newfdp->fd_rdir = fdp->fd_rdir; + if (newfdp->fd_rdir) + VREF(newfdp->fd_rdir); + newfdp->fd_jdir = fdp->fd_jdir; + if (newfdp->fd_jdir) + VREF(newfdp->fd_jdir); + + while (fdp->fd_lastfile >= newfdp->fd_nfiles) { FILEDESC_SUNLOCK(fdp); + fdgrowtable(newfdp, fdp->fd_lastfile + 1); + FILEDESC_SLOCK(fdp); } - /* Create the file descriptor table. */ - newfdp->fd_fd.fd_refcnt = 1; - newfdp->fd_fd.fd_holdcnt = 1; - newfdp->fd_fd.fd_cmask = CMASK; - newfdp->fd_dfiles.fdt_nfiles = NDFILE; - newfdp->fd_fd.fd_files = (struct fdescenttbl *)&newfdp->fd_dfiles; - newfdp->fd_fd.fd_map = newfdp->fd_dmap; - newfdp->fd_fd.fd_lastfile = -1; - return (&newfdp->fd_fd); + return (newfdp); } static struct filedesc * @@ -1905,14 +1926,6 @@ fdcopy(struct filedesc *fdp) return (NULL); newfdp = fdinit(fdp); - FILEDESC_SLOCK(fdp); - while (fdp->fd_lastfile >= newfdp->fd_nfiles) { - FILEDESC_SUNLOCK(fdp); - FILEDESC_XLOCK(newfdp); - fdgrowtable(newfdp, fdp->fd_lastfile + 1); - FILEDESC_XUNLOCK(newfdp); - FILEDESC_SLOCK(fdp); - } /* copy all passable descriptors (i.e. not kqueue) */ newfdp->fd_freefile = -1; for (i = 0; i <= fdp->fd_lastfile; ++i) { From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 09:51:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E791B812; Fri, 31 Oct 2014 09:51:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C81A27B3; Fri, 31 Oct 2014 09:51:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9V9ptp5020442; Fri, 31 Oct 2014 09:51:55 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9V9ptoj020440; Fri, 31 Oct 2014 09:51:55 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410310951.s9V9ptoj020440@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 31 Oct 2014 09:51:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273896 - head/sbin/mount_nfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 09:51:56 -0000 Author: trasz Date: Fri Oct 31 09:51:54 2014 New Revision: 273896 URL: https://svnweb.freebsd.org/changeset/base/273896 Log: Build mount_nfs(8) with WARNS=6. Reviewed by: rmacklem@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sbin/mount_nfs/Makefile head/sbin/mount_nfs/mount_nfs.c Modified: head/sbin/mount_nfs/Makefile ============================================================================== --- head/sbin/mount_nfs/Makefile Fri Oct 31 09:25:28 2014 (r273895) +++ head/sbin/mount_nfs/Makefile Fri Oct 31 09:51:54 2014 (r273896) @@ -10,7 +10,6 @@ MLINKS= mount_nfs.8 mount_oldnfs.8 MOUNT= ${.CURDIR}/../mount UMNTALL= ${.CURDIR}/../../usr.sbin/rpc.umntall CFLAGS+= -DNFS -I${MOUNT} -I${UMNTALL} -WARNS?= 3 LINKS= ${BINDIR}/mount_nfs ${BINDIR}/mount_oldnfs Modified: head/sbin/mount_nfs/mount_nfs.c ============================================================================== --- head/sbin/mount_nfs/mount_nfs.c Fri Oct 31 09:25:28 2014 (r273895) +++ head/sbin/mount_nfs/mount_nfs.c Fri Oct 31 09:51:54 2014 (r273896) @@ -79,7 +79,7 @@ __FBSDID("$FreeBSD$"); #include "mounttab.h" /* Table for af,sotype -> netid conversions. */ -struct nc_protos { +static struct nc_protos { const char *netid; int af; int sotype; @@ -102,20 +102,21 @@ struct nfhret { #define ISBGRND 2 #define OF_NOINET4 4 #define OF_NOINET6 8 -int retrycnt = -1; -int opflags = 0; -int nfsproto = IPPROTO_TCP; -int mnttcp_ok = 1; -int noconn = 0; -char *portspec = NULL; /* Server nfs port; NULL means look up via rpcbind. */ -struct sockaddr *addr; -int addrlen = 0; -u_char *fh = NULL; -int fhsize = 0; -int secflavor = -1; -int got_principal = 0; +static int retrycnt = -1; +static int opflags = 0; +static int nfsproto = IPPROTO_TCP; +static int mnttcp_ok = 1; +static int noconn = 0; +/* The 'portspec' is the server nfs port; NULL means look up via rpcbind. */ +static const char *portspec = NULL; +static struct sockaddr *addr; +static int addrlen = 0; +static u_char *fh = NULL; +static int fhsize = 0; +static int secflavor = -1; +static int got_principal = 0; -enum mountmode { +static enum mountmode { ANY, V2, V3, @@ -130,8 +131,8 @@ enum tryret { TRYRET_LOCALERR /* Local failure. */ }; -static int sec_name_to_num(char *sec); -static char *sec_num_to_name(int num); +static int sec_name_to_num(const char *sec); +static const char *sec_num_to_name(int num); static int getnfsargs(char *, struct iovec **iov, int *iovlen); /* void set_rpc_maxgrouplist(int); */ static struct netconfig *getnetconf_cached(const char *netid); @@ -149,9 +150,10 @@ main(int argc, char *argv[]) int c; struct iovec *iov; int num, iovlen; - char *name, *p, *spec, *fstype; + char *mntname, *p, *spec, *tmp; char mntpath[MAXPATHLEN], errmsg[255]; - char hostname[MAXHOSTNAMELEN + 1], *gssname, gssn[MAXHOSTNAMELEN + 50]; + char hostname[MAXHOSTNAMELEN + 1], gssn[MAXHOSTNAMELEN + 50]; + const char *fstype, *gssname; iov = NULL; iovlen = 0; @@ -226,7 +228,7 @@ main(int argc, char *argv[]) while (opt) { char *pval = NULL; char *pnextopt = NULL; - char *val = ""; + const char *val = ""; pass_flag_to_nmount = 1; pnextopt = strchr(opt, ','); if (pnextopt != NULL) { @@ -276,10 +278,10 @@ main(int argc, char *argv[]) portspec = "2049"; } else if (strcmp(opt, "port") == 0) { pass_flag_to_nmount=0; - asprintf(&portspec, "%d", - atoi(val)); - if (portspec == NULL) + asprintf(&tmp, "%d", atoi(val)); + if (tmp == NULL) err(1, "asprintf"); + portspec = tmp; } else if (strcmp(opt, "principal") == 0) { got_principal = 1; } else if (strcmp(opt, "proto") == 0) { @@ -364,9 +366,11 @@ main(int argc, char *argv[]) } pass_flag_to_nmount=0; } - if (pass_flag_to_nmount) - build_iovec(&iov, &iovlen, opt, val, + if (pass_flag_to_nmount) { + build_iovec(&iov, &iovlen, opt, + __DECONST(void *, val), strlen(val) + 1); + } opt = pnextopt; } } @@ -426,7 +430,7 @@ main(int argc, char *argv[]) } spec = *argv++; - name = *argv; + mntname = *argv; if (retrycnt == -1) /* The default is to keep retrying forever. */ @@ -455,18 +459,19 @@ main(int argc, char *argv[]) hostname); gssname = gssn; } - build_iovec(&iov, &iovlen, "gssname", gssname, - strlen(gssname) + 1); + build_iovec(&iov, &iovlen, "gssname", + __DECONST(void *, gssname), strlen(gssname) + 1); } if (!getnfsargs(spec, &iov, &iovlen)) exit(1); /* resolve the mountpoint with realpath(3) */ - if (checkpath(name, mntpath) != 0) + if (checkpath(mntname, mntpath) != 0) err(1, "%s", mntpath); - build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1); + build_iovec(&iov, &iovlen, "fstype", + __DECONST(void *, fstype), (size_t)-1); build_iovec(&iov, &iovlen, "fspath", mntpath, (size_t)-1); build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); @@ -477,7 +482,7 @@ main(int argc, char *argv[]) } static int -sec_name_to_num(char *sec) +sec_name_to_num(const char *sec) { if (!strcmp(sec, "krb5")) return (RPCSEC_GSS_KRB5); @@ -490,7 +495,7 @@ sec_name_to_num(char *sec) return (-1); } -static char * +static const char * sec_num_to_name(int flavor) { switch (flavor) { @@ -674,10 +679,9 @@ nfs_tryproto(struct addrinfo *ai, char * struct rpc_err rpcerr; CLIENT *clp; struct netconfig *nconf, *nconf_mnt; - const char *netid, *netid_mnt; - char *secname; + const char *netid, *netid_mnt, *secname; int doconnect, nfsvers, mntvers, sotype; - enum clnt_stat stat; + enum clnt_stat clntstat; enum mountmode trymntmode; sotype = 0; @@ -721,6 +725,7 @@ nfs_tryproto(struct addrinfo *ai, char * tryagain: if (trymntmode == V4) { nfsvers = 4; + mntvers = 3; /* Workaround for GCC. */ } else if (trymntmode == V2) { nfsvers = 2; mntvers = 1; @@ -780,10 +785,10 @@ tryagain: try.tv_sec = 10; try.tv_usec = 0; - stat = clnt_call(clp, NFSPROC_NULL, (xdrproc_t)xdr_void, NULL, + clntstat = clnt_call(clp, NFSPROC_NULL, (xdrproc_t)xdr_void, NULL, (xdrproc_t)xdr_void, NULL, try); - if (stat != RPC_SUCCESS) { - if (stat == RPC_PROGVERSMISMATCH && trymntmode == ANY) { + if (clntstat != RPC_SUCCESS) { + if (clntstat == RPC_PROGVERSMISMATCH && trymntmode == ANY) { clnt_destroy(clp); trymntmode = V2; goto tryagain; @@ -792,7 +797,7 @@ tryagain: snprintf(errbuf, sizeof errbuf, "[%s] %s:%s: %s", netid, hostp, spec, clnt_sperror(clp, "NFSPROC_NULL")); clnt_destroy(clp); - return (returncode(stat, &rpcerr)); + return (returncode(clntstat, &rpcerr)); } clnt_destroy(clp); @@ -812,8 +817,10 @@ tryagain: build_iovec(iov, iovlen, "addr", addr, addrlen); secname = sec_num_to_name(secflavor); - if (secname != NULL) - build_iovec(iov, iovlen, "sec", secname, (size_t)-1); + if (secname != NULL) { + build_iovec(iov, iovlen, "sec", + __DECONST(void *, secname), (size_t)-1); + } build_iovec(iov, iovlen, "nfsv4", NULL, 0); build_iovec(iov, iovlen, "dirpath", spec, (size_t)-1); @@ -833,12 +840,12 @@ tryagain: clp->cl_auth = authsys_create_default(); nfhret.auth = secflavor; nfhret.vers = mntvers; - stat = clnt_call(clp, MOUNTPROC_MNT, (xdrproc_t)xdr_dir, spec, + clntstat = clnt_call(clp, MOUNTPROC_MNT, (xdrproc_t)xdr_dir, spec, (xdrproc_t)xdr_fh, &nfhret, try); auth_destroy(clp->cl_auth); - if (stat != RPC_SUCCESS) { - if (stat == RPC_PROGVERSMISMATCH && trymntmode == ANY) { + if (clntstat != RPC_SUCCESS) { + if (clntstat == RPC_PROGVERSMISMATCH && trymntmode == ANY) { clnt_destroy(clp); trymntmode = V2; goto tryagain; @@ -847,7 +854,7 @@ tryagain: snprintf(errbuf, sizeof errbuf, "[%s] %s:%s: %s", netid_mnt, hostp, spec, clnt_sperror(clp, "RPCPROG_MNT")); clnt_destroy(clp); - return (returncode(stat, &rpcerr)); + return (returncode(clntstat, &rpcerr)); } clnt_destroy(clp); @@ -873,8 +880,10 @@ tryagain: build_iovec(iov, iovlen, "addr", addr, addrlen); build_iovec(iov, iovlen, "fh", fh, fhsize); secname = sec_num_to_name(nfhret.auth); - if (secname) - build_iovec(iov, iovlen, "sec", secname, (size_t)-1); + if (secname) { + build_iovec(iov, iovlen, "sec", + __DECONST(void *, secname), (size_t)-1); + } if (nfsvers == 3) build_iovec(iov, iovlen, "nfsv3", NULL, 0); @@ -886,9 +895,10 @@ tryagain: * return code. */ static enum tryret -returncode(enum clnt_stat stat, struct rpc_err *rpcerr) +returncode(enum clnt_stat clntstat, struct rpc_err *rpcerr) { - switch (stat) { + + switch (clntstat) { case RPC_TIMEDOUT: return (TRYRET_TIMEOUT); case RPC_PMAPFAILURE: From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 09:53:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 760369B4; Fri, 31 Oct 2014 09:53:10 +0000 (UTC) Received: from mail-lb0-x229.google.com (mail-lb0-x229.google.com [IPv6:2a00:1450:4010:c04::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A7AE7CA; Fri, 31 Oct 2014 09:53:09 +0000 (UTC) Received: by mail-lb0-f169.google.com with SMTP id p9so121360lbv.14 for ; Fri, 31 Oct 2014 02:53:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=UADyE3XsXLiB6OWB+kup+Ks/o7cz7WgsTdzkq8ReVOY=; b=CEnCqSRtf3OFC3L9JD3CNwbUz1GdDyXiQVRVkKPGgYE8jK5xYmgWexRcn7pc9qXSLf cLdHzaeAP5/b3pq7lHKUGiIBV4cFWlns/0HEkRhhpVaIBZqFNRkUbBqohjil0VTBTHJn oykZGuQWEsjXbdkBX+uCi/SeSRwyLnCBGz2nz66/bU27ewPGW4jGc2qUykRqmgTpBC3g AcxAfB/cnc1DhU113PgePh3cSuWHESs72qYye+AJ0HqCRsZ6bUsheSTvB1+GRd1fRHRV /JJ5UpMQhQsSd8mBX2HhAa85fymO3bnxW0h3ArOxKneVM21ykLgBZmLfCDtuZV4iA54U nChQ== X-Received: by 10.112.47.37 with SMTP id a5mr24911981lbn.31.1414749187289; Fri, 31 Oct 2014 02:53:07 -0700 (PDT) Received: from brick.home (adbf36.neoplus.adsl.tpnet.pl. [79.184.5.36]) by mx.google.com with ESMTPSA id t5sm4242331lat.46.2014.10.31.02.53.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Oct 2014 02:53:06 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Fri, 31 Oct 2014 10:53:03 +0100 From: Edward Tomasz Napierala To: Sergey Kandaurov Subject: Re: svn commit: r273861 - head/sbin/mount_nfs Message-ID: <20141031095303.GA7150@brick.home> Mail-Followup-To: Sergey Kandaurov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201410301405.s9UE5nUO046896@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 09:53:10 -0000 On 1030T1847, Sergey Kandaurov wrote: > On 30 October 2014 17:05, Edward Tomasz Napierala wrote: > > Author: trasz > > Date: Thu Oct 30 14:05:48 2014 > > New Revision: 273861 > > URL: https://svnweb.freebsd.org/changeset/base/273861 > > > > Log: > > Remove two functions unused after r273848. Would be nice if clang > > or at least scan-build yelled about it. > > It does but with WARNS=3, -Wunused-function is disabled. Ah, right. Fixed :-) From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 09:56:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5A8A9B88; Fri, 31 Oct 2014 09:56:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 467227EF; Fri, 31 Oct 2014 09:56:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9V9u132021010; Fri, 31 Oct 2014 09:56:01 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9V9u09i021005; Fri, 31 Oct 2014 09:56:00 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410310956.s9V9u09i021005@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 31 Oct 2014 09:56:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273897 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 09:56:01 -0000 Author: mjg Date: Fri Oct 31 09:56:00 2014 New Revision: 273897 URL: https://svnweb.freebsd.org/changeset/base/273897 Log: filedesc: fix missed comments about fdsetugidsafety While here just note that both fdsetugidsafety and fdcheckstd take sleepable locks. Modified: head/sys/kern/kern_descrip.c head/sys/kern/kern_exec.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Oct 31 09:51:54 2014 (r273896) +++ head/sys/kern/kern_descrip.c Fri Oct 31 09:56:00 2014 (r273897) @@ -2088,7 +2088,7 @@ fdescfree(struct thread *td) * otherwise be off-limits to the process. We check for filesystems where * the vnode can change out from under us after execve (like [lin]procfs). * - * Since setugidsafety calls this only for fd 0, 1 and 2, this check is + * Since fdsetugidsafety calls this only for fd 0, 1 and 2, this check is * sufficient. We also don't check for setugidness since we know we are. */ static bool Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Fri Oct 31 09:51:54 2014 (r273896) +++ head/sys/kern/kern_exec.c Fri Oct 31 09:56:00 2014 (r273897) @@ -688,10 +688,8 @@ interpret: * Close any file descriptors 0..2 that reference procfs, * then make sure file descriptors 0..2 are in use. * - * setugidsafety() may call closef() and then pfind() - * which may grab the process lock. - * fdcheckstd() may call falloc() which may block to - * allocate memory, so temporarily drop the process lock. + * Both fdsetugidsafety() and fdcheckstd() may call functions + * taking sleepable locks, so temporarily drop our locks. */ PROC_UNLOCK(p); VOP_UNLOCK(imgp->vp, 0); From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 10:19:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F1839823; Fri, 31 Oct 2014 10:18:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2195AA0; Fri, 31 Oct 2014 10:18:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VAIxEQ031517; Fri, 31 Oct 2014 10:18:59 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VAIx9j031516; Fri, 31 Oct 2014 10:18:59 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410311018.s9VAIx9j031516@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 31 Oct 2014 10:18:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273899 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 10:19:00 -0000 Author: hselasky Date: Fri Oct 31 10:18:58 2014 New Revision: 273899 URL: https://svnweb.freebsd.org/changeset/base/273899 Log: Only put one CTASSERT() inside each macro to avoid compile issues. The problem is that the __LINE__ macro is constant inside a macro and results in identical assert statements when the compiler does not support the static builtin assert function. MFC: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/sys/sysctl.h Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Fri Oct 31 10:07:56 2014 (r273898) +++ head/sys/sys/sysctl.h Fri Oct 31 10:18:58 2014 (r273899) @@ -324,9 +324,9 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_int, "I", descr); \ - CTASSERT(((access) & CTLTYPE) == 0 || \ - ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \ - CTASSERT(sizeof(int) == sizeof(*(ptr))) + CTASSERT((((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT) && \ + sizeof(int) == sizeof(*(ptr))) #define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr) \ ({ \ @@ -344,9 +344,9 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, \ CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_int, "IU", descr); \ - CTASSERT(((access) & CTLTYPE) == 0 || \ - ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_UINT);\ - CTASSERT(sizeof(unsigned) == sizeof(*(ptr))) + CTASSERT((((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_UINT) && \ + sizeof(unsigned) == sizeof(*(ptr))) #define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \ ({ \ @@ -364,9 +364,9 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, \ CTLTYPE_LONG | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_long, "L", descr); \ - CTASSERT(((access) & CTLTYPE) == 0 || \ - ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_LONG);\ - CTASSERT(sizeof(long) == sizeof(*(ptr))) + CTASSERT((((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_LONG) && \ + sizeof(long) == sizeof(*(ptr))) #define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ @@ -384,9 +384,9 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, \ CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_long, "LU", descr); \ - CTASSERT(((access) & CTLTYPE) == 0 || \ - ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_ULONG); \ - CTASSERT(sizeof(unsigned long) == sizeof(*(ptr))) + CTASSERT((((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_ULONG) && \ + sizeof(unsigned long) == sizeof(*(ptr))) #define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ @@ -404,9 +404,9 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, \ CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_64, "Q", descr); \ - CTASSERT(((access) & CTLTYPE) == 0 || \ - ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64); \ - CTASSERT(sizeof(int64_t) == sizeof(*(ptr))) + CTASSERT((((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64) && \ + sizeof(int64_t) == sizeof(*(ptr))) #define SYSCTL_ADD_QUAD(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ @@ -423,9 +423,9 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_64, "QU", descr); \ - CTASSERT(((access) & CTLTYPE) == 0 || \ - ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \ - CTASSERT(sizeof(uint64_t) == sizeof(*(ptr))) + CTASSERT((((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64) && \ + sizeof(uint64_t) == sizeof(*(ptr))) #define SYSCTL_ADD_UQUAD(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ @@ -441,9 +441,9 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e #define SYSCTL_ADD_UAUTO(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ struct sysctl_oid *__ret; \ - CTASSERT(sizeof(uint64_t) == sizeof(*(ptr)) || \ - sizeof(unsigned) == sizeof(*(ptr))); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT((sizeof(uint64_t) == sizeof(*(ptr)) || \ + sizeof(unsigned) == sizeof(*(ptr))) && \ + ((access) & CTLTYPE) == 0); \ if (sizeof(uint64_t) == sizeof(*(ptr))) { \ __ret = sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ @@ -463,10 +463,10 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ (ptr), 0, sysctl_handle_counter_u64, "QU", descr); \ - CTASSERT(((access) & CTLTYPE) == 0 || \ - ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \ - CTASSERT(sizeof(counter_u64_t) == sizeof(*(ptr))); \ - CTASSERT(sizeof(uint64_t) == sizeof(**(ptr))) + CTASSERT((((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64) && \ + sizeof(counter_u64_t) == sizeof(*(ptr)) && \ + sizeof(uint64_t) == sizeof(**(ptr))) #define SYSCTL_ADD_COUNTER_U64(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 10:35:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0BC7FCFB; Fri, 31 Oct 2014 10:35:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA8DBC4D; Fri, 31 Oct 2014 10:35:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VAZ1KH041480; Fri, 31 Oct 2014 10:35:01 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VAZ1cu041479; Fri, 31 Oct 2014 10:35:01 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410311035.s9VAZ1cu041479@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 31 Oct 2014 10:35:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273901 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 10:35:02 -0000 Author: mjg Date: Fri Oct 31 10:35:01 2014 New Revision: 273901 URL: https://svnweb.freebsd.org/changeset/base/273901 Log: filedesc: drop retval argument from do_dup It was almost always td_retval anyway. For the one case where it is not, preserve the old value across the call. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Oct 31 10:25:31 2014 (r273900) +++ head/sys/kern/kern_descrip.c Fri Oct 31 10:35:01 2014 (r273901) @@ -101,8 +101,7 @@ static uma_zone_t file_zone; static int closefp(struct filedesc *fdp, int fd, struct file *fp, struct thread *td, int holdleaders); -static int do_dup(struct thread *td, int flags, int old, int new, - register_t *retval); +static int do_dup(struct thread *td, int flags, int old, int new); static int fd_first_free(struct filedesc *fdp, int low, int size); static int fd_last_used(struct filedesc *fdp, int size); static void fdgrowtable(struct filedesc *fdp, int nfd); @@ -361,8 +360,7 @@ int sys_dup2(struct thread *td, struct dup2_args *uap) { - return (do_dup(td, DUP_FIXED, (int)uap->from, (int)uap->to, - td->td_retval)); + return (do_dup(td, DUP_FIXED, (int)uap->from, (int)uap->to)); } /* @@ -378,7 +376,7 @@ int sys_dup(struct thread *td, struct dup_args *uap) { - return (do_dup(td, 0, (int)uap->fd, 0, td->td_retval)); + return (do_dup(td, 0, (int)uap->fd, 0)); } /* @@ -487,24 +485,22 @@ kern_fcntl(struct thread *td, int fd, in switch (cmd) { case F_DUPFD: tmp = arg; - error = do_dup(td, DUP_FCNTL, fd, tmp, td->td_retval); + error = do_dup(td, DUP_FCNTL, fd, tmp); break; case F_DUPFD_CLOEXEC: tmp = arg; - error = do_dup(td, DUP_FCNTL | DUP_CLOEXEC, fd, tmp, - td->td_retval); + error = do_dup(td, DUP_FCNTL | DUP_CLOEXEC, fd, tmp); break; case F_DUP2FD: tmp = arg; - error = do_dup(td, DUP_FIXED, fd, tmp, td->td_retval); + error = do_dup(td, DUP_FIXED, fd, tmp); break; case F_DUP2FD_CLOEXEC: tmp = arg; - error = do_dup(td, DUP_FIXED | DUP_CLOEXEC, fd, tmp, - td->td_retval); + error = do_dup(td, DUP_FIXED | DUP_CLOEXEC, fd, tmp); break; case F_GETFD: @@ -803,8 +799,7 @@ getmaxfd(struct proc *p) * Common code for dup, dup2, fcntl(F_DUPFD) and fcntl(F_DUP2FD). */ static int -do_dup(struct thread *td, int flags, int old, int new, - register_t *retval) +do_dup(struct thread *td, int flags, int old, int new) { struct filedesc *fdp; struct filedescent *oldfde, *newfde; @@ -836,7 +831,7 @@ do_dup(struct thread *td, int flags, int } oldfde = &fdp->fd_ofiles[old]; if (flags & DUP_FIXED && old == new) { - *retval = new; + td->td_retval[0] = new; if (flags & DUP_CLOEXEC) fdp->fd_ofiles[new].fde_flags |= UF_EXCLOSE; FILEDESC_XUNLOCK(fdp); @@ -906,7 +901,7 @@ do_dup(struct thread *td, int flags, int #ifdef CAPABILITIES seq_write_end(&newfde->fde_seq); #endif - *retval = new; + td->td_retval[0] = new; if (delfp != NULL) { (void) closefp(fdp, new, delfp, td, 1); @@ -2191,7 +2186,7 @@ int fdcheckstd(struct thread *td) { struct filedesc *fdp; - register_t retval, save; + register_t save; int i, error, devnull; fdp = td->td_proc->p_fd; @@ -2211,7 +2206,9 @@ fdcheckstd(struct thread *td) break; KASSERT(devnull == i, ("oof, we didn't get our fd")); } else { - error = do_dup(td, DUP_FIXED, devnull, i, &retval); + save = td->td_retval[0]; + error = do_dup(td, DUP_FIXED, devnull, i); + td->td_retval[0] = save; if (error != 0) break; } From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 10:45:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 780675B7; Fri, 31 Oct 2014 10:45:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 64D3ED83; Fri, 31 Oct 2014 10:45:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VAjZ7s046469; Fri, 31 Oct 2014 10:45:35 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VAjZAk046468; Fri, 31 Oct 2014 10:45:35 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201410311045.s9VAjZAk046468@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Fri, 31 Oct 2014 10:45:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273902 - head/sys/modules/drm2/drm2 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 10:45:35 -0000 Author: tijl Date: Fri Oct 31 10:45:34 2014 New Revision: 273902 URL: https://svnweb.freebsd.org/changeset/base/273902 Log: Build ttm_agp_backend.c. Reported by: dumbbell MFC after: 1 month Modified: head/sys/modules/drm2/drm2/Makefile Modified: head/sys/modules/drm2/drm2/Makefile ============================================================================== --- head/sys/modules/drm2/drm2/Makefile Fri Oct 31 10:35:01 2014 (r273901) +++ head/sys/modules/drm2/drm2/Makefile Fri Oct 31 10:45:34 2014 (r273902) @@ -35,6 +35,7 @@ SRCS = \ drm_stub.c \ drm_sysctl.c \ drm_vm.c \ + ttm_agp_backend.c \ ttm_lock.c \ ttm_object.c \ ttm_tt.c \ @@ -46,7 +47,6 @@ SRCS = \ ttm_page_alloc.c \ ttm_bo_vm.c \ ati_pcigart.c -#ttm_agp_backend.c #ttm_page_alloc_dma.c .if ${MACHINE_CPUARCH} == "amd64" From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 11:40:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 30F568D0; Fri, 31 Oct 2014 11:40:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D92836D; Fri, 31 Oct 2014 11:40:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VBenjw070928; Fri, 31 Oct 2014 11:40:49 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VBenaH070927; Fri, 31 Oct 2014 11:40:49 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410311140.s9VBenaH070927@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 31 Oct 2014 11:40:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273903 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 11:40:50 -0000 Author: ae Date: Fri Oct 31 11:40:49 2014 New Revision: 273903 URL: https://svnweb.freebsd.org/changeset/base/273903 Log: Fix typo. Modified: head/sys/netinet/tcp_syncache.c Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Fri Oct 31 10:45:34 2014 (r273902) +++ head/sys/netinet/tcp_syncache.c Fri Oct 31 11:40:49 2014 (r273903) @@ -1519,7 +1519,7 @@ syncache_respond(struct syncache *sc, st /* * We've got SCF_SIGNATURE flag * inherited from listening socket, - * but to SADB key for given source + * but no SADB key for given source * address. Assume signature is not * required and remove signature flag * instead of silently dropping From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 12:19:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5E1B848F; Fri, 31 Oct 2014 12:19:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47BC9992; Fri, 31 Oct 2014 12:19:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VCJN3M089508; Fri, 31 Oct 2014 12:19:23 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VCJNAl089507; Fri, 31 Oct 2014 12:19:23 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410311219.s9VCJNAl089507@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 31 Oct 2014 12:19:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273904 - head/sys/netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 12:19:23 -0000 Author: ae Date: Fri Oct 31 12:19:22 2014 New Revision: 273904 URL: https://svnweb.freebsd.org/changeset/base/273904 Log: Use in_localip() instead of handmade implementation. MFC after: 1 week Sponsored by: Yandex LLC Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Fri Oct 31 11:40:49 2014 (r273903) +++ head/sys/netipsec/key.c Fri Oct 31 12:19:22 2014 (r273904) @@ -3906,33 +3906,14 @@ key_dup_lifemsg(const struct sadb_lifeti * 0: false */ int -key_ismyaddr(sa) - struct sockaddr *sa; +key_ismyaddr(struct sockaddr *sa) { -#ifdef INET - struct sockaddr_in *sin; - struct in_ifaddr *ia; -#endif IPSEC_ASSERT(sa != NULL, ("null sockaddr")); - switch (sa->sa_family) { #ifdef INET case AF_INET: - sin = (struct sockaddr_in *)sa; - IN_IFADDR_RLOCK(); - TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) - { - if (sin->sin_family == ia->ia_addr.sin_family && - sin->sin_len == ia->ia_addr.sin_len && - sin->sin_addr.s_addr == ia->ia_addr.sin_addr.s_addr) - { - IN_IFADDR_RUNLOCK(); - return 1; - } - } - IN_IFADDR_RUNLOCK(); - break; + return (in_localip(satosin(sa)->sin_addr)); #endif #ifdef INET6 case AF_INET6: From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 13:37:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 075AFFEB; Fri, 31 Oct 2014 13:37:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E79FD1C5; Fri, 31 Oct 2014 13:37:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VDbl6B028921; Fri, 31 Oct 2014 13:37:47 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VDblDt028920; Fri, 31 Oct 2014 13:37:47 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410311337.s9VDblDt028920@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Fri, 31 Oct 2014 13:37:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273906 - head/sbin/route X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 13:37:48 -0000 Author: melifaro Date: Fri Oct 31 13:37:47 2014 New Revision: 273906 URL: https://svnweb.freebsd.org/changeset/base/273906 Log: Print human-readable error for "route not found" case. Submitted by: vsevolod (initial version) MFC after: 2 weeks Sponsored by: Yandex LLC Modified: head/sbin/route/route.c Modified: head/sbin/route/route.c ============================================================================== --- head/sbin/route/route.c Fri Oct 31 12:21:43 2014 (r273905) +++ head/sbin/route/route.c Fri Oct 31 13:37:47 2014 (r273906) @@ -1533,9 +1533,18 @@ rtmsg(int cmd, int flags, int fib) if (debugonly) return (0); if ((rlen = write(s, (char *)&m_rtmsg, l)) < 0) { - if (errno == EPERM) + switch (errno) { + case EPERM: err(1, "writing to routing socket"); - warn("writing to routing socket"); + case ESRCH: + warnx("route has not been found"); + break; + case EEXIST: + /* Handled by newroute() */ + break; + default: + warn("writing to routing socket"); + } return (-1); } if (cmd == RTM_GET) { From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 14:22:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 40640343; Fri, 31 Oct 2014 14:22:12 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 01ADB8F2; Fri, 31 Oct 2014 14:22:11 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id C19D2A1E0; Fri, 31 Oct 2014 14:22:10 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 848B010935; Fri, 31 Oct 2014 15:22:12 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Mark Murray Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... References: <201410302121.s9ULLsEw055630@svn.freebsd.org> Date: Fri, 31 Oct 2014 15:22:12 +0100 In-Reply-To: <201410302121.s9ULLsEw055630@svn.freebsd.org> (Mark Murray's message of "Thu, 30 Oct 2014 21:21:54 +0000 (UTC)") Message-ID: <8638a4b9pn.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 14:22:12 -0000 Mark Murray writes: > Log: > This is the much-discussed major upgrade to the random(4) device, > known to you all as /dev/random. Much discussed and long-awaited :) Thank you for your hard work and persistence! > Reviewed by: trasz,des(partial),imp(partial?),rwatson(partial?) Must... resist... tentation to make a joke about "imp(partial?)"... DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 14:22:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6D833483; Fri, 31 Oct 2014 14:22:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59D538F8; Fri, 31 Oct 2014 14:22:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VEMRij052876; Fri, 31 Oct 2014 14:22:27 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VEMRNg052875; Fri, 31 Oct 2014 14:22:27 GMT (envelope-from des@FreeBSD.org) Message-Id: <201410311422.s9VEMRNg052875@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: des set sender to des@FreeBSD.org using -f From: Dag-Erling Smørgrav Date: Fri, 31 Oct 2014 14:22:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273907 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 14:22:27 -0000 Author: des Date: Fri Oct 31 14:22:26 2014 New Revision: 273907 URL: https://svnweb.freebsd.org/changeset/base/273907 Log: Add /etc/rc.d/initrandom, which was removed in r273872. Noticed by: ache@ Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Fri Oct 31 13:37:47 2014 (r273906) +++ head/ObsoleteFiles.inc Fri Oct 31 14:22:26 2014 (r273907) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20141031: initrandom obsoleted by new /dev/random code +OLD_FILES+=etc/rc.d/initrandom # 20141028: debug files accidentally installed as directory name OLD_FILES+=usr/lib/debug/usr/lib/i18n OLD_FILES+=usr/lib/debug/usr/lib/private From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 14:22:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 507965D5; Fri, 31 Oct 2014 14:22:53 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 0ED14900; Fri, 31 Oct 2014 14:22:53 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 675CDA1F3; Fri, 31 Oct 2014 14:22:52 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 2E7AB10937; Fri, 31 Oct 2014 15:22:54 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Andrey Chernov Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <545300F6.9070306@freebsd.org> Date: Fri, 31 Oct 2014 15:22:54 +0100 In-Reply-To: <545300F6.9070306@freebsd.org> (Andrey Chernov's message of "Fri, 31 Oct 2014 06:24:38 +0300") Message-ID: <86y4rw9v41.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mark Murray X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 14:22:53 -0000 Andrey Chernov writes: > Mark Murray writes: > > Deleted: > > head/etc/rc.d/initrandom > It should be added to ObsoleteFiles.inc Good catch, fixed in r273907. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 14:24:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1B995742; Fri, 31 Oct 2014 14:24:18 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id CE383912; Fri, 31 Oct 2014 14:24:17 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id F19B5A200; Fri, 31 Oct 2014 14:24:16 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id B947C10939; Fri, 31 Oct 2014 15:24:18 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Mark Murray Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <8638a4b9pn.fsf@nine.des.no> Date: Fri, 31 Oct 2014 15:24:18 +0100 In-Reply-To: <8638a4b9pn.fsf@nine.des.no> ("Dag-Erling =?utf-8?Q?Sm=C3=B8r?= =?utf-8?Q?grav=22's?= message of "Fri, 31 Oct 2014 15:22:12 +0100") Message-ID: <86r3xo9v1p.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 14:24:18 -0000 Dag-Erling Sm=C3=B8rgrav writes: > Must... resist... tentation to make a joke about "imp(partial?)"... Ouch, *temptation. French leaking into my English. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 14:28:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 326E9ACB; Fri, 31 Oct 2014 14:28:57 +0000 (UTC) Received: from gromit.grondar.org (grandfather.grondar.org [IPv6:2a01:348:0:15:5d59:5c20:0:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC9EC95A; Fri, 31 Oct 2014 14:28:56 +0000 (UTC) Received: from [2001:470:9174:1:681e:d987:e29c:eb12] by gromit.grondar.org with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.84 (FreeBSD)) (envelope-from ) id 1XkDCA-000Dq8-MJ; Fri, 31 Oct 2014 14:28:55 +0000 Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) Content-Type: text/plain; charset=utf-8 From: Mark R V Murray In-Reply-To: <86y4rw9v41.fsf@nine.des.no> Date: Fri, 31 Oct 2014 14:28:53 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <61E474E4-FA62-4E1E-B0C1-C70E21850E75@FreeBSD.org> References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <545300F6.9070306@freebsd.org> <86y4rw9v41.fsf@nine.des.no> To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= X-Mailer: Apple Mail (2.1990.1) X-SA-Score: -1.0 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrey Chernov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 14:28:57 -0000 > On 31 Oct 2014, at 14:22, Dag-Erling Sm=C3=B8rgrav wrote: >=20 > Andrey Chernov writes: >> Mark Murray writes: >>> Deleted: >>> head/etc/rc.d/initrandom >> It should be added to ObsoleteFiles.inc >=20 > Good catch, fixed in r273907. Thanks! M --=20 Mark R V Murray From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 14:29:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CBE4CC1B; Fri, 31 Oct 2014 14:29:38 +0000 (UTC) Received: from gromit.grondar.org (grandfather.grondar.org [IPv6:2a01:348:0:15:5d59:5c20:0:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 933BE969; Fri, 31 Oct 2014 14:29:38 +0000 (UTC) Received: from [2001:470:9174:1:681e:d987:e29c:eb12] by gromit.grondar.org with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.84 (FreeBSD)) (envelope-from ) id 1XkDCq-000Dq8-W5; Fri, 31 Oct 2014 14:29:37 +0000 Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) Content-Type: text/plain; charset=utf-8 From: Mark R V Murray In-Reply-To: <8638a4b9pn.fsf@nine.des.no> Date: Fri, 31 Oct 2014 14:29:36 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <426CD89D-0D26-4B26-A4F0-C958D378D969@FreeBSD.org> References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <8638a4b9pn.fsf@nine.des.no> To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= X-Mailer: Apple Mail (2.1990.1) X-SA-Score: -1.0 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 14:29:38 -0000 > On 31 Oct 2014, at 14:22, Dag-Erling Sm=C3=B8rgrav wrote: >=20 > Mark Murray writes: >> Log: >> This is the much-discussed major upgrade to the random(4) device, >> known to you all as /dev/random. >=20 > Much discussed and long-awaited :) Thank you for your hard work and > persistence! Thank you! >> Reviewed by: = trasz,des(partial),imp(partial?),rwatson(partial?) >=20 > Must... resist... tentation to make a joke about "imp(partial?)"=E2=80= =A6 *snigger* :-) M --=20 Mark R V Murray From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 15:07:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A3DCA46F; Fri, 31 Oct 2014 15:07:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 901F9D7A; Fri, 31 Oct 2014 15:07:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VF7qEk074290; Fri, 31 Oct 2014 15:07:52 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VF7qMo074289; Fri, 31 Oct 2014 15:07:52 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201410311507.s9VF7qMo074289@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Fri, 31 Oct 2014 15:07:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273908 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 15:07:52 -0000 Author: kevlo Date: Fri Oct 31 15:07:51 2014 New Revision: 273908 URL: https://svnweb.freebsd.org/changeset/base/273908 Log: Fix usage of kern_getenv(). Modified: head/sys/arm/arm/machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Fri Oct 31 14:22:26 2014 (r273907) +++ head/sys/arm/arm/machdep.c Fri Oct 31 15:07:51 2014 (r273908) @@ -1246,8 +1246,10 @@ initarm(struct arm_boot_params *abp) print_kenv(); env = kern_getenv("kernelname"); - if (env != NULL) + if (env != NULL) { strlcpy(kernelname, env, sizeof(kernelname)); + freeenv(env); + } if (err_devmap != 0) printf("WARNING: could not fully configure devmap, error=%d\n", From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 15:23:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6468DA39; Fri, 31 Oct 2014 15:23:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50732F74; Fri, 31 Oct 2014 15:23:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VFNP6n083498; Fri, 31 Oct 2014 15:23:25 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VFNPcJ083497; Fri, 31 Oct 2014 15:23:25 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410311523.s9VFNPcJ083497@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 31 Oct 2014 15:23:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273909 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 15:23:25 -0000 Author: ae Date: Fri Oct 31 15:23:24 2014 New Revision: 273909 URL: https://svnweb.freebsd.org/changeset/base/273909 Log: Remove the check for packets with broadcast source from if_gif's encapcheck. The check was recommened in the draft-ietf-ngtrans-mech-05.txt. But it isn't clear, should it compare the source with all direct broadcast addresses in the system or not. RFC 4213 says it is enough to verify that the source address is the address of the encapsulator, as configured on the decapsulator. And this verification can be extended by administrator with any other forms of IPv4 ingress filtering. Discussed with: glebius, melifaro Sponsored by: Yandex LLC Modified: head/sys/netinet/in_gif.c Modified: head/sys/netinet/in_gif.c ============================================================================== --- head/sys/netinet/in_gif.c Fri Oct 31 15:07:51 2014 (r273908) +++ head/sys/netinet/in_gif.c Fri Oct 31 15:23:24 2014 (r273909) @@ -167,7 +167,6 @@ in_gif_input(struct mbuf **mp, int *offp static int gif_validate4(const struct ip *ip, struct gif_softc *sc, struct ifnet *ifp) { - struct in_ifaddr *ia4; GIF_RLOCK_ASSERT(sc); @@ -186,19 +185,6 @@ gif_validate4(const struct ip *ip, struc return (0); } - /* reject packets with broadcast on source */ - /* XXXRW: should use hash lists? */ - IN_IFADDR_RLOCK(); - TAILQ_FOREACH(ia4, &V_in_ifaddrhead, ia_link) { - if ((ia4->ia_ifa.ifa_ifp->if_flags & IFF_BROADCAST) == 0) - continue; - if (ip->ip_src.s_addr == ia4->ia_broadaddr.sin_addr.s_addr) { - IN_IFADDR_RUNLOCK(); - return (0); - } - } - IN_IFADDR_RUNLOCK(); - /* ingress filters on outer source */ if ((GIF2IFP(sc)->if_flags & IFF_LINK2) == 0 && ifp) { struct sockaddr_in sin; From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 16:00:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AEF3EC8E; Fri, 31 Oct 2014 16:00:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9024F619; Fri, 31 Oct 2014 16:00:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VG0kmr002045; Fri, 31 Oct 2014 16:00:46 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VG0kOA002044; Fri, 31 Oct 2014 16:00:46 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201410311600.s9VG0kOA002044@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Fri, 31 Oct 2014 16:00:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273910 - head/sys/netgraph X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 16:00:46 -0000 Author: glebius Date: Fri Oct 31 16:00:45 2014 New Revision: 273910 URL: https://svnweb.freebsd.org/changeset/base/273910 Log: Use macro ERROUT() to make code more laconic and follow style of other netgraph code. Submitted by: Dmitry Luhtionov Modified: head/sys/netgraph/ng_frame_relay.c Modified: head/sys/netgraph/ng_frame_relay.c ============================================================================== --- head/sys/netgraph/ng_frame_relay.c Fri Oct 31 15:23:24 2014 (r273909) +++ head/sys/netgraph/ng_frame_relay.c Fri Oct 31 16:00:45 2014 (r273910) @@ -148,6 +148,8 @@ static struct ng_type typestruct = { }; NETGRAPH_INIT(framerelay, &typestruct); +#define ERROUT(x) do { error = (x); goto done; } while (0) + /* * Given a DLCI, return the index of the context table entry for it, * Allocating a new one if needs be, or -1 if none available. @@ -335,10 +337,8 @@ ngfrm_rcvdata(hook_p hook, item_p item) char *data; /* Data doesn't come in from just anywhere (e.g debug hook) */ - if (ctxp == NULL) { - error = ENETDOWN; - goto bad; - } + if (ctxp == NULL) + ERROUT(ENETDOWN); /* If coming from downstream, decode it to a channel */ dlci = ctxp->dlci; @@ -351,20 +351,16 @@ ngfrm_rcvdata(hook_p hook, item_p item) /* If there is no live channel, throw it away */ if ((sc->downstream.hook == NULL) - || ((ctxp->flags & CHAN_ACTIVE) == 0)) { - error = ENETDOWN; - goto bad; - } + || ((ctxp->flags & CHAN_ACTIVE) == 0)) + ERROUT(ENETDOWN); /* Store the DLCI on the front of the packet */ alen = sc->addrlen; if (alen == 0) alen = 2; /* default value for transmit */ M_PREPEND(m, alen, M_NOWAIT); - if (m == NULL) { - error = ENOBUFS; - goto bad; - } + if (m == NULL) + ERROUT(ENOBUFS); data = mtod(m, char *); /* @@ -401,7 +397,7 @@ ngfrm_rcvdata(hook_p hook, item_p item) NG_FWD_NEW_DATA(error, item, sc->downstream.hook, m); return (error); -bad: +done: NG_FREE_ITEM(item); NG_FREE_M(m); return (error); @@ -422,10 +418,8 @@ ngfrm_decode(node_p node, item_p item) struct mbuf *m; NGI_GET_M(item, m); - if (m->m_len < 4 && (m = m_pullup(m, 4)) == NULL) { - error = ENOBUFS; - goto out; - } + if (m->m_len < 4 && (m = m_pullup(m, 4)) == NULL) + ERROUT(ENOBUFS); data = mtod(m, char *); if ((alen = sc->addrlen) == 0) { sc->addrlen = alen = ngfrm_addrlen(data); @@ -447,14 +441,11 @@ ngfrm_decode(node_p node, item_p item) SHIFTIN(makeup + 3, data[3], dlci); break; default: - error = EINVAL; - goto out; + ERROUT(EINVAL); } - if (dlci > 1023) { - error = EINVAL; - goto out; - } + if (dlci > 1023) + ERROUT(EINVAL); ctxnum = sc->ALT[dlci]; if ((ctxnum & CTX_VALID) && sc->channel[ctxnum &= CTX_VALUE].hook) { /* Send it */ @@ -464,7 +455,7 @@ ngfrm_decode(node_p node, item_p item) } else { error = ENETDOWN; } -out: +done: NG_FREE_ITEM(item); NG_FREE_M(m); return (error); From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 17:43:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5E9F913F; Fri, 31 Oct 2014 17:43:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 498DA369; Fri, 31 Oct 2014 17:43:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VHhNg1056518; Fri, 31 Oct 2014 17:43:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VHhLk8056512; Fri, 31 Oct 2014 17:43:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410311743.s9VHhLk8056512@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 31 Oct 2014 17:43:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273911 - in head: share/man/man9 sys/kern sys/powerpc/powerpc sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 17:43:23 -0000 Author: kib Date: Fri Oct 31 17:43:21 2014 New Revision: 273911 URL: https://svnweb.freebsd.org/changeset/base/273911 Log: Add type qualifier volatile to the base (userspace) address argument of fuword(9) and suword(9). This makes the functions type-compatible with volatile objects and does not require devolatile force, e.g. in kern_umtx.c. Requested by: bde Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Modified: head/share/man/man9/fetch.9 head/share/man/man9/store.9 head/sys/kern/kern_umtx.c head/sys/kern/subr_uio.c head/sys/powerpc/powerpc/copyinout.c head/sys/sys/systm.h Modified: head/share/man/man9/fetch.9 ============================================================================== --- head/share/man/man9/fetch.9 Fri Oct 31 16:00:45 2014 (r273910) +++ head/share/man/man9/fetch.9 Fri Oct 31 17:43:21 2014 (r273911) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 21, 2014 +.Dd October 29, 2014 .Dt FETCH 9 .Os .Sh NAME @@ -53,21 +53,21 @@ .In sys/types.h .In sys/systm.h .Ft int -.Fn fubyte "const void *base" +.Fn fubyte "volatile const void *base" .Ft long -.Fn fuword "const void *base" +.Fn fuword "volatile const void *base" .Ft int -.Fn fuword16 "void *base" +.Fn fuword16 "volatile const void *base" .Ft int32_t -.Fn fuword32 "const void *base" +.Fn fuword32 "volatile const void *base" .Ft int64_t -.Fn fuword64 "const void *base" +.Fn fuword64 "volatile const void *base" .Ft long -.Fn fueword "const void *base" "long *val" +.Fn fueword "volatile const void *base" "long *val" .Ft int32_t -.Fn fueword32 "const void *base" "int32_t *val" +.Fn fueword32 "volatile const void *base" "int32_t *val" .Ft int64_t -.Fn fueword64 "const void *base" "int64_t *val" +.Fn fueword64 "volatile const void *base" "int64_t *val" .In sys/resourcevar.h .Ft int .Fn fuswintr "void *base" Modified: head/share/man/man9/store.9 ============================================================================== --- head/share/man/man9/store.9 Fri Oct 31 16:00:45 2014 (r273910) +++ head/share/man/man9/store.9 Fri Oct 31 17:43:21 2014 (r273911) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 5, 2009 +.Dd October 29, 2014 .Dt STORE 9 .Os .Sh NAME @@ -48,15 +48,15 @@ .In sys/time.h .In sys/systm.h .Ft int -.Fn subyte "void *base" "int byte" +.Fn subyte "volatile void *base" "int byte" .Ft int -.Fn suword "void *base" "long word" +.Fn suword "volatile void *base" "long word" .Ft int -.Fn suword16 "void *base" "int word" +.Fn suword16 "volatile void *base" "int word" .Ft int -.Fn suword32 "void *base" "int32_t word" +.Fn suword32 "volatile void *base" "int32_t word" .Ft int -.Fn suword64 "void *base" "int64_t word" +.Fn suword64 "volatile void *base" "int64_t word" .In sys/resourcevar.h .Ft int .Fn suswintr "void *base" "int word" @@ -64,6 +64,8 @@ The .Nm functions are designed to copy small amounts of data to user-space. +If write is successful, it is performed atomically. +The data written must be naturally aligned. .Pp The .Nm Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Fri Oct 31 16:00:45 2014 (r273910) +++ head/sys/kern/kern_umtx.c Fri Oct 31 17:43:21 2014 (r273911) @@ -942,7 +942,7 @@ do_lock_normal(struct thread *td, struct * can fault on any access. */ for (;;) { - rv = fueword32(__DEVOLATILE(void *, &m->m_owner), &owner); + rv = fueword32(&m->m_owner, &owner); if (rv == -1) return (EFAULT); if (mode == _UMUTEX_WAIT) { @@ -1057,7 +1057,7 @@ do_unlock_normal(struct thread *td, stru /* * Make sure we own this mtx. */ - error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), &owner); + error = fueword32(&m->m_owner, &owner); if (error == -1) return (EFAULT); @@ -1115,7 +1115,7 @@ do_wake_umutex(struct thread *td, struct int error; int count; - error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), &owner); + error = fueword32(&m->m_owner, &owner); if (error == -1) return (EFAULT); @@ -1192,8 +1192,7 @@ do_wake2_umutex(struct thread *td, struc * any memory. */ if (count > 1) { - error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), - &owner); + error = fueword32(&m->m_owner, &owner); if (error == -1) error = EFAULT; while (error == 0 && (owner & UMUTEX_CONTESTED) == 0) { @@ -1211,8 +1210,7 @@ do_wake2_umutex(struct thread *td, struc break; } } else if (count == 1) { - error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), - &owner); + error = fueword32(&m->m_owner, &owner); if (error == -1) error = EFAULT; while (error == 0 && (owner & ~UMUTEX_CONTESTED) != 0 && @@ -1776,7 +1774,7 @@ do_unlock_pi(struct thread *td, struct u /* * Make sure we own this mtx. */ - error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), &owner); + error = fueword32(&m->m_owner, &owner); if (error == -1) return (EFAULT); @@ -2008,7 +2006,7 @@ do_unlock_pp(struct thread *td, struct u /* * Make sure we own this mtx. */ - error = fueword32(__DEVOLATILE(uint32_t *, &m->m_owner), &owner); + error = fueword32(&m->m_owner, &owner); if (error == -1) return (EFAULT); @@ -2040,8 +2038,7 @@ do_unlock_pp(struct thread *td, struct u * to lock the mutex, it is necessary because thread priority * has to be adjusted for such mutex. */ - error = suword32(__DEVOLATILE(uint32_t *, &m->m_owner), - UMUTEX_CONTESTED); + error = suword32(&m->m_owner, UMUTEX_CONTESTED); umtxq_lock(&key); if (error == 0) @@ -2116,8 +2113,7 @@ do_set_ceiling(struct thread *td, struct if (owner == UMUTEX_CONTESTED) { suword32(&m->m_ceilings[0], ceiling); - suword32(__DEVOLATILE(uint32_t *, &m->m_owner), - UMUTEX_CONTESTED); + suword32(&m->m_owner, UMUTEX_CONTESTED); error = 0; break; } @@ -2263,10 +2259,9 @@ do_cv_wait(struct thread *td, struct uco * Set c_has_waiters to 1 before releasing user mutex, also * don't modify cache line when unnecessary. */ - error = fueword32(__DEVOLATILE(uint32_t *, &cv->c_has_waiters), - &hasw); + error = fueword32(&cv->c_has_waiters, &hasw); if (error == 0 && hasw == 0) - suword32(__DEVOLATILE(uint32_t *, &cv->c_has_waiters), 1); + suword32(&cv->c_has_waiters, 1); umtxq_unbusy_unlocked(&uq->uq_key); @@ -2296,9 +2291,7 @@ do_cv_wait(struct thread *td, struct uco umtxq_remove(uq); if (oldlen == 1) { umtxq_unlock(&uq->uq_key); - suword32( - __DEVOLATILE(uint32_t *, - &cv->c_has_waiters), 0); + suword32(&cv->c_has_waiters, 0); umtxq_lock(&uq->uq_key); } } @@ -2333,8 +2326,7 @@ do_cv_signal(struct thread *td, struct u nwake = umtxq_signal(&key, 1); if (cnt <= nwake) { umtxq_unlock(&key); - error = suword32( - __DEVOLATILE(uint32_t *, &cv->c_has_waiters), 0); + error = suword32(&cv->c_has_waiters, 0); if (error == -1) error = EFAULT; umtxq_lock(&key); @@ -2363,7 +2355,7 @@ do_cv_broadcast(struct thread *td, struc umtxq_signal(&key, INT_MAX); umtxq_unlock(&key); - error = suword32(__DEVOLATILE(uint32_t *, &cv->c_has_waiters), 0); + error = suword32(&cv->c_has_waiters, 0); if (error == -1) error = EFAULT; @@ -2399,8 +2391,7 @@ do_rw_rdlock(struct thread *td, struct u wrflags |= URWLOCK_WRITE_WAITERS; for (;;) { - rv = fueword32(__DEVOLATILE(int32_t *, &rwlock->rw_state), - &state); + rv = fueword32(&rwlock->rw_state, &state); if (rv == -1) { umtx_key_release(&uq->uq_key); return (EFAULT); @@ -2440,8 +2431,7 @@ do_rw_rdlock(struct thread *td, struct u * re-read the state, in case it changed between the try-lock above * and the check below */ - rv = fueword32(__DEVOLATILE(int32_t *, &rwlock->rw_state), - &state); + rv = fueword32(&rwlock->rw_state, &state); if (rv == -1) error = EFAULT; @@ -2499,8 +2489,7 @@ sleep: umtxq_unlock(&uq->uq_key); if (error) break; - rv = fueword32(__DEVOLATILE(int32_t *, - &rwlock->rw_state), &state); + rv = fueword32(&rwlock->rw_state, &state); if (rv == -1) { error = EFAULT; break; @@ -2517,8 +2506,7 @@ sleep: } suword32(&rwlock->rw_blocked_readers, blocked_readers-1); if (blocked_readers == 1) { - rv = fueword32(__DEVOLATILE(int32_t *, - &rwlock->rw_state), &state); + rv = fueword32(&rwlock->rw_state, &state); if (rv == -1) error = EFAULT; while (error == 0) { @@ -2569,8 +2557,7 @@ do_rw_wrlock(struct thread *td, struct u blocked_readers = 0; for (;;) { - rv = fueword32(__DEVOLATILE(int32_t *, &rwlock->rw_state), - &state); + rv = fueword32(&rwlock->rw_state, &state); if (rv == -1) { umtx_key_release(&uq->uq_key); return (EFAULT); @@ -2614,8 +2601,7 @@ do_rw_wrlock(struct thread *td, struct u * re-read the state, in case it changed between the try-lock above * and the check below */ - rv = fueword32(__DEVOLATILE(int32_t *, &rwlock->rw_state), - &state); + rv = fueword32(&rwlock->rw_state, &state); if (rv == -1) error = EFAULT; @@ -2670,8 +2656,7 @@ sleep: umtxq_unlock(&uq->uq_key); if (error) break; - rv = fueword32(__DEVOLATILE(int32_t *, - &rwlock->rw_state), &state); + rv = fueword32(&rwlock->rw_state, &state); if (rv == -1) { error = EFAULT; break; @@ -2687,8 +2672,7 @@ sleep: } suword32(&rwlock->rw_blocked_writers, blocked_writers-1); if (blocked_writers == 1) { - rv = fueword32(__DEVOLATILE(int32_t *, - &rwlock->rw_state), &state); + rv = fueword32(&rwlock->rw_state, &state); if (rv == -1) { umtxq_unbusy_unlocked(&uq->uq_key); error = EFAULT; @@ -2748,7 +2732,7 @@ do_rw_unlock(struct thread *td, struct u if (error != 0) return (error); - error = fueword32(__DEVOLATILE(int32_t *, &rwlock->rw_state), &state); + error = fueword32(&rwlock->rw_state, &state); if (error == -1) { error = EFAULT; goto out; @@ -2856,7 +2840,7 @@ do_sem_wait(struct thread *td, struct _u umtxq_unlock(&uq->uq_key); rv = casueword32(&sem->_has_waiters, 0, &count1, 1); if (rv == 0) - rv = fueword32(__DEVOLATILE(uint32_t *, &sem->_count), &count); + rv = fueword32(&sem->_count, &count); if (rv == -1 || count != 0) { umtxq_lock(&uq->uq_key); umtxq_unbusy(&uq->uq_key); @@ -2911,8 +2895,7 @@ do_sem_wake(struct thread *td, struct _u */ if (cnt == 1) { umtxq_unlock(&key); - error = suword32( - __DEVOLATILE(uint32_t *, &sem->_has_waiters), 0); + error = suword32(&sem->_has_waiters, 0); umtxq_lock(&key); if (error == -1) error = EFAULT; @@ -2946,7 +2929,7 @@ do_sem2_wait(struct thread *td, struct _ umtxq_busy(&uq->uq_key); umtxq_insert(uq); umtxq_unlock(&uq->uq_key); - rv = fueword32(__DEVOLATILE(uint32_t *, &sem->_count), &count); + rv = fueword32(&sem->_count, &count); if (rv == -1) { umtxq_lock(&uq->uq_key); umtxq_unbusy(&uq->uq_key); @@ -3024,8 +3007,7 @@ do_sem2_wake(struct thread *td, struct _ */ if (cnt == 1) { umtxq_unlock(&key); - rv = fueword32(__DEVOLATILE(uint32_t *, &sem->_count), - &count); + rv = fueword32(&sem->_count, &count); while (rv != -1 && count & USEM_HAS_WAITERS) rv = casueword32(&sem->_count, count, &count, count & ~USEM_HAS_WAITERS); Modified: head/sys/kern/subr_uio.c ============================================================================== --- head/sys/kern/subr_uio.c Fri Oct 31 16:00:45 2014 (r273910) +++ head/sys/kern/subr_uio.c Fri Oct 31 17:43:21 2014 (r273911) @@ -453,7 +453,7 @@ copyout_unmap(struct thread *td, vm_offs */ int -fueword(const void *base, long *val) +fueword(volatile const void *base, long *val) { long res; @@ -465,7 +465,7 @@ fueword(const void *base, long *val) } int -fueword32(const void *base, int32_t *val) +fueword32(volatile const void *base, int32_t *val) { int32_t res; @@ -478,7 +478,7 @@ fueword32(const void *base, int32_t *val #ifdef _LP64 int -fueword64(const void *base, int64_t *val) +fueword64(volatile const void *base, int64_t *val) { int32_t res; @@ -516,7 +516,7 @@ casueword(volatile u_long *p, u_long old } #else /* NO_FUEWORD */ int32_t -fuword32(const void *addr) +fuword32(volatile const void *addr) { int rv; int32_t val; @@ -527,7 +527,7 @@ fuword32(const void *addr) #ifdef _LP64 int64_t -fuword64(const void *addr) +fuword64(volatile const void *addr) { int rv; int64_t val; @@ -538,7 +538,7 @@ fuword64(const void *addr) #endif /* _LP64 */ long -fuword(const void *addr) +fuword(volatile const void *addr) { long val; int rv; Modified: head/sys/powerpc/powerpc/copyinout.c ============================================================================== --- head/sys/powerpc/powerpc/copyinout.c Fri Oct 31 16:00:45 2014 (r273910) +++ head/sys/powerpc/powerpc/copyinout.c Fri Oct 31 17:43:21 2014 (r273911) @@ -80,7 +80,7 @@ int setfault(faultbuf); /* defined in lo #ifdef __powerpc64__ static __inline void -set_user_sr(pmap_t pm, const void *addr) +set_user_sr(pmap_t pm, volatile const void *addr) { struct slb *slb; register_t slbv; @@ -113,7 +113,7 @@ set_user_sr(pmap_t pm, const void *addr) } #else static __inline void -set_user_sr(pmap_t pm, const void *addr) +set_user_sr(pmap_t pm, volatile const void *addr) { register_t vsid; @@ -135,7 +135,7 @@ set_user_sr(pmap_t pm, const void *addr) #endif static __inline int -map_user_ptr(pmap_t pm, const void *uaddr, void **kaddr, size_t ulen, +map_user_ptr(pmap_t pm, volatile const void *uaddr, void **kaddr, size_t ulen, size_t *klen) { size_t l; @@ -156,7 +156,7 @@ map_user_ptr(pmap_t pm, const void *uadd } #else /* Book-E uses a combined kernel/user mapping */ static __inline int -map_user_ptr(pmap_t pm, const void *uaddr, void **kaddr, size_t ulen, +map_user_ptr(pmap_t pm, volatile const void *uaddr, void **kaddr, size_t ulen, size_t *klen) { @@ -281,7 +281,7 @@ copyinstr(const void *udaddr, void *kadd } int -subyte(void *addr, int byte) +subyte(volatile void *addr, int byte) { struct thread *td; pmap_t pm; @@ -309,7 +309,7 @@ subyte(void *addr, int byte) #ifdef __powerpc64__ int -suword32(void *addr, int word) +suword32(volatile void *addr, int word) { struct thread *td; pmap_t pm; @@ -337,7 +337,7 @@ suword32(void *addr, int word) #endif int -suword(void *addr, long word) +suword(volatile void *addr, long word) { struct thread *td; pmap_t pm; @@ -365,20 +365,20 @@ suword(void *addr, long word) #ifdef __powerpc64__ int -suword64(void *addr, int64_t word) +suword64(volatile void *addr, int64_t word) { return (suword(addr, (long)word)); } #else int -suword32(void *addr, int32_t word) +suword32(volatile void *addr, int32_t word) { return (suword(addr, (long)word)); } #endif int -fubyte(const void *addr) +fubyte(volatile const void *addr) { struct thread *td; pmap_t pm; @@ -406,7 +406,7 @@ fubyte(const void *addr) } int -fuword16(const void *addr) +fuword16(volatile const void *addr) { struct thread *td; pmap_t pm; @@ -433,7 +433,7 @@ fuword16(const void *addr) } int -fueword32(const void *addr, int32_t *val) +fueword32(volatile const void *addr, int32_t *val) { struct thread *td; pmap_t pm; @@ -461,7 +461,7 @@ fueword32(const void *addr, int32_t *val #ifdef __powerpc64__ int -fueword64(const void *addr, int64_t *val) +fueword64(volatile const void *addr, int64_t *val) { struct thread *td; pmap_t pm; @@ -489,7 +489,7 @@ fueword64(const void *addr, int64_t *val #endif int -fueword(const void *addr, long *val) +fueword(volatile const void *addr, long *val) { struct thread *td; pmap_t pm; Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Fri Oct 31 16:00:45 2014 (r273910) +++ head/sys/sys/systm.h Fri Oct 31 17:43:21 2014 (r273911) @@ -252,19 +252,19 @@ int copyout(const void * __restrict kadd int copyout_nofault(const void * __restrict kaddr, void * __restrict udaddr, size_t len) __nonnull(1) __nonnull(2); -int fubyte(const void *base); -long fuword(const void *base); -int fuword16(const void *base); -int32_t fuword32(const void *base); -int64_t fuword64(const void *base); -int fueword(const void *base, long *val); -int fueword32(const void *base, int32_t *val); -int fueword64(const void *base, int64_t *val); -int subyte(void *base, int byte); -int suword(void *base, long word); -int suword16(void *base, int word); -int suword32(void *base, int32_t word); -int suword64(void *base, int64_t word); +int fubyte(volatile const void *base); +long fuword(volatile const void *base); +int fuword16(volatile const void *base); +int32_t fuword32(volatile const void *base); +int64_t fuword64(volatile const void *base); +int fueword(volatile const void *base, long *val); +int fueword32(volatile const void *base, int32_t *val); +int fueword64(volatile const void *base, int64_t *val); +int subyte(volatile void *base, int byte); +int suword(volatile void *base, long word); +int suword16(volatile void *base, int word); +int suword32(volatile void *base, int32_t word); +int suword64(volatile void *base, int64_t word); uint32_t casuword32(volatile uint32_t *base, uint32_t oldval, uint32_t newval); u_long casuword(volatile u_long *p, u_long oldval, u_long newval); int casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp, From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 18:20:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 875FB275; Fri, 31 Oct 2014 18:20:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 737E2A64; Fri, 31 Oct 2014 18:20:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VIKeNO075062; Fri, 31 Oct 2014 18:20:40 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VIKew2075061; Fri, 31 Oct 2014 18:20:40 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201410311820.s9VIKew2075061@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 31 Oct 2014 18:20:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273913 - head/sys/boot/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 18:20:40 -0000 Author: andrew Date: Fri Oct 31 18:20:39 2014 New Revision: 273913 URL: https://svnweb.freebsd.org/changeset/base/273913 Log: Clean up the types of a few strings to make them const when they are never written to. Modified: head/sys/boot/fdt/fdt_loader_cmd.c Modified: head/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- head/sys/boot/fdt/fdt_loader_cmd.c Fri Oct 31 18:18:04 2014 (r273912) +++ head/sys/boot/fdt/fdt_loader_cmd.c Fri Oct 31 18:20:39 2014 (r273913) @@ -364,11 +364,11 @@ fdt_setup_fdtp() (cellbuf), (lim), (cellsize), 16); static int -_fdt_strtovect(char *str, void *cellbuf, int lim, unsigned char cellsize, +_fdt_strtovect(const char *str, void *cellbuf, int lim, unsigned char cellsize, uint8_t base) { - char *buf = str; - char *end = str + strlen(str) - 2; + const char *buf = str; + const char *end = str + strlen(str) - 2; uint32_t *u32buf = NULL; uint8_t *u8buf = NULL; int cnt = 0; @@ -411,7 +411,8 @@ _fdt_strtovect(char *str, void *cellbuf, static void fixup_ethernet(const char *env, char *ethstr, int *eth_no, int len) { - char *end, *str; + const char *str; + char *end; uint8_t tmp_addr[6]; int i, n; @@ -1347,7 +1348,7 @@ static int fdt_modprop(int nodeoff, char *propname, void *value, char mode) { uint32_t cells[100]; - char *buf; + const char *buf; int len, rv; const struct fdt_property *p; @@ -1365,7 +1366,7 @@ fdt_modprop(int nodeoff, char *propname, } len = strlen(value); rv = 0; - buf = (char *)value; + buf = value; switch (*buf) { case '&': From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 18:35:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CAA37690; Fri, 31 Oct 2014 18:35:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6C2EBB5; Fri, 31 Oct 2014 18:35:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VIZ30t083716; Fri, 31 Oct 2014 18:35:03 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VIZ3qH083715; Fri, 31 Oct 2014 18:35:03 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201410311835.s9VIZ3qH083715@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 31 Oct 2014 18:35:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273914 - head/sys/boot/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 18:35:03 -0000 Author: andrew Date: Fri Oct 31 18:35:03 2014 New Revision: 273914 URL: https://svnweb.freebsd.org/changeset/base/273914 Log: The command name is a constant, use the correct type. MFC after: 1 week Modified: head/sys/boot/fdt/fdt_loader_cmd.c Modified: head/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- head/sys/boot/fdt/fdt_loader_cmd.c Fri Oct 31 18:20:39 2014 (r273913) +++ head/sys/boot/fdt/fdt_loader_cmd.c Fri Oct 31 18:35:03 2014 (r273914) @@ -93,9 +93,9 @@ static int fdt_cmd_mres(int argc, char * typedef int cmdf_t(int, char *[]); struct cmdtab { - char *name; - cmdf_t *handler; - int flags; + const char *name; + cmdf_t *handler; + int flags; }; static const struct cmdtab commands[] = { From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 19:15:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 30E5BFF2; Fri, 31 Oct 2014 19:15:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CBE2DF; Fri, 31 Oct 2014 19:15:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VJFFbX003535; Fri, 31 Oct 2014 19:15:15 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VJFEDZ003525; Fri, 31 Oct 2014 19:15:14 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410311915.s9VJFEDZ003525@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 31 Oct 2014 19:15:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273917 - head/sys/dev/gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 19:15:16 -0000 Author: loos Date: Fri Oct 31 19:15:14 2014 New Revision: 273917 URL: https://svnweb.freebsd.org/changeset/base/273917 Log: Fix the gpiobus locking by using a more sane model where it isn't necessary hold the gpiobus lock between the gpio calls. gpiobus_acquire_lock() now accepts a third parameter which tells gpiobus what to do when the bus is already busy. When GPIOBUS_WAIT wait is used, the calling thread will be put to sleep until the bus became free. With GPIOBUS_DONTWAIT the calling thread will receive EWOULDBLOCK right away and then it can act upon. This fixes the gpioiic(4) locking issues that arises when doing multiple concurrent access on the bus. Modified: head/sys/dev/gpio/gpiobus.c head/sys/dev/gpio/gpiobus_if.m head/sys/dev/gpio/gpiobusvar.h head/sys/dev/gpio/gpioiic.c head/sys/dev/gpio/gpioled.c Modified: head/sys/dev/gpio/gpiobus.c ============================================================================== --- head/sys/dev/gpio/gpiobus.c Fri Oct 31 18:53:16 2014 (r273916) +++ head/sys/dev/gpio/gpiobus.c Fri Oct 31 19:15:14 2014 (r273917) @@ -53,9 +53,7 @@ static void gpiobus_hinted_child(device_ /* * GPIOBUS interface */ -static void gpiobus_lock_bus(device_t); -static void gpiobus_unlock_bus(device_t); -static void gpiobus_acquire_bus(device_t, device_t); +static int gpiobus_acquire_bus(device_t, device_t, int); static void gpiobus_release_bus(device_t, device_t); static int gpiobus_pin_setflags(device_t, device_t, uint32_t, uint32_t); static int gpiobus_pin_getflags(device_t, device_t, uint32_t, uint32_t*); @@ -326,37 +324,26 @@ gpiobus_hinted_child(device_t bus, const device_delete_child(bus, child); } -static void -gpiobus_lock_bus(device_t busdev) +static int +gpiobus_acquire_bus(device_t busdev, device_t child, int how) { struct gpiobus_softc *sc; sc = device_get_softc(busdev); GPIOBUS_ASSERT_UNLOCKED(sc); GPIOBUS_LOCK(sc); -} - -static void -gpiobus_unlock_bus(device_t busdev) -{ - struct gpiobus_softc *sc; - - sc = device_get_softc(busdev); - GPIOBUS_ASSERT_LOCKED(sc); + if (sc->sc_owner != NULL) { + if (how == GPIOBUS_DONTWAIT) { + GPIOBUS_UNLOCK(sc); + return (EWOULDBLOCK); + } + while (sc->sc_owner != NULL) + mtx_sleep(sc, &sc->sc_mtx, 0, "gpiobuswait", 0); + } + sc->sc_owner = child; GPIOBUS_UNLOCK(sc); -} -static void -gpiobus_acquire_bus(device_t busdev, device_t child) -{ - struct gpiobus_softc *sc; - - sc = device_get_softc(busdev); - GPIOBUS_ASSERT_LOCKED(sc); - - if (sc->sc_owner) - panic("gpiobus: cannot serialize the access to device."); - sc->sc_owner = child; + return (0); } static void @@ -365,14 +352,15 @@ gpiobus_release_bus(device_t busdev, dev struct gpiobus_softc *sc; sc = device_get_softc(busdev); - GPIOBUS_ASSERT_LOCKED(sc); - - if (!sc->sc_owner) + GPIOBUS_ASSERT_UNLOCKED(sc); + GPIOBUS_LOCK(sc); + if (sc->sc_owner == NULL) panic("gpiobus: releasing unowned bus."); if (sc->sc_owner != child) panic("gpiobus: you don't own the bus. game over."); - sc->sc_owner = NULL; + wakeup(sc); + GPIOBUS_UNLOCK(sc); } static int @@ -469,8 +457,6 @@ static device_method_t gpiobus_methods[] DEVMETHOD(bus_hinted_child, gpiobus_hinted_child), /* GPIO protocol */ - DEVMETHOD(gpiobus_lock_bus, gpiobus_lock_bus), - DEVMETHOD(gpiobus_unlock_bus, gpiobus_unlock_bus), DEVMETHOD(gpiobus_acquire_bus, gpiobus_acquire_bus), DEVMETHOD(gpiobus_release_bus, gpiobus_release_bus), DEVMETHOD(gpiobus_pin_getflags, gpiobus_pin_getflags), Modified: head/sys/dev/gpio/gpiobus_if.m ============================================================================== --- head/sys/dev/gpio/gpiobus_if.m Fri Oct 31 18:53:16 2014 (r273916) +++ head/sys/dev/gpio/gpiobus_if.m Fri Oct 31 19:15:14 2014 (r273917) @@ -32,25 +32,12 @@ INTERFACE gpiobus; # -# Lock the gpio bus -# -METHOD void lock_bus { - device_t busdev; -}; - -# -# Unlock the gpio bus -# -METHOD void unlock_bus { - device_t busdev; -}; - -# # Dedicate the gpio bus control for a child # -METHOD void acquire_bus { +METHOD int acquire_bus { device_t busdev; device_t dev; + int how; }; # Modified: head/sys/dev/gpio/gpiobusvar.h ============================================================================== --- head/sys/dev/gpio/gpiobusvar.h Fri Oct 31 18:53:16 2014 (r273916) +++ head/sys/dev/gpio/gpiobusvar.h Fri Oct 31 19:15:14 2014 (r273917) @@ -56,6 +56,9 @@ #define GPIOBUS_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED) #define GPIOBUS_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED) +#define GPIOBUS_WAIT 1 +#define GPIOBUS_DONTWAIT 2 + struct gpiobus_softc { struct mtx sc_mtx; /* bus mutex */ Modified: head/sys/dev/gpio/gpioiic.c ============================================================================== --- head/sys/dev/gpio/gpioiic.c Fri Oct 31 18:53:16 2014 (r273916) +++ head/sys/dev/gpio/gpioiic.c Fri Oct 31 19:15:14 2014 (r273917) @@ -154,18 +154,18 @@ static int gpioiic_callback(device_t dev, int index, caddr_t data) { struct gpioiic_softc *sc = device_get_softc(dev); - int error = 0; + int error, how; + how = GPIOBUS_DONTWAIT; + if (data != NULL && (int)*data == IIC_WAIT) + how = GPIOBUS_WAIT; + error = 0; switch (index) { case IIC_REQUEST_BUS: - GPIOBUS_LOCK_BUS(sc->sc_busdev); - GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev); - GPIOBUS_UNLOCK_BUS(sc->sc_busdev); + error = GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev, how); break; case IIC_RELEASE_BUS: - GPIOBUS_LOCK_BUS(sc->sc_busdev); GPIOBUS_RELEASE_BUS(sc->sc_busdev, sc->sc_dev); - GPIOBUS_UNLOCK_BUS(sc->sc_busdev); break; default: error = EINVAL; Modified: head/sys/dev/gpio/gpioled.c ============================================================================== --- head/sys/dev/gpio/gpioled.c Fri Oct 31 18:53:16 2014 (r273916) +++ head/sys/dev/gpio/gpioled.c Fri Oct 31 19:15:14 2014 (r273917) @@ -79,16 +79,23 @@ static int gpioled_detach(device_t); static void gpioled_control(void *priv, int onoff) { - struct gpioled_softc *sc = priv; + int error; + struct gpioled_softc *sc; + + sc = (struct gpioled_softc *)priv; GPIOLED_LOCK(sc); - GPIOBUS_LOCK_BUS(sc->sc_busdev); - GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, - GPIO_PIN_OUTPUT); - GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, - onoff ? GPIO_PIN_HIGH : GPIO_PIN_LOW); + error = GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev, + GPIOBUS_DONTWAIT); + if (error != 0) { + GPIOLED_UNLOCK(sc); + return; + } + error = GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, + GPIOLED_PIN, GPIO_PIN_OUTPUT); + if (error == 0) + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, + onoff ? GPIO_PIN_HIGH : GPIO_PIN_LOW); GPIOBUS_RELEASE_BUS(sc->sc_busdev, sc->sc_dev); - GPIOBUS_UNLOCK_BUS(sc->sc_busdev); GPIOLED_UNLOCK(sc); } From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 19:26:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BDE13A30; Fri, 31 Oct 2014 19:26:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9AE9525A; Fri, 31 Oct 2014 19:26:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VJQDB1008825; Fri, 31 Oct 2014 19:26:13 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VJQDXJ008824; Fri, 31 Oct 2014 19:26:13 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410311926.s9VJQDXJ008824@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 31 Oct 2014 19:26:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273918 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 19:26:13 -0000 Author: trasz Date: Fri Oct 31 19:26:12 2014 New Revision: 273918 URL: https://svnweb.freebsd.org/changeset/base/273918 Log: Change the default log level for iSCSI target from 3 to 1. It should have been 1 from the beginning; not sure how it ended up at 3. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.c Fri Oct 31 19:15:14 2014 (r273917) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Fri Oct 31 19:26:12 2014 (r273918) @@ -84,7 +84,7 @@ static uma_zone_t cfiscsi_data_wait_zone SYSCTL_NODE(_kern_cam_ctl, OID_AUTO, iscsi, CTLFLAG_RD, 0, "CAM Target Layer iSCSI Frontend"); -static int debug = 3; +static int debug = 1; SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, debug, CTLFLAG_RWTUN, &debug, 1, "Enable debug messages"); static int ping_timeout = 5; From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 21:05:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 04DE2306; Fri, 31 Oct 2014 21:05:00 +0000 (UTC) Received: from mail-pd0-x22d.google.com (mail-pd0-x22d.google.com [IPv6:2607:f8b0:400e:c02::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B78DF17D; Fri, 31 Oct 2014 21:04:59 +0000 (UTC) Received: by mail-pd0-f173.google.com with SMTP id v10so7946164pde.18 for ; Fri, 31 Oct 2014 14:04:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=syo7zTDGrExCqopBxWbuq9HnJi1zRyVZ5m+uXq0WjM4=; b=uboQ4oe8SG9ZQIA2IZHJ42N2jNrxozx5nW9mTVFA69F1P+JyI1kBEXNbMIH+98wtvx v9wuMj2UBlgpI7bMu5qV70ucMLJgWAURVyuEmH/Nf86RCWSImDOo0TdN7wiitnrSBwqG HKgK+fHm6kXdtTmqfaTbkfk5OdoIpjQ0w9sUd1tJTvtJibnBlrjQYFLzHzekSul1jbUu tTlHA7LkvlYrFZLZtK8gc31bfK8t8BpQciK3+Tec31f6qsr9dq5+aBMl8knLC2oKLNqi jLyrCkiVZgfi3zJFmcGf7IbBQN2rYNNkviV4rjy036ap0+x5DEW5et/oqdTy/HofTCTk r9zg== X-Received: by 10.68.135.33 with SMTP id pp1mr26851133pbb.120.1414789499340; Fri, 31 Oct 2014 14:04:59 -0700 (PDT) Received: from [192.168.20.5] (c-98-247-240-204.hsd1.wa.comcast.net. [98.247.240.204]) by mx.google.com with ESMTPSA id ny9sm10782581pab.25.2014.10.31.14.04.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 14:04:58 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_784D8CF4-A843-45CA-8987-B30DD87FD416"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... From: Garrett Cooper In-Reply-To: <201410302121.s9ULLsEw055630@svn.freebsd.org> Date: Fri, 31 Oct 2014 14:04:57 -0700 Message-Id: <9D38CD22-6BFC-4D55-8E8F-622EC2997723@gmail.com> References: <201410302121.s9ULLsEw055630@svn.freebsd.org> To: Mark Murray X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 21:05:00 -0000 --Apple-Mail=_784D8CF4-A843-45CA-8987-B30DD87FD416 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Oct 30, 2014, at 14:21, Mark Murray wrote: > Author: markm > Date: Thu Oct 30 21:21:53 2014 > New Revision: 273872 > URL: https://svnweb.freebsd.org/changeset/base/273872 >=20 > Log: > This is the much-discussed major upgrade to the random(4) device, = known to you all as /dev/random. >=20 > This code has had an extensive rewrite and a good series of reviews, = both by the author and other parties. This means a lot of code has been = simplified. Pluggable structures for high-rate entropy generators are = available, and it is most definitely not the case that /dev/random can = be driven by only a hardware souce any more. This has been designed out = of the device. Hardware sources are stirred into the CSPRNG (Yarrow, = Fortuna) like any other entropy source. Pluggable modules may be written = by third parties for additional sources. >=20 > The harvesting structures and consequently the locking have been = simplified. Entropy harvesting is done in a more general way (the = documentation for this will follow). There is some GREAT entropy to be = had in the UMA allocator, but it is disabled for now as messing with = that is likely to annoy many people. >=20 > The venerable (but effective) Yarrow algorithm, which is no longer = supported by its authors now has an alternative, Fortuna. For now, = Yarrow is retained as the default algorithm, but this may be changed = using a kernel option. It is intended to make Fortuna the default = algorithm for 11.0. Interested parties are encouraged to read ISBN = 978-0-470-47424-2 "Cryptography Engineering" By Ferguson, Schneier and = Kohno for Fortuna's gory details. Heck, read it anyway. >=20 > Many thanks to Arthur Mesh who did early grunt work, and who got = caught in the crossfire rather more than he deserved to. >=20 > My thanks also to folks who helped me thresh this out on whiteboards = and in the odd "Hallway track", or otherwise. >=20 > My Nomex pants are on. Let the feedback commence! >=20 > Reviewed by: trasz,des(partial),imp(partial?),rwatson(partial?) > Approved by: so(des) Hi Mark, Could you please add an UPDATING entry for this? Some users (like me) = who do make installworld from old kernels are experiencing issues (some = dealing with filesystem corruption). Please see this thread on -current@ = for more details: = https://lists.freebsd.org/pipermail/freebsd-current/2014-October/053039.ht= ml This also should have had =93Relnotes: yes=94 in the commit message = because this deserves to be put in the release notes for 11.0 Thanks! --Apple-Mail=_784D8CF4-A843-45CA-8987-B30DD87FD416 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJUU/l5AAoJEMZr5QU6S73eUAAH/iIxf9FQWxQJF0aAhyoq62eV kax0hHoHARYNtgGQBfifv6y7sjjHx8p3EgfNoW0W5IIuYftoE33WWzmMnp9HPMQE Owepj7sNxTKLvIJNSxJXzDOLH71fqRSliqEdI9n3SfuQTholg9dsqus9k+28zj2X Y+hNOav9M8xR6YdccGG7K4FyJTnafxadWxqjMifvwCbEjDPQkvcd4xoMRLjiaiD9 R/xbkzyz5iLQXPH4o7+vbOe6fXn55sj1/ApTmwLoVrH2iUZZXQVDV8ybFQkQEzLl uDDG40mmBePQun2+u0rEunNs+KikHaXOysi8zZoy6eZ8KNvtM/ytrGzyFzc8dkU= =eYUg -----END PGP SIGNATURE----- --Apple-Mail=_784D8CF4-A843-45CA-8987-B30DD87FD416-- From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 21:30:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 543B39C3; Fri, 31 Oct 2014 21:30:40 +0000 (UTC) Received: from mail-pd0-x231.google.com (mail-pd0-x231.google.com [IPv6:2607:f8b0:400e:c02::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0ED793D7; Fri, 31 Oct 2014 21:30:40 +0000 (UTC) Received: by mail-pd0-f177.google.com with SMTP id v10so7936986pde.22 for ; Fri, 31 Oct 2014 14:30:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=QOzae4tdRYGSi7lxNg78gh+ogXveLpFaYV+R8/06iTI=; b=sHzN4+b0LRqOpFsNN56IusC6+sTQkccXw9EbKeGyQkXYD+O4bAT0kw/qZRl3uN1s0F o7+qtv/JfJawprHycRIfQY9QKK4ZZ9D8dcx/zFAY6s1nULrkKLKt/SCona/wb3VMFN06 4QQ7KSymnlLodCcVQWlNMvm2nIPQEkPuKHqedz//lkCSDm7XDciMUkasQYtewuqUh24h IT0DyvX3kjNr54+iDoMHQ+4PKGdKLxgO9bzG2tyQKErBdaE7rUpjZNBV9gEaNB/B5Ie8 wD8qzW+LzrPBsNEC+iPFJVyic2oPgJB/HaAIwd2Y0v0yt88UuFmciVb7eGhGi8WRby5i d9uA== X-Received: by 10.68.135.65 with SMTP id pq1mr27210329pbb.18.1414791039647; Fri, 31 Oct 2014 14:30:39 -0700 (PDT) Received: from [192.168.20.5] (c-98-247-240-204.hsd1.wa.comcast.net. [98.247.240.204]) by mx.google.com with ESMTPSA id v4sm4115327pbs.64.2014.10.31.14.30.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 14:30:38 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_537C600A-464D-4B99-B286-17F6C1C194DB"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273734 - head/bin/dd From: Garrett Cooper In-Reply-To: <20141028210830.L1034@besplex.bde.org> Date: Fri, 31 Oct 2014 14:30:37 -0700 Message-Id: References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141027153957.GZ1877@kib.kiev.ua> <20141027155427.GM1492@f10.opsec.eu> <86vbn4egjt.fsf@nine.des.no> <20141028200418.E849@besplex.bde.org> <86mw8ged20.fsf@nine.des.no> <20141028210830.L1034@besplex.bde.org> To: Bruce Evans X-Mailer: Apple Mail (2.1878.6) Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Kurt Jaeger , Konstantin Belousov , =?iso-8859-1?Q?Dag-Erling_Sm=F8rgrav?= X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 21:30:40 -0000 --Apple-Mail=_537C600A-464D-4B99-B286-17F6C1C194DB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Oct 28, 2014, at 4:33, Bruce Evans wrote: > On Tue, 28 Oct 2014, [utf-8] Dag-Erling Sm=F8rgrav wrote: >=20 >> Bruce Evans writes: >>> Dag-Erling Sm=F8rgrav writes: >>>> This is a bug on all platforms, and both clang and (recent) gcc >>>> should complain about it. That printf() call will print garbage. >>> No, this is only a bug on 32-bit arches. The is is SSIZE_MAX. >>=20 >> If you mean "it only has consequences on 32-bit arches", then I agree = - >> but it is still a bug to pass an int to %jd. >=20 > This is machine-dependent. intmax_t may be int. The only requirement > on intmax_t is that it can represent any value of any signed integer > type. This is possible if the largest integer type is 64 bits (the > smallest permitted largest type) and int is also 64 bits (and there > are no complications for padding bits). intmax_t can even be signed > char if that is wide enough (not in POSIX starting 10-15 years ago, > since signed char is now required to be 8 bits. It is weird for > intmax_t to have the lowest rank (not counting Bool), but FreeBSD uses > this loophole to make it have second highest rank on 64-bit arches. Indeed. For some giggles, look at this bug: = https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D191674 = ("printf("%tu", (intmax_t)-1) returns UINT64_MAX on i386, not = UINT32_MAX=94). Cheers, --Apple-Mail=_537C600A-464D-4B99-B286-17F6C1C194DB Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJUU/99AAoJEMZr5QU6S73eaPoIAJoklajBANchbv1dj1yHfslz lOOA+QBzOHsVnc/6mncytOZeu2lUxN86n3EnEkRanyzs0csxMZI2DI+BXdBf3SnT 85WyoiBLMgv+7rqdkUc7xWzmRNQl7uV1CK464sFdpv1rYAaVT1gSCkZmXvKQALgg qPiyBUz4M03P8yNT2tiJPPvK1NYw5e8NYatTaR81Qp9NgTUHvSO0s38oQMHziQ2g MhuWhWWOySzF6NhW/dcBOzB5Hzp8Rbwnio8WIcuwy/zlK5Jeozgb+zQulqEP96UK Q+OJ1AMIJ7WNIy17Ts1kRMdVCdJu3lOrquJ8rdy96tppP0wDAeKYUYIRdtXrVZM= =LbDi -----END PGP SIGNATURE----- --Apple-Mail=_537C600A-464D-4B99-B286-17F6C1C194DB-- From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 22:20:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2DB011AC; Fri, 31 Oct 2014 22:20:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A206C64; Fri, 31 Oct 2014 22:20:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VMKRdg096415; Fri, 31 Oct 2014 22:20:27 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VMKRaO096404; Fri, 31 Oct 2014 22:20:27 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410312220.s9VMKRaO096404@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 31 Oct 2014 22:20:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273919 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 22:20:28 -0000 Author: delphij Date: Fri Oct 31 22:20:27 2014 New Revision: 273919 URL: https://svnweb.freebsd.org/changeset/base/273919 Log: rc.d/geli should not depend on random, as the attach functionality do not require additional entropy to function. It would create a circular dependency (not immediately obvious: geli provides 'disks' and requires 'random' as of r273872, 'random' requires 'FILESYSTEMS', 'FILESYSTEMS' requires 'root', 'root' requires 'swap', and finally 'swap' requires 'disk'). Modified: head/etc/rc.d/geli Modified: head/etc/rc.d/geli ============================================================================== --- head/etc/rc.d/geli Fri Oct 31 19:26:12 2014 (r273918) +++ head/etc/rc.d/geli Fri Oct 31 22:20:27 2014 (r273919) @@ -28,7 +28,6 @@ # # PROVIDE: disks -# REQUIRE: random # KEYWORD: nojail . /etc/rc.subr From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 22:28:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EA17C4CC; Fri, 31 Oct 2014 22:28:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC48AD20; Fri, 31 Oct 2014 22:28:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VMSBKU099777; Fri, 31 Oct 2014 22:28:11 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VMSBkP099774; Fri, 31 Oct 2014 22:28:11 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201410312228.s9VMSBkP099774@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Fri, 31 Oct 2014 22:28:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273920 - in head/bin/sh: . tests/expansion X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 22:28:12 -0000 Author: jilles Date: Fri Oct 31 22:28:10 2014 New Revision: 273920 URL: https://svnweb.freebsd.org/changeset/base/273920 Log: sh: Fix corruption of CTL* bytes in positional parameters in redirection. EXP_REDIR was not being checked for while expanding positional parameters in redirection, so CTL* bytes were not being prefixed where they should be. MFC after: 1 week Added: head/bin/sh/tests/expansion/redir1.0 (contents, props changed) Modified: head/bin/sh/expand.c head/bin/sh/tests/expansion/Makefile Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Fri Oct 31 22:20:27 2014 (r273919) +++ head/bin/sh/expand.c Fri Oct 31 22:28:10 2014 (r273920) @@ -862,7 +862,7 @@ varisset(const char *name, int nulok) static void strtodest(const char *p, int flag, int subtype, int quoted) { - if (flag & (EXP_FULL | EXP_CASE) && subtype != VSLENGTH) + if (flag & (EXP_FULL | EXP_CASE | EXP_REDIR) && subtype != VSLENGTH) STPUTS_QUOTES(p, quoted ? DQSYNTAX : BASESYNTAX, expdest); else STPUTS(p, expdest); Modified: head/bin/sh/tests/expansion/Makefile ============================================================================== --- head/bin/sh/tests/expansion/Makefile Fri Oct 31 22:20:27 2014 (r273919) +++ head/bin/sh/tests/expansion/Makefile Fri Oct 31 22:28:10 2014 (r273920) @@ -72,6 +72,7 @@ FILES+= plus-minus7.0 FILES+= plus-minus8.0 FILES+= question1.0 FILES+= readonly1.0 +FILES+= redir1.0 FILES+= set-u1.0 FILES+= set-u2.0 FILES+= set-u3.0 Added: head/bin/sh/tests/expansion/redir1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/expansion/redir1.0 Fri Oct 31 22:28:10 2014 (r273920) @@ -0,0 +1,26 @@ +# $FreeBSD$ + +bad=0 +for i in 0 1 2 3; do + for j in 0 1 2 3 4 5 6 7; do + for k in 0 1 2 3 4 5 6 7; do + case $i$j$k in + 000) continue ;; + esac + set -- "$(printf \\$i$j$k@)" + set -- "${1%@}" + ff= + for f in /dev/null /dev/zero /; do + if [ -e "$f" ] && [ ! -e "$f$1" ]; then + ff=$f + fi + done + [ -n "$ff" ] || continue + if { true <$ff$1; } 2>/dev/null; then + echo "Bad: $i$j$k ($ff)" >&2 + : $((bad += 1)) + fi + done + done +done +exit $((bad ? 2 : 0)) From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 23:09:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5D94981E; Fri, 31 Oct 2014 23:09:54 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "funkthat.com", Issuer "funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 2E448136; Fri, 31 Oct 2014 23:09:53 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id s9VN9lSm045630 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 31 Oct 2014 16:09:47 -0700 (PDT) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id s9VN9lCE045629; Fri, 31 Oct 2014 16:09:47 -0700 (PDT) (envelope-from jmg) Date: Fri, 31 Oct 2014 16:09:47 -0700 From: John-Mark Gurney To: Garrett Cooper Subject: Re: svn commit: r273734 - head/bin/dd Message-ID: <20141031230947.GT8852@funkthat.com> References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141027153957.GZ1877@kib.kiev.ua> <20141027155427.GM1492@f10.opsec.eu> <86vbn4egjt.fsf@nine.des.no> <20141028200418.E849@besplex.bde.org> <86mw8ged20.fsf@nine.des.no> <20141028210830.L1034@besplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Fri, 31 Oct 2014 16:09:48 -0700 (PDT) Cc: src-committers@freebsd.org, Bruce Evans , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Kurt Jaeger , Konstantin Belousov , Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 23:09:54 -0000 Garrett Cooper wrote this message on Fri, Oct 31, 2014 at 14:30 -0700: > On Oct 28, 2014, at 4:33, Bruce Evans wrote: > > > On Tue, 28 Oct 2014, [utf-8] Dag-Erling Smørgrav wrote: > > > >> Bruce Evans writes: > >>> Dag-Erling Smørgrav writes: > >>>> This is a bug on all platforms, and both clang and (recent) gcc > >>>> should complain about it. That printf() call will print garbage. > >>> No, this is only a bug on 32-bit arches. The is is SSIZE_MAX. > >> > >> If you mean "it only has consequences on 32-bit arches", then I agree - > >> but it is still a bug to pass an int to %jd. > > > > This is machine-dependent. intmax_t may be int. The only requirement > > on intmax_t is that it can represent any value of any signed integer > > type. This is possible if the largest integer type is 64 bits (the > > smallest permitted largest type) and int is also 64 bits (and there > > are no complications for padding bits). intmax_t can even be signed > > char if that is wide enough (not in POSIX starting 10-15 years ago, > > since signed char is now required to be 8 bits. It is weird for > > intmax_t to have the lowest rank (not counting Bool), but FreeBSD uses > > this loophole to make it have second highest rank on 64-bit arches. > > Indeed. For some giggles, look at this bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191674 ("printf("%tu", (intmax_t)-1) returns UINT64_MAX on i386, not UINT32_MAX?). That isn't surprising.. because you're sign extending -1 via intmax_t... Even if you didn't mix unsigned and signed in your printf, and casted to uintmax_t, you'd still get UINT64_MAX... This is just how casting of signed numbers work and conversion from signed to unsigned... The bug (from 191674) is in [SU]JARG casting ptrdiff_t to intmax_t if anywhere... It should be cast to the correct intXX_t sized value instead.. In the SJARG case, a simple cast to ptrdiff_t is sufficient.. Now bde will have better idea on the UJARG case, but that needs to go be casted to uintXX_t, and no further casting is needed... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 23:41:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AFE5AD55; Fri, 31 Oct 2014 23:41:29 +0000 (UTC) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C9AE633; Fri, 31 Oct 2014 23:41:29 +0000 (UTC) Received: from [73.34.117.227] (helo=ilsoft.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1XkLot-000Cjb-LM; Fri, 31 Oct 2014 23:41:27 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id s9VNfP4I086083; Fri, 31 Oct 2014 17:41:26 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX19kc7ugBiFf3qtJymHQ9VJt X-Authentication-Warning: paranoia.hippie.lan: Host revolution.hippie.lan [172.22.42.240] claimed to be [172.22.42.240] Subject: Re: svn commit: r273734 - head/bin/dd From: Ian Lepore To: Garrett Cooper In-Reply-To: References: <201410271138.s9RBcHrA002447@svn.freebsd.org> <20141027153957.GZ1877@kib.kiev.ua> <20141027155427.GM1492@f10.opsec.eu> <86vbn4egjt.fsf@nine.des.no> <20141028200418.E849@besplex.bde.org> <86mw8ged20.fsf@nine.des.no> <20141028210830.L1034@besplex.bde.org> Content-Type: text/plain; charset="iso-8859-13" Date: Fri, 31 Oct 2014 17:41:25 -0600 Message-ID: <1414798885.17308.198.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by ilsoft.org id s9VNfP4I086083 Cc: src-committers@freebsd.org, Bruce Evans , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Kurt Jaeger , Konstantin Belousov , Dag-Erling =?ISO-8859-1?Q?Sm=F8rgrav?= X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 23:41:29 -0000 On Fri, 2014-10-31 at 14:30 -0700, Garrett Cooper wrote: > On Oct 28, 2014, at 4:33, Bruce Evans wrote: >=20 > > On Tue, 28 Oct 2014, [utf-8] Dag-Erling Sm=B8rgrav wrote: > >=20 > >> Bruce Evans writes: > >>> Dag-Erling Sm=B8rgrav writes: > >>>> This is a bug on all platforms, and both clang and (recent) gcc > >>>> should complain about it. That printf() call will print garbage. > >>> No, this is only a bug on 32-bit arches. The is is SSIZE_MAX. > >>=20 > >> If you mean "it only has consequences on 32-bit arches", then I agre= e - > >> but it is still a bug to pass an int to %jd. > >=20 > > This is machine-dependent. intmax_t may be int. The only requiremen= t > > on intmax_t is that it can represent any value of any signed integer > > type. This is possible if the largest integer type is 64 bits (the > > smallest permitted largest type) and int is also 64 bits (and there > > are no complications for padding bits). intmax_t can even be signed > > char if that is wide enough (not in POSIX starting 10-15 years ago, > > since signed char is now required to be 8 bits. It is weird for > > intmax_t to have the lowest rank (not counting Bool), but FreeBSD use= s > > this loophole to make it have second highest rank on 64-bit arches. >=20 > Indeed. For some giggles, look at this bug: https://bugs.freebsd.org/bu= gzilla/show_bug.cgi?id=3D191674 ("printf("%tu", (intmax_t)-1) returns UIN= T64_MAX on i386, not UINT32_MAX=A1). > Cheers, Isn't the problem in that bug that the cast doesn't match the printf format, and the correct code would be something like the following? printf("%tu", (ptrdiff_t)-1); -- Ian From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 23:52:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 95D7C730; Fri, 31 Oct 2014 23:52:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81832805; Fri, 31 Oct 2014 23:52:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9VNq3C9044766; Fri, 31 Oct 2014 23:52:03 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9VNq3iO044765; Fri, 31 Oct 2014 23:52:03 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201410312352.s9VNq3iO044765@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Fri, 31 Oct 2014 23:52:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273922 - head/usr.sbin/bsdinstall X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 23:52:03 -0000 Author: nwhitehorn Date: Fri Oct 31 23:52:02 2014 New Revision: 273922 URL: https://svnweb.freebsd.org/changeset/base/273922 Log: Rewrite some of the disk setup documentation to be clearer and contain less obsolete information. Also move the entropy command down the list -- the list is ordered by likelihood of use rather than alphabetically. MFC after: 1 week Modified: head/usr.sbin/bsdinstall/bsdinstall.8 Modified: head/usr.sbin/bsdinstall/bsdinstall.8 ============================================================================== --- head/usr.sbin/bsdinstall/bsdinstall.8 Fri Oct 31 23:10:58 2014 (r273921) +++ head/usr.sbin/bsdinstall/bsdinstall.8 Fri Oct 31 23:52:02 2014 (r273922) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 15, 2013 +.Dd October 31, 2014 .Dt BSDINSTALL 8 .Os .Sh NAME @@ -73,10 +73,6 @@ targets. .Bl -tag -width ".Cm jail Ar destination" .It Cm auto Run the standard interactive installation, including disk partitioning. -.It Cm entropy -Reads a small amount of data from -.Pa /dev/random -and stores it in a file in the new system's root directory. .It Cm jail Ar destination Sets up a new chroot system at .Pa destination , @@ -119,32 +115,28 @@ If is set, also configures the network interfaces of the current system to match. .It Cm autopart Provides the installer's interactive guided disk partitioner for single-disk -installations. Partitions disks, runs -.Xr newfs 8 , -and writes the new system's -.Pa fstab . +installations. Defaults to UFS. .It Cm zfsboot -Provides the installer's -.Pq experimental -interactive/scriptable ZFS partitioner for multi-disk installations. +Provides an alternative ZFS-only automatic interactive disk partitioner. Creates a single .Ic zpool -with datasets and writes to the new system's -.Pa rc.conf , -.Pa loader.conf , +with separate datasets for +.Pa /tmp , +.Pa /usr , +.Pa /usr/home , +.Pa /usr/ports , +.Pa /usr/src , and -.Pa fstab . -Supports -.Xr geli 8 , -.Xr gnop 8 , -and many other features. +.Pa /var . +Optionally can set up +.Xr geli 8 +to encrypt the disk. .It Cm partedit -Provides the installer's interactive manual disk partitioner, with support -for multi disk setups, non-UFS file systems, and manual selection of -partition schemes. Partitions disks, runs -.Xr newfs 8 , -and writes the new system's -.Pa fstab . +Provides the installer's interactive manual disk partitioner with an interface +identical to +.Xr sade 8 . +Supports multiple disks as well as UFS, ZFS, and FAT file systems. ZFS +is set up with one pool and dataset per partition. .It Cm scriptedpart Ar parameters Sets up disks like .Cm autopart @@ -190,13 +182,19 @@ keyword causes the partition to take all .Ar type option chooses the .Xr gpart 8 -filesystem type (e.g. freebsd-ufs or freebsd-swap). +filesystem type (e.g. freebsd-ufs, freebsd-zfs, or freebsd-swap). The optional .Ar mount point argument sets where the created partition is to be mounted in the installed system. As an example, a typical invocation looks like: .Pp bsdinstall scriptedpart ada0 { 20G freebsd-ufs /, 4G freebsd-swap, 20G freebsd-ufs /var, auto freebsd-ufs /usr } +.Pp +A shorter invocation to use the default partitioning (as +.Cm autopart +would have used) on the same disk: +.Pp +bsdinstall scriptedpart ada0 .It Cm mount Mounts the file systems previously configured by .Cm autopart , @@ -235,6 +233,10 @@ Interactively sets the time, date, and t Queries the user for the system daemons to begin at system startup, writing the result into the new system's .Pa rc.conf . +.It Cm entropy +Reads a small amount of data from +.Pa /dev/random +and stores it in a file in the new system's root directory. .It Cm config Installs the configuration files destined for the new system (e.g. rc.conf fragments generated by @@ -346,14 +348,14 @@ which is passed to the .Cm scriptedpart target to control disk setup. Alternatively, +to use +.Cm zfsboot instead of -.Ev PARTITIONS , +.Cm partedit , the preamble can contain the variable .Ev ZFSBOOT_DATASETS -which is parsed by the -.Pq experimental -.Cm zfsboot -target to control ZFS datasets/options of the boot pool setup. +instead of +.Ev PARTITIONS . .Ss SETUP SCRIPT Following the preamble is an optional shell script, beginning with a #! declaration. This script will be run at the end of the installation process From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 00:51:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 44DEA6FF; Sat, 1 Nov 2014 00:51:41 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 08971D48; Sat, 1 Nov 2014 00:51:40 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 0CEA7A28A; Sat, 1 Nov 2014 00:51:40 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 0AC6C109F8; Sat, 1 Nov 2014 01:51:41 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Xin LI Subject: Re: svn commit: r273919 - head/etc/rc.d References: <201410312220.s9VMKRaO096404@svn.freebsd.org> Date: Sat, 01 Nov 2014 01:51:41 +0100 In-Reply-To: <201410312220.s9VMKRaO096404@svn.freebsd.org> (Xin LI's message of "Fri, 31 Oct 2014 22:20:27 +0000 (UTC)") Message-ID: <86bnor9202.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 00:51:41 -0000 Xin LI writes: > Log: > rc.d/geli should not depend on random, as the attach functionality > do not require additional entropy to function. >=20=20=20 > It would create a circular dependency (not immediately obvious: > geli provides 'disks' and requires 'random' as of r273872, > 'random' requires 'FILESYSTEMS', 'FILESYSTEMS' requires 'root', > 'root' requires 'swap', and finally 'swap' requires 'disk'). My first instinct was: shouldn't rcorder warn about this? It turns out that it does, but in a very cryptic fashion: des@nine ~head/etc/rc.d% svn up -qr273871=20=20 des@nine ~head/etc/rc.d% rcorder * >/dev/null des@nine ~head/etc/rc.d% svn up -qr273872=20=20=20=20 des@nine ~head/etc/rc.d% rcorder * >/dev/null rcorder: Circular dependency on file `zfs'. rcorder: Circular dependency on provision `mountcritlocal' in file `zfs'. rcorder: Circular dependency on provision `mountcritlocal' in file `var'. rcorder: Circular dependency on provision `mountcritlocal' in file `FILESYS= TEMS'. rcorder: Circular dependency on provision `root' in file `FILESYSTEMS'. des@nine ~head/etc/rc.d% svn up -qr273919=20=20=20=20 des@nine ~head/etc/rc.d% rcorder * >/dev/null des@nine ~head/etc/rc.d%=20 DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 00:54:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 41E8D855; Sat, 1 Nov 2014 00:54:10 +0000 (UTC) Received: from mail-pa0-x230.google.com (mail-pa0-x230.google.com [IPv6:2607:f8b0:400e:c03::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 020B1D54; Sat, 1 Nov 2014 00:54:09 +0000 (UTC) Received: by mail-pa0-f48.google.com with SMTP id ey11so8689180pad.35 for ; Fri, 31 Oct 2014 17:54:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=j121buUndlL354zFkCva1wNdNn1Yw/O4DsxkMpMy6gY=; b=J/N49T7jX1B0iuV/wnP5zTbrom2A1IIlMVEjN/3GSGHV4SjQBcslL9/jTlz838dHqM UU5hFrGMLgp16dQ8aGN6Hb/v6eSeL+KQVNZUDI6aO44765jrnCme7iVPSSZ8VsRXW1S4 esSR4/SUtmUy45La1T6yD1cLowWWWsg/uyVsB7QpXQdDh6U0NKhMr2fM5nSEYkoHRp6q 3cnsi0BL08ThliXyJrRWw7bfA9lRWYrd1CWj+7cVUGvQ6dWfWXnVEbtr11J37XYgoN7H PqDJwL3Ruyum8LZqY6lJ5F7YQcLHZmutCl31ow9lkVRoqgdFbqGaCZ73JIN0jNT7D/92 F4Ow== X-Received: by 10.70.37.101 with SMTP id x5mr28566927pdj.24.1414803249225; Fri, 31 Oct 2014 17:54:09 -0700 (PDT) Received: from ?IPv6:2601:8:ab80:7d6:34d4:4abd:64bb:590a? ([2601:8:ab80:7d6:34d4:4abd:64bb:590a]) by mx.google.com with ESMTPSA id ri9sm10980947pbc.5.2014.10.31.17.54.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 17:54:08 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_DF1385D1-9A8E-43B3-A633-733B5E8017FC"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273919 - head/etc/rc.d From: Garrett Cooper In-Reply-To: <86bnor9202.fsf@nine.des.no> Date: Fri, 31 Oct 2014 17:54:07 -0700 Message-Id: <0577B462-91E9-4E46-BF9E-085B50EDE09C@gmail.com> References: <201410312220.s9VMKRaO096404@svn.freebsd.org> <86bnor9202.fsf@nine.des.no> To: =?iso-8859-1?Q?Dag-Erling_Sm=F8rgrav?= X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Xin LI X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 00:54:10 -0000 --Apple-Mail=_DF1385D1-9A8E-43B3-A633-733B5E8017FC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 On Oct 31, 2014, at 17:51, Dag-Erling Sm=F8rgrav wrote: > Xin LI writes: >> Log: >> rc.d/geli should not depend on random, as the attach functionality >> do not require additional entropy to function. >>=20 >> It would create a circular dependency (not immediately obvious: >> geli provides 'disks' and requires 'random' as of r273872, >> 'random' requires 'FILESYSTEMS', 'FILESYSTEMS' requires 'root', >> 'root' requires 'swap', and finally 'swap' requires 'disk'). >=20 > My first instinct was: shouldn't rcorder warn about this? It turns = out > that it does, but in a very cryptic fashion: >=20 > des@nine ~head/etc/rc.d% svn up -qr273871 =20 > des@nine ~head/etc/rc.d% rcorder * >/dev/null > des@nine ~head/etc/rc.d% svn up -qr273872 =20 > des@nine ~head/etc/rc.d% rcorder * >/dev/null > rcorder: Circular dependency on file `zfs'. > rcorder: Circular dependency on provision `mountcritlocal' in file = `zfs'. > rcorder: Circular dependency on provision `mountcritlocal' in file = `var'. > rcorder: Circular dependency on provision `mountcritlocal' in file = `FILESYSTEMS'. > rcorder: Circular dependency on provision `root' in file = `FILESYSTEMS'. > des@nine ~head/etc/rc.d% svn up -qr273919 =20 > des@nine ~head/etc/rc.d% rcorder * >/dev/null > des@nine ~head/etc/rc.d%=20 rcorder errors are indeed cryptic/confusing. I can quickly add a = testcase for this if you like (basically check for all the scenarios = that need to be covered via /etc/rc). Does that sound good? Thanks! --Apple-Mail=_DF1385D1-9A8E-43B3-A633-733B5E8017FC Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJUVC8vAAoJEMZr5QU6S73eH4AH/0x96qlsz3AdSPeCxTjNU1cE 7xJPuln401K/ORTt28vnzyw8uPQ2ldvfzqmwuR5ijSl3o1lW/jMWMPbwCuSkFP2w xgviOSsqzdqhPifOb5VCoRP95kuCyq9+k9Cdrs9Q3jlC7ijBAla7cxYCGtRK2xQW qgVI4v/a+/P1Q+rHS2XC5fh9qBXUH/U7Ybq5CrAfPCh57BpUfWtArmYHyGubcDew m/c172ERAiG035IJeTdoBC/dX2NMCOwQiy3wxNkSq7OCMeLirv04GK5tOOZIHaaZ HXPBcyFQfAtB5ugILC4/rjIWznaTMZg3+n6WdJs6643fJ2qLCeSHlHlmhjohoZY= =AsJe -----END PGP SIGNATURE----- --Apple-Mail=_DF1385D1-9A8E-43B3-A633-733B5E8017FC-- From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 09:10:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4E111C39; Sat, 1 Nov 2014 09:10:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39D93C11; Sat, 1 Nov 2014 09:10:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA19AMLb005106; Sat, 1 Nov 2014 09:10:22 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA19AMDu005105; Sat, 1 Nov 2014 09:10:22 GMT (envelope-from des@FreeBSD.org) Message-Id: <201411010910.sA19AMDu005105@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: des set sender to des@FreeBSD.org using -f From: Dag-Erling Smørgrav Date: Sat, 1 Nov 2014 09:10:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273924 - head/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 09:10:22 -0000 Author: des Date: Sat Nov 1 09:10:21 2014 New Revision: 273924 URL: https://svnweb.freebsd.org/changeset/base/273924 Log: is a superset of and must always come first. Coincidentally, today is the 11th anniversary of this man page's (and this bug's) first appearance in FreeBSD. MFC after: 3 days Modified: head/lib/libc/sys/utrace.2 Modified: head/lib/libc/sys/utrace.2 ============================================================================== --- head/lib/libc/sys/utrace.2 Sat Nov 1 05:45:05 2014 (r273923) +++ head/lib/libc/sys/utrace.2 Sat Nov 1 09:10:21 2014 (r273924) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 28, 2000 +.Dd November 1, 2014 .Dt UTRACE 2 .Os .Sh NAME @@ -37,7 +37,6 @@ .Sh LIBRARY .Lb libc .Sh SYNOPSIS -.In sys/types.h .In sys/param.h .In sys/time.h .In sys/uio.h From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 09:11:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 20B68DED; Sat, 1 Nov 2014 09:11:39 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id D6A36CB1; Sat, 1 Nov 2014 09:11:38 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 93AFDA893; Sat, 1 Nov 2014 09:11:36 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id BA62F10A46; Sat, 1 Nov 2014 10:11:38 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Garrett Cooper Subject: Re: svn commit: r273919 - head/etc/rc.d References: <201410312220.s9VMKRaO096404@svn.freebsd.org> <86bnor9202.fsf@nine.des.no> <0577B462-91E9-4E46-BF9E-085B50EDE09C@gmail.com> Date: Sat, 01 Nov 2014 10:11:38 +0100 In-Reply-To: <0577B462-91E9-4E46-BF9E-085B50EDE09C@gmail.com> (Garrett Cooper's message of "Fri, 31 Oct 2014 17:54:07 -0700") Message-ID: <867fzf8eut.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Xin LI X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 09:11:39 -0000 Garrett Cooper writes: > rcorder errors are indeed cryptic/confusing. I can quickly add a > testcase for this if you like (basically check for all the scenarios > that need to be covered via /etc/rc). Does that sound good? Yes, that sounds great. I'll look into adding a loop detection and reporting mode to rcorder so we can get a better error message. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 09:56:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32DC7A38; Sat, 1 Nov 2014 09:56:43 +0000 (UTC) Received: from mx1.sbone.de (bird.sbone.de [46.4.1.90]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8A54EE4; Sat, 1 Nov 2014 09:56:41 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 4B4B925D37C3; Sat, 1 Nov 2014 09:56:32 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 394FCC770C2; Sat, 1 Nov 2014 09:56:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id x8GJ3MbGfcPH; Sat, 1 Nov 2014 09:56:28 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4420:cabc:c8ff:fe8b:4fe6] (orange-tun0-ula.sbone.de [IPv6:fde9:577b:c1a9:4420:cabc:c8ff:fe8b:4fe6]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id CEBE2C77057; Sat, 1 Nov 2014 09:56:25 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273917 - head/sys/dev/gpio From: "Bjoern A. Zeeb" In-Reply-To: <201410311915.s9VJFEDZ003525@svn.freebsd.org> Date: Sat, 1 Nov 2014 09:56:23 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201410311915.s9VJFEDZ003525@svn.freebsd.org> To: Luiz Otavio O Souza X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 09:56:43 -0000 On 31 Oct 2014, at 19:15 , Luiz Otavio O Souza wrote: > Author: loos > Date: Fri Oct 31 19:15:14 2014 > New Revision: 273917 > URL: https://svnweb.freebsd.org/changeset/base/273917 >=20 > Log: > Fix the gpiobus locking by using a more sane model where it isn't = necessary > hold the gpiobus lock between the gpio calls. >=20 > gpiobus_acquire_lock() now accepts a third parameter which tells = gpiobus > what to do when the bus is already busy. >=20 > When GPIOBUS_WAIT wait is used, the calling thread will be put to = sleep > until the bus became free. >=20 > With GPIOBUS_DONTWAIT the calling thread will receive EWOULDBLOCK = right > away and then it can act upon. >=20 > This fixes the gpioiic(4) locking issues that arises when doing = multiple > concurrent access on the bus. I guess it was this commit that broke things: /scratch/tmp/bz/head.svn/sys/dev/gpio/gpioled.c: In function = 'gpioled_control': /scratch/tmp/bz/head.svn/sys/dev/gpio/gpioled.c:88: error: = 'GPIOBUS_DONTWAIT' undeclared (first use in this function) /scratch/tmp/bz/head.svn/sys/dev/gpio/gpioled.c:88: error: (Each = undeclared identifier is reported only once /scratch/tmp/bz/head.svn/sys/dev/gpio/gpioled.c:88: error: for each = function it appears in.) --- gpioled.o --- *** [gpioled.o] Error code 1 bmake: stopped in = /storage/head/obj/mips.mips/scratch/tmp/bz/head.svn/sys/AP121 --- buildkernel --- *** [buildkernel] Error code 1 >=20 > Modified: > head/sys/dev/gpio/gpiobus.c > head/sys/dev/gpio/gpiobus_if.m > head/sys/dev/gpio/gpiobusvar.h > head/sys/dev/gpio/gpioiic.c > head/sys/dev/gpio/gpioled.c >=20 > Modified: head/sys/dev/gpio/gpiobus.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/gpio/gpiobus.c Fri Oct 31 18:53:16 2014 = (r273916) > +++ head/sys/dev/gpio/gpiobus.c Fri Oct 31 19:15:14 2014 = (r273917) > @@ -53,9 +53,7 @@ static void gpiobus_hinted_child(device_ > /* > * GPIOBUS interface > */ > -static void gpiobus_lock_bus(device_t); > -static void gpiobus_unlock_bus(device_t); > -static void gpiobus_acquire_bus(device_t, device_t); > +static int gpiobus_acquire_bus(device_t, device_t, int); > static void gpiobus_release_bus(device_t, device_t); > static int gpiobus_pin_setflags(device_t, device_t, uint32_t, = uint32_t); > static int gpiobus_pin_getflags(device_t, device_t, uint32_t, = uint32_t*); > @@ -326,37 +324,26 @@ gpiobus_hinted_child(device_t bus, const > device_delete_child(bus, child); > } >=20 > -static void > -gpiobus_lock_bus(device_t busdev) > +static int > +gpiobus_acquire_bus(device_t busdev, device_t child, int how) > { > struct gpiobus_softc *sc; >=20 > sc =3D device_get_softc(busdev); > GPIOBUS_ASSERT_UNLOCKED(sc); > GPIOBUS_LOCK(sc); > -} > - > -static void > -gpiobus_unlock_bus(device_t busdev) > -{ > - struct gpiobus_softc *sc; > - > - sc =3D device_get_softc(busdev); > - GPIOBUS_ASSERT_LOCKED(sc); > + if (sc->sc_owner !=3D NULL) { > + if (how =3D=3D GPIOBUS_DONTWAIT) { > + GPIOBUS_UNLOCK(sc); > + return (EWOULDBLOCK); > + } > + while (sc->sc_owner !=3D NULL) > + mtx_sleep(sc, &sc->sc_mtx, 0, "gpiobuswait", 0); > + } > + sc->sc_owner =3D child; > GPIOBUS_UNLOCK(sc); > -} >=20 > -static void > -gpiobus_acquire_bus(device_t busdev, device_t child) > -{ > - struct gpiobus_softc *sc; > - > - sc =3D device_get_softc(busdev); > - GPIOBUS_ASSERT_LOCKED(sc); > - > - if (sc->sc_owner) > - panic("gpiobus: cannot serialize the access to = device."); > - sc->sc_owner =3D child; > + return (0); > } >=20 > static void > @@ -365,14 +352,15 @@ gpiobus_release_bus(device_t busdev, dev > struct gpiobus_softc *sc; >=20 > sc =3D device_get_softc(busdev); > - GPIOBUS_ASSERT_LOCKED(sc); > - > - if (!sc->sc_owner) > + GPIOBUS_ASSERT_UNLOCKED(sc); > + GPIOBUS_LOCK(sc); > + if (sc->sc_owner =3D=3D NULL) > panic("gpiobus: releasing unowned bus."); > if (sc->sc_owner !=3D child) > panic("gpiobus: you don't own the bus. game over."); > - > sc->sc_owner =3D NULL; > + wakeup(sc); > + GPIOBUS_UNLOCK(sc); > } >=20 > static int > @@ -469,8 +457,6 @@ static device_method_t gpiobus_methods[] > DEVMETHOD(bus_hinted_child, gpiobus_hinted_child), >=20 > /* GPIO protocol */ > - DEVMETHOD(gpiobus_lock_bus, gpiobus_lock_bus), > - DEVMETHOD(gpiobus_unlock_bus, gpiobus_unlock_bus), > DEVMETHOD(gpiobus_acquire_bus, gpiobus_acquire_bus), > DEVMETHOD(gpiobus_release_bus, gpiobus_release_bus), > DEVMETHOD(gpiobus_pin_getflags, gpiobus_pin_getflags), >=20 > Modified: head/sys/dev/gpio/gpiobus_if.m > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/gpio/gpiobus_if.m Fri Oct 31 18:53:16 2014 = (r273916) > +++ head/sys/dev/gpio/gpiobus_if.m Fri Oct 31 19:15:14 2014 = (r273917) > @@ -32,25 +32,12 @@ > INTERFACE gpiobus; >=20 > # > -# Lock the gpio bus > -# > -METHOD void lock_bus { > - device_t busdev; > -}; > - > -# > -# Unlock the gpio bus > -# > -METHOD void unlock_bus { > - device_t busdev; > -}; > - > -# > # Dedicate the gpio bus control for a child > # > -METHOD void acquire_bus { > +METHOD int acquire_bus { > device_t busdev; > device_t dev; > + int how; > }; >=20 > # >=20 > Modified: head/sys/dev/gpio/gpiobusvar.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/gpio/gpiobusvar.h Fri Oct 31 18:53:16 2014 = (r273916) > +++ head/sys/dev/gpio/gpiobusvar.h Fri Oct 31 19:15:14 2014 = (r273917) > @@ -56,6 +56,9 @@ > #define GPIOBUS_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, = MA_OWNED) > #define GPIOBUS_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, = MA_NOTOWNED) >=20 > +#define GPIOBUS_WAIT 1 > +#define GPIOBUS_DONTWAIT 2 > + > struct gpiobus_softc > { > struct mtx sc_mtx; /* bus mutex */ >=20 > Modified: head/sys/dev/gpio/gpioiic.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/gpio/gpioiic.c Fri Oct 31 18:53:16 2014 = (r273916) > +++ head/sys/dev/gpio/gpioiic.c Fri Oct 31 19:15:14 2014 = (r273917) > @@ -154,18 +154,18 @@ static int > gpioiic_callback(device_t dev, int index, caddr_t data) > { > struct gpioiic_softc *sc =3D device_get_softc(dev); > - int error =3D 0; > + int error, how; >=20 > + how =3D GPIOBUS_DONTWAIT; > + if (data !=3D NULL && (int)*data =3D=3D IIC_WAIT) > + how =3D GPIOBUS_WAIT; > + error =3D 0; > switch (index) { > case IIC_REQUEST_BUS: > - GPIOBUS_LOCK_BUS(sc->sc_busdev); > - GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev); > - GPIOBUS_UNLOCK_BUS(sc->sc_busdev); > + error =3D GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev, = how); > break; > case IIC_RELEASE_BUS: > - GPIOBUS_LOCK_BUS(sc->sc_busdev); > GPIOBUS_RELEASE_BUS(sc->sc_busdev, sc->sc_dev); > - GPIOBUS_UNLOCK_BUS(sc->sc_busdev); > break; > default: > error =3D EINVAL; >=20 > Modified: head/sys/dev/gpio/gpioled.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/gpio/gpioled.c Fri Oct 31 18:53:16 2014 = (r273916) > +++ head/sys/dev/gpio/gpioled.c Fri Oct 31 19:15:14 2014 = (r273917) > @@ -79,16 +79,23 @@ static int gpioled_detach(device_t); > static void=20 > gpioled_control(void *priv, int onoff) > { > - struct gpioled_softc *sc =3D priv; > + int error; > + struct gpioled_softc *sc; > + > + sc =3D (struct gpioled_softc *)priv; > GPIOLED_LOCK(sc); > - GPIOBUS_LOCK_BUS(sc->sc_busdev); > - GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev); > - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, > - GPIO_PIN_OUTPUT); > - GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN,=20 > - onoff ? GPIO_PIN_HIGH : GPIO_PIN_LOW); > + error =3D GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev, > + GPIOBUS_DONTWAIT); > + if (error !=3D 0) { > + GPIOLED_UNLOCK(sc); > + return; > + } > + error =3D GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, > + GPIOLED_PIN, GPIO_PIN_OUTPUT); > + if (error =3D=3D 0) > + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, GPIOLED_PIN, > + onoff ? GPIO_PIN_HIGH : GPIO_PIN_LOW); > GPIOBUS_RELEASE_BUS(sc->sc_busdev, sc->sc_dev); > - GPIOBUS_UNLOCK_BUS(sc->sc_busdev); > GPIOLED_UNLOCK(sc); > } >=20 >=20 =97=20 Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 10:35:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BEF31498; Sat, 1 Nov 2014 10:35:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90FB2666; Sat, 1 Nov 2014 10:35:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1AZk1c046362; Sat, 1 Nov 2014 10:35:46 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1AZkFu046361; Sat, 1 Nov 2014 10:35:46 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201411011035.sA1AZkFu046361@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 1 Nov 2014 10:35:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273925 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 10:35:46 -0000 Author: tuexen Date: Sat Nov 1 10:35:45 2014 New Revision: 273925 URL: https://svnweb.freebsd.org/changeset/base/273925 Log: Don't zero the stats before they are read out. MFC after: 3 days Modified: head/sys/netinet/sctp_sysctl.c Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Sat Nov 1 09:10:21 2014 (r273924) +++ head/sys/netinet/sctp_sysctl.c Sat Nov 1 10:35:45 2014 (r273925) @@ -636,26 +636,27 @@ sctp_sysctl_handle_stats(SYSCTL_HANDLER_ int error; #if defined(SMP) && defined(SCTP_USE_PERCPU_STAT) - struct sctpstat sb_temp; struct sctpstat *sarry; struct sctpstat sb; int cpu; + #endif + struct sctpstat sb_temp; if ((req->newptr != NULL) && (req->newlen != sizeof(struct sctpstat))) { return (EINVAL); } - -#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT) - memset(&sb, 0, sizeof(sb)); - memset(&sb_temp, 0, sizeof(sb_temp)); + memset(&sb_temp, 0, sizeof(struct sctpstat)); if (req->newptr != NULL) { - error = SYSCTL_IN(req, &sb_temp, sizeof(sb_temp)); - if (error != 0) + error = SYSCTL_IN(req, &sb_temp, sizeof(struct sctpstat)); + if (error != 0) { return (error); + } } +#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT) + memset(&sb, 0, sizeof(sb)); for (cpu = 0; cpu < mp_maxid; cpu++) { sarry = &SCTP_BASE_STATS[cpu]; if (sarry->sctps_discontinuitytime.tv_sec > sb.sctps_discontinuitytime.tv_sec) { @@ -783,15 +784,19 @@ sctp_sysctl_handle_stats(SYSCTL_HANDLER_ sb.sctps_send_burst_avoid += sarry->sctps_send_burst_avoid; sb.sctps_send_cwnd_avoid += sarry->sctps_send_cwnd_avoid; sb.sctps_fwdtsn_map_over += sarry->sctps_fwdtsn_map_over; - if (req->newptr != NULL) + if (req->newptr != NULL) { memcpy(sarry, &sb_temp, sizeof(struct sctpstat)); + } } error = SYSCTL_OUT(req, &sb, sizeof(struct sctpstat)); #else - error = SYSCTL_IN(req, &SCTP_BASE_STATS, sizeof(struct sctpstat)); - if (error) - return (error); error = SYSCTL_OUT(req, &SCTP_BASE_STATS, sizeof(struct sctpstat)); + if (error != 0) { + return (error); + } + if (req->newptr != NULL) { + memcpy(&SCTP_BASE_STATS, &sb_temp, sizeof(struct sctpstat)); + } #endif return (error); } From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 10:40:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EB927720; Sat, 1 Nov 2014 10:40:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D8639690; Sat, 1 Nov 2014 10:40:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1AeTbe050015; Sat, 1 Nov 2014 10:40:29 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1AeT2Z050014; Sat, 1 Nov 2014 10:40:29 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201411011040.sA1AeT2Z050014@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Sat, 1 Nov 2014 10:40:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273926 - head/sys/dev/gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 10:40:30 -0000 Author: loos Date: Sat Nov 1 10:40:29 2014 New Revision: 273926 URL: https://svnweb.freebsd.org/changeset/base/273926 Log: Fix the build of non-FDT systems by moving the gpiobusvar.h header outside the FDT #ifdef. While here remove a few unused headers. Modified: head/sys/dev/gpio/gpioled.c Modified: head/sys/dev/gpio/gpioled.c ============================================================================== --- head/sys/dev/gpio/gpioled.c Sat Nov 1 10:35:45 2014 (r273925) +++ head/sys/dev/gpio/gpioled.c Sat Nov 1 10:40:29 2014 (r273926) @@ -31,11 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include -#include +#include #include -#include #include #include #include @@ -43,12 +41,12 @@ __FBSDID("$FreeBSD$"); #ifdef FDT #include -#include #include #endif +#include #include -#include + #include "gpiobus_if.h" /* From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 10:47:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A36CAE3; Sat, 1 Nov 2014 10:47:19 +0000 (UTC) Received: from mail-wg0-x231.google.com (mail-wg0-x231.google.com [IPv6:2a00:1450:400c:c00::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 36E4C7C6; Sat, 1 Nov 2014 10:47:18 +0000 (UTC) Received: by mail-wg0-f49.google.com with SMTP id x13so9395032wgg.8 for ; Sat, 01 Nov 2014 03:47:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=pp1CEaeEw664mEeIafBfq59Vpt/rr3fS1rCOIocKIPc=; b=vCRACRnaX5SSSmJxg3PUqYXGgcLuNOGDuXtt4qaZCNDngl3C2mecNrPikMUOmA2wn5 xG7Is/8eKrloMtD9zDZElWgMyb8lwnqfvlyzu52wVItft6lDw31VMS+WxOo4OTk16fs9 V8aW2NGeE//NyRcBE7CXPYCskR676t0w79IV1Yj9TQJtobAyL0lq9UdUxfAAZtG+0te7 izp1bem7UU5u6lrvsCG1P/0MXDrDGrw76CODCQLgCXPH5XGWEqcYpHo8NAZ+iFW49MF3 i6abuHGfdVPhD35ZVnxVj9JZJCMpnQYR+j4LQVQLtsoL8qHDS5P8x08PY/fzvTtAEBRc XLSg== MIME-Version: 1.0 X-Received: by 10.195.12.76 with SMTP id eo12mr34472393wjd.22.1414838836369; Sat, 01 Nov 2014 03:47:16 -0700 (PDT) Received: by 10.216.204.71 with HTTP; Sat, 1 Nov 2014 03:47:16 -0700 (PDT) In-Reply-To: References: <201410311915.s9VJFEDZ003525@svn.freebsd.org> Date: Sat, 1 Nov 2014 08:47:16 -0200 Message-ID: Subject: Re: svn commit: r273917 - head/sys/dev/gpio From: Luiz Otavio O Souza To: "Bjoern A. Zeeb" Content-Type: text/plain; charset=UTF-8 Cc: Luiz Otavio O Souza , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 10:47:19 -0000 On Sat, Nov 1, 2014 at 7:56 AM, Bjoern A. Zeeb wrote: > > On 31 Oct 2014, at 19:15 , Luiz Otavio O Souza wrote: > >> Author: loos >> Date: Fri Oct 31 19:15:14 2014 >> New Revision: 273917 >> URL: https://svnweb.freebsd.org/changeset/base/273917 >> >> Log: >> Fix the gpiobus locking by using a more sane model where it isn't necessary >> hold the gpiobus lock between the gpio calls. >> >> gpiobus_acquire_lock() now accepts a third parameter which tells gpiobus >> what to do when the bus is already busy. >> >> When GPIOBUS_WAIT wait is used, the calling thread will be put to sleep >> until the bus became free. >> >> With GPIOBUS_DONTWAIT the calling thread will receive EWOULDBLOCK right >> away and then it can act upon. >> >> This fixes the gpioiic(4) locking issues that arises when doing multiple >> concurrent access on the bus. > > I guess it was this commit that broke things: > > /scratch/tmp/bz/head.svn/sys/dev/gpio/gpioled.c: In function 'gpioled_control': > /scratch/tmp/bz/head.svn/sys/dev/gpio/gpioled.c:88: error: 'GPIOBUS_DONTWAIT' undeclared (first use in this function) > /scratch/tmp/bz/head.svn/sys/dev/gpio/gpioled.c:88: error: (Each undeclared identifier is reported only once > /scratch/tmp/bz/head.svn/sys/dev/gpio/gpioled.c:88: error: for each function it appears in.) > --- gpioled.o --- > *** [gpioled.o] Error code 1 > > bmake: stopped in /storage/head/obj/mips.mips/scratch/tmp/bz/head.svn/sys/AP121 > --- buildkernel --- > *** [buildkernel] Error code 1 Fixed in r273926. Sorry for the breakage. Luiz From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 10:50:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA586C6A; Sat, 1 Nov 2014 10:50:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B6AE7DD; Sat, 1 Nov 2014 10:50:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1AoKDe051777; Sat, 1 Nov 2014 10:50:20 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1AoJji051771; Sat, 1 Nov 2014 10:50:19 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201411011050.sA1AoJji051771@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sat, 1 Nov 2014 10:50:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273927 - in head/sys/boot: fdt uboot/common uboot/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 10:50:20 -0000 Author: andrew Date: Sat Nov 1 10:50:18 2014 New Revision: 273927 URL: https://svnweb.freebsd.org/changeset/base/273927 Log: Move the definitions of the fdt functions from a uboot header to a new fdt header. There is nothing in the fdt spec that ties it to U-Boot. While here sort and fix the signature of fdt_setup_fdtp. MFC after: 1 week Added: head/sys/boot/fdt/fdt_platform.h (contents, props changed) Modified: head/sys/boot/fdt/fdt_loader_cmd.c head/sys/boot/uboot/common/metadata.c head/sys/boot/uboot/lib/Makefile head/sys/boot/uboot/lib/libuboot.h head/sys/boot/uboot/lib/module.c Modified: head/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- head/sys/boot/fdt/fdt_loader_cmd.c Sat Nov 1 10:40:29 2014 (r273926) +++ head/sys/boot/fdt/fdt_loader_cmd.c Sat Nov 1 10:50:18 2014 (r273927) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include "bootstrap.h" +#include "fdt_platform.h" #include "glue.h" #ifdef DEBUG Added: head/sys/boot/fdt/fdt_platform.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/fdt/fdt_platform.h Sat Nov 1 10:50:18 2014 (r273927) @@ -0,0 +1,35 @@ +/*- + * Copyright (c) 2014 Andrew Turner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef FDT_PLATFORM_H +#define FDT_PLATFORM_H + +extern int fdt_copy(vm_offset_t); +extern int fdt_setup_fdtp(void); + +#endif /* FDT_PLATFORM_H */ Modified: head/sys/boot/uboot/common/metadata.c ============================================================================== --- head/sys/boot/uboot/common/metadata.c Sat Nov 1 10:40:29 2014 (r273926) +++ head/sys/boot/uboot/common/metadata.c Sat Nov 1 10:50:18 2014 (r273927) @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include "glue.h" #if defined(LOADER_FDT_SUPPORT) -#include "libuboot.h" +#include #endif static int Modified: head/sys/boot/uboot/lib/Makefile ============================================================================== --- head/sys/boot/uboot/lib/Makefile Sat Nov 1 10:40:29 2014 (r273926) +++ head/sys/boot/uboot/lib/Makefile Sat Nov 1 10:50:18 2014 (r273927) @@ -27,7 +27,7 @@ LOADER_FDT_SUPPORT= no .endif .if ${LOADER_FDT_SUPPORT} == "yes" -CFLAGS+= -DLOADER_FDT_SUPPORT +CFLAGS+= -DLOADER_FDT_SUPPORT -I${.CURDIR}/../../fdt .endif # Pick up FDT includes Modified: head/sys/boot/uboot/lib/libuboot.h ============================================================================== --- head/sys/boot/uboot/lib/libuboot.h Sat Nov 1 10:40:29 2014 (r273926) +++ head/sys/boot/uboot/lib/libuboot.h Sat Nov 1 10:50:18 2014 (r273927) @@ -72,8 +72,3 @@ void reboot(void); int uboot_diskgetunit(int type, int type_unit); -#if defined(LOADER_FDT_SUPPORT) -extern int fdt_setup_fdtp(); -extern int fdt_copy(vm_offset_t); -#endif - Modified: head/sys/boot/uboot/lib/module.c ============================================================================== --- head/sys/boot/uboot/lib/module.c Sat Nov 1 10:40:29 2014 (r273926) +++ head/sys/boot/uboot/lib/module.c Sat Nov 1 10:50:18 2014 (r273927) @@ -34,6 +34,10 @@ __FBSDID("$FreeBSD$"); #include #include +#if defined(LOADER_FDT_SUPPORT) +#include +#endif + #include "bootstrap.h" #include "libuboot.h" From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 11:08:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 50DB519D; Sat, 1 Nov 2014 11:08:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D7D996F; Sat, 1 Nov 2014 11:08:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1B80G2060855; Sat, 1 Nov 2014 11:08:00 GMT (envelope-from jmmv@FreeBSD.org) Received: (from jmmv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1B80vU060849; Sat, 1 Nov 2014 11:08:00 GMT (envelope-from jmmv@FreeBSD.org) Message-Id: <201411011108.sA1B80vU060849@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jmmv set sender to jmmv@FreeBSD.org using -f From: Julio Merino Date: Sat, 1 Nov 2014 11:08:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273928 - head/contrib/netbsd-tests/usr.sbin/mtree X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 11:08:00 -0000 Author: jmmv Date: Sat Nov 1 11:07:59 2014 New Revision: 273928 URL: https://svnweb.freebsd.org/changeset/base/273928 Log: Put mtree test files into a subdirectory. Kyua 0.11 points TMPDIR to the test's work directory, and atf_check creates auxiliary files in TMPDIR. This confuses a couple of mtree tests that were using the work directory's root to validate the contents of the directory. Fix the two affected tests by creating an auxiliary directory to use for the mtree tests. (Kyua should probably do this on its own; filed bug #133 upstream to take a look at this.) Modified: head/contrib/netbsd-tests/usr.sbin/mtree/t_mtree.sh Modified: head/contrib/netbsd-tests/usr.sbin/mtree/t_mtree.sh ============================================================================== --- head/contrib/netbsd-tests/usr.sbin/mtree/t_mtree.sh Sat Nov 1 10:50:18 2014 (r273927) +++ head/contrib/netbsd-tests/usr.sbin/mtree/t_mtree.sh Sat Nov 1 11:07:59 2014 (r273928) @@ -284,6 +284,13 @@ ignore_head() ignore_body() { + # Kyua 0.11 and above point TMPDIR to our work directory and atf-check + # generates a temporary file, which confuses mtree. Put the mtree files + # into a subdirectory. + # + # See https://github.com/jmmv/kyua/issues/133 for details. + mkdir root && cd root + mkdir newdir mtree -F ${FLAVOR} -c | mtree -F ${FLAVOR} -Ck uid,gid,mode > mtree.spec ln -s newdir otherdir @@ -313,6 +320,13 @@ mtree_ignore_body() } netbsd6_ignore_body() { + # Kyua 0.11 and above point TMPDIR to our work directory and atf-check + # generates a temporary file, which confuses mtree. Put the mtree files + # into a subdirectory. + # + # See https://github.com/jmmv/kyua/issues/133 for details. + mkdir root && cd root + FLAVOR=netbsd6 ignore_body } From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 11:17:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3E99648D; Sat, 1 Nov 2014 11:17:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 26C95A49; Sat, 1 Nov 2014 11:17:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1BHwfr065758; Sat, 1 Nov 2014 11:17:58 GMT (envelope-from jmmv@FreeBSD.org) Received: (from jmmv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1BHtuQ065740; Sat, 1 Nov 2014 11:17:55 GMT (envelope-from jmmv@FreeBSD.org) Message-Id: <201411011117.sA1BHtuQ065740@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jmmv set sender to jmmv@FreeBSD.org using -f From: Julio Merino Date: Sat, 1 Nov 2014 11:17:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273929 - in head: . contrib/atf contrib/atf/atf-c contrib/atf/atf-c++ contrib/atf/atf-c++/detail contrib/atf/atf-c/detail contrib/atf/atf-sh contrib/atf/doc contrib/atf/test-programs l... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 11:17:58 -0000 Author: jmmv Date: Sat Nov 1 11:17:54 2014 New Revision: 273929 URL: https://svnweb.freebsd.org/changeset/base/273929 Log: MFV: Import atf-0.21. Added: head/contrib/atf/atf-c++/atf-c++.3 - copied unchanged from r273873, vendor/atf/dist/atf-c++/atf-c++.3 head/contrib/atf/atf-c/atf-c.3 - copied unchanged from r273873, vendor/atf/dist/atf-c/atf-c.3 head/contrib/atf/atf-sh/atf-sh.3 - copied unchanged from r273873, vendor/atf/dist/atf-sh/atf-sh.3 head/contrib/atf/config.h - copied, changed from r273922, head/contrib/atf/bconfig.h head/contrib/atf/doc/atf.7.in - copied unchanged from r273873, vendor/atf/dist/doc/atf.7.in Deleted: head/contrib/atf/atf-c++/config.cpp head/contrib/atf/atf-c++/config.hpp head/contrib/atf/atf-c++/config_test.cpp head/contrib/atf/atf-c++/detail/sanity_test.cpp head/contrib/atf/atf-c/config.c head/contrib/atf/atf-c/config.h head/contrib/atf/atf-c/config_test.c head/contrib/atf/bconfig.h Modified: head/ObsoleteFiles.inc head/contrib/atf/FREEBSD-Xlist head/contrib/atf/NEWS head/contrib/atf/atf-c++.hpp head/contrib/atf/atf-c++/Kyuafile head/contrib/atf/atf-c++/atf_c++_test.cpp head/contrib/atf/atf-c++/build.cpp head/contrib/atf/atf-c++/build.hpp head/contrib/atf/atf-c++/build_test.cpp head/contrib/atf/atf-c++/check.cpp head/contrib/atf/atf-c++/check.hpp head/contrib/atf/atf-c++/check_test.cpp head/contrib/atf/atf-c++/detail/Kyuafile head/contrib/atf/atf-c++/detail/application.cpp head/contrib/atf/atf-c++/detail/application.hpp head/contrib/atf/atf-c++/detail/application_test.cpp head/contrib/atf/atf-c++/detail/auto_array.hpp head/contrib/atf/atf-c++/detail/auto_array_test.cpp head/contrib/atf/atf-c++/detail/env.cpp head/contrib/atf/atf-c++/detail/env.hpp head/contrib/atf/atf-c++/detail/env_test.cpp head/contrib/atf/atf-c++/detail/exceptions.cpp head/contrib/atf/atf-c++/detail/exceptions.hpp head/contrib/atf/atf-c++/detail/exceptions_test.cpp head/contrib/atf/atf-c++/detail/fs.cpp head/contrib/atf/atf-c++/detail/fs.hpp head/contrib/atf/atf-c++/detail/fs_test.cpp head/contrib/atf/atf-c++/detail/process.cpp head/contrib/atf/atf-c++/detail/process.hpp head/contrib/atf/atf-c++/detail/process_test.cpp head/contrib/atf/atf-c++/detail/sanity.hpp head/contrib/atf/atf-c++/detail/test_helpers.cpp head/contrib/atf/atf-c++/detail/test_helpers.hpp head/contrib/atf/atf-c++/detail/text.cpp head/contrib/atf/atf-c++/detail/text.hpp head/contrib/atf/atf-c++/detail/text_test.cpp head/contrib/atf/atf-c++/detail/version_helper.cpp head/contrib/atf/atf-c++/macros.hpp head/contrib/atf/atf-c++/macros_hpp_test.cpp head/contrib/atf/atf-c++/macros_test.cpp head/contrib/atf/atf-c++/pkg_config_test.sh head/contrib/atf/atf-c++/tests.cpp head/contrib/atf/atf-c++/tests.hpp head/contrib/atf/atf-c++/tests_test.cpp head/contrib/atf/atf-c++/unused_test.cpp head/contrib/atf/atf-c++/utils.cpp head/contrib/atf/atf-c++/utils.hpp head/contrib/atf/atf-c++/utils_test.cpp head/contrib/atf/atf-c.h head/contrib/atf/atf-c/Kyuafile head/contrib/atf/atf-c/atf_c_test.c head/contrib/atf/atf-c/build.c head/contrib/atf/atf-c/build.h head/contrib/atf/atf-c/build_test.c head/contrib/atf/atf-c/check.c head/contrib/atf/atf-c/check.h head/contrib/atf/atf-c/check_test.c head/contrib/atf/atf-c/defs.h.in head/contrib/atf/atf-c/detail/dynstr.c head/contrib/atf/atf-c/detail/dynstr.h head/contrib/atf/atf-c/detail/dynstr_test.c head/contrib/atf/atf-c/detail/env.c head/contrib/atf/atf-c/detail/env.h head/contrib/atf/atf-c/detail/env_test.c head/contrib/atf/atf-c/detail/fs.c head/contrib/atf/atf-c/detail/fs.h head/contrib/atf/atf-c/detail/fs_test.c head/contrib/atf/atf-c/detail/list.c head/contrib/atf/atf-c/detail/list.h head/contrib/atf/atf-c/detail/list_test.c head/contrib/atf/atf-c/detail/map.c head/contrib/atf/atf-c/detail/map.h head/contrib/atf/atf-c/detail/map_test.c head/contrib/atf/atf-c/detail/process.c head/contrib/atf/atf-c/detail/process.h head/contrib/atf/atf-c/detail/process_helpers.c head/contrib/atf/atf-c/detail/process_test.c head/contrib/atf/atf-c/detail/sanity.c head/contrib/atf/atf-c/detail/sanity.h head/contrib/atf/atf-c/detail/sanity_test.c head/contrib/atf/atf-c/detail/test_helpers.c head/contrib/atf/atf-c/detail/test_helpers.h head/contrib/atf/atf-c/detail/text.c head/contrib/atf/atf-c/detail/text.h head/contrib/atf/atf-c/detail/text_test.c head/contrib/atf/atf-c/detail/tp_main.c head/contrib/atf/atf-c/detail/user.c head/contrib/atf/atf-c/detail/user.h head/contrib/atf/atf-c/detail/user_test.c head/contrib/atf/atf-c/detail/version_helper.c head/contrib/atf/atf-c/error.c head/contrib/atf/atf-c/error.h head/contrib/atf/atf-c/error_fwd.h head/contrib/atf/atf-c/error_test.c head/contrib/atf/atf-c/h_build.h head/contrib/atf/atf-c/macros.h head/contrib/atf/atf-c/macros_h_test.c head/contrib/atf/atf-c/macros_test.c head/contrib/atf/atf-c/pkg_config_test.sh head/contrib/atf/atf-c/tc.c head/contrib/atf/atf-c/tc.h head/contrib/atf/atf-c/tc_test.c head/contrib/atf/atf-c/tp.c head/contrib/atf/atf-c/tp.h head/contrib/atf/atf-c/tp_test.c head/contrib/atf/atf-c/unused_test.c head/contrib/atf/atf-c/utils.c head/contrib/atf/atf-c/utils.h head/contrib/atf/atf-c/utils_test.c head/contrib/atf/atf-sh/atf-check.1 head/contrib/atf/atf-sh/atf-check.cpp head/contrib/atf/atf-sh/atf-check_test.sh head/contrib/atf/atf-sh/atf-sh.1 head/contrib/atf/atf-sh/atf-sh.cpp head/contrib/atf/atf-sh/atf_check_test.sh head/contrib/atf/atf-sh/config_test.sh head/contrib/atf/atf-sh/integration_test.sh head/contrib/atf/atf-sh/libatf-sh.subr head/contrib/atf/atf-sh/misc_helpers.sh head/contrib/atf/atf-sh/normalize_test.sh head/contrib/atf/atf-sh/tc_test.sh head/contrib/atf/atf-sh/tp_test.sh head/contrib/atf/doc/atf-test-case.4 head/contrib/atf/doc/atf-test-program.1 head/contrib/atf/test-programs/c_helpers.c head/contrib/atf/test-programs/common.sh head/contrib/atf/test-programs/config_test.sh head/contrib/atf/test-programs/cpp_helpers.cpp head/contrib/atf/test-programs/expect_test.sh head/contrib/atf/test-programs/meta_data_test.sh head/contrib/atf/test-programs/result_test.sh head/contrib/atf/test-programs/sh_helpers.sh head/contrib/atf/test-programs/srcdir_test.sh head/lib/atf/Makefile.inc head/lib/atf/common.mk head/lib/atf/libatf-c++/Makefile head/lib/atf/libatf-c++/tests/Makefile head/lib/atf/libatf-c++/tests/detail/Makefile head/lib/atf/libatf-c/Makefile head/lib/atf/libatf-c/tests/Makefile head/lib/atf/libatf-c/tests/detail/Makefile head/libexec/atf/atf-check/Makefile head/libexec/atf/atf-sh/Makefile head/libexec/atf/atf-sh/tests/Makefile head/share/man/man7/Makefile head/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: head/contrib/atf/ (props changed) Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sat Nov 1 11:07:59 2014 (r273928) +++ head/ObsoleteFiles.inc Sat Nov 1 11:17:54 2014 (r273929) @@ -374,7 +374,6 @@ OLD_FILES+=usr/share/man/man1/atf-report OLD_FILES+=usr/share/man/man1/atf-run.1.gz OLD_FILES+=usr/share/man/man1/atf-version.1.gz OLD_FILES+=usr/share/man/man5/atf-formats.5.gz -OLD_FILES+=usr/share/man/man7/atf.7.gz OLD_FILES+=usr/share/xml/atf/tests-results.dtd OLD_FILES+=usr/share/xsl/atf/tests-results.xsl # 20131009: freebsd-version moved from /libexec to /bin Modified: head/contrib/atf/FREEBSD-Xlist ============================================================================== --- head/contrib/atf/FREEBSD-Xlist Sat Nov 1 11:07:59 2014 (r273928) +++ head/contrib/atf/FREEBSD-Xlist Sat Nov 1 11:17:54 2014 (r273929) @@ -1,22 +1,12 @@ -*/*/Atffile */*/Makefile* -*/Atffile */Makefile* */*.m4 */*.pc.in -Atffile INSTALL Makefile* aclocal.m4 admin/ -atf-config/ -atf-report/ -atf-run/ -atf-version/ -bconfig.h.in +config.h.in bootstrap/ configure* -doc/atf-formats.5 -doc/atf.7.in m4/ -tools/ Modified: head/contrib/atf/NEWS ============================================================================== --- head/contrib/atf/NEWS Sat Nov 1 11:07:59 2014 (r273928) +++ head/contrib/atf/NEWS Sat Nov 1 11:17:54 2014 (r273929) @@ -1,6 +1,62 @@ Major changes between releases Automated Testing Framework =========================================================================== +Changes in version 0.21 +*********************** + +Released on October 23rd, 2014. + +* Restored the atf(7) manual page to serve as a reference to all the other + manual pages shipped by ATF. + +* Added the -s flag to atf-sh to support specifying the shell interpreter + to be used. + +* Removed ATF_WORKDIR. The only remaining consumers have been converted to + use the standard TMPDIR environment variable. As a benefit, and because + Kyua forces the TMPDIR to live within the test case's work directory, + any stale files left behind by ATF will be automatically cleaned up. + +* Documented the environment variables recognized by each component in the + relevant manual pages. This information was lost with the atf-config(1) + removal. + +* Added a new "require.diskspace" metadata property to test cases so that + they can specify the minimum amount of disk space required for the test + to run. + +* Renamed the atf-{c,c++,sh}-api(3) manual pages to atf-{c,c++,sh}(3) for + discoverability purposes. Symbolic links are provided for the time + being to still make the old names visible. + +* Issue #5: Recommend the (expected, actual) idiom for calls to the test + macros in the manual pages. + +* Issue #7: Stopped catching unhandled exceptions in atf-c++ tests. This + propagates the crash to the caller, which in turn allows it to obtain + proper debugging information. In particular, Kyua should now be able to + extract a stacktrace pinpointing the problem. + +* Issue #8: Fixed atf-c/macros_test:use test failures spotted by the clang + that ships with FreeBSD 11.0-CURRENT. + +* Issue #12: Improved documentation of atf-sh(3) and atf-check(1) by better + explaining how they relate to each other. + +* Issue #14: Stopped setting 'set -e' in atf-sh. This setting was + initially added as a way to enable a "strict" mode in the library and to + make test cases fail fast when they run unprotected commands. However, + doing so in the library is surprising as the responsibility of enabling + 'set -e' should be on the user's code. Also, 'set -e' introduces + inconsistent behavior on subshells and users do not expect that. + +* Issue #15: Fixed atf_utils_{fork,wait} to support nested calls. + +* Issue #16: Fixed test failures (by removing a long-standing hack) on + systems that lack \e support in printf(1). + +* Issue #19: Removed stale references to atf-config and atf-run. + Changes in version 0.20 *********************** Modified: head/contrib/atf/atf-c++.hpp ============================================================================== --- head/contrib/atf/atf-c++.hpp Sat Nov 1 11:07:59 2014 (r273928) +++ head/contrib/atf/atf-c++.hpp Sat Nov 1 11:17:54 2014 (r273929) @@ -1,6 +1,3 @@ -// -// Automated Testing Framework (atf) -// // Copyright (c) 2007 The NetBSD Foundation, Inc. // All rights reserved. // @@ -25,12 +22,11 @@ // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -#if !defined(_ATF_CXX_HPP_) -#define _ATF_CXX_HPP_ +#if !defined(ATF_CXX_HPP) +#define ATF_CXX_HPP #include #include -#endif // !defined(_ATF_CXX_HPP_) +#endif // !defined(ATF_CXX_HPP) Modified: head/contrib/atf/atf-c++/Kyuafile ============================================================================== --- head/contrib/atf/atf-c++/Kyuafile Sat Nov 1 11:07:59 2014 (r273928) +++ head/contrib/atf/atf-c++/Kyuafile Sat Nov 1 11:17:54 2014 (r273929) @@ -5,7 +5,6 @@ test_suite("atf") atf_test_program{name="atf_c++_test"} atf_test_program{name="build_test"} atf_test_program{name="check_test"} -atf_test_program{name="config_test"} atf_test_program{name="macros_test"} atf_test_program{name="pkg_config_test"} atf_test_program{name="tests_test"} Copied: head/contrib/atf/atf-c++/atf-c++.3 (from r273873, vendor/atf/dist/atf-c++/atf-c++.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/atf/atf-c++/atf-c++.3 Sat Nov 1 11:17:54 2014 (r273929, copy of r273873, vendor/atf/dist/atf-c++/atf-c++.3) @@ -0,0 +1,649 @@ +.\" Copyright (c) 2008 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND +.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, +.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.Dd October 13, 2014 +.Dt ATF-C++ 3 +.Os +.Sh NAME +.Nm atf-c++ , +.Nm ATF_ADD_TEST_CASE , +.Nm ATF_CHECK_ERRNO , +.Nm ATF_FAIL , +.Nm ATF_INIT_TEST_CASES , +.Nm ATF_PASS , +.Nm ATF_REQUIRE , +.Nm ATF_REQUIRE_EQ , +.Nm ATF_REQUIRE_ERRNO , +.Nm ATF_REQUIRE_IN , +.Nm ATF_REQUIRE_MATCH , +.Nm ATF_REQUIRE_NOT_IN , +.Nm ATF_REQUIRE_THROW , +.Nm ATF_REQUIRE_THROW_RE , +.Nm ATF_SKIP , +.Nm ATF_TEST_CASE , +.Nm ATF_TEST_CASE_BODY , +.Nm ATF_TEST_CASE_CLEANUP , +.Nm ATF_TEST_CASE_HEAD , +.Nm ATF_TEST_CASE_NAME , +.Nm ATF_TEST_CASE_USE , +.Nm ATF_TEST_CASE_WITH_CLEANUP , +.Nm ATF_TEST_CASE_WITHOUT_HEAD , +.Nm atf::utils::cat_file , +.Nm atf::utils::compare_file , +.Nm atf::utils::copy_file , +.Nm atf::utils::create_file , +.Nm atf::utils::file_exists , +.Nm atf::utils::fork , +.Nm atf::utils::grep_collection , +.Nm atf::utils::grep_file , +.Nm atf::utils::grep_string , +.Nm atf::utils::redirect , +.Nm atf::utils::wait +.Nd C++ API to write ATF-based test programs +.Sh SYNOPSIS +.In atf-c++.hpp +.Fn ATF_ADD_TEST_CASE "tcs" "name" +.Fn ATF_CHECK_ERRNO "expected_errno" "bool_expression" +.Fn ATF_FAIL "reason" +.Fn ATF_INIT_TEST_CASES "tcs" +.Fn ATF_PASS +.Fn ATF_REQUIRE "expression" +.Fn ATF_REQUIRE_EQ "expected_expression" "actual_expression" +.Fn ATF_REQUIRE_ERRNO "expected_errno" "bool_expression" +.Fn ATF_REQUIRE_IN "element" "collection" +.Fn ATF_REQUIRE_MATCH "regexp" "string_expression" +.Fn ATF_REQUIRE_NOT_IN "element" "collection" +.Fn ATF_REQUIRE_THROW "expected_exception" "statement" +.Fn ATF_REQUIRE_THROW_RE "expected_exception" "regexp" "statement" +.Fn ATF_SKIP "reason" +.Fn ATF_TEST_CASE "name" +.Fn ATF_TEST_CASE_BODY "name" +.Fn ATF_TEST_CASE_CLEANUP "name" +.Fn ATF_TEST_CASE_HEAD "name" +.Fn ATF_TEST_CASE_NAME "name" +.Fn ATF_TEST_CASE_USE "name" +.Fn ATF_TEST_CASE_WITH_CLEANUP "name" +.Fn ATF_TEST_CASE_WITHOUT_HEAD "name" +.Ft void +.Fo atf::utils::cat_file +.Fa "const std::string& path" +.Fa "const std::string& prefix" +.Fc +.Ft bool +.Fo atf::utils::compare_file +.Fa "const std::string& path" +.Fa "const std::string& contents" +.Fc +.Ft void +.Fo atf::utils::copy_file +.Fa "const std::string& source" +.Fa "const std::string& destination" +.Fc +.Ft void +.Fo atf::utils::create_file +.Fa "const std::string& path" +.Fa "const std::string& contents" +.Fc +.Ft void +.Fo atf::utils::file_exists +.Fa "const std::string& path" +.Fc +.Ft pid_t +.Fo atf::utils::fork +.Fa "void" +.Fc +.Ft bool +.Fo atf::utils::grep_collection +.Fa "const std::string& regexp" +.Fa "const Collection& collection" +.Fc +.Ft bool +.Fo atf::utils::grep_file +.Fa "const std::string& regexp" +.Fa "const std::string& path" +.Fc +.Ft bool +.Fo atf::utils::grep_string +.Fa "const std::string& regexp" +.Fa "const std::string& path" +.Fc +.Ft void +.Fo atf::utils::redirect +.Fa "const int fd" +.Fa "const std::string& path" +.Fc +.Ft void +.Fo atf::utils::wait +.Fa "const pid_t pid" +.Fa "const int expected_exit_status" +.Fa "const std::string& expected_stdout" +.Fa "const std::string& expected_stderr" +.Fc +.Sh DESCRIPTION +ATF provides a C++ programming interface to implement test programs. +C++-based test programs follow this template: +.Bd -literal -offset indent +extern "C" { +.Ns ... C-specific includes go here ... +} + +.Ns ... C++-specific includes go here ... + +#include + +ATF_TEST_CASE(tc1); +ATF_TEST_CASE_HEAD(tc1) +{ + ... first test case's header ... +} +ATF_TEST_CASE_BODY(tc1) +{ + ... first test case's body ... +} + +ATF_TEST_CASE_WITH_CLEANUP(tc2); +ATF_TEST_CASE_HEAD(tc2) +{ + ... second test case's header ... +} +ATF_TEST_CASE_BODY(tc2) +{ + ... second test case's body ... +} +ATF_TEST_CASE_CLEANUP(tc2) +{ + ... second test case's cleanup ... +} + +ATF_TEST_CASE(tc3); +ATF_TEST_CASE_BODY(tc3) +{ + ... third test case's body ... +} + +.Ns ... additional test cases ... + +ATF_INIT_TEST_CASES(tcs) +{ + ATF_ADD_TEST_CASE(tcs, tc1); + ATF_ADD_TEST_CASE(tcs, tc2); + ATF_ADD_TEST_CASE(tcs, tc3); + ... add additional test cases ... +} +.Ed +.Ss Definition of test cases +Test cases have an identifier and are composed of three different parts: +the header, the body and an optional cleanup routine, all of which are +described in +.Xr atf-test-case 4 . +To define test cases, one can use the +.Fn ATF_TEST_CASE , +.Fn ATF_TEST_CASE_WITH_CLEANUP +or the +.Fn ATF_TEST_CASE_WITHOUT_HEAD +macros, which take a single parameter specifiying the test case's +name. +.Fn ATF_TEST_CASE , +requires to define a head and a body for the test case, +.Fn ATF_TEST_CASE_WITH_CLEANUP +requires to define a head, a body and a cleanup for the test case and +.Fn ATF_TEST_CASE_WITHOUT_HEAD +requires only a body for the test case. +It is important to note that these +.Em do not +set the test case up for execution when the program is run. +In order to do so, a later registration is needed through the +.Fn ATF_ADD_TEST_CASE +macro detailed in +.Sx Program initialization . +.Pp +Later on, one must define the three parts of the body by means of three +functions. +Their headers are given by the +.Fn ATF_TEST_CASE_HEAD , +.Fn ATF_TEST_CASE_BODY +and +.Fn ATF_TEST_CASE_CLEANUP +macros, all of which take the test case's name. +Following each of these, a block of code is expected, surrounded by the +opening and closing brackets. +.Pp +Additionally, the +.Fn ATF_TEST_CASE_NAME +macro can be used to obtain the name of the class corresponding to a +particular test case, as the name is internally manged by the library to +prevent clashes with other user identifiers. +Similarly, the +.Fn ATF_TEST_CASE_USE +macro can be executed on a particular test case to mark it as "used" and +thus prevent compiler warnings regarding unused symbols. +Note that +.Em you should never have to use these macros during regular operation. +.Ss Program initialization +The library provides a way to easily define the test program's +.Fn main +function. +You should never define one on your own, but rely on the +library to do it for you. +This is done by using the +.Fn ATF_INIT_TEST_CASES +macro, which is passed the name of the list that will hold the test cases. +This name can be whatever you want as long as it is a valid variable value. +.Pp +After the macro, you are supposed to provide the body of a function, which +should only use the +.Fn ATF_ADD_TEST_CASE +macro to register the test cases the test program will execute. +The first parameter of this macro matches the name you provided in the +former call. +.Ss Header definitions +The test case's header can define the meta-data by using the +.Fn set_md_var +method, which takes two parameters: the first one specifies the +meta-data variable to be set and the second one specifies its value. +Both of them are strings. +.Ss Configuration variables +The test case has read-only access to the current configuration variables +by means of the +.Ft bool +.Fn has_config_var +and the +.Ft std::string +.Fn get_config_var +methods, which can be called in any of the three parts of a test case. +.Ss Access to the source directory +It is possible to get the path to the test case's source directory from any +of its three components by querying the +.Sq srcdir +configuration variable. +.Ss Requiring programs +Aside from the +.Va require.progs +meta-data variable available in the header only, one can also check for +additional programs in the test case's body by using the +.Fn require_prog +function, which takes the base name or full path of a single binary. +Relative paths are forbidden. +If it is not found, the test case will be automatically skipped. +.Ss Test case finalization +The test case finalizes either when the body reaches its end, at which +point the test is assumed to have +.Em passed , +or at any explicit call to +.Fn ATF_PASS , +.Fn ATF_FAIL +or +.Fn ATF_SKIP . +These three macros terminate the execution of the test case immediately. +The cleanup routine will be processed afterwards in a completely automated +way, regardless of the test case's termination reason. +.Pp +.Fn ATF_PASS +does not take any parameters. +.Fn ATF_FAIL +and +.Fn ATF_SKIP +take a single string that describes why the test case failed or +was skipped, respectively. +It is very important to provide a clear error message in both cases so that +the user can quickly know why the test did not pass. +.Ss Expectations +Everything explained in the previous section changes when the test case +expectations are redefined by the programmer. +.Pp +Each test case has an internal state called +.Sq expect +that describes what the test case expectations are at any point in time. +The value of this property can change during execution by any of: +.Bl -tag -width indent +.It Fn expect_death "reason" +Expects the test case to exit prematurely regardless of the nature of the +exit. +.It Fn expect_exit "exitcode" "reason" +Expects the test case to exit cleanly. +If +.Va exitcode +is not +.Sq -1 , +the runtime engine will validate that the exit code of the test case +matches the one provided in this call. +Otherwise, the exact value will be ignored. +.It Fn expect_fail "reason" +Any failure (be it fatal or non-fatal) raised in this mode is recorded. +However, such failures do not report the test case as failed; instead, the +test case finalizes cleanly and is reported as +.Sq expected failure ; +this report includes the provided +.Fa reason +as part of it. +If no error is raised while running in this mode, then the test case is +reported as +.Sq failed . +.Pp +This mode is useful to reproduce actual known bugs in tests. +Whenever the developer fixes the bug later on, the test case will start +reporting a failure, signaling the developer that the test case must be +adjusted to the new conditions. +In this situation, it is useful, for example, to set +.Fa reason +as the bug number for tracking purposes. +.It Fn expect_pass +This is the normal mode of execution. +In this mode, any failure is reported as such to the user and the test case +is marked as +.Sq failed . +.It Fn expect_race "reason" +Any failure or timeout during the execution of the test case will be +considered as if a race condition has been triggered and reported as such. +If no problems arise, the test will continue execution as usual. +.It Fn expect_signal "signo" "reason" +Expects the test case to terminate due to the reception of a signal. +If +.Va signo +is not +.Sq -1 , +the runtime engine will validate that the signal that terminated the test +case matches the one provided in this call. +Otherwise, the exact value will be ignored. +.It Fn expect_timeout "reason" +Expects the test case to execute for longer than its timeout. +.El +.Ss Helper macros for common checks +The library provides several macros that are very handy in multiple +situations. +These basically check some condition after executing a given statement or +processing a given expression and, if the condition is not met, they +automatically call +.Fn ATF_FAIL +with an appropriate error message. +.Pp +.Fn ATF_REQUIRE +takes an expression and raises a failure if it evaluates to false. +.Pp +.Fn ATF_REQUIRE_EQ +takes two expressions and raises a failure if the two do not evaluate to +the same exact value. +The common style is to put the expected value in the first parameter and the +actual value in the second parameter. +.Pp +.Fn ATF_REQUIRE_IN +takes an element and a collection and validates that the element is present in +the collection. +.Pp +.Fn ATF_REQUIRE_MATCH +takes a regular expression and a string and raises a failure if the regular +expression does not match the string. +.Pp +.Fn ATF_REQUIRE_NOT_IN +takes an element and a collection and validates that the element is not present +in the collection. +.Pp +.Fn ATF_REQUIRE_THROW +takes the name of an exception and a statement and raises a failure if +the statement does not throw the specified exception. +.Fn ATF_REQUIRE_THROW_RE +takes the name of an exception, a regular expresion and a statement and raises a +failure if the statement does not throw the specified exception and if the +message of the exception does not match the regular expression. +.Pp +.Fn ATF_CHECK_ERRNO +and +.Fn ATF_REQUIRE_ERRNO +take, first, the error code that the check is expecting to find in the +.Va errno +variable and, second, a boolean expression that, if evaluates to true, +means that a call failed and +.Va errno +has to be checked against the first value. +.Ss Utility functions +The following functions are provided as part of the +.Nm +API to simplify the creation of a variety of tests. +In particular, these are useful to write tests for command-line interfaces. +.Pp +.Ft void +.Fo atf::utils::cat_file +.Fa "const std::string& path" +.Fa "const std::string& prefix" +.Fc +.Bd -ragged -offset indent +Prints the contents of +.Fa path +to the standard output, prefixing every line with the string in +.Fa prefix . +.Ed +.Pp +.Ft bool +.Fo atf::utils::compare_file +.Fa "const std::string& path" +.Fa "const std::string& contents" +.Fc +.Bd -ragged -offset indent +Returns true if the given +.Fa path +matches exactly the expected inlined +.Fa contents . +.Ed +.Pp +.Ft void +.Fo atf::utils::copy_file +.Fa "const std::string& source" +.Fa "const std::string& destination" +.Fc +.Bd -ragged -offset indent +Copies the file +.Fa source +to +.Fa destination . +The permissions of the file are preserved during the code. +.Ed +.Pp +.Ft void +.Fo atf::utils::create_file +.Fa "const std::string& path" +.Fa "const std::string& contents" +.Fc +.Bd -ragged -offset indent +Creates +.Fa file +with the text given in +.Fa contents . +.Ed +.Pp +.Ft void +.Fo atf::utils::file_exists +.Fa "const std::string& path" +.Fc +.Bd -ragged -offset indent +Checks if +.Fa path +exists. +.Ed +.Pp +.Ft pid_t +.Fo atf::utils::fork +.Fa "void" +.Fc +.Bd -ragged -offset indent +Forks a process and redirects the standard output and standard error of the +child to files for later validation with +.Fn atf::utils::wait . +Fails the test case if the fork fails, so this does not return an error. +.Ed +.Pp +.Ft bool +.Fo atf::utils::grep_collection +.Fa "const std::string& regexp" +.Fa "const Collection& collection" +.Fc +.Bd -ragged -offset indent +Searches for the regular expression +.Fa regexp +in any of the strings contained in the +.Fa collection . +This is a template that accepts any one-dimensional container of strings. +.Ed +.Pp +.Ft bool +.Fo atf::utils::grep_file +.Fa "const std::string& regexp" +.Fa "const std::string& path" +.Fc +.Bd -ragged -offset indent +Searches for the regular expression +.Fa regexp +in the file +.Fa path . +The variable arguments are used to construct the regular expression. +.Ed +.Pp +.Ft bool +.Fo atf::utils::grep_string +.Fa "const std::string& regexp" +.Fa "const std::string& str" +.Fc +.Bd -ragged -offset indent +Searches for the regular expression +.Fa regexp +in the string +.Fa str . +.Ed +.Ft void +.Fo atf::utils::redirect +.Fa "const int fd" +.Fa "const std::string& path" +.Fc +.Bd -ragged -offset indent +Redirects the given file descriptor +.Fa fd +to the file +.Fa path . +This function exits the process in case of an error and does not properly mark +the test case as failed. +As a result, it should only be used in subprocesses of the test case; specially +those spawned by +.Fn atf::utils::fork . +.Ed +.Pp +.Ft void +.Fo atf::utils::wait +.Fa "const pid_t pid" +.Fa "const int expected_exit_status" +.Fa "const std::string& expected_stdout" +.Fa "const std::string& expected_stderr" +.Fc +.Bd -ragged -offset indent +Waits and validates the result of a subprocess spawned with +.Fn atf::utils::wait . +The validation involves checking that the subprocess exited cleanly and returned +the code specified in +.Fa expected_exit_status +and that its standard output and standard error match the strings given in +.Fa expected_stdout +and +.Fa expected_stderr . +.Pp +If any of the +.Fa expected_stdout +or +.Fa expected_stderr +strings are prefixed with +.Sq save: , +then they specify the name of the file into which to store the stdout or stderr +of the subprocess, and no comparison is performed. +.Ed +.Sh ENVIRONMENT +The following variables are recognized by +.Nm +but should not be overridden other than for testing purposes: +.Pp +.Bl -tag -width ATFXBUILDXCXXFLAGSXX -compact +.It Va ATF_BUILD_CC +Path to the C compiler. +.It Va ATF_BUILD_CFLAGS +C compiler flags. +.It Va ATF_BUILD_CPP +Path to the C/C++ preprocessor. +.It Va ATF_BUILD_CPPFLAGS +C/C++ preprocessor flags. +.It Va ATF_BUILD_CXX +Path to the C++ compiler. +.It Va ATF_BUILD_CXXFLAGS +C++ compiler flags. +.El +.Sh EXAMPLES +The following shows a complete test program with a single test case that +validates the addition operator: +.Bd -literal -offset indent +#include + +ATF_TEST_CASE(addition); +ATF_TEST_CASE_HEAD(addition) +{ + set_md_var("descr", "Sample tests for the addition operator"); +} +ATF_TEST_CASE_BODY(addition) +{ + ATF_REQUIRE_EQ(0, 0 + 0); + ATF_REQUIRE_EQ(1, 0 + 1); + ATF_REQUIRE_EQ(1, 1 + 0); + + ATF_REQUIRE_EQ(2, 1 + 1); + + ATF_REQUIRE_EQ(300, 100 + 200); +} + +ATF_TEST_CASE(open_failure); +ATF_TEST_CASE_HEAD(open_failure) +{ + set_md_var("descr", "Sample tests for the open function"); +} +ATF_TEST_CASE_BODY(open_failure) +{ + ATF_REQUIRE_ERRNO(ENOENT, open("non-existent", O_RDONLY) == -1); +} + +ATF_TEST_CASE(known_bug); +ATF_TEST_CASE_HEAD(known_bug) +{ + set_md_var("descr", "Reproduces a known bug"); +} +ATF_TEST_CASE_BODY(known_bug) +{ + expect_fail("See bug number foo/bar"); + ATF_REQUIRE_EQ(3, 1 + 1); + expect_pass(); + ATF_REQUIRE_EQ(3, 1 + 2); +} + +ATF_INIT_TEST_CASES(tcs) +{ + ATF_ADD_TEST_CASE(tcs, addition); + ATF_ADD_TEST_CASE(tcs, open_failure); + ATF_ADD_TEST_CASE(tcs, known_bug); +} +.Ed +.Sh SEE ALSO +.Xr atf-test-program 1 , +.Xr atf-test-case 4 Modified: head/contrib/atf/atf-c++/atf_c++_test.cpp ============================================================================== --- head/contrib/atf/atf-c++/atf_c++_test.cpp Sat Nov 1 11:07:59 2014 (r273928) +++ head/contrib/atf/atf-c++/atf_c++_test.cpp Sat Nov 1 11:17:54 2014 (r273929) @@ -1,6 +1,3 @@ -// -// Automated Testing Framework (atf) -// // Copyright (c) 2009 The NetBSD Foundation, Inc. // All rights reserved. // @@ -25,11 +22,10 @@ // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -#include "macros.hpp" +#include -#include "detail/test_helpers.hpp" +#include "atf-c++/detail/test_helpers.hpp" // ------------------------------------------------------------------------ // Tests cases for the header file. Modified: head/contrib/atf/atf-c++/build.cpp ============================================================================== --- head/contrib/atf/atf-c++/build.cpp Sat Nov 1 11:07:59 2014 (r273928) +++ head/contrib/atf/atf-c++/build.cpp Sat Nov 1 11:17:54 2014 (r273929) @@ -1,6 +1,3 @@ -// -// Automated Testing Framework (atf) -// // Copyright (c) 2009 The NetBSD Foundation, Inc. // All rights reserved. // @@ -25,7 +22,8 @@ // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// + +#include "atf-c++/build.hpp" extern "C" { #include "atf-c/build.h" @@ -33,10 +31,8 @@ extern "C" { #include "atf-c/utils.h" } -#include "build.hpp" - -#include "detail/exceptions.hpp" -#include "detail/process.hpp" +#include "atf-c++/detail/exceptions.hpp" +#include "atf-c++/detail/process.hpp" namespace impl = atf::build; #define IMPL_NAME "atf::build" Modified: head/contrib/atf/atf-c++/build.hpp ============================================================================== --- head/contrib/atf/atf-c++/build.hpp Sat Nov 1 11:07:59 2014 (r273928) +++ head/contrib/atf/atf-c++/build.hpp Sat Nov 1 11:17:54 2014 (r273929) @@ -1,6 +1,3 @@ -// -// Automated Testing Framework (atf) -// // Copyright (c) 2009 The NetBSD Foundation, Inc. // All rights reserved. // @@ -25,10 +22,9 @@ // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -#if !defined(_ATF_CXX_BUILD_HPP_) -#define _ATF_CXX_BUILD_HPP_ +#if !defined(ATF_CXX_BUILD_HPP) +#define ATF_CXX_BUILD_HPP #include @@ -54,4 +50,4 @@ process::argv_array cxx_o(const std::str } // namespace build } // namespace atf -#endif // !defined(_ATF_CXX_BUILD_HPP_) +#endif // !defined(ATF_CXX_BUILD_HPP) Modified: head/contrib/atf/atf-c++/build_test.cpp ============================================================================== --- head/contrib/atf/atf-c++/build_test.cpp Sat Nov 1 11:07:59 2014 (r273928) +++ head/contrib/atf/atf-c++/build_test.cpp Sat Nov 1 11:17:54 2014 (r273929) @@ -1,6 +1,3 @@ -// -// Automated Testing Framework (atf) -// // Copyright (c) 2009 The NetBSD Foundation, Inc. // All rights reserved. // @@ -25,31 +22,25 @@ // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// + +#include "atf-c++/build.hpp" #include #include -#include "../atf-c/h_build.h" +#include -#include "build.hpp" -#include "config.hpp" -#include "macros.hpp" - -#include "detail/env.hpp" -#include "detail/process.hpp" -#include "detail/test_helpers.hpp" +extern "C" { +#include "atf-c/h_build.h" +} + +#include "atf-c++/detail/env.hpp" +#include "atf-c++/detail/process.hpp" // ------------------------------------------------------------------------ // Auxiliary functions. // ------------------------------------------------------------------------ -namespace atf { - namespace config { - void __reinit(void); - } -} - template< class C > void print_col(const char* prefix, const C& c) @@ -168,7 +159,6 @@ ATF_TEST_CASE_BODY(c_o) verbose_set_env("ATF_BUILD_CC", test->cc); verbose_set_env("ATF_BUILD_CFLAGS", test->cflags); verbose_set_env("ATF_BUILD_CPPFLAGS", test->cppflags); - atf::config::__reinit(); atf::process::argv_array argv = atf::build::c_o(test->sfile, test->ofile, @@ -190,7 +180,6 @@ ATF_TEST_CASE_BODY(cpp) verbose_set_env("ATF_BUILD_CPP", test->cpp); verbose_set_env("ATF_BUILD_CPPFLAGS", test->cppflags); - atf::config::__reinit(); atf::process::argv_array argv = atf::build::cpp(test->sfile, test->ofile, @@ -213,7 +202,6 @@ ATF_TEST_CASE_BODY(cxx_o) verbose_set_env("ATF_BUILD_CXX", test->cxx); verbose_set_env("ATF_BUILD_CXXFLAGS", test->cxxflags); verbose_set_env("ATF_BUILD_CPPFLAGS", test->cppflags); - atf::config::__reinit(); atf::process::argv_array argv = atf::build::cxx_o(test->sfile, test->ofile, @@ -223,12 +211,6 @@ ATF_TEST_CASE_BODY(cxx_o) } // ------------------------------------------------------------------------ -// Tests cases for the header file. -// ------------------------------------------------------------------------ - -HEADER_TC(include, "atf-c++/build.hpp"); - -// ------------------------------------------------------------------------ // Main. // ------------------------------------------------------------------------ @@ -241,7 +223,4 @@ ATF_INIT_TEST_CASES(tcs) ATF_ADD_TEST_CASE(tcs, c_o); ATF_ADD_TEST_CASE(tcs, cpp); ATF_ADD_TEST_CASE(tcs, cxx_o); - - // Add the test cases for the header file. - ATF_ADD_TEST_CASE(tcs, include); } Modified: head/contrib/atf/atf-c++/check.cpp ============================================================================== --- head/contrib/atf/atf-c++/check.cpp Sat Nov 1 11:07:59 2014 (r273928) +++ head/contrib/atf/atf-c++/check.cpp Sat Nov 1 11:17:54 2014 (r273929) @@ -1,6 +1,3 @@ -// -// Automated Testing Framework (atf) -// // Copyright (c) 2007 The NetBSD Foundation, Inc. // All rights reserved. // @@ -25,7 +22,8 @@ // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// + +#include "atf-c++/check.hpp" #include @@ -34,11 +32,9 @@ extern "C" { #include "atf-c/error.h" } -#include "check.hpp" - -#include "detail/exceptions.hpp" -#include "detail/process.hpp" -#include "detail/sanity.hpp" +#include "atf-c++/detail/exceptions.hpp" +#include "atf-c++/detail/process.hpp" +#include "atf-c++/detail/sanity.hpp" namespace impl = atf::check; #define IMPL_NAME "atf::check" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 15:55:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DDC8C183; Sat, 1 Nov 2014 15:55:18 +0000 (UTC) Received: from gromit.grondar.org (grandfather.grondar.org [IPv6:2a01:348:0:15:5d59:5c20:0:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4F7D64A; Sat, 1 Nov 2014 15:55:18 +0000 (UTC) Received: from [2001:470:9174:1:99:daa4:a52e:9610] by gromit.grondar.org with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.84 (FreeBSD)) (envelope-from ) id 1Xkb1I-000FL1-Pl; Sat, 01 Nov 2014 15:55:17 +0000 Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) Content-Type: text/plain; charset=windows-1252 From: Mark R V Murray In-Reply-To: <9D38CD22-6BFC-4D55-8E8F-622EC2997723@gmail.com> Date: Sat, 1 Nov 2014 15:55:15 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <931AE051-9ED8-46FB-B6D2-5FD5BD78FE8F@FreeBSD.org> References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <9D38CD22-6BFC-4D55-8E8F-622EC2997723@gmail.com> To: Garrett Cooper X-Mailer: Apple Mail (2.1990.1) X-SA-Score: -1.0 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 15:55:19 -0000 Hi Garrett, > On 31 Oct 2014, at 21:04, Garrett Cooper = wrote: > Could you please add an UPDATING entry for this? Some users (like me) = who do make installworld from old kernels are experiencing issues (some = dealing with filesystem corruption). Please see this thread on -current@ = for more details: = https://lists.freebsd.org/pipermail/freebsd-current/2014-October/053039.ht= ml Will do. Thanks for the reminder. > This also should have had =93Relnotes: yes=94 in the commit message = because this deserves to be put in the release notes for 11.0 Oops. :-( M --=20 Mark R V Murray From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 16:11:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 33BDC5BB for ; Sat, 1 Nov 2014 16:11:20 +0000 (UTC) Received: from vfemail.net (nine.vfemail.net [108.76.175.9]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBB86825 for ; Sat, 1 Nov 2014 16:11:19 +0000 (UTC) Received: (qmail 5198 invoked by uid 89); 1 Nov 2014 16:06:45 -0000 Received: from localhost (HELO freequeue.vfemail.net) (127.0.0.1) by localhost with (DHE-RSA-AES256-SHA encrypted) SMTP; 1 Nov 2014 16:06:39 -0000 Received: (qmail 85632 invoked by uid 89); 31 Oct 2014 15:19:19 -0000 Received: by simscan 1.3.1 ppid: 85624, pid: 85628, t: 0.1011s scanners:none Received: from unknown (HELO smtp102-2.vfemail.net) (172.16.100.62) by FreeQueue with SMTP; 31 Oct 2014 15:19:19 -0000 Received: (qmail 30168 invoked by uid 89); 31 Oct 2014 15:19:19 -0000 Received: by simscan 1.4.0 ppid: 30127, pid: 30164, t: 0.6638s scanners:none Received: from unknown (HELO nil) (amJlaWNoQHZmZW1haWwubmV0@172.16.100.27) by 172.16.100.62 with ESMTPA; 31 Oct 2014 15:19:18 -0000 From: Jan Beich To: Julian Elischer Subject: Re: svn commit: r273762 - head/sys/modules/dtrace/dtraceall References: <201410280418.s9S4I9qh094390@svn.freebsd.org> Date: Fri, 31 Oct 2014 16:19:13 +0100 In-Reply-To: <201410280418.s9S4I9qh094390@svn.freebsd.org> (Julian Elischer's message of "Tue, 28 Oct 2014 04:18:09 +0000 (UTC)") Message-ID: MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 16:11:20 -0000 Julian Elischer writes: > Log: > Allow loading of dtraceall without nfscl if what you really wnat is nfsclient ... or if what you really want is neither, no NFS by default. > > Obtained from: Panzura tree > MFC after: 1 week > > Modified: > head/sys/modules/dtrace/dtraceall/dtraceall.c > > Modified: head/sys/modules/dtrace/dtraceall/dtraceall.c > ============================================================================== > --- head/sys/modules/dtrace/dtraceall/dtraceall.c Tue Oct 28 03:42:09 2014 (r273761) > +++ head/sys/modules/dtrace/dtraceall/dtraceall.c Tue Oct 28 04:18:09 2014 (r273762) > @@ -67,7 +67,9 @@ MODULE_DEPEND(dtraceall, cyclic, 1, 1, 1 > MODULE_DEPEND(dtraceall, opensolaris, 1, 1, 1); > MODULE_DEPEND(dtraceall, dtrace, 1, 1, 1); > MODULE_DEPEND(dtraceall, dtmalloc, 1, 1, 1); > +#if defined(NFSCLIENT) Did you mean #if defined(NFSCL) ? Otherwise, dtraceall.ko with GENERIC kernel wouldn't pull dtnfscl.ko despite nfscl.ko being compiled in. > MODULE_DEPEND(dtraceall, dtnfscl, 1, 1, 1); > +#endif > #if defined(NFSCLIENT) > MODULE_DEPEND(dtraceall, dtnfsclient, 1, 1, 1); > #endif ------------------------------------------------- VFEmail.net - http://www.vfemail.net ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands! $24.95 ONETIME Lifetime accounts with Privacy Features! 15GB disk! No bandwidth quotas! Commercial and Bulk Mail Options! From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 17:05:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 791ECF59; Sat, 1 Nov 2014 17:05:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 647E3C9B; Sat, 1 Nov 2014 17:05:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1H5HVR030104; Sat, 1 Nov 2014 17:05:17 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1H5GrM030099; Sat, 1 Nov 2014 17:05:16 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201411011705.sA1H5GrM030099@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: Jean-Sebastien Pedron Date: Sat, 1 Nov 2014 17:05:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273932 - in head/sys: dev/vt kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 17:05:17 -0000 Author: dumbbell Date: Sat Nov 1 17:05:15 2014 New Revision: 273932 URL: https://svnweb.freebsd.org/changeset/base/273932 Log: vt(4): Adjust the cursor position after changing the window size A new terminal_set_cursor() is added: it wraps the existing teken_set_cursor() function. In vtbuf_grow(), the cursor position is adjusted at the end of the function. In vt_change_font(), we call terminal_set_cursor() just after terminal_set_winsize_blank(), while the terminal is mute. This fixes a bug where, after loading a kernel video driver which increases the terminal window size, the cursor remains at its old position, in other words, in the middle of the display content. PR: 194421 MFC after: 1 week Modified: head/sys/dev/vt/vt_buf.c head/sys/dev/vt/vt_core.c head/sys/kern/subr_terminal.c head/sys/sys/terminal.h Modified: head/sys/dev/vt/vt_buf.c ============================================================================== --- head/sys/dev/vt/vt_buf.c Sat Nov 1 13:45:01 2014 (r273931) +++ head/sys/dev/vt/vt_buf.c Sat Nov 1 17:05:15 2014 (r273932) @@ -562,6 +562,18 @@ vtbuf_grow(struct vt_buf *vb, const term vb->vb_roffset = vb->vb_curroffset; } + /* Adjust cursor position. */ + if (vb->vb_cursor.tp_col > p->tp_col - 1) + /* + * Move cursor to the last column, in case its previous + * position is outside of the new screen area. + */ + vb->vb_cursor.tp_col = p->tp_col - 1; + + if (vb->vb_curroffset > 0 || vb->vb_cursor.tp_row > p->tp_row - 1) + /* Move cursor to the last line on the screen. */ + vb->vb_cursor.tp_row = p->tp_row - 1; + vtbuf_make_undirty(vb); VTBUF_UNLOCK(vb); Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Sat Nov 1 13:45:01 2014 (r273931) +++ head/sys/dev/vt/vt_core.c Sat Nov 1 17:05:15 2014 (r273932) @@ -1532,6 +1532,7 @@ vt_change_font(struct vt_window *vw, str terminal_mute(tm, 1); vtbuf_grow(&vw->vw_buf, &size, vw->vw_buf.vb_history_size); terminal_set_winsize_blank(tm, &wsz, 0, NULL); + terminal_set_cursor(tm, &vw->vw_buf.vb_cursor); terminal_mute(tm, 0); /* Actually apply the font to the current window. */ Modified: head/sys/kern/subr_terminal.c ============================================================================== --- head/sys/kern/subr_terminal.c Sat Nov 1 13:45:01 2014 (r273931) +++ head/sys/kern/subr_terminal.c Sat Nov 1 17:05:15 2014 (r273932) @@ -190,6 +190,13 @@ terminal_maketty(struct terminal *tm, co } void +terminal_set_cursor(struct terminal *tm, const term_pos_t *pos) +{ + + teken_set_cursor(&tm->tm_emulator, pos); +} + +void terminal_set_winsize_blank(struct terminal *tm, const struct winsize *size, int blank, const term_attr_t *attr) { Modified: head/sys/sys/terminal.h ============================================================================== --- head/sys/sys/terminal.h Sat Nov 1 13:45:01 2014 (r273931) +++ head/sys/sys/terminal.h Sat Nov 1 17:05:15 2014 (r273932) @@ -207,6 +207,7 @@ struct terminal { struct terminal *terminal_alloc(const struct terminal_class *tc, void *softc); void terminal_maketty(struct terminal *tm, const char *fmt, ...); +void terminal_set_cursor(struct terminal *tm, const term_pos_t *pos); void terminal_set_winsize_blank(struct terminal *tm, const struct winsize *size, int blank, const term_attr_t *attr); void terminal_set_winsize(struct terminal *tm, const struct winsize *size); From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 17:09:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 392261BC; Sat, 1 Nov 2014 17:09:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25431CD2; Sat, 1 Nov 2014 17:09:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1H9eMR030766; Sat, 1 Nov 2014 17:09:40 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1H9eHd030765; Sat, 1 Nov 2014 17:09:40 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201411011709.sA1H9eHd030765@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 1 Nov 2014 17:09:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273933 - head/contrib/netbsd-tests/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 17:09:40 -0000 Author: ngie Date: Sat Nov 1 17:09:39 2014 New Revision: 273933 URL: https://svnweb.freebsd.org/changeset/base/273933 Log: Don't prune duplicate services in the expected output from /etc/services on FreeBSD Submitted by: pho Modified: head/contrib/netbsd-tests/lib/libc/net/t_servent.sh Modified: head/contrib/netbsd-tests/lib/libc/net/t_servent.sh ============================================================================== --- head/contrib/netbsd-tests/lib/libc/net/t_servent.sh Sat Nov 1 17:05:15 2014 (r273932) +++ head/contrib/netbsd-tests/lib/libc/net/t_servent.sh Sat Nov 1 17:09:39 2014 (r273933) @@ -81,6 +81,24 @@ servent_body() } ' | sort >exp + case "$(uname)" in + FreeBSD) + # (3) Don't prune duplicates + tr '\t' ' ' < /etc/services | + sed 's/#.*//;s/ */ /g; /^$/d;s#\([0-9]\)/#\1 #;s/ *$//' | + sort | + while read l; do + set $l + name=$1; shift + port=$1; shift + proto=$1; shift + alias="$@" + printf "name=%s, port=%s, proto=%s, aliases=%s\n" \ + $name $port $proto "$alias" + done > exp + ;; + esac + # run test program "$(atf_get_srcdir)/h_servent" | sed 's/ *$//' | sort >out From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 17:12:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1F90936B; Sat, 1 Nov 2014 17:12:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09F85D7B; Sat, 1 Nov 2014 17:12:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1HClXA034632; Sat, 1 Nov 2014 17:12:47 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1HCjEt034620; Sat, 1 Nov 2014 17:12:45 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201411011712.sA1HCjEt034620@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sat, 1 Nov 2014 17:12:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273934 - in head/sys/boot: arm/uboot fdt powerpc/uboot uboot uboot/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 17:12:47 -0000 Author: andrew Date: Sat Nov 1 17:12:44 2014 New Revision: 273934 URL: https://svnweb.freebsd.org/changeset/base/273934 Log: Start to allow platforms other than U-Boot to use the FDT code in loader by moving U-Boot specific code from libfdt.a to a new libuboot_fdt.a. This needs to be a new library for linking to work correctly. Differential Revision: https://reviews.freebsd.org/D1054 Reviewed by: ian, rpaulo (earlier version) MFC after: 1 week Added: head/sys/boot/uboot/fdt/ head/sys/boot/uboot/fdt/Makefile (contents, props changed) head/sys/boot/uboot/fdt/uboot_fdt.c (contents, props changed) Modified: head/sys/boot/arm/uboot/Makefile head/sys/boot/fdt/Makefile head/sys/boot/fdt/fdt_loader_cmd.c head/sys/boot/fdt/fdt_platform.h head/sys/boot/powerpc/uboot/Makefile head/sys/boot/uboot/Makefile Modified: head/sys/boot/arm/uboot/Makefile ============================================================================== --- head/sys/boot/arm/uboot/Makefile Sat Nov 1 17:09:39 2014 (r273933) +++ head/sys/boot/arm/uboot/Makefile Sat Nov 1 17:12:44 2014 (r273934) @@ -72,6 +72,7 @@ CFLAGS+= -DLOADER_TFTP_SUPPORT CFLAGS+= -I${.CURDIR}/../../fdt CFLAGS+= -I${.OBJDIR}/../../fdt CFLAGS+= -DLOADER_FDT_SUPPORT +LIBUBOOT_FDT= ${.OBJDIR}/../../uboot/fdt/libuboot_fdt.a LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a .endif @@ -112,8 +113,8 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/li # clang doesn't understand %D as a specifier to printf NO_WERROR.clang= -DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} -lstand +DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND} +LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} -lstand vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} Modified: head/sys/boot/fdt/Makefile ============================================================================== --- head/sys/boot/fdt/Makefile Sat Nov 1 17:09:39 2014 (r273933) +++ head/sys/boot/fdt/Makefile Sat Nov 1 17:12:44 2014 (r273934) @@ -11,8 +11,7 @@ SRCS+= fdt.c fdt_ro.c fdt_wip.c fdt_sw. # Loader's fdt commands extension sources. SRCS+= fdt_loader_cmd.c -CFLAGS+= -I${.CURDIR}/../../contrib/libfdt/ -I${.CURDIR}/../common/ \ - -I${.CURDIR}/../uboot/lib +CFLAGS+= -I${.CURDIR}/../../contrib/libfdt/ -I${.CURDIR}/../common/ CFLAGS+= -ffreestanding Modified: head/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- head/sys/boot/fdt/fdt_loader_cmd.c Sat Nov 1 17:09:39 2014 (r273933) +++ head/sys/boot/fdt/fdt_loader_cmd.c Sat Nov 1 17:12:44 2014 (r273934) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "fdt_platform.h" -#include "glue.h" #ifdef DEBUG #define debugf(fmt, args...) do { printf("%s(): ", __func__); \ @@ -53,9 +52,6 @@ __FBSDID("$FreeBSD$"); #define FDT_PROP_SEP " = " -#define STR(number) #number -#define STRINGIFY(number) STR(number) - #define COPYOUT(s,d,l) archsw.arch_copyout(s, d, l) #define COPYIN(s,d,l) archsw.arch_copyin(s, d, l) @@ -229,7 +225,7 @@ fdt_load_dtb(vm_offset_t va) return (0); } -static int +int fdt_load_dtb_addr(struct fdt_header *header) { int err; @@ -254,7 +250,7 @@ fdt_load_dtb_addr(struct fdt_header *hea return (0); } -static int +int fdt_load_dtb_file(const char * filename) { struct preloaded_file *bfp, *oldbfp; @@ -284,9 +280,6 @@ int fdt_setup_fdtp() { struct preloaded_file *bfp; - struct fdt_header *hdr; - const char *s; - char *p; vm_offset_t va; debugf("fdt_setup_fdtp()\n"); @@ -309,41 +302,8 @@ fdt_setup_fdtp() } } - /* - * If the U-boot environment contains a variable giving the address of a - * valid blob in memory, use it. The U-boot README says the right - * variable for fdt data loaded into ram is fdt_addr_r, so try that - * first. Board vendors also use both fdtaddr and fdt_addr names. - */ - s = ub_env_get("fdt_addr_r"); - if (s == NULL) - s = ub_env_get("fdtaddr"); - if (s == NULL) - s = ub_env_get("fdt_addr"); - if (s != NULL && *s != '\0') { - hdr = (struct fdt_header *)strtoul(s, &p, 16); - if (*p == '\0') { - if (fdt_load_dtb_addr(hdr) == 0) { - printf("Using DTB provided by U-Boot at " - "address %p.\n", hdr); - return (0); - } - } - } - - /* - * If the U-boot environment contains a variable giving the name of a - * file, use it if we can load and validate it. - */ - s = ub_env_get("fdtfile"); - if (s == NULL) - s = ub_env_get("fdt_file"); - if (s != NULL && *s != '\0') { - if (fdt_load_dtb_file(s) == 0) { - printf("Loaded DTB from file '%s'.\n", s); - return (0); - } - } + if (fdt_platform_load_dtb() == 0) + return (0); /* If there is a dtb compiled into the kernel, use it. */ if ((va = fdt_find_static_dtb()) != 0) { @@ -407,48 +367,20 @@ _fdt_strtovect(const char *str, void *ce return (cnt); } -#define TMP_MAX_ETH 8 - -static void -fixup_ethernet(const char *env, char *ethstr, int *eth_no, int len) +void +fdt_fixup_ethernet(const char *str, char *ethstr, int len) { - const char *str; - char *end; uint8_t tmp_addr[6]; - int i, n; - - /* Extract interface number */ - i = strtol(env + 3, &end, 10); - if (end == (env + 3)) - /* 'ethaddr' means interface 0 address */ - n = 0; - else - n = i; - - if (n > TMP_MAX_ETH) - return; - - str = ub_env_get(env); /* Convert macaddr string into a vector of uints */ fdt_strtovectx(str, &tmp_addr, 6, sizeof(uint8_t)); - if (n != 0) { - i = strlen(env) - 7; - strncpy(ethstr + 8, env + 3, i); - } /* Set actual property to a value from vect */ fdt_setprop(fdtp, fdt_path_offset(fdtp, ethstr), "local-mac-address", &tmp_addr, 6 * sizeof(uint8_t)); - - /* Clear ethernet..XXXX.. string */ - bzero(ethstr + 8, len - 8); - - if (n + 1 > *eth_no) - *eth_no = n + 1; } -static void -fixup_cpubusfreqs(unsigned long cpufreq, unsigned long busfreq) +void +fdt_fixup_cpubusfreqs(unsigned long cpufreq, unsigned long busfreq) { int lo, o = 0, o2, maxo = 0, depth; const uint32_t zero = 0; @@ -527,13 +459,14 @@ fdt_reg_valid(uint32_t *reg, int len, in return (0); } -static void -fixup_memory(struct sys_info *si) +void +fdt_fixup_memory(struct fdt_mem_region *region, size_t num) { - struct mem_region *curmr; + struct fdt_mem_region *curmr; uint32_t addr_cells, size_cells; uint32_t *addr_cellsp, *reg, *size_cellsp; - int err, i, len, memory, realmrno, root; + int err, i, len, memory, root; + size_t realmrno; uint8_t *buf, *sb; uint64_t rstart, rsize; int reserved; @@ -591,7 +524,6 @@ fixup_memory(struct sys_info *si) bzero(buf, len); for (i = 0; i < reserved; i++) { - curmr = &si->mr[i]; if (fdt_get_mem_rsv(fdtp, i, &rstart, &rsize)) break; if (rsize) { @@ -623,9 +555,9 @@ fixup_memory(struct sys_info *si) } /* Count valid memory regions entries in sysinfo. */ - realmrno = si->mr_no; - for (i = 0; i < si->mr_no; i++) - if (si->mr[i].start == 0 && si->mr[i].size == 0) + realmrno = num; + for (i = 0; i < num; i++) + if (region[i].start == 0 && region[i].size == 0) realmrno--; if (realmrno == 0) { @@ -652,8 +584,8 @@ fixup_memory(struct sys_info *si) bzero(buf, len); - for (i = 0; i < si->mr_no; i++) { - curmr = &si->mr[i]; + for (i = 0; i < num; i++) { + curmr = ®ion[i]; if (curmr->size != 0) { /* Ensure endianess, and put cells into a buffer */ if (addr_cells == 2) @@ -682,17 +614,15 @@ fixup_memory(struct sys_info *si) free(sb); } -static void -fixup_stdout(const char *env) +void +fdt_fixup_stdout(const char *str) { - const char *str; char *ptr; int serialno; int len, no, sero; const struct fdt_property *prop; char *tmp[10]; - str = ub_env_get(env); ptr = (char *)str + strlen(str) - 1; while (ptr > str && isdigit(*(str - 1))) str--; @@ -738,14 +668,8 @@ fixup_stdout(const char *env) static int fdt_fixup(void) { - const char *env; - char *ethstr; - int chosen, eth_no, len; - struct sys_info *si; - - env = NULL; - eth_no = 0; - ethstr = NULL; + int chosen, len; + len = 0; debugf("fdt_fixup()\n"); @@ -762,45 +686,7 @@ fdt_fixup(void) if (fdt_getprop(fdtp, chosen, "fixup-applied", NULL)) return (1); - /* Acquire sys_info */ - si = ub_get_sys_info(); - - while ((env = ub_env_enum(env)) != NULL) { - if (strncmp(env, "eth", 3) == 0 && - strncmp(env + (strlen(env) - 4), "addr", 4) == 0) { - /* - * Handle Ethernet addrs: parse uboot env eth%daddr - */ - - if (!eth_no) { - /* - * Check how many chars we will need to store - * maximal eth iface number. - */ - len = strlen(STRINGIFY(TMP_MAX_ETH)) + - strlen("ethernet"); - - /* - * Reserve mem for string "ethernet" and len - * chars for iface no. - */ - ethstr = (char *)malloc(len * sizeof(char)); - bzero(ethstr, len * sizeof(char)); - strcpy(ethstr, "ethernet0"); - } - - /* Modify blob */ - fixup_ethernet(env, ethstr, ð_no, len); - - } else if (strcmp(env, "consoledev") == 0) - fixup_stdout(env); - } - - /* Modify cpu(s) and bus clock frequenties in /cpus node [Hz] */ - fixup_cpubusfreqs(si->clk_cpu, si->clk_bus); - - /* Fixup memory regions */ - fixup_memory(si); + fdt_platform_fixups(); fdt_setprop(fdtp, chosen, "fixup-applied", NULL, 0); return (1); Modified: head/sys/boot/fdt/fdt_platform.h ============================================================================== --- head/sys/boot/fdt/fdt_platform.h Sat Nov 1 17:09:39 2014 (r273933) +++ head/sys/boot/fdt/fdt_platform.h Sat Nov 1 17:12:44 2014 (r273934) @@ -29,7 +29,26 @@ #ifndef FDT_PLATFORM_H #define FDT_PLATFORM_H -extern int fdt_copy(vm_offset_t); -extern int fdt_setup_fdtp(void); +struct fdt_header; + +struct fdt_mem_region { + unsigned long start; + unsigned long size; +}; + +#define TMP_MAX_ETH 8 + +int fdt_copy(vm_offset_t); +void fdt_fixup_cpubusfreqs(unsigned long, unsigned long); +void fdt_fixup_ethernet(const char *, char *, int); +void fdt_fixup_memory(struct fdt_mem_region *, size_t); +void fdt_fixup_stdout(const char *); +int fdt_load_dtb_addr(struct fdt_header *); +int fdt_load_dtb_file(const char *); +int fdt_setup_fdtp(void); + +/* The platform library needs to implement these functions */ +int fdt_platform_load_dtb(void); +void fdt_platform_fixups(void); #endif /* FDT_PLATFORM_H */ Modified: head/sys/boot/powerpc/uboot/Makefile ============================================================================== --- head/sys/boot/powerpc/uboot/Makefile Sat Nov 1 17:09:39 2014 (r273933) +++ head/sys/boot/powerpc/uboot/Makefile Sat Nov 1 17:12:44 2014 (r273934) @@ -62,6 +62,7 @@ CFLAGS+= -DLOADER_TFTP_SUPPORT CFLAGS+= -I${.CURDIR}/../../fdt CFLAGS+= -I${.OBJDIR}/../../fdt CFLAGS+= -DLOADER_FDT_SUPPORT +LIBUBOOT_FDT= ${.OBJDIR}/../../uboot/fdt/libuboot_fdt.a LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a .endif @@ -98,8 +99,8 @@ CFLAGS+= -I${.OBJDIR}/../../uboot/lib LIBSTAND= ${.OBJDIR}/../../libstand32/libstand.a CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ -DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBSTAND} +DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND} +LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND} vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} Modified: head/sys/boot/uboot/Makefile ============================================================================== --- head/sys/boot/uboot/Makefile Sat Nov 1 17:09:39 2014 (r273933) +++ head/sys/boot/uboot/Makefile Sat Nov 1 17:12:44 2014 (r273934) @@ -1,5 +1,11 @@ # $FreeBSD$ +.include + SUBDIR= lib +.if ${MK_FDT} != "no" +SUBDIR+=fdt +.endif + .include Added: head/sys/boot/uboot/fdt/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/uboot/fdt/Makefile Sat Nov 1 17:12:44 2014 (r273934) @@ -0,0 +1,33 @@ +# $FreeBSD$ + +.include + +.PATH: ${.CURDIR}/../../common + +LIB= uboot_fdt +INTERNALLIB= +WARNS?= 2 + +SRCS= uboot_fdt.c + +CFLAGS+= -ffreestanding -msoft-float + +CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ + +# U-Boot library headers +CFLAGS+= -I${.CURDIR}/../lib + +# libfdt headers +CFLAGS+= -I${.CURDIR}/../../fdt + +# Pick up the bootstrap header for some interface items +CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I. + +machine: + ln -sf ${.CURDIR}/../../../${MACHINE_CPUARCH}/include machine + +CLEANFILES+= machine + +.include + +beforedepend ${OBJS}: machine Added: head/sys/boot/uboot/fdt/uboot_fdt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/uboot/fdt/uboot_fdt.c Sat Nov 1 17:12:44 2014 (r273934) @@ -0,0 +1,181 @@ +/*- + * Copyright (c) 2009-2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Semihalf under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include "glue.h" + +#define STR(number) #number +#define STRINGIFY(number) STR(number) + +int +fdt_platform_load_dtb(void) +{ + struct fdt_header *hdr; + const char *s; + char *p; + + /* + * If the U-boot environment contains a variable giving the address of a + * valid blob in memory, use it. The U-boot README says the right + * variable for fdt data loaded into ram is fdt_addr_r, so try that + * first. Board vendors also use both fdtaddr and fdt_addr names. + */ + s = ub_env_get("fdt_addr_r"); + if (s == NULL) + s = ub_env_get("fdtaddr"); + if (s == NULL) + s = ub_env_get("fdt_addr"); + if (s != NULL && *s != '\0') { + hdr = (struct fdt_header *)strtoul(s, &p, 16); + if (*p == '\0') { + if (fdt_load_dtb_addr(hdr) == 0) { + printf("Using DTB provided by U-Boot at " + "address %p.\n", hdr); + return (0); + } + } + } + + /* + * If the U-boot environment contains a variable giving the name of a + * file, use it if we can load and validate it. + */ + s = ub_env_get("fdtfile"); + if (s == NULL) + s = ub_env_get("fdt_file"); + if (s != NULL && *s != '\0') { + if (fdt_load_dtb_file(s) == 0) { + printf("Loaded DTB from file '%s'.\n", s); + return (0); + } + } + + return (1); +} + +void +fdt_platform_fixups(void) +{ + struct fdt_mem_region regions[3]; + const char *env, *str; + char *end, *ethstr; + int eth_no, i, len, n; + struct sys_info *si; + + env = NULL; + eth_no = 0; + ethstr = NULL; + + /* Acquire sys_info */ + si = ub_get_sys_info(); + + while ((env = ub_env_enum(env)) != NULL) { + if (strncmp(env, "eth", 3) == 0 && + strncmp(env + (strlen(env) - 4), "addr", 4) == 0) { + /* + * Handle Ethernet addrs: parse uboot env eth%daddr + */ + + if (!eth_no) { + /* + * Check how many chars we will need to store + * maximal eth iface number. + */ + len = strlen(STRINGIFY(TMP_MAX_ETH)) + + strlen("ethernet") + 1; + + /* + * Reserve mem for string "ethernet" and len + * chars for iface no. + */ + ethstr = (char *)malloc(len * sizeof(char)); + bzero(ethstr, len * sizeof(char)); + strcpy(ethstr, "ethernet0"); + } + + /* Extract interface number */ + i = strtol(env + 3, &end, 10); + if (end == (env + 3)) + /* 'ethaddr' means interface 0 address */ + n = 0; + else + n = i; + + if (n > TMP_MAX_ETH) + continue; + + str = ub_env_get(env); + + if (n != 0) { + /* + * Find the lenght of the interface id by + * taking in to account the first 3 and + * last 4 characters. + */ + i = strlen(env) - 7; + strncpy(ethstr + 8, env + 3, i); + } + + /* Modify blob */ + fdt_fixup_ethernet(str, ethstr, len); + + /* Clear ethernet..XXXX.. string */ + bzero(ethstr + 8, len - 8); + + if (n + 1 > eth_no) + eth_no = n + 1; + } else if (strcmp(env, "consoledev") == 0) { + str = ub_env_get(env); + fdt_fixup_stdout(str); + } + } + + /* Modify cpu(s) and bus clock frequenties in /cpus node [Hz] */ + fdt_fixup_cpubusfreqs(si->clk_cpu, si->clk_bus); + + /* Copy the data into a useful form */ + for (i = 0; i < si->mr_no; i++) { + if (i > nitems(regions)) { + i = nitems(regions); + break; + } + + regions[i].start = si->mr[i].start; + regions[i].size = si->mr[i].size; + } + + /* Fixup memory regions */ + fdt_fixup_memory(regions, i); +} From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 17:13:14 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5838C4B5; Sat, 1 Nov 2014 17:13:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B21DD87; Sat, 1 Nov 2014 17:13:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1HDEvP034749; Sat, 1 Nov 2014 17:13:14 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1HDE14034748; Sat, 1 Nov 2014 17:13:14 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201411011713.sA1HDE14034748@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 1 Nov 2014 17:13:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273935 - head/contrib/netbsd-tests/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 17:13:14 -0000 Author: ngie Date: Sat Nov 1 17:13:13 2014 New Revision: 273935 URL: https://svnweb.freebsd.org/changeset/base/273935 Log: Port tests to FreeBSD/Linux Some of the testcases don't work outside of NetBSD, and the behavior of ether_aton_r differs between FreeBSD, Linux, and NetBSD, and the calls to the API need to be massaged for FreeBSD and Linux. Submitted by: pho Modified: head/contrib/netbsd-tests/lib/libc/net/t_ether_aton.c Modified: head/contrib/netbsd-tests/lib/libc/net/t_ether_aton.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/net/t_ether_aton.c Sat Nov 1 17:12:44 2014 (r273934) +++ head/contrib/netbsd-tests/lib/libc/net/t_ether_aton.c Sat Nov 1 17:13:13 2014 (r273935) @@ -46,9 +46,18 @@ __RCSID("$NetBSD: t_ether_aton.c,v 1.1 2 #include #include +#if !defined(__NetBSD__) +#if defined(__linux__) +#include +#endif +#include +#endif + +#if defined(__NetBSD__) #define ETHER_ADDR_LEN 6 int ether_aton_r(u_char *dest, size_t len, const char *str); +#endif static const struct { u_char res[ETHER_ADDR_LEN]; @@ -56,9 +65,11 @@ static const struct { int error; } tests[] = { { { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab }, "01:23:45:67:89:ab", 0 }, +#if defined(__NetBSD__) { { 0x00, 0x01, 0x22, 0x03, 0x14, 0x05 }, "0:1:22-3:14:05", 0 }, { { 0x00, 0x01, 0x22, 0x03, 0x14, 0x05 }, "000122031405", 0 }, { { 0x0a, 0x0B, 0xcc, 0xdD, 0xEE, 0x0f }, "0a0BccdDEE0f", 0 }, +#endif #define ZERO { 0, 0, 0, 0, 0, 0 } { ZERO, "0:1:2-3:04:05:06", ENAMETOOLONG }, { ZERO, "0:1:2-3:04:", ENOBUFS }, @@ -75,22 +86,44 @@ ATF_TC_HEAD(tc_ether_aton, tc) ATF_TC_BODY(tc_ether_aton, tc) { +#if defined(__NetBSD__) u_char dest[ETHER_ADDR_LEN]; +#else + struct ether_addr dest; +#endif size_t t; +#if defined(__NetBSD__) int e, r; +#else + int e; + struct ether_addr *r; +#endif const char *s; for (t = 0; tests[t].str; t++) { s = tests[t].str; if ((e = tests[t].error) == 0) { +#if defined(__NetBSD__) if (ether_aton_r(dest, sizeof(dest), s) != e) atf_tc_fail("failed on `%s'", s); if (memcmp(dest, tests[t].res, sizeof(dest)) != 0) atf_tc_fail("unexpected result on `%s'", s); +#else + if (ether_aton_r(s, &dest) == NULL && e == 0) + atf_tc_fail("failed on `%s'", s); + if (memcmp(&dest, tests[t].res, sizeof(dest)) != 0) + atf_tc_fail("unexpected result on `%s'", s); +#endif } else { +#if defined(__NetBSD__) if ((r = ether_aton_r(dest, sizeof(dest), s)) != e) atf_tc_fail("unexpectedly succeeded on `%s' " "(%d != %d)", s, r, e); +#else + if ((r = ether_aton_r(s, &dest)) != NULL && e != 0) + atf_tc_fail("unexpectedly succeeded on `%s' " + "(%p != %d)", s, r, e); +#endif } } } From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 17:14:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 42C1060D; Sat, 1 Nov 2014 17:14:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2EA17D9A; Sat, 1 Nov 2014 17:14:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1HEUKJ034960; Sat, 1 Nov 2014 17:14:30 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1HEUso034959; Sat, 1 Nov 2014 17:14:30 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201411011714.sA1HEUso034959@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 1 Nov 2014 17:14:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273936 - head/contrib/netbsd-tests/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 17:14:30 -0000 Author: ngie Date: Sat Nov 1 17:14:29 2014 New Revision: 273936 URL: https://svnweb.freebsd.org/changeset/base/273936 Log: Port lib/libc/net/h_dns_server to FreeBSD Submitted by: pho Modified: head/contrib/netbsd-tests/lib/libc/net/h_dns_server.c Modified: head/contrib/netbsd-tests/lib/libc/net/h_dns_server.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/net/h_dns_server.c Sat Nov 1 17:13:13 2014 (r273935) +++ head/contrib/netbsd-tests/lib/libc/net/h_dns_server.c Sat Nov 1 17:14:29 2014 (r273936) @@ -49,7 +49,13 @@ __RCSID("$NetBSD: h_dns_server.c,v 1.4 2 #include #include +#ifdef __NetBSD__ #include +#endif + +#ifdef __FreeBSD__ +#include +#endif union sockaddr_either { struct sockaddr s; @@ -164,6 +170,106 @@ name2str(const void *v, char *buf, size_ } #endif +#ifdef __FreeBSD__ +/* XXX the daemon2_* functions should be in a library */ + +int __daemon2_detach_pipe[2]; + +static int +daemon2_fork(void) +{ + int r; + int fd; + int i; + + /* + * Set up the pipe, making sure the write end does not + * get allocated one of the file descriptors that will + * be closed in daemon2_detach(). + */ + for (i = 0; i < 3; i++) { + r = pipe(__daemon2_detach_pipe); + if (r < 0) + return -1; + if (__daemon2_detach_pipe[1] <= STDERR_FILENO && + (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { + (void)dup2(fd, __daemon2_detach_pipe[0]); + (void)dup2(fd, __daemon2_detach_pipe[1]); + if (fd > STDERR_FILENO) + (void)close(fd); + continue; + } + break; + } + + r = fork(); + if (r < 0) { + return -1; + } else if (r == 0) { + /* child */ + close(__daemon2_detach_pipe[0]); + return 0; + } + /* Parent */ + + (void) close(__daemon2_detach_pipe[1]); + + for (;;) { + char dummy; + r = read(__daemon2_detach_pipe[0], &dummy, 1); + if (r < 0) { + if (errno == EINTR) + continue; + _exit(1); + } else if (r == 0) { + _exit(1); + } else { /* r > 0 */ + _exit(0); + } + } +} + +static int +daemon2_detach(int nochdir, int noclose) +{ + int r; + int fd; + + if (setsid() == -1) + return -1; + + if (!nochdir) + (void)chdir("/"); + + if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { + (void)dup2(fd, STDIN_FILENO); + (void)dup2(fd, STDOUT_FILENO); + (void)dup2(fd, STDERR_FILENO); + if (fd > STDERR_FILENO) + (void)close(fd); + } + + while (1) { + r = write(__daemon2_detach_pipe[1], "", 1); + if (r < 0) { + if (errno == EINTR) + continue; + /* May get "broken pipe" here if parent is killed */ + return -1; + } else if (r == 0) { + /* Should not happen */ + return -1; + } else { + break; + } + } + + (void) close(__daemon2_detach_pipe[1]); + + return 0; +} +#endif + int main(int argc, char **argv) { int s, r, protocol; union sockaddr_either saddr; @@ -176,6 +282,9 @@ int main(int argc, char **argv) { char buf1[1024], buf2[1024]; #endif +#ifdef __FreeBSD__ + daemon2_fork(); +#endif if (argc < 2 || ((protocol = argv[1][0]) != '4' && protocol != '6')) errx(1, "usage: dns_server 4 | 6"); s = socket(protocol == '4' ? PF_INET : PF_INET6, SOCK_DGRAM, IPPROTO_UDP); @@ -212,11 +321,19 @@ int main(int argc, char **argv) { f = fopen(pidfile_name, "w"); fprintf(f, "%d", getpid()); fclose(f); +#ifdef __FreeBSD__ +#ifdef DEBUG + daemon2_detach(0, 1); +#else + daemon2_detach(0, 0); +#endif +#else #ifdef DEBUG daemon(0, 1); #else daemon(0, 0); #endif +#endif for (;;) { unsigned char buf[512]; From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 17:19:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 47D627A1; Sat, 1 Nov 2014 17:19:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 341D6DC7; Sat, 1 Nov 2014 17:19:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1HJitW035651; Sat, 1 Nov 2014 17:19:44 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1HJiua035650; Sat, 1 Nov 2014 17:19:44 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201411011719.sA1HJiua035650@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 1 Nov 2014 17:19:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273937 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 17:19:44 -0000 Author: ngie Date: Sat Nov 1 17:19:43 2014 New Revision: 273937 URL: https://svnweb.freebsd.org/changeset/base/273937 Log: Port lib/libc/sys/t_dup to FreeBSD/Linux - The requirements differ between FreeBSD/Linux when dealing with oldd/newd being equal (both fail with EINVAL, not EBADF) - Add an EBADF testcase - Fix compilation issues on clang In collaboration with: pho Modified: head/contrib/netbsd-tests/lib/libc/sys/t_dup.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_dup.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_dup.c Sat Nov 1 17:14:29 2014 (r273936) +++ head/contrib/netbsd-tests/lib/libc/sys/t_dup.c Sat Nov 1 17:19:43 2014 (r273937) @@ -45,8 +45,14 @@ __RCSID("$NetBSD: t_dup.c,v 1.8 2012/03/ #include #include +#ifdef __FreeBSD__ +#include +#endif + static char path[] = "dup"; +#ifdef __NetBSD__ static void check_mode(bool, bool, bool); +#endif static void check_mode(bool _dup, bool _dup2, bool _dup3) @@ -207,10 +213,24 @@ ATF_TC_BODY(dup3_err, tc) ATF_REQUIRE(fd >= 0); errno = 0; +#if defined(__FreeBSD__) || defined(__linux__) + /* + * FreeBSD and linux return EINVAL, because... + * + * [EINVAL] The oldd argument is equal to the newd argument. + */ + ATF_REQUIRE(dup3(fd, fd, O_CLOEXEC) == -1); +#else ATF_REQUIRE(dup3(fd, fd, O_CLOEXEC) != -1); +#endif errno = 0; +#if defined(__FreeBSD__) || defined(__linux__) + ATF_REQUIRE_ERRNO(EINVAL, dup3(-1, -1, O_CLOEXEC) == -1); + ATF_REQUIRE_ERRNO(EBADF, dup3(fd, -1, O_CLOEXEC) == -1); +#else ATF_REQUIRE_ERRNO(EBADF, dup3(-1, -1, O_CLOEXEC) == -1); +#endif errno = 0; ATF_REQUIRE_ERRNO(EBADF, dup3(fd, -1, O_CLOEXEC) == -1); From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 17:22:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C0EE4909; Sat, 1 Nov 2014 17:22:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD1F8E6A; Sat, 1 Nov 2014 17:22:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1HMrHw039523; Sat, 1 Nov 2014 17:22:53 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1HMrOZ039522; Sat, 1 Nov 2014 17:22:53 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201411011722.sA1HMrOZ039522@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 1 Nov 2014 17:22:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273938 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 17:22:53 -0000 Author: ngie Date: Sat Nov 1 17:22:53 2014 New Revision: 273938 URL: https://svnweb.freebsd.org/changeset/base/273938 Log: getitimer on FreeBSD returns the last set time instead of the remaining time; test for that instead Submitted by: pho Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.c Sat Nov 1 17:19:43 2014 (r273937) +++ head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.c Sat Nov 1 17:22:53 2014 (r273938) @@ -194,8 +194,13 @@ ATF_TC_BODY(setitimer_old, tc) ATF_REQUIRE(setitimer(ITIMER_REAL, &it, &ot) == 0); +#ifdef __FreeBSD__ + if (ot.it_value.tv_sec == 4 && ot.it_value.tv_usec == 3) + atf_tc_fail("setitimer(2) did not return remaining time"); +#else if (ot.it_value.tv_sec != 4 || ot.it_value.tv_usec != 3) atf_tc_fail("setitimer(2) did not store old values"); +#endif } ATF_TP_ADD_TCS(tp) From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 17:52:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8D7ADDF8; Sat, 1 Nov 2014 17:52:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79D9316C; Sat, 1 Nov 2014 17:52:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1Hq5Bj053535; Sat, 1 Nov 2014 17:52:05 GMT (envelope-from markm@FreeBSD.org) Received: (from markm@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1Hq59P053534; Sat, 1 Nov 2014 17:52:05 GMT (envelope-from markm@FreeBSD.org) Message-Id: <201411011752.sA1Hq59P053534@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markm set sender to markm@FreeBSD.org using -f From: Mark Murray Date: Sat, 1 Nov 2014 17:52:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273939 - head/sys/modules X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 17:52:05 -0000 Author: markm Date: Sat Nov 1 17:52:04 2014 New Revision: 273939 URL: https://svnweb.freebsd.org/changeset/base/273939 Log: Remove duplicate macro settings (probably due to an SVN merge /faux pas/ on my part. Spotted by: DES Approved by: DES(implicit) Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Sat Nov 1 17:22:53 2014 (r273938) +++ head/sys/modules/Makefile Sat Nov 1 17:52:04 2014 (r273939) @@ -606,17 +606,6 @@ _x86bios= x86bios _ixl= ixl _ixlv= ixlv _ntb= ntb -_nvd= nvd -_nvme= nvme -_nvram= nvram -_nxge= nxge -.if ${MK_CDDL} != "no" || defined(ALL_MODULES) -_opensolaris= opensolaris -.endif -.if ${MK_CRYPT} != "no" || defined(ALL_MODULES) -_padlock= padlock -.endif -_pccard= pccard _qlxge= qlxge _qlxgb= qlxgb _qlxgbe= qlxgbe From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 18:51:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8D557C05; Sat, 1 Nov 2014 18:51:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 795238F1; Sat, 1 Nov 2014 18:51:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1Ipn8e082127; Sat, 1 Nov 2014 18:51:49 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1IpnCB082126; Sat, 1 Nov 2014 18:51:49 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201411011851.sA1IpnCB082126@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Sat, 1 Nov 2014 18:51:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273940 - head/sys/boot/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 18:51:49 -0000 Author: marcel Date: Sat Nov 1 18:51:48 2014 New Revision: 273940 URL: https://svnweb.freebsd.org/changeset/base/273940 Log: Change the order of the arguments to file_loadraw(). They were swapped as of r262345 when file_loadraw() was made public and this little detail got overlooked during porting. Obtained from: Juniper Networks, Inc. Modified: head/sys/boot/common/install.c Modified: head/sys/boot/common/install.c ============================================================================== --- head/sys/boot/common/install.c Sat Nov 1 17:52:04 2014 (r273939) +++ head/sys/boot/common/install.c Sat Nov 1 18:51:48 2014 (r273940) @@ -286,7 +286,7 @@ install(char *pkgname) } s = (inst_rootfs == NULL) ? "/install.iso" : inst_rootfs; - if (file_loadraw("mfs_root", s) == NULL) { + if (file_loadraw(s, "mfs_root") == NULL) { error = errno; command_errmsg = "cannot load root file system"; goto fail; From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 20:07:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 44F6AD8F; Sat, 1 Nov 2014 20:07:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16CD6F0E; Sat, 1 Nov 2014 20:07:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1K7Wbf017317; Sat, 1 Nov 2014 20:07:32 GMT (envelope-from gavin@FreeBSD.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1K7WS6017316; Sat, 1 Nov 2014 20:07:32 GMT (envelope-from gavin@FreeBSD.org) Message-Id: <201411012007.sA1K7WS6017316@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gavin set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson Date: Sat, 1 Nov 2014 20:07:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273941 - head/release/doc/en_US.ISO8859-1/hardware X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 20:07:33 -0000 Author: gavin Date: Sat Nov 1 20:07:32 2014 New Revision: 273941 URL: https://svnweb.freebsd.org/changeset/base/273941 Log: Updates to the list of CPUs supported by the amd64 platform MFC after: 3 days Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.xml Sat Nov 1 18:51:48 2014 (r273940) +++ head/release/doc/en_US.ISO8859-1/hardware/article.xml Sat Nov 1 20:07:32 2014 (r273941) @@ -76,7 +76,7 @@ Note that there are two names for this architecture, AMD64 (AMD) and Intel EM64T (Extended Memory 64-bit Technology). 64-bit mode of the two architectures are almost compatible - with each other, and &os;/&arch.amd64; should support them + with each other, and &os;/&arch.amd64; supports them both. As of this writing, the following processors are @@ -92,6 +92,18 @@ + &amd.sempron;. + + + + &amd.turion;. + + + + &amd.phenom;. + + + All multi-core &intel; &xeon; processors except Sossaman have EM64T support. @@ -104,22 +116,30 @@ - All &intel; Core 2 (not Core Duo) and later + All &intel; &core; 2 (not &core; Duo) and later processors + All &intel; &core; i range of processors + + + All &intel; &pentium; D processors - &intel; &pentium; 4s and Celeron Ds using + All &intel; ¢rino; Duo and ¢rino; Pro platforms + + + + &intel; &pentium; 4s and &celeron; Ds using the Cedar Mill core have EM64T support. - Some &intel; &pentium; 4s and Celeron Ds using + Some &intel; &pentium; 4s and &celeron; Ds using the Prescott core have EM64T support. See the Intel Processor Spec Finder for the definitive answer about From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 20:33:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D666CA20; Sat, 1 Nov 2014 20:33:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2521226; Sat, 1 Nov 2014 20:33:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1KXgSA031733; Sat, 1 Nov 2014 20:33:42 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1KXgBn031732; Sat, 1 Nov 2014 20:33:42 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201411012033.sA1KXgBn031732@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 1 Nov 2014 20:33:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273942 - head/contrib/netbsd-tests/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 20:33:43 -0000 Author: ngie Date: Sat Nov 1 20:33:42 2014 New Revision: 273942 URL: https://svnweb.freebsd.org/changeset/base/273942 Log: Skip :sethostname_basic because it messes up the test host's hostname Convert code from #if defined(__FreeBSD__) to #ifdef __FreeBSD__ Modified: head/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c Modified: head/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c Sat Nov 1 20:07:32 2014 (r273941) +++ head/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c Sat Nov 1 20:33:42 2014 (r273942) @@ -59,11 +59,13 @@ ATF_TC_BODY(sethostname_basic, tc) char name[MAXHOSTNAMELEN]; size_t i; + atf_tc_skip("screws up the test host's hostname on FreeBSD"); + for (i = 0; i < __arraycount(hosts); i++) { (void)memset(name, 0, sizeof(name)); -#if defined(__FreeBSD__) +#ifdef __FreeBSD__ /* * Sanity checks to ensure that the wrong invariant isn't being * tested for per PR # 181127 @@ -106,7 +108,7 @@ ATF_TC_BODY(sethostname_limit, tc) ATF_TC_CLEANUP(sethostname_limit, tc) { -#if defined(__FreeBSD__) +#ifdef __FreeBSD__ ATF_REQUIRE(sethostname(host, MAXHOSTNAMELEN - 1 ) == 0); ATF_REQUIRE(sethostname(host, MAXHOSTNAMELEN) == -1); #endif From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 20:41:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 168D6D11; Sat, 1 Nov 2014 20:41:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC971315; Sat, 1 Nov 2014 20:41:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1KfeYl034451; Sat, 1 Nov 2014 20:41:40 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1Kfeiw034450; Sat, 1 Nov 2014 20:41:40 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201411012041.sA1Kfeiw034450@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 1 Nov 2014 20:41:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273943 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 20:41:41 -0000 Author: ngie Date: Sat Nov 1 20:41:40 2014 New Revision: 273943 URL: https://svnweb.freebsd.org/changeset/base/273943 Log: Port t_kevent to FreeBSD Submitted by: pho Modified: head/contrib/netbsd-tests/lib/libc/sys/t_kevent.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_kevent.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_kevent.c Sat Nov 1 20:33:42 2014 (r273942) +++ head/contrib/netbsd-tests/lib/libc/sys/t_kevent.c Sat Nov 1 20:41:40 2014 (r273943) @@ -43,12 +43,18 @@ __RCSID("$NetBSD: t_kevent.c,v 1.6 2012/ #include #include #include +#ifdef __NetBSD__ #include +#endif #include #include #include #include +#ifdef __FreeBSD__ +#define DRVCTLDEV "/nonexistent" +#endif + ATF_TC(kevent_zerotimer); ATF_TC_HEAD(kevent_zerotimer, tc) { @@ -108,9 +114,15 @@ ATF_TC_BODY(kqueue_desc_passing, tc) if (recvmsg(s[1], &m, 0) == -1) err(1, "child: could not recvmsg"); +#ifdef __FreeBSD__ + bcopy(CMSG_DATA(msg), &kq, sizeof(kq)); + printf("child (pid %d): received kq fd %d\n", getpid(), kq); + _exit(0); +#else kq = *(int *)CMSG_DATA(msg); printf("child (pid %d): received kq fd %d\n", getpid(), kq); exit(0); +#endif } close(s[1]); @@ -122,15 +134,29 @@ ATF_TC_BODY(kqueue_desc_passing, tc) msg->cmsg_type = SCM_RIGHTS; msg->cmsg_len = CMSG_LEN(sizeof(int)); +#ifdef __FreeBSD__ + /* + * What is should have been + * bcopy(&s[0], CMSG_DATA(msg), sizeof(kq)); + */ + bcopy(&kq, CMSG_DATA(msg), sizeof(kq)); +#else *(int *)CMSG_DATA(msg) = kq; +#endif EV_SET(&ev, 1, EVFILT_TIMER, EV_ADD|EV_ENABLE, 0, 1, 0); ATF_CHECK(kevent(kq, &ev, 1, NULL, 0, NULL) != -1); printf("parent (pid %d): sending kq fd %d\n", getpid(), kq); if (sendmsg(s[0], &m, 0) == -1) { +#if defined(__NetBSD__) ATF_REQUIRE_EQ_MSG(errno, EBADF, "errno is %d", errno); atf_tc_skip("PR kern/46523"); +#endif +#if defined(__FreeBSD__) + ATF_REQUIRE_EQ_MSG(errno, EOPNOTSUPP, "errno is %d", errno); + close(s[0]); +#endif } close(kq); From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 20:45:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 260ADF91; Sat, 1 Nov 2014 20:45:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC04F338; Sat, 1 Nov 2014 20:45:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1Kjjxd036934; Sat, 1 Nov 2014 20:45:45 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1KjjgO036933; Sat, 1 Nov 2014 20:45:45 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201411012045.sA1KjjgO036933@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 1 Nov 2014 20:45:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273945 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 20:45:46 -0000 Author: ngie Date: Sat Nov 1 20:45:45 2014 New Revision: 273945 URL: https://svnweb.freebsd.org/changeset/base/273945 Log: Port t_mincore to FreeBSD Mark :mincore_resid as atf_tc_expect_fail on FreeBSD because of new bug discovered in running the tests (it succeeded from earlier on in the year to September/October on FreeBSD, at least) Submitted by: pho Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mincore.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Sat Nov 1 20:41:47 2014 (r273944) +++ head/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Sat Nov 1 20:45:45 2014 (r273945) @@ -74,6 +74,10 @@ __RCSID("$NetBSD: t_mincore.c,v 1.8 2012 #include #include +#ifdef __FreeBSD__ +#include +#endif + static long page = 0; static const char path[] = "mincore"; static size_t check_residency(void *, size_t); @@ -121,8 +125,10 @@ ATF_TC_BODY(mincore_err, tc) ATF_REQUIRE(vec != NULL); ATF_REQUIRE(map != MAP_FAILED); +#ifdef __NetBSD__ errno = 0; ATF_REQUIRE_ERRNO(EINVAL, mincore(map, 0, vec) == -1); +#endif errno = 0; ATF_REQUIRE_ERRNO(ENOMEM, mincore(0, page, vec) == -1); @@ -187,13 +193,24 @@ ATF_TC_BODY(mincore_resid, tc) npgs = 128; +#ifdef __FreeBSD__ + addr = mmap(NULL, npgs * page, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, -1, (off_t)0); +#else addr = mmap(NULL, npgs * page, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_WIRED, -1, (off_t)0); +#endif if (addr == MAP_FAILED) atf_tc_skip("could not mmap wired anonymous test area, system " "might be low on memory"); +#ifdef __FreeBSD__ + atf_tc_expect_fail("the following calls fail; this seems to be a new " + "issue (didn't occur in 07/2014)"); + + ATF_REQUIRE(mlock(addr, npgs * page) == 0); +#endif ATF_REQUIRE(check_residency(addr, npgs) == npgs); ATF_REQUIRE(munmap(addr, npgs * page) == 0); @@ -238,12 +255,16 @@ ATF_TC_BODY(mincore_resid, tc) (void)munlockall(); ATF_REQUIRE(madvise(addr2, npgs * page, MADV_FREE) == 0); +#ifdef __NetBSD__ ATF_REQUIRE(check_residency(addr2, npgs) == 0); +#endif (void)memset(addr, 0, npgs * page); ATF_REQUIRE(madvise(addr, npgs * page, MADV_FREE) == 0); +#ifdef __NetBSD__ ATF_REQUIRE(check_residency(addr, npgs) == 0); +#endif (void)munmap(addr, npgs * page); (void)munmap(addr2, npgs * page); From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 20:50:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E5DD22DA; Sat, 1 Nov 2014 20:50:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C707E359; Sat, 1 Nov 2014 20:50:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1KodmY039969; Sat, 1 Nov 2014 20:50:39 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1KodEq039948; Sat, 1 Nov 2014 20:50:39 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201411012050.sA1KodEq039948@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 1 Nov 2014 20:50:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273946 - head/contrib/netbsd-tests/lib/libc/stdlib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 20:50:40 -0000 Author: ngie Date: Sat Nov 1 20:50:39 2014 New Revision: 273946 URL: https://svnweb.freebsd.org/changeset/base/273946 Log: Port h_atexit to FreeBSD __cxa_atexit varies between FreeBSD and NetBSD, and thus we must use pointers instead of static fields in the BSS. More extensive discussion is included in the source code In collaboration with: kib Submitted by: pho Modified: head/contrib/netbsd-tests/lib/libc/stdlib/h_atexit.c Modified: head/contrib/netbsd-tests/lib/libc/stdlib/h_atexit.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/stdlib/h_atexit.c Sat Nov 1 20:45:45 2014 (r273945) +++ head/contrib/netbsd-tests/lib/libc/stdlib/h_atexit.c Sat Nov 1 20:50:39 2014 (r273946) @@ -42,9 +42,33 @@ __RCSID("$NetBSD: h_atexit.c,v 1.1 2011/ extern int __cxa_atexit(void (*func)(void *), void *, void *); extern void __cxa_finalize(void *); +#if defined(__FreeBSD__) +/* + * On shared object unload, in __cxa_finalize, call and clear all installed + * atexit and __cxa_atexit handlers that are either installed by unloaded + * dso, or points to the functions provided by the dso. + * + * The reason of the change is to ensure that there is no lingering pointers + * to the unloaded code after the dlclose(3). It is known reason for infinite + * stream of the crash reports for many programs which use loadable modules + * and fail to properly clean on module unload. Examples are apache, php, + * perl etc. + * + * You pass the &dso_handle_1 and &dso_handle_2, which points inside the + * main binary, to the registration function. The code from r211706, + * correctly detects that they are for the main binary, and on the first + * call to __cxa_finalize(), which also pass pointer to main binary, all + * registered functions from the main binary are executed. + */ + +static void *dso_handle_1 = (void *)1; +static void *dso_handle_2 = (void *)2; +static void *dso_handle_3 = (void *)3; +#else static int dso_handle_1; static int dso_handle_2; static int dso_handle_3; +#endif static int arg_1; static int arg_2; @@ -167,6 +191,15 @@ main(int argc, char *argv[]) ASSERT(0 == atexit(normal_handler_0)); ASSERT(0 == atexit(normal_handler_1)); +#if defined(__FreeBSD__) + ASSERT(0 == __cxa_atexit(cxa_handler_4, &arg_1, dso_handle_1)); + ASSERT(0 == __cxa_atexit(cxa_handler_5, &arg_1, dso_handle_1)); + ASSERT(0 == __cxa_atexit(cxa_handler_3, &arg_2, dso_handle_2)); + ASSERT(0 == __cxa_atexit(cxa_handler_2, &arg_3, dso_handle_3)); + + __cxa_finalize(dso_handle_1); + __cxa_finalize(dso_handle_2); +#else ASSERT(0 == __cxa_atexit(cxa_handler_4, &arg_1, &dso_handle_1)); ASSERT(0 == __cxa_atexit(cxa_handler_5, &arg_1, &dso_handle_1)); ASSERT(0 == __cxa_atexit(cxa_handler_3, &arg_2, &dso_handle_2)); @@ -174,5 +207,6 @@ main(int argc, char *argv[]) __cxa_finalize(&dso_handle_1); __cxa_finalize(&dso_handle_2); +#endif exit(0); } From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 21:00:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 56161507; Sat, 1 Nov 2014 21:00:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 41F44612; Sat, 1 Nov 2014 21:00:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1L0fTT043138; Sat, 1 Nov 2014 21:00:41 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1L0fU0043137; Sat, 1 Nov 2014 21:00:41 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201411012100.sA1L0fU0043137@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 1 Nov 2014 21:00:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273947 - head/contrib/netbsd-tests/lib/libc/stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 21:00:41 -0000 Author: ngie Date: Sat Nov 1 21:00:40 2014 New Revision: 273947 URL: https://svnweb.freebsd.org/changeset/base/273947 Log: Expect :snprintf_posarg_error to blow up with a SIGSEGV on !NetBSD OSes Modified: head/contrib/netbsd-tests/lib/libc/stdio/t_printf.c Modified: head/contrib/netbsd-tests/lib/libc/stdio/t_printf.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/stdio/t_printf.c Sat Nov 1 20:50:39 2014 (r273946) +++ head/contrib/netbsd-tests/lib/libc/stdio/t_printf.c Sat Nov 1 21:00:40 2014 (r273947) @@ -36,6 +36,10 @@ #include #include +#ifndef __NetBSD__ +#include +#endif + ATF_TC(snprintf_c99); ATF_TC_HEAD(snprintf_c99, tc) { @@ -116,6 +120,12 @@ ATF_TC_BODY(snprintf_posarg_error, tc) { char s[16], fmt[32]; +#ifndef __NetBSD__ + atf_tc_expect_signal(SIGSEGV, + "some non-NetBSD platforms including FreeBSD don't validate " + "negative size; testcase blows up with SIGSEGV"); +#endif + snprintf(fmt, sizeof(fmt), "%%%zu$d", SIZE_MAX / sizeof(size_t)); ATF_CHECK(snprintf(s, sizeof(s), fmt, -23) == -1); From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 21:21:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 47CC87E1; Sat, 1 Nov 2014 21:21:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19B7589A; Sat, 1 Nov 2014 21:21:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1LL6RP054708; Sat, 1 Nov 2014 21:21:06 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1LL6wS054707; Sat, 1 Nov 2014 21:21:06 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201411012121.sA1LL6wS054707@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 1 Nov 2014 21:21:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273948 - head/contrib/netbsd-tests/lib/libc/stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 21:21:07 -0000 Author: ngie Date: Sat Nov 1 21:21:06 2014 New Revision: 273948 URL: https://svnweb.freebsd.org/changeset/base/273948 Log: Disable testcases 12 and 15-22 on FreeBSD Submitted by: pho Modified: head/contrib/netbsd-tests/lib/libc/stdio/t_fmemopen.c Modified: head/contrib/netbsd-tests/lib/libc/stdio/t_fmemopen.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/stdio/t_fmemopen.c Sat Nov 1 21:00:40 2014 (r273947) +++ head/contrib/netbsd-tests/lib/libc/stdio/t_fmemopen.c Sat Nov 1 21:21:06 2014 (r273948) @@ -27,7 +27,7 @@ * */ -#if defined(__NetBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) #include #else #if defined(__linux__) @@ -563,6 +563,7 @@ ATF_TC_BODY(test11, tc) } } +#ifndef __FreeBSD__ ATF_TC(test12); ATF_TC_HEAD(test12, tc) { @@ -620,6 +621,7 @@ ATF_TC_BODY(test12, tc) } } } +#endif ATF_TC(test13); ATF_TC_HEAD(test13, tc) @@ -629,7 +631,9 @@ ATF_TC_HEAD(test13, tc) ATF_TC_BODY(test13, tc) { struct testcase *t; +#ifndef __FreeBSD__ off_t i; +#endif const char **p; char buf[BUFSIZ]; FILE *fp; @@ -659,7 +663,9 @@ ATF_TC_BODY(test13, tc) /* negative + OOB */ ATF_CHECK(fseeko(fp, -1, SEEK_END) == -1); ATF_CHECK(ftello(fp) == (off_t)0); +#endif +#ifndef __FreeBSD__ /* positive */ for (i = 1; i <= t->n; ++i) { ATF_CHECK(fseeko(fp, i, SEEK_END) == 0); @@ -711,11 +717,13 @@ ATF_TC_BODY(test14, tc) ATF_CHECK(fseeko(fp, -(len + 1), SEEK_END) == -1); ATF_CHECK(ftello(fp) == len); +#ifndef __FreeBSD__ /* positive */ for (i = 1; i <= rest; ++i) { ATF_CHECK(fseeko(fp, i, SEEK_END) == 0); ATF_CHECK(ftello(fp) == len + i); } +#endif /* negative */ for (i = 1; i < len; ++i) { @@ -734,6 +742,8 @@ const char *mode_rw1[] = { NULL }; +#ifndef __FreeBSD__ + /* test15 - 18: * When a stream open for writing is flushed or closed, a null byte is written * at the current position or at the end of the buffer, depending on the size @@ -1135,6 +1145,7 @@ ATF_TC_BODY(test22, tc) } } } +#endif ATF_TP_ADD_TCS(tp) { @@ -1150,9 +1161,12 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, test09); ATF_TP_ADD_TC(tp, test10); ATF_TP_ADD_TC(tp, test11); +#ifndef __FreeBSD__ ATF_TP_ADD_TC(tp, test12); +#endif ATF_TP_ADD_TC(tp, test13); ATF_TP_ADD_TC(tp, test14); +#ifndef __FreeBSD__ ATF_TP_ADD_TC(tp, test15); ATF_TP_ADD_TC(tp, test16); ATF_TP_ADD_TC(tp, test17); @@ -1161,6 +1175,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, test20); ATF_TP_ADD_TC(tp, test21); ATF_TP_ADD_TC(tp, test22); +#endif return atf_no_error(); } From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 21:23:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EB380937; Sat, 1 Nov 2014 21:23:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D58B28B1; Sat, 1 Nov 2014 21:23:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1LNR8e055976; Sat, 1 Nov 2014 21:23:27 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1LNROd055975; Sat, 1 Nov 2014 21:23:27 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201411012123.sA1LNROd055975@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 1 Nov 2014 21:23:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273949 - head/contrib/netbsd-tests/lib/libc/stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 21:23:28 -0000 Author: ngie Date: Sat Nov 1 21:23:27 2014 New Revision: 273949 URL: https://svnweb.freebsd.org/changeset/base/273949 Log: Add new atf_tc_expect_fail to fflush_err; this is a new (within the past couple months) bug Modified: head/contrib/netbsd-tests/lib/libc/stdio/t_fflush.c Modified: head/contrib/netbsd-tests/lib/libc/stdio/t_fflush.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/stdio/t_fflush.c Sat Nov 1 21:21:06 2014 (r273948) +++ head/contrib/netbsd-tests/lib/libc/stdio/t_fflush.c Sat Nov 1 21:23:27 2014 (r273949) @@ -48,6 +48,10 @@ ATF_TC_BODY(fflush_err, tc) { FILE *f; +#ifdef __FreeBSD__ + atf_tc_expect_fail("the EOF invariant fails on FreeBSD; this is new"); +#endif + f = fopen(path, "w"); ATF_REQUIRE(f != NULL); From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 21:25:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CAB15A81; Sat, 1 Nov 2014 21:25:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6E6F8BC; Sat, 1 Nov 2014 21:25:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1LPMO8056289; Sat, 1 Nov 2014 21:25:22 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1LPM2X056288; Sat, 1 Nov 2014 21:25:22 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201411012125.sA1LPM2X056288@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 1 Nov 2014 21:25:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273950 - head/contrib/netbsd-tests/lib/libc/stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 21:25:22 -0000 Author: ngie Date: Sat Nov 1 21:25:22 2014 New Revision: 273950 URL: https://svnweb.freebsd.org/changeset/base/273950 Log: Skip :fopen_regular on !NetBSD because it's a NetBSD specific test Submitted by: pho Modified: head/contrib/netbsd-tests/lib/libc/stdio/t_fopen.c Modified: head/contrib/netbsd-tests/lib/libc/stdio/t_fopen.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/stdio/t_fopen.c Sat Nov 1 21:23:27 2014 (r273949) +++ head/contrib/netbsd-tests/lib/libc/stdio/t_fopen.c Sat Nov 1 21:25:22 2014 (r273950) @@ -434,7 +434,9 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, fopen_err); ATF_TP_ADD_TC(tp, fopen_mode); ATF_TP_ADD_TC(tp, fopen_perm); +#ifdef __NetBSD__ ATF_TP_ADD_TC(tp, fopen_regular); +#endif ATF_TP_ADD_TC(tp, fopen_seek); ATF_TP_ADD_TC(tp, freopen_std); From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 21:30:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 26B1CBEE; Sat, 1 Nov 2014 21:30:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12D768DD; Sat, 1 Nov 2014 21:30:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1LUI2m057639; Sat, 1 Nov 2014 21:30:18 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1LUIs5057638; Sat, 1 Nov 2014 21:30:18 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201411012130.sA1LUIs5057638@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 1 Nov 2014 21:30:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273951 - head/contrib/netbsd-tests/lib/libc/stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 21:30:19 -0000 Author: ngie Date: Sat Nov 1 21:30:18 2014 New Revision: 273951 URL: https://svnweb.freebsd.org/changeset/base/273951 Log: Expect :sscanf_whitespace to fail on !NetBSD OSes Submitted by: pho Modified: head/contrib/netbsd-tests/lib/libc/stdio/t_scanf.c Modified: head/contrib/netbsd-tests/lib/libc/stdio/t_scanf.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/stdio/t_scanf.c Sat Nov 1 21:25:22 2014 (r273950) +++ head/contrib/netbsd-tests/lib/libc/stdio/t_scanf.c Sat Nov 1 21:30:18 2014 (r273951) @@ -64,6 +64,10 @@ ATF_TC_BODY(sscanf_whitespace, tc) const char str[] = "\f\n\r\t\v%z"; char c; +#ifndef __NetBSD__ + atf_tc_expect_fail("fails on FreeBSD and some variants of Linux"); +#endif + /* set of "white space" symbols from isspace(3) */ c = 0; (void)sscanf(str, "%%%c", &c); From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 21:57:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7451C186; Sat, 1 Nov 2014 21:57:05 +0000 (UTC) Received: from mail-wg0-x233.google.com (mail-wg0-x233.google.com [IPv6:2a00:1450:400c:c00::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 609DEB2F; Sat, 1 Nov 2014 21:57:04 +0000 (UTC) Received: by mail-wg0-f51.google.com with SMTP id l18so8615578wgh.38 for ; Sat, 01 Nov 2014 14:57:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=Ffap2AVWXrksIFyRxialRswZF9014k3xu3RoF9N3AzU=; b=XDkV9wJQkgayfNnagCL28AeG4vt4pVGzzqrR8hF6TUmC10pQmLFBQcqoCQdMwFiIxF pEauny195vCbzQu+XknrwWGFe9Wml6GQ4zWFSqRT7McXLNABamSYZGZ2VS+g4zp4xwMn De/eliH0nxXbwGi9iAGYzNYwuUuPbTjFL59hXAygVQKPcuCYFplmM0UVxs42JyMcXlEe 0zg7fm+2vErhRn8qFphDRejM1/S7LhgNPw3oMZAeXpNIvPWHHYyGBhX7sG+ssjgP212B g6uBMpQKhwPEst5Emv0jWypZePWsVPQjkLvI7A2ui3TfCXqFhb9gCzWyrrFFaYMUWqja ND4Q== MIME-Version: 1.0 X-Received: by 10.180.92.169 with SMTP id cn9mr6128094wib.26.1414879022525; Sat, 01 Nov 2014 14:57:02 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Sat, 1 Nov 2014 14:57:02 -0700 (PDT) In-Reply-To: <201410302121.s9ULLsEw055630@svn.freebsd.org> References: <201410302121.s9ULLsEw055630@svn.freebsd.org> Date: Sat, 1 Nov 2014 14:57:02 -0700 X-Google-Sender-Auth: pA62k5IsyGHW4cFPAK8zZdCi5a4 Message-ID: Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... From: Adrian Chadd To: Mark Murray Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 21:57:05 -0000 Hi, I'm having a problem with this on MIPS router boards now: db> bt 277 Tracing pid 277 tid 100034 td 0x80d7b9c0 cpu_switch+90 (?,?,?,?) ra ca90db6800000000 sp 0 sz 0 sched_switch+224 (?,?,?,?) ra ca90db6800000028 sp 0 sz 0 mi_switch+27c (?,?,?,?) ra ca90db9000000020 sp 0 sz 0 80176358+1a0 (?,?,?,?) ra ca90dbb000000028 sp 0 sz 0 801765dc+2d0 (?,?,?,?) ra ca90dbd800000030 sp 0 sz 0 sleepq_timedwait_sig+18 (?,?,?,?) ra ca90dc0800000020 sp 0 sz 0 _sleep+3b8 (?,?,?,803199e0) ra ca90dc2800000068 sp 0 sz 0 random_adaptor_read+114 (?,?,?,?) ra ca90dc9000000038 sp 0 sz 0 800b1898+c0 (?,?,?,?) ra ca90dcc800000048 sp 0 sz 0 80187450+6c (?,?,?,?) ra ca90dd1000000028 sp 0 sz 0 kern_readv+8c (?,?,?,?) ra ca90dd3800000050 sp 0 sz 0 sys_read+48 (?,?,?,?) ra ca90dd8800000040 sp 0 sz 0 trap+7f0 (?,?,?,?) ra ca90ddc8000000b8 sp 0 sz 0 MipsUserGenException+10c (?,?,?,408ed960) ra ca90de8000000000 sp 0 sz 0 ... I've included "random" into the kernel rather than as a module now. This -looks- like it's not getting enough entropy now? -adrian On 30 October 2014 14:21, Mark Murray wrote: > Author: markm > Date: Thu Oct 30 21:21:53 2014 > New Revision: 273872 > URL: https://svnweb.freebsd.org/changeset/base/273872 > > Log: > This is the much-discussed major upgrade to the random(4) device, known= to you all as /dev/random. > > This code has had an extensive rewrite and a good series of reviews, bo= th by the author and other parties. This means a lot of code has been simpl= ified. Pluggable structures for high-rate entropy generators are available,= and it is most definitely not the case that /dev/random can be driven by o= nly a hardware souce any more. This has been designed out of the device. Ha= rdware sources are stirred into the CSPRNG (Yarrow, Fortuna) like any other= entropy source. Pluggable modules may be written by third parties for addi= tional sources. > > The harvesting structures and consequently the locking have been simpli= fied. Entropy harvesting is done in a more general way (the documentation f= or this will follow). There is some GREAT entropy to be had in the UMA allo= cator, but it is disabled for now as messing with that is likely to annoy m= any people. > > The venerable (but effective) Yarrow algorithm, which is no longer supp= orted by its authors now has an alternative, Fortuna. For now, Yarrow is re= tained as the default algorithm, but this may be changed using a kernel opt= ion. It is intended to make Fortuna the default algorithm for 11.0. Interes= ted parties are encouraged to read ISBN 978-0-470-47424-2 "Cryptography Eng= ineering" By Ferguson, Schneier and Kohno for Fortuna's gory details. Heck,= read it anyway. > > Many thanks to Arthur Mesh who did early grunt work, and who got caught= in the crossfire rather more than he deserved to. > > My thanks also to folks who helped me thresh this out on whiteboards an= d in the odd "Hallway track", or otherwise. > > My Nomex pants are on. Let the feedback commence! > > Reviewed by: trasz,des(partial),imp(partial?),rwatson(partial?) > Approved by: so(des) > > Added: > head/sys/dev/random/build.sh (contents, props changed) > head/sys/dev/random/fortuna.c (contents, props changed) > head/sys/dev/random/fortuna.h (contents, props changed) > head/sys/dev/random/uint128.h (contents, props changed) > head/sys/dev/random/unit_test.c (contents, props changed) > head/sys/dev/random/unit_test.h (contents, props changed) > head/sys/modules/padlock_rng/ > head/sys/modules/padlock_rng/Makefile (contents, props changed) > head/sys/modules/rdrand_rng/ > head/sys/modules/rdrand_rng/Makefile (contents, props changed) > Deleted: > head/etc/rc.d/initrandom > head/sys/dev/random/harvest.c > head/sys/dev/random/rwfile.c > head/sys/dev/random/rwfile.h > Modified: > head/etc/defaults/rc.conf > head/etc/rc.d/Makefile > head/etc/rc.d/geli > head/etc/rc.d/postrandom > head/etc/rc.d/random > head/libexec/save-entropy/save-entropy.sh > head/share/examples/kld/random_adaptor/random_adaptor_example.c > head/sys/conf/NOTES > head/sys/conf/files > head/sys/conf/options > head/sys/dev/glxsb/glxsb.c > head/sys/dev/random/dummy_rng.c > head/sys/dev/random/hash.c > head/sys/dev/random/hash.h > head/sys/dev/random/ivy.c > head/sys/dev/random/live_entropy_sources.c > head/sys/dev/random/live_entropy_sources.h > head/sys/dev/random/nehemiah.c > head/sys/dev/random/random_adaptors.c > head/sys/dev/random/random_adaptors.h > head/sys/dev/random/random_harvestq.c > head/sys/dev/random/random_harvestq.h > head/sys/dev/random/randomdev.c > head/sys/dev/random/randomdev.h > head/sys/dev/random/randomdev_soft.c > head/sys/dev/random/randomdev_soft.h > head/sys/dev/random/yarrow.c > head/sys/dev/random/yarrow.h > head/sys/kern/init_main.c > head/sys/kern/kern_intr.c > head/sys/kern/subr_bus.c > head/sys/modules/Makefile > head/sys/modules/random/Makefile > head/sys/net/if_ethersubr.c > head/sys/net/if_tun.c > head/sys/netgraph/ng_iface.c > head/sys/sys/random.h > head/sys/vm/uma_core.c > > Modified: head/etc/defaults/rc.conf > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/etc/defaults/rc.conf Thu Oct 30 17:58:57 2014 (r273871) > +++ head/etc/defaults/rc.conf Thu Oct 30 21:21:53 2014 (r273872) > @@ -645,7 +645,7 @@ update_motd=3D"YES" # update version info > entropy_file=3D"/entropy" # Set to NO to disable caching entropy = through reboots. > # /var/db/entropy-file is preferred if / is not a= vail. > entropy_dir=3D"/var/db/entropy" # Set to NO to disable caching entropy v= ia cron. > -entropy_save_sz=3D"2048" # Size of the entropy cache files. > +entropy_save_sz=3D"4096" # Size of the entropy cache files. > entropy_save_num=3D"8" # Number of entropy cache files to save. > harvest_interrupt=3D"YES" # Entropy device harvests interrupt ran= domness > harvest_ethernet=3D"YES" # Entropy device harvests ethernet randomness > > Modified: head/etc/rc.d/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/etc/rc.d/Makefile Thu Oct 30 17:58:57 2014 (r273871) > +++ head/etc/rc.d/Makefile Thu Oct 30 21:21:53 2014 (r273872) > @@ -57,7 +57,6 @@ FILES=3D DAEMON \ > hostid_save \ > hostname \ > inetd \ > - initrandom \ > ip6addrctl \ > ipfilter \ > ipfs \ > > Modified: head/etc/rc.d/geli > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/etc/rc.d/geli Thu Oct 30 17:58:57 2014 (r273871) > +++ head/etc/rc.d/geli Thu Oct 30 21:21:53 2014 (r273872) > @@ -28,7 +28,7 @@ > # > > # PROVIDE: disks > -# REQUIRE: initrandom > +# REQUIRE: random > # KEYWORD: nojail > > . /etc/rc.subr > > Modified: head/etc/rc.d/postrandom > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/etc/rc.d/postrandom Thu Oct 30 17:58:57 2014 (r273871) > +++ head/etc/rc.d/postrandom Thu Oct 30 21:21:53 2014 (r273872) > @@ -4,7 +4,7 @@ > # > > # PROVIDE: postrandom > -# REQUIRE: initrandom random FILESYSTEMS > +# REQUIRE: random FILESYSTEMS > # BEFORE: LOGIN > # KEYWORD: nojail > > > Modified: head/etc/rc.d/random > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/etc/rc.d/random Thu Oct 30 17:58:57 2014 (r273871) > +++ head/etc/rc.d/random Thu Oct 30 21:21:53 2014 (r273872) > @@ -4,7 +4,7 @@ > # > > # PROVIDE: random > -# REQUIRE: initrandom FILESYSTEMS > +# REQUIRE: FILESYSTEMS > # BEFORE: netif > # KEYWORD: nojail shutdown > > > Modified: head/libexec/save-entropy/save-entropy.sh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/libexec/save-entropy/save-entropy.sh Thu Oct 30 17:58:57 2014 = (r273871) > +++ head/libexec/save-entropy/save-entropy.sh Thu Oct 30 21:21:53 2014 = (r273872) > @@ -53,7 +53,7 @@ case ${entropy_dir} in > ;; > esac > > -entropy_save_sz=3D${entropy_save_sz:-2048} > +entropy_save_sz=3D${entropy_save_sz:-4096} > entropy_save_num=3D${entropy_save_num:-8} > > if [ ! -d "${entropy_dir}" ]; then > > Modified: head/share/examples/kld/random_adaptor/random_adaptor_example.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/examples/kld/random_adaptor/random_adaptor_example.c T= hu Oct 30 17:58:57 2014 (r273871) > +++ head/share/examples/kld/random_adaptor/random_adaptor_example.c T= hu Oct 30 21:21:53 2014 (r273872) > @@ -35,17 +35,20 @@ __FBSDID("$FreeBSD$"); > #include > #include > > -#include > -#include > #include > +#include > +#include > +#include > > -static int random_example_read(void *, int); > - > -struct random_adaptor random_example =3D { > - .ident =3D "Example RNG", > - .source =3D RANDOM_PURE_BOGUS, /* Make sure this is in > - * sys/random.h and is unique */ > - .read =3D random_example_read, > +static void live_random_example_init(void); > +static void live_random_example_deinit(void); > +static u_int live_random_example_read(void *, u_int); > + > +struct random_adaptor live_random_example =3D { > + .les_ident =3D "Example RNG", > + .les_source =3D RANDOM_PURE_BOGUS, /* Make sure this is in > + * sys/random.h and is unique */ > + .les_read =3D live_random_example_read, > }; > > /* > @@ -58,8 +61,26 @@ getRandomNumber(void) > return 4; /* chosen by fair dice roll, guaranteed to be random = */ > } > > -static int > -random_example_read(void *buf, int c) > +static void > +live_random_example_init(void) > +{ > + > + /* Do initialisation stuff here */ > +} > + > +static void > +live_random_example_deinit(void) > +{ > + > + /* Do de-initialisation stuff here */ > +} > + > +/* get bytes of random stuff into . You may presume > + * that is a multiple of 2^n, with n>=3D3. A typical value > + * is c=3D16. > + */ > +static u_int > +live_random_example_read(void *buf, u_int c) > { > uint8_t *b; > int count; > @@ -69,22 +90,23 @@ random_example_read(void *buf, int c) > for (count =3D 0; count < c; count++) > b[count] =3D getRandomNumber(); > > - printf("returning %d bytes of pure randomness\n", c); > + /* printf("returning %d bytes of pure randomness\n", c); */ > return (c); > } > > +/* ARGSUSED */ > static int > -random_example_modevent(module_t mod, int type, void *unused) > +live_random_example_modevent(module_t mod __unused, int type, void *unus= ed __unused) > { > int error =3D 0; > > switch (type) { > case MOD_LOAD: > - live_entropy_source_register(&random_example); > + live_entropy_source_register(&live_random_example); > break; > > case MOD_UNLOAD: > - live_entropy_source_deregister(&random_example); > + live_entropy_source_deregister(&live_random_example); > break; > > case MOD_SHUTDOWN: > @@ -98,4 +120,6 @@ random_example_modevent(module_t mod, in > return (error); > } > > -LIVE_ENTROPY_SRC_MODULE(live_entropy_source_example, random_example_mode= vent, 1); > +DEV_MODULE(live_random_example, live_random_example_modevent, NULL); > +MODULE_VERSION(live_random_example, 1); > +MODULE_DEPEND(live_random_example, randomdev, 1, 1, 1); > > Modified: head/sys/conf/NOTES > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/conf/NOTES Thu Oct 30 17:58:57 2014 (r273871) > +++ head/sys/conf/NOTES Thu Oct 30 21:21:53 2014 (r273872) > @@ -2993,10 +2993,10 @@ options BROOKTREE_ALLOC_PAGES=3D(217*4+1) > options MAXFILES=3D999 > > # Random number generator > -options RANDOM_YARROW # Yarrow RNG > -##options RANDOM_FORTUNA # Fortuna RNG - not yet implemented > +# Only ONE of the below two may be used; they are mutually exclusive. > +options RANDOM_YARROW # Yarrow CSPRNG (Default) > +#options RANDOM_FORTUNA # Fortuna CSPRNG > options RANDOM_DEBUG # Debugging messages > -options RANDOM_RWFILE # Read and write entropy cache > > # Module to enable execution of application via emulators like QEMU > options IMAGACT_BINMISC > > Modified: head/sys/conf/files > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/conf/files Thu Oct 30 17:58:57 2014 (r273871) > +++ head/sys/conf/files Thu Oct 30 21:21:53 2014 (r273872) > @@ -2132,16 +2132,15 @@ rt2860.fw optional rt2860fw= | ralfw \ > compile-with "${NORMAL_FW}" \ > no-obj no-implicit-rule \ > clean "rt2860.fw" > -dev/random/harvest.c standard > -dev/random/dummy_rng.c standard > +dev/random/randomdev.c standard > dev/random/random_adaptors.c standard > -dev/random/live_entropy_sources.c optional random > -dev/random/random_harvestq.c optional random > -dev/random/randomdev.c optional random > +dev/random/dummy_rng.c standard > +dev/random/live_entropy_sources.c standard > +dev/random/random_harvestq.c standard > dev/random/randomdev_soft.c optional random > dev/random/yarrow.c optional random > +dev/random/fortuna.c optional random > dev/random/hash.c optional random > -dev/random/rwfile.c optional random > dev/rc/rc.c optional rc > dev/re/if_re.c optional re > dev/rl/if_rl.c optional rl pci > > Modified: head/sys/conf/options > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/conf/options Thu Oct 30 17:58:57 2014 (r273871) > +++ head/sys/conf/options Thu Oct 30 21:21:53 2014 (r273872) > @@ -930,4 +930,3 @@ RCTL opt_global.h > RANDOM_YARROW opt_random.h > RANDOM_FORTUNA opt_random.h > RANDOM_DEBUG opt_random.h > -RANDOM_RWFILE opt_random.h > > Modified: head/sys/dev/glxsb/glxsb.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/glxsb/glxsb.c Thu Oct 30 17:58:57 2014 (r273871) > +++ head/sys/dev/glxsb/glxsb.c Thu Oct 30 21:21:53 2014 (r273872) > @@ -476,7 +476,7 @@ glxsb_rnd(void *v) > if (status & SB_RNS_TRNG_VALID) { > value =3D bus_read_4(sc->sc_sr, SB_RANDOM_NUM); > /* feed with one uint32 */ > - random_harvest(&value, 4, 32/2, RANDOM_PURE_GLXSB); > + random_harvest(&value, sizeof(value), 32/2, RANDOM_PURE_G= LXSB); > } > > callout_reset(&sc->sc_rngco, sc->sc_rnghz, glxsb_rnd, sc); > > Added: head/sys/dev/random/build.sh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/random/build.sh Thu Oct 30 21:21:53 2014 (= r273872) > @@ -0,0 +1,24 @@ > +# $FreeBSD$ > +# > +# Basic script to build crude unit tests. > +# > +cc -g -O0 -pthread -DRANDOM_DEBUG -DRANDOM_YARROW \ > + -I../.. -lstdthreads -Wall \ > + unit_test.c \ > + yarrow.c \ > + hash.c \ > + ../../crypto/rijndael/rijndael-api-fst.c \ > + ../../crypto/rijndael/rijndael-alg-fst.c \ > + ../../crypto/sha2/sha2.c \ > + ../../crypto/sha2/sha256c.c \ > + -o yunit_test > +cc -g -O0 -pthread -DRANDOM_DEBUG -DRANDOM_FORTUNA \ > + -I../.. -lstdthreads -Wall \ > + unit_test.c \ > + fortuna.c \ > + hash.c \ > + ../../crypto/rijndael/rijndael-api-fst.c \ > + ../../crypto/rijndael/rijndael-alg-fst.c \ > + ../../crypto/sha2/sha2.c \ > + ../../crypto/sha2/sha256c.c \ > + -o funit_test > > Modified: head/sys/dev/random/dummy_rng.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/random/dummy_rng.c Thu Oct 30 17:58:57 2014 (= r273871) > +++ head/sys/dev/random/dummy_rng.c Thu Oct 30 21:21:53 2014 (= r273872) > @@ -1,5 +1,6 @@ > /*- > * Copyright (c) 2013 Arthur Mesh > + * Copyright (c) 2013 Mark R V Murray > * All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > @@ -27,98 +28,92 @@ > #include > __FBSDID("$FreeBSD$"); > > +#include "opt_random.h" > + > #include > +#include > #include > #include > +#include > #include > -#include > #include > -#include > +#include > #include > -#include > > -#include > #include > - > -static struct mtx dummy_random_mtx; > - > -/* Used to fake out unused random calls in random_adaptor */ > -static void > -random_null_func(void) > -{ > -} > +#include > > static int > -dummy_random_poll(int events __unused, struct thread *td __unused) > +dummy_random_zero(void) > { > > return (0); > } > > -static int > -dummy_random_block(int flag) > +static void > +dummy_random(void) > { > - int error =3D 0; > - > - mtx_lock(&dummy_random_mtx); > - > - /* Blocking logic */ > - while (!error) { > - if (flag & O_NONBLOCK) > - error =3D EWOULDBLOCK; > - else { > - printf("random: dummy device blocking on read.\n"= ); > - error =3D msleep(&dummy_random_block, > - &dummy_random_mtx, > - PUSER | PCATCH, "block", 0); > - } > - } > - mtx_unlock(&dummy_random_mtx); > - > - return (error); > } > > +/* ARGSUSED */ > static void > dummy_random_init(void) > { > > - mtx_init(&dummy_random_mtx, "sleep mtx for dummy_random", > - NULL, MTX_DEF); > -} > - > -static void > -dummy_random_deinit(void) > -{ > +#ifdef RANDOM_DEBUG > + printf("random: %s\n", __func__); > +#endif > > - mtx_destroy(&dummy_random_mtx); > + randomdev_init_reader(dummy_random_read_phony); > } > > -struct random_adaptor dummy_random =3D { > - .ident =3D "Dummy entropy device that always blocks", > - .init =3D dummy_random_init, > - .deinit =3D dummy_random_deinit, > - .block =3D dummy_random_block, > - .poll =3D dummy_random_poll, > - .read =3D (random_read_func_t *)random_null_func, > - .reseed =3D (random_reseed_func_t *)random_null_func, > - .seeded =3D 0, /* This device can never be seeded */ > - .priority =3D 1, /* Bottom priority, so goes to last position */ > -}; > - > -static int > -dummy_random_modevent(module_t mod __unused, int type, void *unused __un= used) > +/* This is used only by the internal read_random(9) call, and then only > + * if no entropy processor is loaded. > + * > + * Make a token effort to provide _some_ kind of output. No warranty of > + * the quality of this output is made, mainly because its lousy. > + * > + * This is only used by the internal read_random(9) call when no other > + * adaptor is active. > + * > + * It has external scope due to the way things work in > + * randomdev_[de]init_reader() that the rest of the world doesn't need t= o > + * know about. > + * > + * Caveat Emptor. > + */ > +u_int > +dummy_random_read_phony(uint8_t *buf, u_int count) > { > + /* If no entropy device is loaded, don't spam the console with wa= rnings */ > + static int warned =3D 0; > + u_long randval; > + size_t size, i; > + > + if (!warned) { > + log(LOG_WARNING, "random device not loaded/active; using = insecure pseudo-random number generator\n"); > + warned =3D 1; > + } > > - switch (type) { > - case MOD_LOAD: > - random_adaptor_register("dummy", &dummy_random); > - EVENTHANDLER_INVOKE(random_adaptor_attach, > - &dummy_random); > + /* srandom() is called in kern/init_main.c:proc0_post() */ > > - return (0); > + /* Fill buf[] with random(9) output */ > + for (i =3D 0; i < count; i +=3D sizeof(randval)) { > + randval =3D random(); > + size =3D MIN(count - i, sizeof(randval)); > + memcpy(buf + i, &randval, (size_t)size); > } > > - return (EINVAL); > + return (count); > } > > -RANDOM_ADAPTOR_MODULE(dummy, dummy_random_modevent, 1); > +struct random_adaptor randomdev_dummy =3D { > + .ra_ident =3D "Dummy", > + .ra_priority =3D 1, /* Bottom priority, so goes to last position = */ > + .ra_reseed =3D dummy_random, > + .ra_seeded =3D (random_adaptor_seeded_func_t *)dummy_random_zero, > + .ra_read =3D (random_adaptor_read_func_t *)dummy_random_zero, > + .ra_write =3D (random_adaptor_write_func_t *)dummy_random_zero, > + .ra_init =3D dummy_random_init, > + .ra_deinit =3D dummy_random, > +}; > > Added: head/sys/dev/random/fortuna.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/random/fortuna.c Thu Oct 30 21:21:53 2014 (= r273872) > @@ -0,0 +1,433 @@ > +/*- > + * Copyright (c) 2013-2014 Mark R V Murray > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer > + * in this position and unchanged. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in th= e > + * documentation and/or other materials provided with the distributio= n. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR > + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRAN= TIES > + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIME= D. > + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, > + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, = BUT > + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF = USE, > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE= OF > + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + * > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#ifdef _KERNEL > +#include "opt_random.h" > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > + > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#else /* !_KERNEL */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "unit_test.h" > + > +#include > +#include > + > +#include > +#include > +#include > +#endif /* _KERNEL */ > + > +#if !defined(RANDOM_YARROW) && !defined(RANDOM_FORTUNA) > +#define RANDOM_YARROW > +#elif defined(RANDOM_YARROW) && defined(RANDOM_FORTUNA) > +#error "Must define either RANDOM_YARROW or RANDOM_FORTUNA" > +#endif > + > +#if defined(RANDOM_FORTUNA) > + > +#define NPOOLS 32 > +#define MINPOOLSIZE 64 > +#define DEFPOOLSIZE 256 > +#define MAXPOOLSIZE 65536 > + > +/* This algorithm (and code) presumes that KEYSIZE is twice as large as = BLOCKSIZE */ > +CTASSERT(BLOCKSIZE =3D=3D sizeof(uint128_t)); > +CTASSERT(KEYSIZE =3D=3D 2*BLOCKSIZE); > + > +/* This is the beastie that needs protecting. It contains all of the > + * state that we are excited about. > + * Exactly one is instantiated. > + */ > +static struct fortuna_state { > + /* P_i */ > + struct pool { > + u_int length; > + struct randomdev_hash hash; > + } pool[NPOOLS]; > + > + /* ReseedCnt */ > + u_int reseedcount; > + > + /* C - 128 bits */ > + union { > + uint8_t byte[BLOCKSIZE]; > + uint128_t whole; > + } counter; > + > + /* K */ > + struct randomdev_key key; > + > + /* Extras */ > + u_int minpoolsize; > + > + /* Extras for the OS */ > + > +#ifdef _KERNEL > + /* For use when 'pacing' the reseeds */ > + sbintime_t lasttime; > +#endif > +} fortuna_state; > + > +/* The random_reseed_mtx mutex protects seeding and polling/blocking. *= / > +static mtx_t random_reseed_mtx; > + > +static struct fortuna_start_cache { > + uint8_t junk[PAGE_SIZE]; > + size_t length; > + struct randomdev_hash hash; > +} fortuna_start_cache; > + > +#ifdef _KERNEL > +static struct sysctl_ctx_list random_clist; > +RANDOM_CHECK_UINT(minpoolsize, MINPOOLSIZE, MAXPOOLSIZE); > +#endif > + > +void > +random_fortuna_init_alg(void) > +{ > + int i; > +#ifdef _KERNEL > + struct sysctl_oid *random_fortuna_o; > +#endif > + > + memset(fortuna_start_cache.junk, 0, sizeof(fortuna_start_cache.ju= nk)); > + fortuna_start_cache.length =3D 0U; > + randomdev_hash_init(&fortuna_start_cache.hash); > + > + /* Set up a lock for the reseed process */ > +#ifdef _KERNEL > + mtx_init(&random_reseed_mtx, "reseed mutex", NULL, MTX_DEF); > +#else /* !_KERNEL */ > + mtx_init(&random_reseed_mtx, mtx_plain); > +#endif /* _KERNEL */ > + > +#ifdef _KERNEL > + /* Fortuna parameters. Do not adjust these unless you have > + * have a very good clue about what they do! > + */ > + random_fortuna_o =3D SYSCTL_ADD_NODE(&random_clist, > + SYSCTL_STATIC_CHILDREN(_kern_random), > + OID_AUTO, "fortuna", CTLFLAG_RW, 0, > + "Fortuna Parameters"); > + > + SYSCTL_ADD_PROC(&random_clist, > + SYSCTL_CHILDREN(random_fortuna_o), OID_AUTO, > + "minpoolsize", CTLTYPE_UINT|CTLFLAG_RW, > + &fortuna_state.minpoolsize, DEFPOOLSIZE, > + random_check_uint_minpoolsize, "IU", > + "Minimum pool size necessary to cause a reseed automatica= lly"); > + > + fortuna_state.lasttime =3D 0U; > +#endif > + > + fortuna_state.minpoolsize =3D DEFPOOLSIZE; > + > + /* F&S - InitializePRNG() */ > + > + /* F&S - P_i =3D \epsilon */ > + for (i =3D 0; i < NPOOLS; i++) { > + randomdev_hash_init(&fortuna_state.pool[i].hash); > + fortuna_state.pool[i].length =3D 0U; > + } > + > + /* F&S - ReseedCNT =3D 0 */ > + fortuna_state.reseedcount =3D 0U; > + > + /* F&S - InitializeGenerator() */ > + > + /* F&S - C =3D 0 */ > + uint128_clear(&fortuna_state.counter.whole); > + > + /* F&S - K =3D 0 */ > + memset(&fortuna_state.key, 0, sizeof(fortuna_state.key)); > +} > + > +void > +random_fortuna_deinit_alg(void) > +{ > + > + mtx_destroy(&random_reseed_mtx); > + memset(&fortuna_state, 0, sizeof(fortuna_state)); > +} > + > +/* F&S - AddRandomEvent() */ > +/* Process a single stochastic event off the harvest queue */ > +void > +random_fortuna_process_event(struct harvest_event *event) > +{ > + u_int pl; > + > + /* We must be locked for all this as plenty of state gets messed = with */ > + mtx_lock(&random_reseed_mtx); > + > + /* Accumulate the event into the appropriate pool > + * where each event carries the destination information > + */ > + /* F&S - P_i =3D P_i| */ > + /* The hash_init and hash_finish are done in random_fortuna_read(= ) below */ > + pl =3D event->he_destination % NPOOLS; > + randomdev_hash_iterate(&fortuna_state.pool[pl].hash, event, sizeo= f(*event)); > + /* No point in counting above the outside maximum */ > + fortuna_state.pool[pl].length +=3D event->he_size; > + fortuna_state.pool[pl].length =3D MIN(fortuna_state.pool[pl].leng= th, MAXPOOLSIZE); > + > + /* Done with state-messing */ > + mtx_unlock(&random_reseed_mtx); > +} > + > +/* F&S - Reseed() */ > +/* Reseed Mutex is held */ > +static void > +reseed(uint8_t *junk, u_int length) > +{ > + struct randomdev_hash context; > + uint8_t hash[KEYSIZE], temp[KEYSIZE]; > + > + KASSERT(fortuna_state.minpoolsize > 0, ("random: Fortuna threshol= d =3D 0")); > +#ifdef _KERNEL > + mtx_assert(&random_reseed_mtx, MA_OWNED); > +#endif > + > + /* F&S - temp =3D H(K|s) */ > + randomdev_hash_init(&context); > + randomdev_hash_iterate(&context, &fortuna_state.key, sizeof(fortu= na_state.key)); > + randomdev_hash_iterate(&context, junk, length); > + randomdev_hash_finish(&context, temp); > + > + /* F&S - hash =3D H(temp) */ > + randomdev_hash_init(&context); > + randomdev_hash_iterate(&context, temp, KEYSIZE); > + randomdev_hash_finish(&context, hash); > + > + /* F&S - K =3D hash */ > + randomdev_encrypt_init(&fortuna_state.key, temp); > + memset(temp, 0, sizeof(temp)); > + memset(hash, 0, sizeof(hash)); > + > + /* Unblock the device if it was blocked due to being unseeded */ > + if (uint128_is_zero(fortuna_state.counter.whole)) > + random_adaptor_unblock(); > + /* F&S - C =3D C + 1 */ > + uint128_increment(&fortuna_state.counter.whole); > +} > + > +/* F&S - GenerateBlocks() */ > +/* Reseed Mutex is held, and buf points to a whole number of blocks. */ > +static __inline void > +random_fortuna_genblocks(uint8_t *buf, u_int blockcount) > +{ > + u_int i; > + > + for (i =3D 0u; i < blockcount; i++) { > + /* F&S - r =3D r|E(K,C) */ > + randomdev_encrypt(&fortuna_state.key, fortuna_state.count= er.byte, buf, BLOCKSIZE); > + buf +=3D BLOCKSIZE; > + > + /* F&S - C =3D C + 1 */ > + uint128_increment(&fortuna_state.counter.whole); > + } > +} > + > +/* F&S - PseudoRandomData() */ > +/* Reseed Mutex is held, and buf points to a whole number of blocks. */ > +static __inline void > +random_fortuna_genrandom(uint8_t *buf, u_int bytecount) > +{ > + static uint8_t temp[BLOCKSIZE*(KEYSIZE/BLOCKSIZE)]; > + u_int blockcount; > + > + /* F&S - assert(n < 2^20) */ > + KASSERT((bytecount <=3D (1 << 20)), ("invalid single read request= to fortuna of %d bytes", bytecount)); > + > + /* F&S - r =3D first-n-bytes(GenerateBlocks(ceil(n/16))) */ > + blockcount =3D (bytecount + BLOCKSIZE - 1)/BLOCKSIZE; > + random_fortuna_genblocks(buf, blockcount); > + > + /* F&S - K =3D GenerateBlocks(2) */ > + random_fortuna_genblocks(temp, KEYSIZE/BLOCKSIZE); > + randomdev_encrypt_init(&fortuna_state.key, temp); > + memset(temp, 0, sizeof(temp)); > +} > + > +/* F&S - RandomData() */ > +/* Used to return processed entropy from the PRNG */ > +/* The argument buf points to a whole number of blocks. */ > +void > +random_fortuna_read(uint8_t *buf, u_int bytecount) > +{ > +#ifdef _KERNEL > + sbintime_t thistime; > +#endif > + struct randomdev_hash context; > + uint8_t s[NPOOLS*KEYSIZE], temp[KEYSIZE]; > + int i; > + u_int seedlength; > + > + /* We must be locked for all this as plenty of state gets messed = with */ > + mtx_lock(&random_reseed_mtx); > + > + /* if buf =3D=3D NULL and bytecount =3D=3D 0 then this is the pre= -read. */ > + /* if buf =3D=3D NULL and bytecount !=3D 0 then this is the post-= read; ignore. */ > + if (buf =3D=3D NULL) { > + if (bytecount =3D=3D 0) { > + if (fortuna_state.pool[0].length >=3D fortuna_sta= te.minpoolsize > +#ifdef _KERNEL > + /* F&S - Use 'getsbinuptime()' to prevent reseed-= spamming. */ > + && ((thistime =3D getsbinuptime()) - fortuna_stat= e.lasttime > hz/10) > +#endif > + ) { > +#ifdef _KERNEL > + fortuna_state.lasttime =3D thistime; > +#endif > + > + seedlength =3D 0U; > + /* F&S - ReseedCNT =3D ReseedCNT + 1 */ > + fortuna_state.reseedcount++; > + /* s =3D \epsilon by default */ > + for (i =3D 0; i < NPOOLS; i++) { > + /* F&S - if Divides(ReseedCnt, 2^= i) ... */ > + if ((fortuna_state.reseedcount % = (1 << i)) =3D=3D 0U) { > + seedlength +=3D KEYSIZE; > + /* F&S - temp =3D (P_i) *= / > + randomdev_hash_finish(&fo= rtuna_state.pool[i].hash, temp); > + /* F&S - P_i =3D \epsilon= */ > + randomdev_hash_init(&fort= una_state.pool[i].hash); > + fortuna_state.pool[i].len= gth =3D 0U; > + /* F&S - s =3D s|H(temp) = */ > + randomdev_hash_init(&cont= ext); > + randomdev_hash_iterate(&c= ontext, temp, KEYSIZE); > + randomdev_hash_finish(&co= ntext, s + i*KEYSIZE); > + } > + else > + break; > + } > +#ifdef RANDOM_DEBUG > + printf("random: active reseed: reseedcoun= t [%d] ", fortuna_state.reseedcount); > + for (i =3D 0; i < NPOOLS; i++) > + printf(" %d", fortuna_state.pool[= i].length); > + printf("\n"); > +#endif > + /* F&S */ > + reseed(s, seedlength); > + > + /* Clean up */ > + memset(s, 0, seedlength); > + seedlength =3D 0U; > + memset(temp, 0, sizeof(temp)); > + memset(&context, 0, sizeof(context)); > + } > + } > + } > + /* if buf !=3D NULL do a regular read. */ > + else > + random_fortuna_genrandom(buf, bytecount); > + > + mtx_unlock(&random_reseed_mtx); > +} > + > +/* Internal function to hand external entropy to the PRNG */ > +void > +random_fortuna_write(uint8_t *buf, u_int count) > +{ > + uint8_t temp[KEYSIZE]; > + int i; > + uintmax_t timestamp; > + > + timestamp =3D get_cyclecount(); > + randomdev_hash_iterate(&fortuna_start_cache.hash, ×tamp, siz= eof(timestamp)); > + randomdev_hash_iterate(&fortuna_start_cache.hash, buf, count); > + timestamp =3D get_cyclecount(); > + randomdev_hash_iterate(&fortuna_start_cache.hash, ×tamp, siz= eof(timestamp)); > + randomdev_hash_finish(&fortuna_start_cache.hash, temp); > + for (i =3D 0; i < KEYSIZE; i++) > + fortuna_start_cache.junk[(fortuna_start_cache.length + i)= %PAGE_SIZE] ^=3D temp[i]; > + fortuna_start_cache.length +=3D KEYSIZE; > + > +#ifdef RANDOM_DEBUG > + printf("random: %s - ", __func__); > + for (i =3D 0; i < KEYSIZE; i++) > + printf("%02X", temp[i]); > + printf("\n"); > +#endif > + > + memset(temp, 0, KEYSIZE); > + > + /* We must be locked for all this as plenty of state gets messed = with */ > + mtx_lock(&random_reseed_mtx); > + > + randomdev_hash_init(&fortuna_start_cache.hash); > + > + reseed(fortuna_start_cache.junk, MIN(PAGE_SIZE, fortuna_start_cac= he.length)); > + memset(fortuna_start_cache.junk, 0, sizeof(fortuna_start_cache.ju= nk)); > + > + mtx_unlock(&random_reseed_mtx); > +} > + > +void > +random_fortuna_reseed(void) > +{ > + > + /* CWOT */ > +} > + > +int > +random_fortuna_seeded(void) > +{ > + > + return (!uint128_is_zero(fortuna_state.counter.whole)); > +} > + > +#endif /* RANDOM_FORTUNA */ > > Added: head/sys/dev/random/fortuna.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/random/fortuna.h Thu Oct 30 21:21:53 2014 (= r273872) > @@ -0,0 +1,44 @@ > +/*- > + * Copyright (c) 2013 Mark R V Murray > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer > + * in this position and unchanged. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in th= e > + * documentation and/or other materials provided with the distributio= n. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR > + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRAN= TIES > + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIME= D. > + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, > + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, = BUT > + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF = USE, > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE= OF > + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > +#ifndef SYS_DEV_RANDOM_FORTUNA_H_INCLUDED > +#define SYS_DEV_RANDOM_FORTUNA_H_INCLUDED > + > +#ifdef _KERNEL > +typedef struct mtx mtx_t; > +#endif > + > +void random_fortuna_init_alg(void); > +void random_fortuna_deinit_alg(void); > +void random_fortuna_read(uint8_t *, u_int); > +void random_fortuna_write(uint8_t *, u_int); > +void random_fortuna_reseed(void); > +int random_fortuna_seeded(void); > +void random_fortuna_process_event(struct harvest_event *event); > + > +#endif > > Modified: head/sys/dev/random/hash.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/random/hash.c Thu Oct 30 17:58:57 2014 (r273871) > +++ head/sys/dev/random/hash.c Thu Oct 30 21:21:53 2014 (r273872) > @@ -28,18 +28,33 @@ > #include > __FBSDID("$FreeBSD$"); > > +#ifdef _KERNEL > #include > #include > +#else /* !_KERNEL */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include "unit_test.h" > +#endif /* _KERNEL */ > > #include > #include > > #include > > +/* This code presumes that KEYSIZE is twice as large as BLOCKSIZE */ > +CTASSERT(KEYSIZE =3D=3D 2*BLOCKSIZE); > + > /* Initialise the hash */ > void > randomdev_hash_init(struct randomdev_hash *context) > { > + > SHA256_Init(&context->sha); > } > > @@ -47,6 +62,7 @@ randomdev_hash_init(struct randomdev_has > void > randomdev_hash_iterate(struct randomdev_hash *context, void *data, size_= t size) > { > + > SHA256_Update(&context->sha, data, size); > } > > @@ -56,6 +72,7 @@ randomdev_hash_iterate(struct randomdev_ > void > randomdev_hash_finish(struct randomdev_hash *context, void *buf) > { > + > SHA256_Final(buf, &context->sha); > } > > @@ -66,6 +83,7 @@ randomdev_hash_finish(struct randomdev_h > void > randomdev_encrypt_init(struct randomdev_key *context, void *data) > { > + > rijndael_cipherInit(&context->cipher, MODE_CBC, NULL); > rijndael_makeKey(&context->key, DIR_ENCRYPT, KEYSIZE*8, data); > } > @@ -75,7 +93,8 @@ randomdev_encrypt_init(struct randomdev_ > * a multiple of BLOCKSIZE. > */ > void > -randomdev_encrypt(struct randomdev_key *context, void *d_in, void *d_out= , unsigned length) > +randomdev_encrypt(struct randomdev_key *context, void *d_in, void *d_out= , u_int length) > { > + > rijndael_blockEncrypt(&context->cipher, &context->key, d_in, leng= th*8, d_out); > } > > Modified: head/sys/dev/random/hash.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/random/hash.h Thu Oct 30 17:58:57 2014 (r273871) > +++ head/sys/dev/random/hash.h Thu Oct 30 21:21:53 2014 (r273872) > @@ -45,6 +45,6 @@ void randomdev_hash_init(struct randomde > void randomdev_hash_iterate(struct randomdev_hash *, void *, size_t); > void randomdev_hash_finish(struct randomdev_hash *, void *); > void randomdev_encrypt_init(struct randomdev_key *, void *); > -void randomdev_encrypt(struct randomdev_key *context, void *, void *, un= signed); > +void randomdev_encrypt(struct randomdev_key *context, void *, void *, u_= int); > > #endif > > Modified: head/sys/dev/random/ivy.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/random/ivy.c Thu Oct 30 17:58:57 2014 (r273871) > +++ head/sys/dev/random/ivy.c Thu Oct 30 21:21:53 2014 (r273872) > @@ -35,11 +35,11 @@ __FBSDID("$FreeBSD$"); > > #include > #include > +#include > #include > #include > #include > #include > -#include > #include > > #include > @@ -47,18 +47,17 @@ __FBSDID("$FreeBSD$"); > > #include > #include > -#include > -#include > #include > +#include > > #define RETRY_COUNT 10 > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 22:00:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4A9012E5; Sat, 1 Nov 2014 22:00:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CA33B4F; Sat, 1 Nov 2014 22:00:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1M0kd6072175; Sat, 1 Nov 2014 22:00:46 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1M0kMc072172; Sat, 1 Nov 2014 22:00:46 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201411012200.sA1M0kMc072172@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 1 Nov 2014 22:00:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273952 - head/contrib/netbsd-tests/lib/libc/hash X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 22:00:47 -0000 Author: ngie Date: Sat Nov 1 22:00:46 2014 New Revision: 273952 URL: https://svnweb.freebsd.org/changeset/base/273952 Log: Port h_hash and t_sha2 to FreeBSD t_sha2 contains dirty copy-paste hacks that need to be fixed with the openssh OpenBSD compat layer Submitted by: pho Modified: head/contrib/netbsd-tests/lib/libc/hash/h_hash.c head/contrib/netbsd-tests/lib/libc/hash/t_sha2.c Modified: head/contrib/netbsd-tests/lib/libc/hash/h_hash.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/hash/h_hash.c Sat Nov 1 21:30:18 2014 (r273951) +++ head/contrib/netbsd-tests/lib/libc/hash/h_hash.c Sat Nov 1 22:00:46 2014 (r273952) @@ -35,8 +35,13 @@ #include #include #include +#ifdef __NetBSD__ #include +#endif +#ifdef __FreeBSD__ +#include +#endif int mflag, rflag, sflag, tflag; @@ -102,17 +107,32 @@ regress(void) MD5Final(out, &ctx); outlen = 16; } else { +#ifdef __FreeBSD__ + SHA_CTX ctx; + + SHA1_Init(&ctx); + SHA1_Update(&ctx, buf, len); +#else SHA1_CTX ctx; SHA1Init(&ctx); SHA1Update(&ctx, buf, len); +#endif while (!last && fgets((char *)buf, sizeof(buf), stdin) != NULL) { len = strlen((char *)buf); CHOMP(buf, len, last); +#ifdef __FreeBSD__ + SHA1_Update(&ctx, buf, len); +#else SHA1Update(&ctx, buf, len); +#endif } +#ifdef __FreeBSD__ + SHA1_Final(out, &ctx); +#else SHA1Final(out, &ctx); +#endif outlen = 20; } hexdump(out, outlen); Modified: head/contrib/netbsd-tests/lib/libc/hash/t_sha2.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/hash/t_sha2.c Sat Nov 1 21:30:18 2014 (r273951) +++ head/contrib/netbsd-tests/lib/libc/hash/t_sha2.c Sat Nov 1 22:00:46 2014 (r273952) @@ -36,9 +36,23 @@ __RCSID("$NetBSD: t_sha2.c,v 1.3 2012/09 #include #include +#ifdef __NetBSD__ #include +#endif #include +#ifdef __FreeBSD__ +#include +typedef SHA512_CTX SHA384_CTX; +/* From /usr/src/crypto/openssh/openbsd-compat/sha2.h */ +#define SHA256_DIGEST_LENGTH 32 +#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) +#define SHA384_DIGEST_LENGTH 48 +#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1) +#define SHA512_DIGEST_LENGTH 64 +#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) +#endif + ATF_TC(t_sha256); ATF_TC(t_sha384); ATF_TC(t_sha512); From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 22:15:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8090D618; Sat, 1 Nov 2014 22:15:45 +0000 (UTC) Received: from mail-qa0-x22f.google.com (mail-qa0-x22f.google.com [IPv6:2607:f8b0:400d:c00::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E9F44CD7; Sat, 1 Nov 2014 22:15:44 +0000 (UTC) Received: by mail-qa0-f47.google.com with SMTP id dc16so6783737qab.6 for ; Sat, 01 Nov 2014 15:15:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type; bh=bJQYtBErg0XgVuA43QffL+t8beInSk7nkScW7xwoUco=; b=UtuQ18W71HQX6890dM4fJnH2uE1AvxUh0e4y6iP4hVa787Sv0mx1jPhD9HF+Vp4pCO FIbYKP8Oc98AkTf5AIIj9s+SF0NI25jKZlDUlMTERtYQiLDORgQPf5g1I+pHf6B5PEYZ r+XFrJJGH/uLtafTenIWTHzeAHYhy/e4cutpGRGkvXVxFsg1/RUHg9egDp/86sDuqGvq ICC++sKFmfWWaJ7J83Qca0rmaHCaaUaRC8z6xWkHjmz81gB8ypDlu9YqFhfo7eHoC7vb hP3Fx0LmaUDWpJs4fHfeyBwXuA1y7qiYO/Em1HH2DKPeyL9+FT0mpNSfAvkziTQIpxLF PUOQ== X-Received: by 10.229.193.5 with SMTP id ds5mr26386987qcb.30.1414880144077; Sat, 01 Nov 2014 15:15:44 -0700 (PDT) Received: from kan ([2601:6:6780:7d0:226:18ff:fe00:232e]) by mx.google.com with ESMTPSA id w8sm13049763qag.2.2014.11.01.15.15.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Nov 2014 15:15:43 -0700 (PDT) Date: Sat, 1 Nov 2014 18:15:36 -0400 From: Alexander Kabaev To: Adrian Chadd Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... Message-ID: <20141101181536.2b6a5911@kan> In-Reply-To: References: <201410302121.s9ULLsEw055630@svn.freebsd.org> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.22; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/Kh.GeyVy052Vm8/aZJ+I8VS"; protocol="application/pgp-signature" Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Mark Murray X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 22:15:45 -0000 --Sig_/Kh.GeyVy052Vm8/aZJ+I8VS Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sat, 1 Nov 2014 14:57:02 -0700 Adrian Chadd wrote: > Hi, >=20 > I'm having a problem with this on MIPS router boards now: >=20 > db> bt 277 > Tracing pid 277 tid 100034 td 0x80d7b9c0 > cpu_switch+90 (?,?,?,?) ra ca90db6800000000 sp 0 sz 0 > sched_switch+224 (?,?,?,?) ra ca90db6800000028 sp 0 sz 0 > mi_switch+27c (?,?,?,?) ra ca90db9000000020 sp 0 sz 0 > 80176358+1a0 (?,?,?,?) ra ca90dbb000000028 sp 0 sz 0 > 801765dc+2d0 (?,?,?,?) ra ca90dbd800000030 sp 0 sz 0 > sleepq_timedwait_sig+18 (?,?,?,?) ra ca90dc0800000020 sp 0 sz 0 > _sleep+3b8 (?,?,?,803199e0) ra ca90dc2800000068 sp 0 sz 0 > random_adaptor_read+114 (?,?,?,?) ra ca90dc9000000038 sp 0 sz 0 > 800b1898+c0 (?,?,?,?) ra ca90dcc800000048 sp 0 sz 0 > 80187450+6c (?,?,?,?) ra ca90dd1000000028 sp 0 sz 0 > kern_readv+8c (?,?,?,?) ra ca90dd3800000050 sp 0 sz 0 > sys_read+48 (?,?,?,?) ra ca90dd8800000040 sp 0 sz 0 > trap+7f0 (?,?,?,?) ra ca90ddc8000000b8 sp 0 sz 0 > MipsUserGenException+10c (?,?,?,408ed960) ra ca90de8000000000 sp 0 sz > 0 >=20 > ... I've included "random" into the kernel rather than as a module > now. >=20 > This -looks- like it's not getting enough entropy now? >=20 >=20 >=20 > -adrian >=20 Me too, on amd64 box. The machine gets hung for several minutes after 'writing entropy file' until random is unblocked. Anecdotally, banging on the keyboard trying to help the entropy gathering along seems to speed the process up. --=20 Alexander Kabaev --Sig_/Kh.GeyVy052Vm8/aZJ+I8VS Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iD8DBQFUVVuNQ6z1jMm+XZYRAkhPAJ4xHpOnjMgjOdcL+FGSnltcBycnAwCeIWvN ttbm5jQe0y/BNPBvwJ6MWU0= =lAAD -----END PGP SIGNATURE----- --Sig_/Kh.GeyVy052Vm8/aZJ+I8VS-- From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 22:29:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 13EEE864; Sat, 1 Nov 2014 22:29:58 +0000 (UTC) Received: from mail-wi0-x22b.google.com (mail-wi0-x22b.google.com [IPv6:2a00:1450:400c:c05::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 35C11DB1; Sat, 1 Nov 2014 22:29:57 +0000 (UTC) Received: by mail-wi0-f171.google.com with SMTP id q5so3804914wiv.10 for ; Sat, 01 Nov 2014 15:29:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=LBAvlIU7HuOKmnAfsIKCtt3fC5YcKlLp9bhOnFBj4WY=; b=igy8PPdIs+//6xTld44Uch5FG+b9MdmuEuirjGJKmuVSFYd9kbUEXInmMrbo7YbqOw hXAK+dM4JAx01mvp26TCA6mVAfKESj+P5nbHy0fqJaf89H+F6m/zc29T6MH8VgpTsYW7 nfvfN9pr+0Fv6W0LgDQocK3hjpb2nzHQUhfbu2aUzKIFqIb3FUOwDx310qU6VqDeB9PQ 0IL2OPqedjs1J+g1lJaXc9etyulH+JnG6Fmefjc7/GakzC+/ydIzlryWUyOxggBfug6E Ol5WsIGUIKhUOIZbMgopVPAeqWoR++CfJSCytJ4hIPHElvGdzKDz+QyiCloDtjoVfFuB 2qQQ== MIME-Version: 1.0 X-Received: by 10.180.83.98 with SMTP id p2mr6151819wiy.20.1414880995553; Sat, 01 Nov 2014 15:29:55 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Sat, 1 Nov 2014 15:29:55 -0700 (PDT) In-Reply-To: <20141101181536.2b6a5911@kan> References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <20141101181536.2b6a5911@kan> Date: Sat, 1 Nov 2014 15:29:55 -0700 X-Google-Sender-Auth: zI-U6BoCAIXWrEWfYp8e9FypQGY Message-ID: Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... From: Adrian Chadd To: Alexander Kabaev Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Mark Murray X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 22:29:58 -0000 Yeah I can't do that for a wireless AP. Oh, and if I hit Ctrl-C, the whole system hangs! :( -adrian On 1 November 2014 15:15, Alexander Kabaev wrote: > On Sat, 1 Nov 2014 14:57:02 -0700 > Adrian Chadd wrote: > >> Hi, >> >> I'm having a problem with this on MIPS router boards now: >> >> db> bt 277 >> Tracing pid 277 tid 100034 td 0x80d7b9c0 >> cpu_switch+90 (?,?,?,?) ra ca90db6800000000 sp 0 sz 0 >> sched_switch+224 (?,?,?,?) ra ca90db6800000028 sp 0 sz 0 >> mi_switch+27c (?,?,?,?) ra ca90db9000000020 sp 0 sz 0 >> 80176358+1a0 (?,?,?,?) ra ca90dbb000000028 sp 0 sz 0 >> 801765dc+2d0 (?,?,?,?) ra ca90dbd800000030 sp 0 sz 0 >> sleepq_timedwait_sig+18 (?,?,?,?) ra ca90dc0800000020 sp 0 sz 0 >> _sleep+3b8 (?,?,?,803199e0) ra ca90dc2800000068 sp 0 sz 0 >> random_adaptor_read+114 (?,?,?,?) ra ca90dc9000000038 sp 0 sz 0 >> 800b1898+c0 (?,?,?,?) ra ca90dcc800000048 sp 0 sz 0 >> 80187450+6c (?,?,?,?) ra ca90dd1000000028 sp 0 sz 0 >> kern_readv+8c (?,?,?,?) ra ca90dd3800000050 sp 0 sz 0 >> sys_read+48 (?,?,?,?) ra ca90dd8800000040 sp 0 sz 0 >> trap+7f0 (?,?,?,?) ra ca90ddc8000000b8 sp 0 sz 0 >> MipsUserGenException+10c (?,?,?,408ed960) ra ca90de8000000000 sp 0 sz >> 0 >> >> ... I've included "random" into the kernel rather than as a module >> now. >> >> This -looks- like it's not getting enough entropy now? >> >> >> >> -adrian >> > > Me too, on amd64 box. The machine gets hung for several minutes after > 'writing entropy file' until random is unblocked. Anecdotally, banging > on the keyboard trying to help the entropy gathering along seems to > speed the process up. > > -- > Alexander Kabaev From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 22:36:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2E8AEAB7; Sat, 1 Nov 2014 22:36:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00D96E89; Sat, 1 Nov 2014 22:36:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA1MafJr089794; Sat, 1 Nov 2014 22:36:41 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA1Mafe2089791; Sat, 1 Nov 2014 22:36:41 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201411012236.sA1Mafe2089791@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 1 Nov 2014 22:36:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273953 - in head/sys: dev/hwpmc kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 22:36:42 -0000 Author: mjg Date: Sat Nov 1 22:36:40 2014 New Revision: 273953 URL: https://svnweb.freebsd.org/changeset/base/273953 Log: Fix up module unload for syscall_module_handler consumers. After r273707 it was registering syscalls as static. This fixes hwpmc module unload. Reported by: markj Modified: head/sys/dev/hwpmc/hwpmc_mod.c head/sys/kern/kern_syscalls.c head/sys/sys/sysent.h Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Sat Nov 1 22:00:46 2014 (r273952) +++ head/sys/dev/hwpmc/hwpmc_mod.c Sat Nov 1 22:36:40 2014 (r273953) @@ -320,7 +320,8 @@ static struct syscall_module_data pmc_sy NULL, &pmc_syscall_num, &pmc_sysent, - { 0, NULL } + { 0, NULL }, + SY_THR_STATIC_KLD, }; static moduledata_t pmc_mod = { Modified: head/sys/kern/kern_syscalls.c ============================================================================== --- head/sys/kern/kern_syscalls.c Sat Nov 1 22:00:46 2014 (r273952) +++ head/sys/kern/kern_syscalls.c Sat Nov 1 22:36:40 2014 (r273953) @@ -160,7 +160,7 @@ syscall_module_handler(struct module *mo switch (what) { case MOD_LOAD: error = syscall_register(data->offset, data->new_sysent, - &data->old_sysent, SY_THR_STATIC_KLD); + &data->old_sysent, data->flags); if (error) { /* Leave a mark so we know to safely unload below. */ data->offset = NULL; Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Sat Nov 1 22:00:46 2014 (r273952) +++ head/sys/sys/sysent.h Sat Nov 1 22:36:40 2014 (r273953) @@ -175,6 +175,7 @@ struct syscall_module_data { int *offset; /* offset into sysent */ struct sysent *new_sysent; /* new sysent */ struct sysent old_sysent; /* old sysent */ + int flags; /* flags for syscall_register */ }; #define MAKE_SYSENT(syscallname) \ From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 22:39:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DAA81C20; Sat, 1 Nov 2014 22:39:21 +0000 (UTC) Received: from gromit.grondar.org (grandfather.grondar.org [IPv6:2a01:348:0:15:5d59:5c20:0:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F413EA2; Sat, 1 Nov 2014 22:39:21 +0000 (UTC) Received: from [2001:470:9174:1:407c:4bb6:6af1:63e2] by gromit.grondar.org with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.84 (FreeBSD)) (envelope-from ) id 1XkhKJ-000FhB-Ly; Sat, 01 Nov 2014 22:39:20 +0000 Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) Content-Type: text/plain; charset=utf-8 From: Mark R V Murray In-Reply-To: <20141101181536.2b6a5911@kan> Date: Sat, 1 Nov 2014 22:39:17 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <20141101181536.2b6a5911@kan> To: Alexander Kabaev X-Mailer: Apple Mail (2.1990.1) X-SA-Score: -1.0 Cc: "svn-src-head@freebsd.org" , Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 22:39:22 -0000 Hi I=E2=80=99m not sure what you are showing me here? How yo you draw the =E2=80=9Cnot enough entropy=E2=80=9D conclusion? The writing happens at shutdown; before you do the shutdown could you = please do a =E2=80=98sysctl kern.random=E2=80=99 and post the result? Do you have anything random-related in your rc.conf? Could you please do a verbose boot on a kernel with =E2=80=9Coptions = RANDOM_DEBUG=E2=80=9D set and send me the dmesg output from a failing = box. M > On 1 Nov 2014, at 22:15, Alexander Kabaev wrote: >=20 > On Sat, 1 Nov 2014 14:57:02 -0700 > Adrian Chadd wrote: >=20 >> Hi, >>=20 >> I'm having a problem with this on MIPS router boards now: >>=20 >> db> bt 277 >> Tracing pid 277 tid 100034 td 0x80d7b9c0 >> cpu_switch+90 (?,?,?,?) ra ca90db6800000000 sp 0 sz 0 >> sched_switch+224 (?,?,?,?) ra ca90db6800000028 sp 0 sz 0 >> mi_switch+27c (?,?,?,?) ra ca90db9000000020 sp 0 sz 0 >> 80176358+1a0 (?,?,?,?) ra ca90dbb000000028 sp 0 sz 0 >> 801765dc+2d0 (?,?,?,?) ra ca90dbd800000030 sp 0 sz 0 >> sleepq_timedwait_sig+18 (?,?,?,?) ra ca90dc0800000020 sp 0 sz 0 >> _sleep+3b8 (?,?,?,803199e0) ra ca90dc2800000068 sp 0 sz 0 >> random_adaptor_read+114 (?,?,?,?) ra ca90dc9000000038 sp 0 sz 0 >> 800b1898+c0 (?,?,?,?) ra ca90dcc800000048 sp 0 sz 0 >> 80187450+6c (?,?,?,?) ra ca90dd1000000028 sp 0 sz 0 >> kern_readv+8c (?,?,?,?) ra ca90dd3800000050 sp 0 sz 0 >> sys_read+48 (?,?,?,?) ra ca90dd8800000040 sp 0 sz 0 >> trap+7f0 (?,?,?,?) ra ca90ddc8000000b8 sp 0 sz 0 >> MipsUserGenException+10c (?,?,?,408ed960) ra ca90de8000000000 sp 0 sz >> 0 >>=20 >> ... I've included "random" into the kernel rather than as a module >> now. >>=20 >> This -looks- like it's not getting enough entropy now? >>=20 >>=20 >>=20 >> -adrian >>=20 >=20 > Me too, on amd64 box. The machine gets hung for several minutes after > 'writing entropy file' until random is unblocked. Anecdotally, banging > on the keyboard trying to help the entropy gathering along seems to > speed the process up. >=20 > --=20 > Alexander Kabaev --=20 Mark R V Murray From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 22:49:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 14833178; Sat, 1 Nov 2014 22:49:49 +0000 (UTC) Received: from mho-01-ewr.mailhop.org (mho-03-ewr.mailhop.org [204.13.248.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4882FD8; Sat, 1 Nov 2014 22:49:48 +0000 (UTC) Received: from [73.34.117.227] (helo=ilsoft.org) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1XkhUQ-00067l-I7; Sat, 01 Nov 2014 22:49:46 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id sA1MnjZj088146; Sat, 1 Nov 2014 16:49:45 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX19pLjWHkJSTZjzpMxaQMHZ0 X-Authentication-Warning: paranoia.hippie.lan: Host revolution.hippie.lan [172.22.42.240] claimed to be [172.22.42.240] Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... From: Ian Lepore To: Mark R V Murray In-Reply-To: <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <20141101181536.2b6a5911@kan> <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> Content-Type: text/plain; charset="windows-1251" Date: Sat, 01 Nov 2014 16:49:45 -0600 Message-ID: <1414882185.17308.221.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by ilsoft.org id sA1MnjZj088146 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Adrian Chadd , "src-committers@freebsd.org" , Alexander Kabaev X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 22:49:49 -0000 On Sat, 2014-11-01 at 22:39 +0000, Mark R V Murray wrote: > Hi >=20 > I=92m not sure what you are showing me here? >=20 > How yo you draw the =93not enough entropy=94 conclusion? >=20 > The writing happens at shutdown; before you do the shutdown could you p= lease do a =91sysctl kern.random=92 and post the result? >=20 I'm not sure where you're getting "at shutdown" from. Everyone reporting these problems has been pretty clear that it's happening at boot time: ... warning: no time-of-day clock registered, system time will not be set acc= urately warning: no time-of-day clock registered, system time will not be set acc= urately Interface ue0 IP-Address 172.22.42.28 Broadcast 172.22.42.255=20 Setting hostuuid: 1d295353-1dd2-11b2-9f30-653cd80a9fc4. Setting hostid: 0x2896f513. No suitable dump device was found. Starting file system checks: mount_nfs: can't update /var/db/mounttab for 172.22.42.240:/rpi Mounting local file systems:. Writing entropy file: And there it hangs, I guess maybe forever. In this case it's an R-Pi running -current that I just sync'd and built fresh from scratch a few minutes ago: FreeBSD 11.0-CURRENT #0 r273952: Sat Nov 1 16:27:00 MDT 2014 -- Ian From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 22:50:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 793452DD; Sat, 1 Nov 2014 22:50:01 +0000 (UTC) Received: from mail-wg0-x236.google.com (mail-wg0-x236.google.com [IPv6:2a00:1450:400c:c00::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 92C55FDA; Sat, 1 Nov 2014 22:50:00 +0000 (UTC) Received: by mail-wg0-f54.google.com with SMTP id n12so3340695wgh.13 for ; Sat, 01 Nov 2014 15:49:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=rvxb6nSe6BUVm/kklI60Zolhou0h+PMMQ5WwsnFhcrY=; b=TqCiF6kqkBtaPx8vOmWONyPBG+SUlPh+4SWWfZjsB1uYe8frDxSyfimtLYHp/lvjle sgrF0mFQTYw6TN7ae1+L7nzpvM1mNFcrmGJ/z427owpYQeQcgvb9qcg9pAOiHOGvMh7J 4gnYM2unbc9TWupv4jwjMQzBwkpM1tbwlxugK1FEr1qBtNeK47014xpziNUPOR2Hc31I IY+k+rHHi50Tt44WprgkkSBYKLYsomJjB5fWFHWR7yb2Hk0JWl+iieMBB4HKUtpswQrZ GJKar12qFnngU7WDzuG4vpUGVkQPqD3+Uy652CgpuPj8wmto10X9l4PN/KEAoZDkxJAG MT6g== MIME-Version: 1.0 X-Received: by 10.194.221.105 with SMTP id qd9mr37686840wjc.51.1414882198888; Sat, 01 Nov 2014 15:49:58 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Sat, 1 Nov 2014 15:49:58 -0700 (PDT) In-Reply-To: <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <20141101181536.2b6a5911@kan> <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> Date: Sat, 1 Nov 2014 15:49:58 -0700 X-Google-Sender-Auth: 8m1S2wUh2f-vsU4178lfHUsU9tQ Message-ID: Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... From: Adrian Chadd To: Mark R V Murray Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Alexander Kabaev X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 22:50:01 -0000 On 1 November 2014 15:39, Mark R V Murray wrote: > Hi > > I=E2=80=99m not sure what you are showing me here? > > How yo you draw the =E2=80=9Cnot enough entropy=E2=80=9D conclusion? This is a kernel backtrace from the hostap process. It's stuck in that particular read, waiting somewhere in random_adaptor_read(). If I hit ctrl-C on this process, the whole kernel hangs. I'll see if I can get some ddb output from that. > The writing happens at shutdown; before you do the shutdown could you ple= ase do a =E2=80=98sysctl kern.random=E2=80=99 and post the result? It won't ever get to that point, as it's hanging at startup. :) > Do you have anything random-related in your rc.conf? Nope. > Could you please do a verbose boot on a kernel with =E2=80=9Coptions RAND= OM_DEBUG=E2=80=9D set and send me the dmesg output from a failing box. Ok, I'll give that a go. Thanks, -adrian From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 22:58:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0EBA04F1; Sat, 1 Nov 2014 22:58:49 +0000 (UTC) Received: from mail-qc0-x232.google.com (mail-qc0-x232.google.com [IPv6:2607:f8b0:400d:c01::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 77EC5142; Sat, 1 Nov 2014 22:58:48 +0000 (UTC) Received: by mail-qc0-f178.google.com with SMTP id b13so8607558qcw.9 for ; Sat, 01 Nov 2014 15:58:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type; bh=yWYGa6jKBQeQEY2b0BaeJBQ4a9yKZhHCxYjErx9GoS0=; b=tgl1KR6BuimS+GnzHOuFrpfO6Kh9cYhdKDDe2yZVS8jTUYoeEz4KZGgslkrOwrIXyl kAY74Na0d6yRcW3LIzflQ/75ge2UU6x/WceYSfQ1M0OZZQ8T9K2IEzAA4ZPJpfV82B2c /WEkNXrJRb0WNxKwqys5sg1JjoGcFbzgbPzBh+K5oEltT2Y0l5IO6HVu50gRnoZ6H3FF qispoIqtXbeNcTGqfZpDQaTNNvEcxVMBjkhFKwk6/sRmD76QK9oL6JBU84dulw/fbpUZ ktSrYmL3ZKDBaR0wijWOoR8mjxLmaiyJc9HHtSD78vTbumf5N20qmwu1iVBKI/R/wpC4 6PeQ== X-Received: by 10.224.120.67 with SMTP id c3mr50872573qar.84.1414882727605; Sat, 01 Nov 2014 15:58:47 -0700 (PDT) Received: from kan ([2601:6:6780:7d0:226:18ff:fe00:232e]) by mx.google.com with ESMTPSA id e8sm13083705qai.33.2014.11.01.15.58.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Nov 2014 15:58:46 -0700 (PDT) Date: Sat, 1 Nov 2014 18:58:40 -0400 From: Alexander Kabaev To: Mark R V Murray Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... Message-ID: <20141101185840.59e24ba8@kan> In-Reply-To: <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <20141101181536.2b6a5911@kan> <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.22; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/PG7gzn/8+1ttDIWRlGWKNpx"; protocol="application/pgp-signature" Cc: "svn-src-head@freebsd.org" , Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 22:58:49 -0000 --Sig_/PG7gzn/8+1ttDIWRlGWKNpx Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: quoted-printable On Sat, 1 Nov 2014 22:39:17 +0000 Mark R V Murray wrote: > Hi >=20 > I'm not sure what you are showing me here? >=20 > How yo you draw the "not enough entropy" conclusion? >=20 > The writing happens at shutdown; before you do the shutdown could you > please do a 'sysctl kern.random' and post the result? >=20 > Do you have anything random-related in your rc.conf? >=20 > Could you please do a verbose boot on a kernel with "options > RANDOM_DEBUG" set and send me the dmesg output from a failing box. >=20 > M >=20 > > On 1 Nov 2014, at 22:15, Alexander Kabaev wrote: > >=20 > > On Sat, 1 Nov 2014 14:57:02 -0700 > > Adrian Chadd wrote: > >=20 > >> Hi, > >>=20 > >> I'm having a problem with this on MIPS router boards now: > >>=20 > >> db> bt 277 > >> Tracing pid 277 tid 100034 td 0x80d7b9c0 > >> cpu_switch+90 (?,?,?,?) ra ca90db6800000000 sp 0 sz 0 > >> sched_switch+224 (?,?,?,?) ra ca90db6800000028 sp 0 sz 0 > >> mi_switch+27c (?,?,?,?) ra ca90db9000000020 sp 0 sz 0 > >> 80176358+1a0 (?,?,?,?) ra ca90dbb000000028 sp 0 sz 0 > >> 801765dc+2d0 (?,?,?,?) ra ca90dbd800000030 sp 0 sz 0 > >> sleepq_timedwait_sig+18 (?,?,?,?) ra ca90dc0800000020 sp 0 sz 0 > >> _sleep+3b8 (?,?,?,803199e0) ra ca90dc2800000068 sp 0 sz 0 > >> random_adaptor_read+114 (?,?,?,?) ra ca90dc9000000038 sp 0 sz 0 > >> 800b1898+c0 (?,?,?,?) ra ca90dcc800000048 sp 0 sz 0 > >> 80187450+6c (?,?,?,?) ra ca90dd1000000028 sp 0 sz 0 > >> kern_readv+8c (?,?,?,?) ra ca90dd3800000050 sp 0 sz 0 > >> sys_read+48 (?,?,?,?) ra ca90dd8800000040 sp 0 sz 0 > >> trap+7f0 (?,?,?,?) ra ca90ddc8000000b8 sp 0 sz 0 > >> MipsUserGenException+10c (?,?,?,408ed960) ra ca90de8000000000 sp 0 > >> sz 0 > >>=20 > >> ... I've included "random" into the kernel rather than as a module > >> now. > >>=20 > >> This -looks- like it's not getting enough entropy now? > >>=20 > >>=20 > >>=20 > >> -adrian > >>=20 > >=20 > > Me too, on amd64 box. The machine gets hung for several minutes > > after 'writing entropy file' until random is unblocked. > > Anecdotally, banging on the keyboard trying to help the entropy > > gathering along seems to speed the process up. > >=20 > > --=20 > > Alexander Kabaev >=20 > --=20 > Mark R V Murray Nothing related to random in my rc.conf % sysctl kern.random kern.random.adaptors: yarrow(90),dummy(1) kern.random.active_adaptor: yarrow kern.random.live_entropy_sources:=20 kern.random.yarrow.gengateinterval: 10 kern.random.yarrow.bins: 10 kern.random.yarrow.fastthresh: 96 kern.random.yarrow.slowthresh: 128 kern.random.yarrow.slowoverthresh: 2 kern.random.harvest.mask: 1023 kern.random.harvest.mask_bin: 1111111111 kern.random.harvest.mask_symbolic: UMA_ALLOC,SWI,INTERRUPT,NET_NG,NET_ETHER,NET_TUN,MOUSE,KEYBOARD,ATTACH,CACH= ED --=20 Alexander Kabaev --Sig_/PG7gzn/8+1ttDIWRlGWKNpx Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iD8DBQFUVWWlQ6z1jMm+XZYRAgU6AKDl/7BmncyOUTcVpj02fyyh3W9W5gCfWi9X iHOOhZX5ONxxqjLrp3BB3eA= =GnCF -----END PGP SIGNATURE----- --Sig_/PG7gzn/8+1ttDIWRlGWKNpx-- From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 23:03:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 242EF6BA; Sat, 1 Nov 2014 23:03:00 +0000 (UTC) Received: from mail-wi0-x22c.google.com (mail-wi0-x22c.google.com [IPv6:2a00:1450:400c:c05::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 37D38200; Sat, 1 Nov 2014 23:02:59 +0000 (UTC) Received: by mail-wi0-f172.google.com with SMTP id bs8so3817638wib.17 for ; Sat, 01 Nov 2014 16:02:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=kBNAe7mFAqWk6LjHlN7/UKSxvPOHGhapzk+pEOEmBM0=; b=cIaLxaM7tXBOMUk8QLxMs64bgrCJR3+IPzkWpUSVS1z9sW78juWjLNxWHSWr0Mz0cX dHqQvB4pFxTIv+5kutzYfSuXvrQY6Qo18B8kuE2uTpaXYwwTp9pmJ6Tb/ZUDmiQKTGex pkaD0NiQkccskJv0aMAqEQrbz+yLFM0NT0LHf7KfVs/fKFJGOt0rzq/Xg4TQGvTMn1od vxog5vCWTyWKW9yid2APVzrflCswVLzF8I4bc2K0f9D0OUm7WVFY5WBBJSaIdbHO4WFg qVpCx8R+ytcuOhZQeH3/63t9frwnKa9f3cEgkwoEkX0SS5mOHrd9sSbgT8i8qXbY8u2f 8EfQ== MIME-Version: 1.0 X-Received: by 10.180.92.169 with SMTP id cn9mr6354588wib.26.1414882977321; Sat, 01 Nov 2014 16:02:57 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Sat, 1 Nov 2014 16:02:57 -0700 (PDT) In-Reply-To: <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <20141101181536.2b6a5911@kan> <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> Date: Sat, 1 Nov 2014 16:02:57 -0700 X-Google-Sender-Auth: aPvGKy4Om7EkkAFLVA8zhDN2hME Message-ID: Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... From: Adrian Chadd To: Mark R V Murray Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Alexander Kabaev X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 23:03:00 -0000 Here's what I have so far: # sysctl kern.random kern.random.adaptors: yarrow(90),dummy(1) kern.random.active_adaptor: yarrow kern.random.live_entropy_sources: kern.random.yarrow.gengateinterval: 10 kern.random.yarrow.bins: 10 kern.random.yarrow.fastthresh: 96 kern.random.yarrow.slowthresh: 128 kern.random.yarrow.slowoverthresh: 2 kern.random.harvest.mask: 1023 kern.random.harvest.mask_bin: 1111111111 kern.random.harvest.mask_symbolic: UMA_ALLOC,SWI,INTERRUPT,NET_NG,NET_ETHER,NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED .. that's after boot, before I run hostapd and it hangs. CPU platform: Atheros AR7161 rev 2 CPU Frequency=680 MHz CPU DDR Frequency=340 MHz CPU AHB Frequency=170 MHz platform frequency: 680 MHz CPU reference clock: 40 MHz CPU MDIO clock: 40 MHz arguments: a0 = 00000007 a1 = a3f77fb0 a2 = a3f78460 a3 = 00000008 Cmd line:argv is invalid Environment: envp is invalid Cache info: picache_stride = 4096 picache_loopcount = 16 pdcache_stride = 4096 pdcache_loopcount = 8 cpu0: MIPS Technologies processor v116.147 MMU: Standard TLB, 16 entries L1 i-cache: 4 ways of 512 sets, 32 bytes per line L1 d-cache: 4 ways of 256 sets, 32 bytes per line Config1=0x9ee3519e Config3=0x20 KDB: debugger backends: ddb KDB: current backend: ddb Copyright (c) 1992-2014 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 11.0-CURRENT #12 r273952M: Sat Nov 1 15:51:09 PDT 2014 adrian@lucy-11i386:/usr/home/adrian/work/freebsd/head-embedded/obj/mips/mips.mips/usr/home/adrian/work/freebsd/head-embedded/src/sys/DIR-825B1 mips gcc version 4.2.1 20070831 patched [FreeBSD] WARNING: WITNESS option enabled, expect reduced performance. MEMGUARD DEBUGGING ALLOCATOR INITIALIZED: MEMGUARD map base: 0xc0800000 MEMGUARD map size: 104860 KBytes real memory = 67108864 (65536K bytes) avail memory = 53735424 (51MB) random device not loaded/active; using insecure pseudo-random number generator random: entropy device infrastructure driver random: random_adaptors_init random: selecting highest priority adaptor random: random_adaptor_choose - changing from NULL to Dummy random: dummy_random_init random: SOFT: yarrow init() random: selecting highest priority adaptor random: random_adaptor_choose - changing from Dummy to Yarrow random: random_harvestq_init nexus0: clock0: on nexus0 Timecounter "MIPS32" frequency 340000000 Hz quality 800 Event timer "MIPS32" frequency 340000000 Hz quality 800 random: device_attach(): feeding 4 bit(s) of entropy from clock0 apb0 at irq 4 on nexus0 uart0: <16550 or compatible> at mem 0x18020003-0x1802001a irq 3 on apb0 uart0: console (115200,n,8,1) random: device_attach(): feeding 4 bit(s) of entropy from uart0 random: device_attach(): feeding 4 bit(s) of entropy from apb0 pcib0 at irq 0 on nexus0 pcib0: ar71xx_pci_attach: missing hint 'baseslot', default to AR71XX_PCI_BASE_SLOT pcib0: found EEPROM at 0x1f661000 on 0.17.0 reg: 6000, val=29168c reg: 6008, val=2800001 reg: 602c, val=a095168c reg: 5000, val=2a168c reg: 5008, val=2800001 reg: 502c, val=a095168c reg: 5064, val=5040cc0 reg: 506c, val=33811 reg: 4004, val=40073b reg: 4074, val=3 reg: 4000, val=1c20000 reg: 6034, val=44 pcib0: EEPROM firmware: 0x1f661000 @ 4096 bytes pcib0: device EEPROM 'pcib.0.bus.0.17.0.eeprom_firmware' registered pcib0: found EEPROM at 0x1f665000 on 0.18.0 reg: 6000, val=29168c reg: 6008, val=2800001 reg: 602c, val=a094168c reg: 5000, val=2a168c reg: 5008, val=2800001 reg: 502c, val=a094168c reg: 5064, val=5040cc0 reg: 506c, val=33811 reg: 4004, val=40073b reg: 4074, val=3 reg: 4000, val=1c20000 reg: 6034, val=44 pcib0: EEPROM firmware: 0x1f665000 @ 4096 bytes pcib0: device EEPROM 'pcib.0.bus.0.18.0.eeprom_firmware' registered pci0: on pcib0 pci0: at device 17.0 (no driver attached) pci0: at device 18.0 (no driver attached) random: device_attach(): feeding 4 bit(s) of entropy from pci0 random: device_attach(): feeding 4 bit(s) of entropy from pcib0 arge0: at mem 0x19000000-0x19000fff irq 2 on nexus0 arge0: Overriding MAC from EEPROM arge0: Vendor stores MAC in ASCII format arge0: finishing attachment, phymask 0000, proxy null arge0: Ethernet address: 00:18:e7:dd:39:97 random: device_attach(): feeding 4 bit(s) of entropy from arge0 arge1: at mem 0x1a000000-0x1a000fff irq 3 on nexus0 arge1: Overriding MAC from EEPROM arge1: Vendor stores MAC in ASCII format arge1: finishing attachment, phymask 0000, proxy null arge1: Ethernet address: 00:18:e7:dd:39:98 random: device_attach(): feeding 4 bit(s) of entropy from arge1 spi0: at mem 0x1f000000-0x1f00000f on nexus0 spibus0: on spi0 mx25l0: at cs 0 on spibus0 mx25l0: m25p64, sector 65536 bytes, 128 sectors random: device_attach(): feeding 4 bit(s) of entropy from mx25l0 random: device_attach(): feeding 4 bit(s) of entropy from spibus0 random: device_attach(): feeding 4 bit(s) of entropy from spi0 ar71xx_wdog0: on nexus0 random: device_attach(): feeding 4 bit(s) of entropy from ar71xx_wdog0 random: device_attach(): feeding 4 bit(s) of entropy from nexus0 Timecounters tick every 1.000 msec map/rootfs.uncompress: GEOM_ULZMA image found map/rootfs.uncompress: 166 x 131072 blocks WARNING: WITNESS option enabled, expect reduced performance. Trying to mount root from ufs:/dev/map/rootfs.uncompress []... warning: no time-of-day clock registered, system time will not be set accurately Nov 1 22:51:16 init: login_getclass: unknown class 'daemon' *** Populating /var .. *** Loading configuration files .. *** Restoring from /dev/map/cfg .. 1+0 records in 1+0 records out 65536 bytes transferred in 1.177255 secs (55668 bytes/sec) gunzip: invalid compressed data--crc error etc/cfg/manifest etc/master.passwd etc/group etc/cfg/rc.conf etc/cfg/hostapd.wlan0.conf etc/cfg/hostapd.wlan1.conf 11 blocks *** Completed. *** setting up hostname *** Load kernel modules interface yarrow.1 already present in the KLD 'kernel'! linker_load_file: Unsupported file type kldload: an error occurred while loading the module. Please check dmesg(8) for more details. ath0: irq 0 at device 17.0 on pci0 ath0: ath_pci_attach: EEPROM firmware @ 0xc6ee6000 ath0: [HT] enabling HT modes ath0: [HT] 1 stream STBC receive enabled ath0: [HT] 1 stream STBC transmit enabled ath0: [HT] 2 RX streams; 2 TX streams ath0: AR9220 mac 128.2 RF5133 phy 13.0 ath0: 2GHz radio: 0x0000; 5GHz radio: 0x00c0 random: device_attach(): feeding 4 bit(s) of entropy from ath0 ath1: irq 1 at device 18.0 on pci0 ath1: ath_pci_attach: EEPROM firmware @ 0xc6ee9000 [ath] enabling AN_TOP2_FIXUP ath1: [HT] enabling HT modes ath1: [HT] 1 stream STBC receive enabled ath1: [HT] 1 stream STBC transmit enabled ath1: [HT] 2 RX streams; 2 TX streams ath1: AR9220 mac 128.2 RF5133 phy 13.0 ath1: 2GHz radio: 0x0000; 5GHz radio: 0x00c0 random: device_attach(): feeding 4 bit(s) of entropy from ath1 *** bringing up loopback .. *** Starting networking via /etc/rc.d/base/net dev.ath.0.txq_mcastq_maxdepth: 512 -> 32 dev.ath.1.txq_mcastq_maxdepth: 512 -> 32 *** Interface: arge0: start *** Interface: arge0: done *** Interface: arge1: start *** Interface: arge1: done *** Interface: bridge0: start bridge0: Ethernet address: de:6f:cf:39:d0:77 ifconfig: BRDGADD wlan0: No such file or directory ifconfig: BRDGADD wlan1: No such file or directory arge0: promiscuous mode enabled bridge0: link state changed to UP arge1: promiscuous mode enabled *** Interface: bridge0: done *** Default password/login databases .. *** inetd *** Done! FreeBSD/mips (freebsd-dir825) (ttyu0) login: root Password: No home directory. Logging in with home = "/". # sysctl kern.random kern.random.adaptors: yarrow(90),dummy(1) kern.random.active_adaptor: yarrow kern.random.live_entropy_sources: kern.random.yarrow.gengateinterval: 10 kern.random.yarrow.bins: 10 kern.random.yarrow.fastthresh: 96 kern.random.yarrow.slowthresh: 128 kern.random.yarrow.slowoverthresh: 2 kern.random.harvest.mask: 1023 kern.random.harvest.mask_bin: 1111111111 kern.random.harvest.mask_symbolic: UMA_ALLOC,SWI,INTERRUPT,NET_NG,NET_ETHER,NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 23:09:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BEF339BE; Sat, 1 Nov 2014 23:09:10 +0000 (UTC) Received: from mho-01-ewr.mailhop.org (mho-03-ewr.mailhop.org [204.13.248.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77FAF257; Sat, 1 Nov 2014 23:09:10 +0000 (UTC) Received: from [73.34.117.227] (helo=ilsoft.org) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1XkhnB-000I21-7z; Sat, 01 Nov 2014 23:09:09 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id sA1N980d088184; Sat, 1 Nov 2014 17:09:08 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1+g92vZD6F+D1rf8eBfdMf6 X-Authentication-Warning: paranoia.hippie.lan: Host revolution.hippie.lan [172.22.42.240] claimed to be [172.22.42.240] Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... From: Ian Lepore To: Mark R V Murray In-Reply-To: <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <20141101181536.2b6a5911@kan> <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> Content-Type: text/plain; charset="windows-1251" Date: Sat, 01 Nov 2014 17:09:08 -0600 Message-ID: <1414883348.17308.223.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by ilsoft.org id sA1N980d088184 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Adrian Chadd , "src-committers@freebsd.org" , Alexander Kabaev X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 23:09:11 -0000 On Sat, 2014-11-01 at 22:39 +0000, Mark R V Murray wrote: > Hi >=20 > I=92m not sure what you are showing me here? >=20 > How yo you draw the =93not enough entropy=94 conclusion? >=20 > The writing happens at shutdown; before you do the shutdown could you p= lease do a =91sysctl kern.random=92 and post the result? >=20 > Do you have anything random-related in your rc.conf? >=20 > Could you please do a verbose boot on a kernel with =93options RANDOM_D= EBUG=94 set and send me the dmesg output from a failing box. >=20 > M Nothing related to random in rc.conf for me. Here's a verbose dmesg: Type '?' for a list of commands, 'help' for more detailed help. loader> set boot_verbose=3D1 loader> boot Using DTB compiled into kernel. Waiting for Ethernet connection... done. Kernel entry at 0x100100... Kernel args: (null) KDB: debugger backends: ddb KDB: current backend: ddb Copyright (c) 1992-2014 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 11.0-CURRENT #1 r273952: Sat Nov 1 16:55:50 MDT 2014 ilepore@revolution.hippie.lan:/local/build/staging/freebsd/rpi/obj/arm.ar= mv6/local/build/staging/freebsd/rpi/src/sys/RPI-B-serial arm FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512 Preloaded elf kernel "/boot/kernel/kernel" at 0xc066d000. CPU: ARM1176JZ-S rev 7 (ARM11J core) Supported features: ARM_ISA THUMB2 JAZELLE ARMv4 Security_Ext WB enabled LABT branch prediction enabled 16KB/32B 4-way instruction cache 16KB/32B 4-way write-back-locking-C data cache real memory =3D 134213632 (127 MB) avail memory =3D 123449344 (117 MB) Physical memory chunk(s): 0x00001000 - 0x07ffffff, 127 MB ( 32767 pages) Excluded memory regions: 0x00100000 - 0x007a4fff, 6 MB ( 1701 pages) NoAlloc=20 0x08000000 - 0x0fffffff, 128 MB ( 32768 pages) NoAlloc NoDump Static device mappings: 0x20000000 - 0x20ffffff mapped at VA 0xfef00000 random device not loaded/active; using insecure pseudo-random number generator random: entropy device infrastructure driver random: random_adaptors_init random: selecting highest priority adaptor random: random_adaptor_choose - changing from NULL to Dummy random: dummy_random_init openfirm: random: SOFT: yarrow init() random: selecting highest priority adaptor random: random_adaptor_choose - changing from Dummy to Yarrow random: random_harvestq_init mem: nfslock: pseudo-device null: random: device_attach(): feeding 4 bit(s) of entropy from nexus0 ofwbus0: simplebus0: mem 0x20000000-0x20ffffff on ofwbus0 random: device_attach(): feeding 4 bit(s) of entropy from simplebus0 random: device_attach(): feeding 4 bit(s) of entropy from ofwbus0 ofwbus0: type unknown (no driver attached) intc0: mem 0xb200-0xb3ff on simplebus0 random: device_attach(): feeding 4 bit(s) of entropy from intc0 systimer0: mem 0x3000-0x3fff irq 8,9,10,11 on simplebus0 Event timer "BCM2835 Event Timer 3" frequency 1000000 Hz quality 1000 Timecounter "BCM2835 Timecounter" frequency 1000000 Hz quality 1000 random: device_attach(): feeding 4 bit(s) of entropy from systimer0 simplebus0: mem 0xb400-0xb423 irq 0 compat broadcom,bcm2835-sp804 (no driver attached) bcmwd0: mem 0x10001c-0x100027 on simplebus0 random: device_attach(): feeding 4 bit(s) of entropy from bcmwd0 gpio0: mem 0x200000-0x2000af irq 57,59,58,60 on simplebus0 gpio0: read-only pins: 46,47,48,49,50,51,52,53. gpio0: reserved pins: 48,49,50,51,52,53. gpioc0: on gpio0 random: device_attach(): feeding 4 bit(s) of entropy from gpioc0 gpiobus0: on gpio0 gpioled0: at pin(s) 16 on gpiobus0 random: device_attach(): feeding 4 bit(s) of entropy from gpioled0 random: device_attach(): feeding 4 bit(s) of entropy from gpiobus0 random: device_attach(): feeding 4 bit(s) of entropy from gpio0 simplebus0: mem 0x205000-0x20501f irq 61 compat broadcom,bcm2835-bsc (no driver attached) simplebus0: mem 0x804000-0x80401f irq 61 compat broadcom,bcm2835-bsc (no driver attached) simplebus0: mem 0x204000-0x20401f irq 62 compat broadcom,bcm2835-spi (no driver attached) bcm_dma0: mem 0x7000-0x7fff,0xe05000-0xe05fff irq 24,25,26,27,28,29,30,31,32,33,34,35,36 on simplebus0 random: device_attach(): feeding 4 bit(s) of entropy from bcm_dma0 mbox0: mem 0xb880-0xb8bf irq 1 on simplebus0 random: device_attach(): feeding 4 bit(s) of entropy from mbox0 sdhci_bcm0: mem 0x300000-0x3000ff irq 70 on simplebus0 sdhci_bcm0-slot0: 50MHz HS 4bits 3.3V 1.8V PIO sdhci_bcm0-slot0: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D REGISTER DUM= P =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D sdhci_bcm0-slot0: Sys addr: 0x00000000 | Version: 0x00009902 sdhci_bcm0-slot0: Blk size: 0x00000000 | Blk cnt: 0x00000000 sdhci_bcm0-slot0: Argument: 0x00000000 | Trn mode: 0x00000000 sdhci_bcm0-slot0: Present: 0x01ff0000 | Host ctl: 0x00000000 sdhci_bcm0-slot0: Power: 0x00000000 | Blk gap: 0x00000000 sdhci_bcm0-slot0: Wake-up: 0x00000000 | Clock: 0x00000000 sdhci_bcm0-slot0: Timeout: 0x00000000 | Int stat: 0x00000000 sdhci_bcm0-slot0: Int enab: 0x01ff00fb | Sig enab: 0x01ff00fb sdhci_bcm0-slot0: AC12 err: 0x00000000 | Slot int: 0x00000000 sdhci_bcm0-slot0: Caps: 0x00000000 | Max curr: 0x00000001 sdhci_bcm0-slot0: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D mmc0: on sdhci_bcm0 random: device_attach(): feeding 4 bit(s) of entropy from mmc0 random: device_attach(): feeding 4 bit(s) of entropy from sdhci_bcm0 uart0: mem 0x201000-0x201fff irq 65 on simplebus0 uart0: console (115200,n,8,1) uart0: fast interrupt random: device_attach(): feeding 4 bit(s) of entropy from uart0 simplebus0: mem 0xb800-0xb84f irq 2 compat broadcom,bcm2835-vchiq (no driver attached) dwcotg0: mem 0x980000-0x99ffff irq 17 on simplebus0 usbus0 on dwcotg0 dwcotg0: usbpf: Attached random: device_attach(): feeding 4 bit(s) of entropy from usbus0 random: device_attach(): feeding 4 bit(s) of entropy from dwcotg0 ofwbus0: type unknown (no driver attached) ofwbus0: type unknown (no driver attached) ofwbus0: type unknown (no driver attached) ofwbus0: type unknown (no driver attached) Timecounters tick every 10.000 msec tcp_init: net.inet.tcp.tcbhashsize auto tuned to 1024 lo0: bpf attached sdhci_bcm0-slot0: Divider 63 for freq 396825 (max 50000000) mmc0: Probing bus usbus0: 480Mbps High Speed USB v2.0 mmc0: SD 2.0 interface conditions: OK mmc0: SD probe: OK (OCR: 0x00ff8000) mmc0: Current OCR: 0x00ff8000 ugen0.1: at usbus0 uhub0: on usbus0 mmc0: Probing cards mmc0: New card detected (CID 02544d5341303847049cce24e3009a00) mmc0: New card detected (CSD 400e00325b5900003b677f800a400000) mmc0: Card at relative address 0x1234 added: mmc0: card: SDHC SA08G 0.4 SN 9CCE24E3 MFG 10/2009 by 2 TM mmc0: bus: 4bit, 50MHz, high speed timing mmc0: memory: 15572992 blocks, erase sector 8192 blocks mmc0: setting transfer rate to 50.000MHz (high speed timing) sdhci_bcm0-slot0: Divider 0 for freq 50000000 (max 50000000) mmcsd0: 8GB at mmc0 50.0MHz/4bit/65535-block random: device_attach(): feeding 4 bit(s) of entropy from mmcsd0 bootpc_init: wired to interface 'ue0' GEOM: new disk mmcsd0 mmc0: setting bus width to 4 bits mmcsd0: Error indicated: 2 Bad CRC uhub_attach: Turning port 1 power on uhub0: 1 port with 1 removable, self powered random: device_attach(): feeding 4 bit(s) of entropy from uhub0 ugen0.2: at usbus0 uhub1: on usbus0 uhub1: MTT enabled uhub_attach: Turning port 1 power on uhub_attach: Turning port 2 power on uhub_attach: Turning port 3 power on uhub1: 3 ports with 2 removable, self powered random: device_attach(): feeding 4 bit(s) of entropy from uhub1 ugen0.3: at usbus0 smsc0: on usbus0 random: device_attach(): feeding 4 bit(s) of entropy from smsc0 smsc0: chip 0xec00, rev. 0002 miibus0: on smsc0 ukphy0: PHY 1 on miibus0 ukphy0: OUI 0x00800f, model 0x000c, rev. 3 ukphy0: none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto random: device_attach(): feeding 4 bit(s) of entropy from ukphy0 random: device_attach(): feeding 4 bit(s) of entropy from miibus0 ue0: on smsc0 ue0: bpf attached ue0: Ethernet address: f6:00:e5:4b:c0:fb smsc0: chip 0xec00, rev. 0002 ue0: link state changed to DOWN Sending DHCP Discover packet from interface ue0 (f6:00:e5:4b:c0:fb) ue0: link state changed to UP Received DHCP Offer packet on ue0 from 0.0.0.0 (accepted) Sending DHCP Request packet from interface ue0 (f6:00:e5:4b:c0:fb) Received DHCP Ack packet on ue0 from 0.0.0.0 (accepted) ue0 at 172.22.42.29 server 0.0.0.0 subnet mask 255.255.255.0 router 172.22.42.254 rootfs 172.22.42.240:/rpi=20 Adjusted interface ue0 Trying to mount root from nfs:172.22.42.240:/rpi [ro,noatime]... NFS ROOT: 172.22.42.240:/rpi warning: no time-of-day clock registered, system time will not be set accurately warning: no time-of-day clock registered, system time will not be set accurately start_init: trying /sbin/init Interface ue0 IP-Address 172.22.42.29 Broadcast 172.22.42.255=20 Setting hostuuid: 1d295353-1dd2-11b2-9f30-653cd80a9fc4. Setting hostid: 0x2896f513. No suitable dump device was found. Starting file system checks: mount_nfs: can't update /var/db/mounttab for 172.22.42.240:/rpi Mounting local file systems:. Writing entropy file: It hangs forever here. If I break into the debugger it's in cpu_idle(). -- Ian From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 23:24:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F2EECE20; Sat, 1 Nov 2014 23:24:19 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id AC6AD5F5; Sat, 1 Nov 2014 23:24:19 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id CC083A58B; Sat, 1 Nov 2014 23:24:18 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 47CBD10ABE; Sun, 2 Nov 2014 00:24:21 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Ian Lepore Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <20141101181536.2b6a5911@kan> <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> <1414882185.17308.221.camel@revolution.hippie.lan> Date: Sun, 02 Nov 2014 00:24:21 +0100 In-Reply-To: <1414882185.17308.221.camel@revolution.hippie.lan> (Ian Lepore's message of "Sat, 01 Nov 2014 16:49:45 -0600") Message-ID: <86r3xm5wt6.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Mark R V Murray , Alexander Kabaev X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 23:24:20 -0000 Ian Lepore writes: > Mark R V Murray writes: > > The writing happens at shutdown; before you do the shutdown could > > you please do a =E2=80=98sysctl kern.random=E2=80=99 and post the resul= t? > I'm not sure where you're getting "at shutdown" from. >From the code. This is a portion of the rc script that only runs at shutdown. If random_stop() runs during boot, something is seriously wrong *somewhere else* and you are welcome to help find out what. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 23:33:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2E6FFFA0; Sat, 1 Nov 2014 23:33:27 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id DC5B26AF; Sat, 1 Nov 2014 23:33:26 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 0AC3DA595; Sat, 1 Nov 2014 23:33:26 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id AF8BD10AC2; Sun, 2 Nov 2014 00:33:27 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Ian Lepore Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <20141101181536.2b6a5911@kan> <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> <1414882185.17308.221.camel@revolution.hippie.lan> <86r3xm5wt6.fsf@nine.des.no> Date: Sun, 02 Nov 2014 00:33:27 +0100 In-Reply-To: <86r3xm5wt6.fsf@nine.des.no> ("Dag-Erling =?utf-8?Q?Sm=C3=B8r?= =?utf-8?Q?grav=22's?= message of "Sun, 02 Nov 2014 00:24:21 +0100") Message-ID: <86mw8a5we0.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Mark R V Murray , Alexander Kabaev X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 23:33:27 -0000 Dag-Erling Sm=C3=B8rgrav writes: > From the code. This is a portion of the rc script that only runs at > shutdown. If random_stop() runs during boot, something is seriously > wrong *somewhere else* and you are welcome to help find out what. I found it - postrandom triggers it. For now, just remove /etc/rc.d/postrandom (I'm not sure it's really needed, there are better ways to do this). DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 23:35:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F015716B; Sat, 1 Nov 2014 23:35:03 +0000 (UTC) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BAFA16B4; Sat, 1 Nov 2014 23:35:03 +0000 (UTC) Received: from [73.34.117.227] (helo=ilsoft.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1XkiC8-000KQR-AN; Sat, 01 Nov 2014 23:34:56 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id sA1NYsI6088214; Sat, 1 Nov 2014 17:34:54 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX180Odeh89Ia+JmcTnUGcxPg X-Authentication-Warning: paranoia.hippie.lan: Host revolution.hippie.lan [172.22.42.240] claimed to be [172.22.42.240] Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... From: Ian Lepore To: Dag-Erling =?ISO-8859-1?Q?Sm=F8rgrav?= In-Reply-To: <86r3xm5wt6.fsf@nine.des.no> References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <20141101181536.2b6a5911@kan> <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> <1414882185.17308.221.camel@revolution.hippie.lan> <86r3xm5wt6.fsf@nine.des.no> Content-Type: text/plain; charset="iso-2022-jp" Date: Sat, 01 Nov 2014 17:34:54 -0600 Message-ID: <1414884894.17308.229.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Mark R V Murray , Alexander Kabaev X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 23:35:04 -0000 On Sun, 2014-11-02 at 00:24 +0100, Dag-Erling Smrgrav wrote: > Ian Lepore writes: > > Mark R V Murray writes: > > > The writing happens at shutdown; before you do the shutdown could > > > you please do a $B!F(Bsysctl kern.random$B!G(B and post the result? > > I'm not sure where you're getting "at shutdown" from. > > From the code. This is a portion of the rc script that only runs at > shutdown. If random_stop() runs during boot, something is seriously > wrong *somewhere else* and you are welcome to help find out what. > > DES Well that took all of 90 seconds... In rc.d/random we have: extra_commands="saveseed" saveseed_cmd="${name}_stop" and in rc.d/postrandom we have: postrandom_start() { /etc/rc.d/random fastsaveseed ... and so it tries to write an entropy file at startup and hangs, presumably because /dev/random hasn't been sufficiently fed to generate that much random output? -- Ian From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 23:42:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 385FA32E; Sat, 1 Nov 2014 23:42:17 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id E70E97C9; Sat, 1 Nov 2014 23:42:16 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 8F07DA5AB; Sat, 1 Nov 2014 23:42:15 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 095E510AC4; Sun, 2 Nov 2014 00:42:18 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Ian Lepore Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <20141101181536.2b6a5911@kan> <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> <1414882185.17308.221.camel@revolution.hippie.lan> <86r3xm5wt6.fsf@nine.des.no> <1414884894.17308.229.camel@revolution.hippie.lan> Date: Sun, 02 Nov 2014 00:42:17 +0100 In-Reply-To: <1414884894.17308.229.camel@revolution.hippie.lan> (Ian Lepore's message of "Sat, 01 Nov 2014 17:34:54 -0600") Message-ID: <86ioiy5vza.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Mark R V Murray , Alexander Kabaev X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 23:42:17 -0000 Ian Lepore writes: > and so it tries to write an entropy file at startup and hangs, > presumably because /dev/random hasn't been sufficiently fed to > generate that much random output? That's problem #2, /dev/random *should* be unblocked by then. BTW, there is no such thing as being "sufficiently fed to generate that much random output". Yarrow doesn't work that way. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 23:44:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F1DF478; Sat, 1 Nov 2014 23:44:11 +0000 (UTC) Received: from mho-01-ewr.mailhop.org (mho-03-ewr.mailhop.org [204.13.248.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 58BD47D3; Sat, 1 Nov 2014 23:44:10 +0000 (UTC) Received: from [73.34.117.227] (helo=ilsoft.org) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1XkiL4-000EnE-1r; Sat, 01 Nov 2014 23:44:10 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id sA1Ni88m088239; Sat, 1 Nov 2014 17:44:08 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/JBjgXZsncOZnMBkx1DFOa X-Authentication-Warning: paranoia.hippie.lan: Host revolution.hippie.lan [172.22.42.240] claimed to be [172.22.42.240] Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... From: Ian Lepore To: Dag-Erling =?ISO-8859-1?Q?Sm=F8rgrav?= In-Reply-To: <86mw8a5we0.fsf@nine.des.no> References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <20141101181536.2b6a5911@kan> <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> <1414882185.17308.221.camel@revolution.hippie.lan> <86r3xm5wt6.fsf@nine.des.no> <86mw8a5we0.fsf@nine.des.no> Content-Type: text/plain; charset="ISO-8859-1" Date: Sat, 01 Nov 2014 17:44:08 -0600 Message-ID: <1414885448.17308.236.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by ilsoft.org id sA1Ni88m088239 Cc: Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Mark R V Murray , Alexander Kabaev X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 23:44:11 -0000 On Sun, 2014-11-02 at 00:33 +0100, Dag-Erling Sm=F8rgrav wrote: > Dag-Erling Sm=F8rgrav writes: > > From the code. This is a portion of the rc script that only runs at > > shutdown. If random_stop() runs during boot, something is seriously > > wrong *somewhere else* and you are welcome to help find out what. >=20 > I found it - postrandom triggers it. For now, just remove > /etc/rc.d/postrandom (I'm not sure it's really needed, there are better > ways to do this). >=20 > DES Yeah. I vaguely remember discussion about this something like 12-18 months ago. As I remember it, there was a desire to avoid using the same startup saved entropy on a rapid series of reboots and the thinking was to combat that by generating some fresh saved entropy on each boot. It seems like that should work if the old saved entropy were stirred in with the modicum of boot-time entropy before generating a new save file. Hmmm, but what if there is no saved entropy? Maybe that's what's happening here, given that a freshly created varmfs is involved. I was thinking maybe postrandom should only try to save a new file if there are some existing files to avoid the possibility of hanging. But when I look at postrandom more closely, it seems to be generating a save file, then deleting it along with all the other save files. -- Ian From owner-svn-src-head@FreeBSD.ORG Sat Nov 1 23:57:15 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 509AF620; Sat, 1 Nov 2014 23:57:15 +0000 (UTC) Received: from mho-01-ewr.mailhop.org (mho-03-ewr.mailhop.org [204.13.248.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A65F89A; Sat, 1 Nov 2014 23:57:14 +0000 (UTC) Received: from [73.34.117.227] (helo=ilsoft.org) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1XkiXh-000NBp-4r; Sat, 01 Nov 2014 23:57:13 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id sA1NvBwc088262; Sat, 1 Nov 2014 17:57:11 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX18Wb+tbfa4wR6OWKjShkWOV X-Authentication-Warning: paranoia.hippie.lan: Host revolution.hippie.lan [172.22.42.240] claimed to be [172.22.42.240] Subject: Re: svn commit: r273872 - in head: etc/defaults etc/rc.d libexec/save-entropy share/examples/kld/random_adaptor sys/conf sys/dev/glxsb sys/dev/random sys/kern sys/modules sys/modules/padlock_rng sys/mo... From: Ian Lepore To: Dag-Erling =?ISO-8859-1?Q?Sm=F8rgrav?= In-Reply-To: <86mw8a5we0.fsf@nine.des.no> References: <201410302121.s9ULLsEw055630@svn.freebsd.org> <20141101181536.2b6a5911@kan> <627C5F71-939A-4579-8A1B-45933662DAED@FreeBSD.org> <1414882185.17308.221.camel@revolution.hippie.lan> <86r3xm5wt6.fsf@nine.des.no> <86mw8a5we0.fsf@nine.des.no> Content-Type: text/plain; charset="ISO-8859-1" Date: Sat, 01 Nov 2014 17:57:11 -0600 Message-ID: <1414886231.17308.238.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by ilsoft.org id sA1NvBwc088262 Cc: Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Mark R V Murray , Alexander Kabaev X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Nov 2014 23:57:15 -0000 On Sun, 2014-11-02 at 00:33 +0100, Dag-Erling Sm=F8rgrav wrote: > Dag-Erling Sm=F8rgrav writes: > > From the code. This is a portion of the rc script that only runs at > > shutdown. If random_stop() runs during boot, something is seriously > > wrong *somewhere else* and you are welcome to help find out what. >=20 > I found it - postrandom triggers it. For now, just remove > /etc/rc.d/postrandom (I'm not sure it's really needed, there are better > ways to do this). >=20 > DES It appears another quick easy workaround is to set entropy_file=3DNO in rc.conf, which may be the right thing to do for people using a varmfs that isn't going to survive a reboot anyway, even after this glitch is fixed. -- Ian