From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16408C432BE for ; Sat, 28 Aug 2021 11:26:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E2A5860EBD for ; Sat, 28 Aug 2021 11:26:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234020AbhH1L1Z (ORCPT ); Sat, 28 Aug 2021 07:27:25 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:14432 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233861AbhH1L1Y (ORCPT ); Sat, 28 Aug 2021 07:27:24 -0400 Received: from dggeme766-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4GxZ1p73FnzbdN7; Sat, 28 Aug 2021 19:22:38 +0800 (CST) Received: from [10.174.176.245] (10.174.176.245) by dggeme766-chm.china.huawei.com (10.3.19.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Sat, 28 Aug 2021 19:26:30 +0800 Subject: Re: Re: [PATCH v3 0/3] auth_gss: netns refcount leaks when use-gss-proxy==1 To: "J. Bruce Fields" , Wenbin Zeng CC: , , , , , , , , , , , , , , , , , References: <1556692945-3996-1-git-send-email-wenbinzeng@tencent.com> <1560341370-24197-1-git-send-email-wenbinzeng@tencent.com> <20190801195346.GA21527@fieldses.org> From: "wanghai (M)" Message-ID: <9cfbd851-81ce-e272-8693-d3430c381c7a@huawei.com> Date: Sat, 28 Aug 2021 19:26:30 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190801195346.GA21527@fieldses.org> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.176.245] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggeme766-chm.china.huawei.com (10.3.19.112) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ÔÚ 2019/8/2 3:53, J. Bruce Fields дµÀ: > I lost track, what happened to these patches? > > --b. > > On Wed, Jun 12, 2019 at 08:09:27PM +0800, Wenbin Zeng wrote: >> This patch series fixes an auth_gss bug that results in netns refcount >> leaks when use-gss-proxy is set to 1. >> >> The problem was found in privileged docker containers with gssproxy service >> enabled and /proc/net/rpc/use-gss-proxy set to 1, the corresponding >> struct net->count ends up at 2 after container gets killed, the consequence >> is that the struct net cannot be freed. >> >> It turns out that write_gssp() called gssp_rpc_create() to create a rpc >> client, this increases net->count by 2; rpcsec_gss_exit_net() is supposed >> to decrease net->count but it never gets called because its call-path is: >> net->count==0 -> cleanup_net -> ops_exit_list -> rpcsec_gss_exit_net >> Before rpcsec_gss_exit_net() gets called, net->count cannot reach 0, this >> is a deadlock situation. >> >> To fix the problem, we must break the deadlock, rpcsec_gss_exit_net() >> should move out of the put() path and find another chance to get called, >> I think nsfs_evict() is a good place to go, when netns inode gets evicted >> we call rpcsec_gss_exit_net() to free the rpc client, this requires a new >> callback i.e. evict to be added in struct proc_ns_operations, and add >> netns_evict() as one of netns_operations as well. >> >> v1->v2: >> * in nsfs_evict(), move ->evict() in front of ->put() >> v2->v3: >> * rpcsec_gss_evict_net() directly call gss_svc_shutdown_net() regardless >> if gssp_clnt is null, this is exactly same to what rpcsec_gss_exit_net() >> previously did >> >> Wenbin Zeng (3): >> nsfs: add evict callback into struct proc_ns_operations >> netns: add netns_evict into netns_operations >> auth_gss: fix deadlock that blocks rpcsec_gss_exit_net when >> use-gss-proxy==1 >> >> fs/nsfs.c | 2 ++ >> include/linux/proc_ns.h | 1 + >> include/net/net_namespace.h | 1 + >> net/core/net_namespace.c | 12 ++++++++++++ >> net/sunrpc/auth_gss/auth_gss.c | 4 ++-- >> 5 files changed, 18 insertions(+), 2 deletions(-) >> >> -- >> 1.8.3.1 These patchsets don't seem to merge into the mainline, are there any other patches that fix this bug?