Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2379948lqo; Mon, 20 May 2024 04:14:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW9/GDpyNGh1u6XHOvnmfqnS9upAmq+1sp1mtD5cWDDOoJ44W4aZTqojobPA/brvqZnEkgXttsTeRSQTlceN+ku8cT9eL08Otofx75OHw== X-Google-Smtp-Source: AGHT+IFFHrQDZwwL91zuPQ6fXa6w7/v73XyMJCkhFE5SXrMKQXek8FhpPzhuz0LcrPn2V4EomKGn X-Received: by 2002:a05:622a:1899:b0:43a:ecf9:c1c7 with SMTP id d75a77b69052e-43dfdb919f5mr302692101cf.51.1716203674897; Mon, 20 May 2024 04:14:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716203674; cv=pass; d=google.com; s=arc-20160816; b=DLi/hXeUu2PzyWXipbNHOIO81a18aUulggBsh1TKl6SBzo0zsaX39JDRpt70glFh9y rbDN75UVpjcrgNIo1IDay6KB+tS1v4wLBRmrxJAXxAThbt2Nb2hslVeIVt8dGupMdAlo TDTagPVDJPvSrrQElcAgMWF3d7dxLm1KwM8t+q5G1lYwBqSYdo+ZlX/82D0MmYaKN88W +4uD+j4eTrwsCiM02Sm0oZCU6wQFhEjfGql6Ld6VNX8m3MXpsrtDyvveU+02WoqLiYmf W4nxgEaOeXvKOZbqf0xISe6aowbhkXYx2WyiatR8AQCRCc5ORCLmrbwOkFQYtsYXQsLP KQZA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=ze0QU0IZjwK/qQNjHOL8QyAeOCpYeZHmAj/V1x/gVL0=; fh=KTM4KRr/LvGOw9mWzmUOwc0z5L2jyiG0h/ml8qsSDYc=; b=xsE1Usjo5QIII4sxwsZm1XL7Kgwq8VQnfkwdiyzSESOdQSSMgnJMCrPRy0/bKTmynQ YlJnpWt1OHVmebQAVDPStGqX6Z9cfve5aqvega0/JEd1oSJpQzCCNjJlptpqDyyz09hg y11flizgyPkUpAU+vAHTjBbiQzqAZBdXKWXl+H8M64LCGHdVn1EkRD3svZ0mwne4rkk4 BIe2bEBmW9QOEA+PbZoGOJpgXTMt2ealfkZ/1Fmsw/8DaoFQl1IuyVtoPjZb+sD+8v5r RdYjCckv0Rrq+JBxK/uRpzRpjWoRNl2AZhVGlK9A4hrOun5BZ+BcTaZFqc5WcC7oJdqZ Viuw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-183648-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183648-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43df54a0f90si46056881cf.24.2024.05.20.04.14.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 04:14:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183648-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-183648-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183648-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A01BB1C21D86 for ; Mon, 20 May 2024 11:14:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D482535BF; Mon, 20 May 2024 11:14:27 +0000 (UTC) Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 409705337E; Mon, 20 May 2024 11:14:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716203667; cv=none; b=phclC8ZtJzRX0RQmpOO2jQ0Owji1O2Ee4WHECp7NUV7lRva0UBXFYRHha0VP257inJBerBmBLTxTCMs4y527llH4rvFaQJx7vjiXKYYQF7bdoQ/3eg2fLRO01cSMGnlSv1bX5ciUid6OjwJxLHM5KsMRzdtTipUmTj4LJVSE9MY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716203667; c=relaxed/simple; bh=w6EWHG/7umfYX85hJzKNaeqWOnb01B251xQqu8FXNag=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=citahhZn34nyjGqbrXXI9xAoEVs0G4/CHJFwF+3LrM48ir4q3pz1A76rXpMlXakUia9WRjy384dO8+QbkJqMG7PoWrSRMyIchy2QYXCNmk6joVZkSgb5w3awXlcM4ti++oXbc2JeHrqhHxzEfFrsB9SfFCrZcsfAiVDjMiNUplc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VjZhL0Jmlz4f3mJD; Mon, 20 May 2024 19:14:10 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 6CF731A016E; Mon, 20 May 2024 19:14:20 +0800 (CST) Received: from [10.174.177.174] (unknown [10.174.177.174]) by APP1 (Coremail) with SMTP id cCh0CgAn9g6IMEtmiAG7NA--.5841S3; Mon, 20 May 2024 19:14:20 +0800 (CST) Message-ID: <5b1b2719-2123-9218-97b4-ccda8b5cb3b4@huaweicloud.com> Date: Mon, 20 May 2024 19:14:16 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH v2 08/12] cachefiles: never get a new anonymous fd if ondemand_id is valid Content-Language: en-US To: Jingbo Xu , netfs@lists.linux.dev, dhowells@redhat.com, jlayton@kernel.org Cc: hsiangkao@linux.alibaba.com, zhujia.zj@bytedance.com, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, yangerkun@huawei.com, houtao1@huawei.com, yukuai3@huawei.com, wozizhi@huawei.com, Baokun Li , libaokun@huaweicloud.com References: <20240515084601.3240503-1-libaokun@huaweicloud.com> <20240515084601.3240503-9-libaokun@huaweicloud.com> From: Baokun Li In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgAn9g6IMEtmiAG7NA--.5841S3 X-Coremail-Antispam: 1UD129KBjvJXoW7WFy7Wr1ktw4rCryUZrW5Wrg_yoW8XFyDpF WxWa4rKF1vqFW0vr9Fvr9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M, Baokun Li wrote: >> On 2024/5/20 16:43, Jingbo Xu wrote: >>> On 5/15/24 4:45 PM, libaokun@huaweicloud.com wrote: >>>> From: Baokun Li >>>> SNIP >>>> >>>> To avoid this, allocate a new anonymous fd only if no anonymous fd has >>>> been allocated (ondemand_id == 0) or if the previously allocated >>>> anonymous >>>> fd has been closed (ondemand_id == -1). Moreover, returns an error if >>>> ondemand_id is valid, letting the daemon know that the current userland >>>> restore logic is abnormal and needs to be checked. >>>> >>>> Fixes: c8383054506c ("cachefiles: notify the user daemon when looking >>>> up cookie") >>>> Signed-off-by: Baokun Li >>> The LOCs of this fix is quite under control.  But still it seems that >>> the worst consequence is that the (potential) malicious daemon gets >>> hung.  No more effect to the system or other processes.  Or does a >>> non-malicious daemon have any chance having the same issue? >> If we enable hung_task_panic, it may cause panic to crash the server. > Then this issue has nothing to do with this patch? As long as a > malicious daemon doesn't close the anonymous fd after umounting, then I > guess a following attempt of mounting cookie with the same name will > also wait and hung there? > Yes, a daemon that only reads requests but doesn't process them will cause hung,but the daemon will obey the basic constraints when we test it. -- With Best Regards, Baokun Li