Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp123505imm; Tue, 10 Jul 2018 22:46:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd3EJJ/x3cmCanlcaOsHoR6ev+A8OKajo305E+xDJi6eNEPhMUP6+6mGgbsPnl7HDAz0pST X-Received: by 2002:a17:902:2006:: with SMTP id n6-v6mr27212630pla.325.1531287974291; Tue, 10 Jul 2018 22:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531287974; cv=none; d=google.com; s=arc-20160816; b=QTznb0WUqsVdbhFbTz6Dr47zIbEpYIn/9pzVkJO5XxyZ4PJ7wy8t11sFtkTPh5TyMo nFa5dDYRo3AaBLsKJbXmRRYc9cil6e+VxiPQvo2qr7LLd7q0u70xTzzFOP5sFAesRqkb 4ZrezMAScLibtrHlyyKOekjpZZRS64C9Xk5wQoXgLhIU5Qd8zghOsQIGUtUAVpboUgAD 9YveJbIG7Hu3WNUeTV0PPbclBFqu+FrIY2XXzOtxLJibchGkvEyl7uP8/yq+KP9dDp5u WdKepet3pOpaBVXbV5h+ErpNPWDJCLzHZRhHyzjmIybnw0BUq0akyNQYFIdOgataswBp 9ZBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=P38okDY9Xm78eRFFXT7XqppFXsgfmRFjVV5iaigPLow=; b=09CGyfVAnQGbUfXZj0sBAEMOFDIr6zRvEnEznZNM1XPbcmrE5shbYlEztiVL2rr94A nAjWG5LUH7/QJkZH/PKJ45yN4bUgbbloEvYd8nK4GCcYfnapDxWZh7QatRRsKkyE6fIA 571eHXCpx8P/EAWbdNmhQQAGZb+ohJdwWNT9VFD158eb1Rh1C25FoRpYxE6tkbeoQkFz uJJPVGQR1f73xrayvwp07fAGYjPJvJ0tyP+X4EnZoqyO04LwhBmW6Gl0LjNegP3/NCqd /+4wto5+dpayw/HRVY2zBUIkLagpVtko2JpcKdezkNzwZuy3RCJfeliwLbB6zYxTatRF EQZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w6-v6si17855831pgb.61.2018.07.10.22.45.58; Tue, 10 Jul 2018 22:46:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726566AbeGKFrF (ORCPT + 99 others); Wed, 11 Jul 2018 01:47:05 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:56792 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726199AbeGKFrE (ORCPT ); Wed, 11 Jul 2018 01:47:04 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 98E5680D; Tue, 10 Jul 2018 22:44:31 -0700 (PDT) Received: from salmiak (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EE5803F318; Tue, 10 Jul 2018 22:44:29 -0700 (PDT) Date: Wed, 11 Jul 2018 06:44:21 +0100 From: Mark Rutland To: Kees Cook Cc: LKML , Boqun Feng , David Sterba , Ingo Molnar , Peter Zijlstra , Will Deacon Subject: Re: [PATCH] refcount: always allow checked forms Message-ID: <20180711054421.qgsdctwtncr32r4y@salmiak> References: <20180703100102.16615-1-mark.rutland@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 03, 2018 at 11:30:38AM -0700, Kees Cook wrote: > On Tue, Jul 3, 2018 at 3:01 AM, Mark Rutland wrote: > > In many cases, it would be useful to be able to use the full > > sanity-checked refcount helpers regardless of CONFIG_REFCOUNT_FULL, as > > this would help to avoid duplicate warnings where callers try to > > sanity-check refcount manipulation. > > > > This patch refactors things such that the full refcount helpers were > > always built, as refcount_${op}_checked(), such that they can be used > > regardless of CONFIG_REFCOUNT_FULL. This will allow code which *always* > > wants a checked refcount to opt-in, avoiding the need to duplicate the > > logic for warnings. > > > > There should be no functional change as a result of this patch. > > > > Signed-off-by: Mark Rutland > > Cc: Boqun Feng > > Cc: David Sterba > > Cc: Ingo Molnar > > Cc: Kees Cook > > Cc: Peter Zijlstra > > Cc: Peter Zijlstra > > Cc: Will Deacon > > Looks good to me! Thanks for doing this. :) Thank David; I rather stole his thunder here. > Acked-by: Kees Cook > > > --- > > include/linux/refcount.h | 27 +++++++++++++++++------- > > lib/refcount.c | 53 +++++++++++++++++++++++------------------------- > > 2 files changed, 45 insertions(+), 35 deletions(-) > > > > Dave pointed out that it would be useful to be able to opt-in to full checks > > regardless of CONFIG_REFCOUNT_FULL, so that we can simplify callsites where we > > always want checks. I've spotted a few of these in code which is still awaiting > > conversion. > > Yeah, I need to go through the cocci output -- Elena had several > outstanding patches that never got picked up. > > > I'm assuming that the atomics group is intended to own the refcount code, even > > though this isn't currently the case in MAINTAINERS. > > That's how it has landed in the past, yes, but if there is a > dependency on these for code that will use it, maybe it should go that > way? That sounds reasonable to me. I was just wanted to be clear as to why I'd Cc'd the atomics maintainers. :) I'll spin a v2 with the fixup Andrea noted. Thanks, Mark.