From owner-freebsd-hackers@freebsd.org Mon Apr 10 08:57:42 2017 Return-Path: Delivered-To: freebsd-hackers@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 A269CD371E1 for ; Mon, 10 Apr 2017 08:57:42 +0000 (UTC) (envelope-from torek@elf.torek.net) Received: from elf.torek.net (mail.torek.net [96.90.199.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "elf.torek.net", Issuer "elf.torek.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8CFE2B17 for ; Mon, 10 Apr 2017 08:57:42 +0000 (UTC) (envelope-from torek@elf.torek.net) Received: from elf.torek.net (localhost [127.0.0.1]) by elf.torek.net (8.15.2/8.15.2) with ESMTPS id v3A8vf3B049846 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 10 Apr 2017 01:57:41 -0700 (PDT) (envelope-from torek@elf.torek.net) Received: (from torek@localhost) by elf.torek.net (8.15.2/8.15.2/Submit) id v3A8vffM049845; Mon, 10 Apr 2017 01:57:41 -0700 (PDT) (envelope-from torek) Date: Mon, 10 Apr 2017 01:57:41 -0700 (PDT) From: Chris Torek Message-Id: <201704100857.v3A8vffM049845@elf.torek.net> To: kostikbel@gmail.com Subject: Re: Understanding the FreeBSD locking mechanism Cc: ablacktshirt@gmail.com, ed@nuxi.nl, freebsd-hackers@freebsd.org, rysto32@gmail.com, vasanth.raonaik@gmail.com In-Reply-To: <20170410084756.GJ1788@kib.kiev.ua> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (elf.torek.net [127.0.0.1]); Mon, 10 Apr 2017 01:57:41 -0700 (PDT) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Apr 2017 08:57:42 -0000 >I considered some variation of this scheme when I worked on the >non-executable stack support. AFAIR the reason why I decided not to do >this was that the kernel-injected signal trampoline is still needed >for backward ABI-compat. In other words, the shared page would be >still needed, and we would end up with both libc trampoline and kernel >trampoline, which felt somewhat excessive. Those are pretty much the same reasons I never did it as well. >Selecting one scheme or another based e.g. on the binary osrel was too >fragile, e.g. new binary might have loaded old library, and the kernel >trampoline still must be present in this situation. The method by which to select the scheme, though, is straightforward: old vs new signal system call numbers and/or flags. ("Flags" presents issues if users of existing mechanism are not good about clearing unknown flag bits.) Besides non-executable stack / shared-page, this would also be particularly good for cases where a runtime library (not necessarily libc itself, perhaps for other languages) wants a different signal handling method in user space. For instance, instead of signals being delivered to some existing thread as interrupts, they might spin off new threads entirely. I think it's still worth pursuing, but it's one of those "forever in the future, low priority" ideas. I can't even seem to get back to my medium-priority ideas these days... Chris