From owner-svn-src-head@freebsd.org Fri Mar 2 17:53:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B2F4F38858 for ; Fri, 2 Mar 2018 17:53:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from sonic311-36.consmr.mail.gq1.yahoo.com (sonic311-36.consmr.mail.gq1.yahoo.com [98.137.65.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11FD96E7EF for ; Fri, 2 Mar 2018 17:53:55 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1520013233; bh=nJhAFKbKO43Se73CDWzYG+bhYfEAfRgZZhUqQj747eg=; h=Subject:To:References:From:Cc:Date:In-Reply-To:From:Subject; b=SxGfQ5LewGs2AmIG7OH5zKVAV1DM3HI4pzYoCAtAWJAVcZtm1Q4feteNlahmKN5786x0n3YlnvP+0ew8I0YQVtRlxpSse7jJloUk6yUoW+GtVdAb0C87qLVXy9jTo/p2ZPhflYb+iXxYppgV64Q1NB30VTJquwcYi1fPz7F3zFs78BxLpQdFS4cVMauoZtNdTU7is3BiofldIJsuxuQiEbxW+8RpYoVjbVeJbaPYZUSLqSXfjrNiTZHj4v3fYNDttFkcvI6iSpnJPpc80cnY+omWo/ThtDC+E8NRtApjktY3jMiMdyq/p9EUPYZVZXsY3mKNN4vNteeunCqGjvtS+Q== X-YMail-OSG: ZbVgzWwVM1lrzfcoQh9uN3_D8pwzcisEmyhd.pJfUjo1OAbPXGlUEs3gTkcFnMz b9.NhZU8wBzXcrgOGxMkxPdnKG_kPCk7SNtcda2BXBcI6yG5EbfaEWQqn8_JIMlZp__Pc1SqRJCS fbrX_Q7e56y.TFA6YfPVDGU99vZ5L2Vjl2NsLvuutAufur_awlAIS4optFgdFOV.VEyVMSYtzOC4 xS65MxKmZVb_IVzhtn.9.F6Cxf0Ip1pCdhp3fFuXUnC90CHhbejllDOzVqC7Rv1Pfq38vylGvNFr CEOHOTk1MjQZvMlZ8p8tfqoQlLHu3BM7RNi6L0v4QM8mbbbohorCWaXzYO7koWo0DRnUP7g7ZqH9 tr9t_biwbXsBoeS4bG_fEUP5tlFei3Wcwairiwd.ilrRXDxM39IElRmqld0CVLGcTS8cB9rG4ZEs 7EwetwJRSw9N3.PEtAxDzRxGrgzC2FA3zBAbPQZp8O_GK_aklU_S6JgWseSWyzuBME_6N59rw6Ot Fx2bnSa3cP8Y- Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.gq1.yahoo.com with HTTP; Fri, 2 Mar 2018 17:53:53 +0000 Received: from smtp109.rhel.mail.gq1.yahoo.com (EHLO [192.168.0.5]) ([10.211.35.160]) by smtp407.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 4fcceec02d620a9008a8fe216a3ce7c5; Fri, 02 Mar 2018 17:43:42 +0000 (UTC) Subject: Re: svn commit: r330285 - head/sys/sys To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201803021647.w22Gl2t7092316@repo.freebsd.org> From: Pedro Giffuni Organization: FreeBSD Project Cc: Eitan Adler Message-ID: Date: Fri, 2 Mar 2018 12:43:34 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <201803021647.w22Gl2t7092316@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 02 Mar 2018 17:53:56 -0000 (cc in Eitan as he may be interested in the extra restrict cases) On 02/03/2018 11:47, Konstantin Belousov wrote: > Author: kib > Date: Fri Mar 2 16:47:02 2018 > New Revision: 330285 > URL: https://svnweb.freebsd.org/changeset/base/330285 > > Log: > Remove _Nonnull attributes from user addresses arguments for > copyout(9) family. > > The addresses are user-controllable, and if the process ABI allows > mapping at zero, then the zero address is meaningful, contradicting > the definition of _Nonnull. In any case, it does not require any > special code to handle NULL udaddr. > FWIW, the _Nonnull attributes didn't do much at all beyond producing a warning. They replaced the GNU __nonnull() attributes which were much more dangerous. I am OK with seeing both gone here though. > It is not clear if __restrict makes sense as well, since kaddr and > udaddr point to different address spaces, so equal numeric values of > the pointers do not imply aliasing and a legitimate. But leave it for > later. > > copyinstr(9) does not have its user address argument annotated. I think use of _Nonnull attributes in the threading functions may also be a waste (I introduced them mostly to be compatible with Android). FWIW, Dragonfly sprinkled some restrict there recently: http://gitweb.dragonflybsd.org/dragonfly.git/commit/d33005aaee6af52c80428b59b52aee522c002492 Just in case someone is considering more cleanups. Cheers, Pedro. > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > > Modified: > head/sys/sys/systm.h > > Modified: head/sys/sys/systm.h > ============================================================================== > --- head/sys/sys/systm.h Fri Mar 2 16:31:23 2018 (r330284) > +++ head/sys/sys/systm.h Fri Mar 2 16:47:02 2018 (r330285) > @@ -277,14 +277,14 @@ int copystr(const void * _Nonnull __restrict kfaddr, > int copyinstr(const void * __restrict udaddr, > void * _Nonnull __restrict kaddr, size_t len, > size_t * __restrict lencopied); > -int copyin(const void * _Nonnull __restrict udaddr, > +int copyin(const void * __restrict udaddr, > void * _Nonnull __restrict kaddr, size_t len); > -int copyin_nofault(const void * _Nonnull __restrict udaddr, > +int copyin_nofault(const void * __restrict udaddr, > void * _Nonnull __restrict kaddr, size_t len); > int copyout(const void * _Nonnull __restrict kaddr, > - void * _Nonnull __restrict udaddr, size_t len); > + void * __restrict udaddr, size_t len); > int copyout_nofault(const void * _Nonnull __restrict kaddr, > - void * _Nonnull __restrict udaddr, size_t len); > + void * __restrict udaddr, size_t len); > > int fubyte(volatile const void *base); > long fuword(volatile const void *base); >