Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp175116lqd; Tue, 23 Apr 2024 20:38:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXAAJGoxUdjUtIXVSvaH0ohE9g7j5C3Lv08e48TV9+r1PDs82N2CmftUnBSSzbN7Ur19z7dSnrCMrvCLpW+gaLzCjwIcMzS/yp5FelCSA== X-Google-Smtp-Source: AGHT+IF9n/sySZdb1cs7Z5PdbsTwLZnQYtrRhfvYOFoHeeE+1Yd3uTJ0jnJ0QTqbP7G0DBelgwa4 X-Received: by 2002:a05:6a21:3d94:b0:1a9:b2a6:1d23 with SMTP id bj20-20020a056a213d9400b001a9b2a61d23mr1203959pzc.20.1713929921141; Tue, 23 Apr 2024 20:38:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713929921; cv=pass; d=google.com; s=arc-20160816; b=TYC1WcQoWCfSmHINlWXgV9NlMsQJChxlNwivZAS4KgM46sNy1YhAkmdgmgTzqFCUcn sddiU3eR/D/3vmKgIQocC+3A5qKidTLHkPPMUQRu92ocH0tf5W+GAnCxxNOGgCwe77fP /B6QBTa0QX5CR4waUwcIUKyAeaFTz/APXEy3q6TrszHkv6CTmPGQbTHtHX4GISfio/z8 70JxaQEHcR8tKLukYmIFSL8Lq3yxmSv4N1jLGjzIQhPE/Ec7yyU0NjcwfBU22UZJsOaZ p1SdZAAhO9t72522lNR6FAJsXcUctXgsFHWVy24a/BwQ8BgsEqIEmB3TI0PhM9Wr60TV LYKg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=nnvln6zWwwHELpOsqPTjOUmqg9SXxWBIXRv0/cY/Kcw=; fh=3CsaseL1DGH+EMXcTH0kn5GO4vnHCl+kF9eyofb3vLk=; b=SXy2QES8+C1ZlJlkdxoZpWbB5+z/NpVJQ8X95AauWw5r1zqp7XvwhxaQP4thwVIsIf 9ohTztj36BkGsQaksi+Uz8Vd3HxnAAHjQ8Y3Z9cVlSxutHC0bRQZPAMeKKh/NCJCBw7f hnea4tVIfmZefyJbicNsRqqX0BJKU25QiEHYvQFOHZsQB9r67Z6dt0qJIoLMi6fKGRiQ 3lUaE6QXoILFX8l18JhSLEdHfXvCxDqlu3n/pQNVWKr96jSIJuD/4Ms/uwtxWQkbSpd8 P54DKs3pKALIS04MOQ/3zEDXssUS5uRa0ub47tZ9toMy7jaD+5aLN/T4bMbXjGTuufiT SihA==; 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-156216-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156216-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id t10-20020a170902e84a00b001e7e0e0fa76si11184275plg.95.2024.04.23.20.38.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 20:38:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156216-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-156216-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156216-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 6FBF9B22C1D for ; Wed, 24 Apr 2024 03:37:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 31DC4142659; Wed, 24 Apr 2024 03:36:54 +0000 (UTC) Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) (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 8D4C313340B; Wed, 24 Apr 2024 03:36:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713929813; cv=none; b=ZBUIIFDCXjGx8dVj+oR/hj4j2FCPoNCC2u3x4GQ8ITFy/UXFLZYtWAD8gYrQA+S6VDH3BsVG4b6PPTgjoL2mCheqVM2KXDL7dDzlcGAV+2vTnkO0nf/c9ZumdkgWV7dMQ0DU0kQAqPNJ+nCEMIHaxUisg/QY0ifxyvjuoMVD5bI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713929813; c=relaxed/simple; bh=GRaCHqEtnIFPBbuvFtR79mT6Pen0M9PcasM0W2yyRFM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=r3/J64Tewy5eYHS6BXj774C/w9p0V3AMZWH50uEDe5imlr0UdwpF8rosSVo8nBN0OA/qxMb7z215iDVSiiKl0N2UCLS1DYx7xF4X5IvB+2Mz8Jq5KssxNMr9l37FxJ2D+c8VR47nsYxINWAq+IXl007UeqRU6fZ760ZClmOkOzQ= 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.56 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 dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4VPPmS3fb6z4f3jM2; Wed, 24 Apr 2024 11:36:40 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 0CE8A1A016E; Wed, 24 Apr 2024 11:36:48 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgBHZQ5Nfihmarc3Kw--.25590S4; Wed, 24 Apr 2024 11:36:47 +0800 (CST) From: libaokun@huaweicloud.com To: netfs@lists.linux.dev Cc: dhowells@redhat.com, jlayton@kernel.org, linux-cachefs@redhat.com, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, libaokun@huaweicloud.com, Baokun Li Subject: [PATCH 0/5] cachefiles: some bugfixes for withdraw and xattr Date: Wed, 24 Apr 2024 11:27:27 +0800 Message-Id: <20240424032732.2711487-1-libaokun@huaweicloud.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgBHZQ5Nfihmarc3Kw--.25590S4 X-Coremail-Antispam: 1UD129KBjvJXoW7uw18JFyfJFWDXrWkWFyfZwb_yoW8Gw45pF WayF43Jry8W3y7Gw1fAr15Jr1rA3s3JF1vg347Wr18Awn5Xr1jqF1Iyr15ZFW5ury7Jws2 q3WUKFy7Ww1jy3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBY14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWUWVWUuwAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2 Y2ka0xkIwI1lw4CEc2x0rVAKj4xxMxkF7I0Ew4C26cxK6c8Ij28IcwCF04k20xvY0x0EwI xGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480 Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7 IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k2 6cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x 0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUUtrc3UUUUU== X-CM-SenderInfo: 5olet0hnxqqx5xdzvxpfor3voofrz/ From: Baokun Li Hello everyone! Recently we found some bugs while doing tests on cachefiles ondemand mode, and this patchset is a fix for some of those issues. The following is a brief overview of the patches, see the patches for more details. Patch 1-2: Add fscache_try_get_volume() helper function to avoid fscache_volume use-after-free on cache withdrawal. Patch 3: Fix cachefiles_lookup_cookie() and cachefiles_withdraw_cache() concurrency causing cachefiles_volume use-after-free. Patch 4-5: Propagate error codes returned by vfs_getxattr() to avoid endless loops. Comments and questions are, as always, welcome. Thanks, Baokun Baokun Li (5): netfs, fscache: export fscache_put_volume() and add fscache_try_get_volume() cachefiles: fix slab-use-after-free in fscache_withdraw_volume() cachefiles: fix slab-use-after-free in cachefiles_withdraw_cookie() cachefiles: correct the return value of cachefiles_check_volume_xattr() cachefiles: correct the return value of cachefiles_check_auxdata() fs/cachefiles/cache.c | 45 +++++++++++++++++++++++++++++++++- fs/cachefiles/volume.c | 1 - fs/cachefiles/xattr.c | 5 +++- fs/netfs/fscache_volume.c | 14 +++++++++++ fs/netfs/internal.h | 2 -- include/linux/fscache-cache.h | 6 +++++ include/trace/events/fscache.h | 4 +++ 7 files changed, 72 insertions(+), 5 deletions(-) -- 2.39.2