From owner-freebsd-threads@freebsd.org Tue Feb 16 11:32:33 2016 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34A6FAAAAA8 for ; Tue, 16 Feb 2016 11:32:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 1F9551EE7 for ; Tue, 16 Feb 2016 11:32:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 1D384AAAAA6; Tue, 16 Feb 2016 11:32:33 +0000 (UTC) Delivered-To: threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CBF3AAAAA2; Tue, 16 Feb 2016 11:32:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::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 918D01EE4; Tue, 16 Feb 2016 11:32:32 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u1GBWMsR011473 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 16 Feb 2016 13:32:23 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u1GBWMsR011473 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u1GBWMnp011470; Tue, 16 Feb 2016 13:32:22 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 16 Feb 2016 13:32:22 +0200 From: Konstantin Belousov To: Eric van Gyzen Cc: threads@freebsd.org, arch@freebsd.org Subject: Re: libthr shared locks Message-ID: <20160216113222.GY91220@kib.kiev.ua> References: <20151223172528.GT3625@kib.kiev.ua> <56BE69B8.9020808@FreeBSD.org> <56C24586.9050906@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56C24586.9050906@FreeBSD.org> User-Agent: Mutt/1.5.24 (2015-08-30) 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.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2016 11:32:33 -0000 On Mon, Feb 15, 2016 at 03:39:18PM -0600, Eric van Gyzen wrote: > My only comment on kern_umtx.c is, why are the permission checks compiled out? Assume that we changed the ABI of libthr and shared locks do not require an offpage. Then, access to the locks is completely controlled by the access to the page containing the lock. If a process can mmap the page, it can own the lock. >From this point of view, access to the offpage shared memory object is the same as the access to the key page. Which is the reason to not include the access permissions checks. On the other hand, if you have something in kernel, which also owns a reference on ucred (for other means), you sure consider whether the usual access control is appropriate. Mostly, I leave the #ifdef-ed checks to reconsider it later, which worked since you asked the question. I definitely do not see much use of the shm_access() checks, but I am not completely sure about possible mac policies utilization there, although I do not really think they could be usefully attached to the app-level locks. > I also reviewed versions 2 and 3; the revisions look fine. Thank you very much.