Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1371549ybt; Sun, 14 Jun 2020 20:58:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqMouH3b3cZ/qzOfjnEx8sMuPKTCYmotcCGW+yX3yYmPYFBvtGcp/ZGpC8WKMVUDmYQGW+ X-Received: by 2002:aa7:c558:: with SMTP id s24mr21220306edr.237.1592193498335; Sun, 14 Jun 2020 20:58:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592193498; cv=none; d=google.com; s=arc-20160816; b=O7/1HvB0Gl0QeTQa3VoM3vgj37AET2yarCxDb5bPVj2sWpMjHWqpDvWUiazNfi+gvw MbbkAf4sYguLIY+Mf0pF+1Fs6e73eflfvQC6LvX9K7XvMh5bK8Wxpt3GiU0j+11wBY5g quh56xOflyvAmb+OK/FhTqDybyjpreoinFZFJHX99RRiSjn9zqnQPOsXhr0VGaLoFazo D4dYqEpIZmcnx9TIgnbf6xo4uLqtTdmgd9wk1/pK9UuwjXfJSNidPAPCducPjD0V12pq Uppa2s4s6Z2x9P1amA9U9oVZinkqXVeEPmSTa1smzycRha/KQEP1ZZUbg+9ziwpL7sZc ujzQ== 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=b3r1b0ogG8RFYmtciXwkUKZ4Alfe4K9lVMAfswnI+sI=; b=ELSo0lE1WGNei0dWhTFkAiYAZL+HAXyTCbG/EpZaskaHw01praW7dDHcE6TEzLq0ML wOaa1lnHM04CS18FPJlIbkwhUlvfIpUXVU1vAzkTPGYWQJsATOFGBFP0loDZjhpa/Lpq 7WoRrz7lJQwpwbQy97i/Ss1dXU5FpwtslDFKJBruzpD9tUxYT4zGv//aMpwYSWo0/7Y4 nBNTtrQWbri/ssqGHoxPvCKg3c9m+WIeom5Y7mGHnAM2UJtMreB1QH+FOaA/OX8M/s9Z Tut90n5sl2mzTIN0rV6VJCAY2u84/fpLS0RW8T0uLBvIJTl2Jg7Ig721BCptnh/7Ftsc j4NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="RJN0Fr/n"; 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 nx24si8012146ejb.615.2020.06.14.20.57.56; Sun, 14 Jun 2020 20:58:18 -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="RJN0Fr/n"; 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 S1728197AbgFODzw (ORCPT + 99 others); Sun, 14 Jun 2020 23:55:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727971AbgFODzv (ORCPT ); Sun, 14 Jun 2020 23:55:51 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94D42C061A0E for ; Sun, 14 Jun 2020 20:55:51 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id d4so6972pgk.4 for ; Sun, 14 Jun 2020 20:55:51 -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=b3r1b0ogG8RFYmtciXwkUKZ4Alfe4K9lVMAfswnI+sI=; b=RJN0Fr/nvvnc1RU8+2/LOsn7FwyS0zS4HfmgrxoTwqWN8HEGW3mlq/thkvx9ltRO4l bDj8uwg3w8tO7j81cWcRdTyyLtL9JdLm5JIIpV1SoqKweNUqkwS3sKIzhoQHCmG8kaYy cB6nSOOnDDwLWmwRRyQodsA7dSxhJP39i75Dw= 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=b3r1b0ogG8RFYmtciXwkUKZ4Alfe4K9lVMAfswnI+sI=; b=Q82v1LsXpBY3EDB9vpKTe4+Zi7v71/KpPvasCh3zqQ5OoywqDXz1zhm0r7Bynv5gJ/ 6fckS92UaOchQNUGcNIMUCUu1qNemRhPqRhsMrWnbDsGZc1g9fzv8FBjYqtzxkZ8G+E4 3zkiJt3j/rsvejYiHEQEieIR/9wMzT8ULRsN5S7klSSZHnAs1lrpABJUdpSKa7qy4N2G 4hMmksgqxMMKYPEvfYddqEokPTuFoV0Dp85mmMmy4XTMBcqfrFevmRKrK2Yjii1xZjjR 4jLiI5Kp8/SQC2SETCzjB+zNn8EY7KbHI/fsgeuz/fW6wYQOkjOpupyHKEbGFoyRSe2Z 80Wg== X-Gm-Message-State: AOAM532EmHM2tLMq9/mccOxxB/FPN3pIZ27Xv9dh2Tlm/cU10kyP85Df 31xRujl27b/1FuvzMJUgmRNlKw== X-Received: by 2002:a63:480d:: with SMTP id v13mr20580425pga.286.1592193351115; Sun, 14 Jun 2020 20:55:51 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id fv7sm10891472pjb.41.2020.06.14.20.55.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 20:55:50 -0700 (PDT) Date: Sun, 14 Jun 2020 20:55:49 -0700 From: Kees Cook To: Xiaoming Ni Cc: Peter Zijlstra , David Windsor , Hans Liljestrand , Elena Reshetova , Paul Moore , edumazet@google.com, paulmck@kernel.org, David Howells , 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: <202006142054.C00B3E9C9@keescook> References: <20200612183450.4189588-1-keescook@chromium.org> <7be4d56b-0406-099b-e505-02e074c5173e@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7be4d56b-0406-099b-e505-02e074c5173e@huawei.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 15, 2020 at 10:10:08AM +0800, Xiaoming Ni wrote: > On 2020/6/13 2:34, Kees Cook wrote: > > This series was never applied[1], and was recently pointed out as > > missing[2]. If someone has a tree for this, please take it. Otherwise, > > please Ack and I'll send it to Linus. > > > > Thanks! > > > > -Kees > > > > [1] https://lore.kernel.org/lkml/20190306110549.7628-1-elena.reshetova@intel.com/ > > [2] https://lore.kernel.org/lkml/1591957695-118312-1-git-send-email-nixiaoming@huawei.com/ > > > > Elena Reshetova (3): > > nsproxy: convert nsproxy.count to refcount_t > > groups: convert group_info.usage to refcount_t > > creds: convert cred.usage to refcount_t > > > > include/linux/cred.h | 15 +++++++------- > > include/linux/nsproxy.h | 7 +++---- > > kernel/cred.c | 44 ++++++++++++++++++++--------------------- > > kernel/groups.c | 2 +- > > kernel/nsproxy.c | 6 +++--- > > net/sunrpc/auth.c | 2 +- > > 6 files changed, 38 insertions(+), 38 deletions(-) > > > > 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 If you can go through that and double check for prior series from Elena, we can get through all the rest of them. Thanks for bringing this topic back up! -- Kees Cook