Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp947401ybh; Tue, 21 Jul 2020 11:47:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1hBEb5OP2XfCnoPqbwegj9m7pFwalSgCSZDU9BpsDI/aIRAxd2UX196w/2PDLLPXsAvFr X-Received: by 2002:a17:906:3282:: with SMTP id 2mr26329512ejw.11.1595357267372; Tue, 21 Jul 2020 11:47:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595357267; cv=none; d=google.com; s=arc-20160816; b=k3nQVaS1vItDPoiEi1baklgB9sHcUNB1/Y0mZcpdmSr6Vn4eJAex5U4pUevaQKO1GP pNSUATAU+6KpkHI/sq0uFrAAs2Rgnlp0E9JcALArP7j2C/QGHPI2FNGPE5+PLo7v1w7F UcLmk5NpTj2v+bXNpR4Ib6XQuNXplUdsut4XI/ETP4bp2sCekCVLEFMvhtwybBbtN7Rk vL7qHNHJ1ypzwWvcO90jj6LYcWdA8QqjkYET8nIqNS0N36Q7DfKF06G0A2oqr9RLJTmr LciqFXEKiOndF6Sk3ilSXpR5YnVwDDexJpx3YiLXMp+LLwIHNYrzW/hj7mEA+1a1SQ+M l9eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ktrA6qles9txxK/VYI2vM11yWK+fPxocyvkCQAJyaOY=; b=G7Ecn7nLW+o4cWjmhxbKl2zzsB8/rUIhTYCfWOJpXNd2YxbEcG68vWNyxHhiy719PX wc97S10omFkOD/HGNUSQsAkcITxJjB00T43HHh/oN5T2R2cec7K7ltHVICZLn6RWOKVj J4c1pShQwuBvlqOXIby/KcRh3P7PrcN26CgZSJOaXHFz+jUb/F6ibUoYfVYZx1B/D08g zsEWRGi5C1Wu1AJYdU+aA2GHoa9N2SEniu0OJGjIAXqucaQyhEK7DfwDQp8UzvegfKMo wzVzR2MTew47G2cAd2veP+I7ciEznbLm4LLyy5CzYyYzwwxd4mEnFj8BExb5HCVbXbpg b4Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=N97BcoyD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l17si13944337ejc.174.2020.07.21.11.47.22; Tue, 21 Jul 2020 11:47:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=N97BcoyD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728278AbgGUSo4 (ORCPT + 99 others); Tue, 21 Jul 2020 14:44:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726602AbgGUSoz (ORCPT ); Tue, 21 Jul 2020 14:44:55 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89E23C061794 for ; Tue, 21 Jul 2020 11:44:55 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id g67so12346867pgc.8 for ; Tue, 21 Jul 2020 11:44:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ktrA6qles9txxK/VYI2vM11yWK+fPxocyvkCQAJyaOY=; b=N97BcoyD7bGx2yP6cuoMvwcpm0oMr+8bz013kXkloSXrP8e5sitfBTilO9XbJomnz9 UEq8Oq9T6zUILR7FhI5SM7h4JndK/D85Nn7olc7uH1pAxgdJaIDu/6mNdbLeAX2tal2r E3dfGWP2DQn1Uz6B9urWB4nMoJcawyxJnAe1A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ktrA6qles9txxK/VYI2vM11yWK+fPxocyvkCQAJyaOY=; b=NLuldRLGk1GCTHwatUwuMlTU5hvaWDZZ7HB+8JFCcDU4+QObpWQkPdraboxMbLvF99 5vksVrnyKB7yuVnfzIo0zUOcVJ3fod2jP+bxvp5eXTiaxdx0nEjWETsGXK4Niu8o1oRf u86dr9rUiakhhzcJqPIB5d8GlVYJM09ZFN4SzPZwL7iZsz9R0KauzwoznlhJnkS+faL/ WeC2bS2uf1MzwaBPz/qnfupCAr1gpyqvuBteCq91q/IqVR24SCN0a8F4kID7xe5fHq8E pO+jCrlHQAiCcUmsHbSYS1rgO4jVnV3xMVKXvdCTJ9J1EW5nf6ZbjXuCFz2Was8JQim+ lMPA== X-Gm-Message-State: AOAM531DQ3yI46OvJIKm73JKrpzof+EMBHFcl3funSFI1+WJK1paQe9l 33M3n7jzChHMoBB5iOlhzFApwg== X-Received: by 2002:a62:1407:: with SMTP id 7mr23742991pfu.88.1595357095105; Tue, 21 Jul 2020 11:44:55 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id i7sm18429700pgh.58.2020.07.21.11.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 11:44:54 -0700 (PDT) Date: Tue, 21 Jul 2020 11:44:53 -0700 From: Kees Cook To: David Howells Cc: Xiaoming Ni , Peter Zijlstra , David Windsor , Hans Liljestrand , Elena Reshetova , Paul Moore , edumazet@google.com, paulmck@kernel.org, shakeelb@google.com, James Morris , alex.huangjianhui@huawei.com, dylix.dailei@huawei.com, chenzefeng2@huawei.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/3] Convert nsproxy, groups, and creds to refcount_t Message-ID: <202007211144.A68C31D@keescook> References: <202006142054.C00B3E9C9@keescook> <20200612183450.4189588-1-keescook@chromium.org> <7be4d56b-0406-099b-e505-02e074c5173e@huawei.com> <544539.1595328664@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <544539.1595328664@warthog.procyon.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 21, 2020 at 11:51:04AM +0100, David Howells wrote: > Kees Cook wrote: > > > > Should mm->mm_users also be replaced by refcount_t? > > > > I'll say "yes". :) > > https://lore.kernel.org/lkml/1487671124-11188-1-git-send-email-elena.reshetova@intel.com/ > > > > > In addition, is it better to change all variables that use > > > atomic_dec_and_test to control the release process to refconut_t? > > > > For the most part, yes. The following may find a lot of them: > > scripts/coccinelle/api/atomic_as_refcounter.cocci > > I've been gradually undoing some of the conversions as there's no equivalent > of atomic_add_return() and atomic_dec_return() that allow me to log the > altered refcount through a tracepoint. Please do not _undo_ the changes; just add the API you need. -- Kees Cook