Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1169173AbdDXLRK (ORCPT ); Mon, 24 Apr 2017 07:17:10 -0400 Received: from merlin.infradead.org ([205.233.59.134]:51074 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1169091AbdDXLQN (ORCPT ); Mon, 24 Apr 2017 07:16:13 -0400 Date: Mon, 24 Apr 2017 13:15:53 +0200 From: Peter Zijlstra To: PaX Team Cc: Kees Cook , linux-kernel@vger.kernel.org, Eric Biggers , Christoph Hellwig , "axboe@kernel.dk" , James Bottomley , Elena Reshetova , Hans Liljestrand , David Windsor , x86@kernel.org, Ingo Molnar , Arnd Bergmann , Greg Kroah-Hartman , Jann Horn , davem@davemloft.net, linux-arch@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: Re: [PATCH] x86/refcount: Implement fast refcount_t handling Message-ID: <20170424111553.p3kbyir4ztsldc56@hirez.programming.kicks-ass.net> References: <20170421220939.GA65363@beast> <20170424083250.h2wv2exbi4ytigac@hirez.programming.kicks-ass.net> <58FDDAC2.11341.175B5A99@pageexec.freemail.hu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <58FDDAC2.11341.175B5A99@pageexec.freemail.hu> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 726 Lines: 19 On Mon, Apr 24, 2017 at 01:00:18PM +0200, PaX Team wrote: > On 24 Apr 2017 at 10:32, Peter Zijlstra wrote: > > Also, you forgot nr_cpus in your bound. Afaict the worst case here is > > O(nr_tasks + 3*nr_cpus). > > what does nr_cpus have to do with winning the race? The CPUs could each run nested softirq/hardirq/nmi context poking at the refcount, irrespective of the (preempted) task context. > > Because PaX does it, is not a correctness argument. And this really > > wants one. > > heh, do you want to tell me about how checking for a 0 refcount prevents > exploiting a bug? Not the point. All I said was that saying somebody else does it (anybody else, doesn't matter it was you) isn't an argument for correctness.