From patchwork Fri Dec 13 16:01:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13907411 Received: from outbound-ip168b.ess.barracuda.com (outbound-ip168b.ess.barracuda.com [209.222.82.102]) (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 0E7FC1DFDBE for ; Fri, 13 Dec 2024 16:01:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.102 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734105721; cv=fail; b=VtistoQSjedU83vzDel5qDiCHJBrcmGJOC6h8UsY9uC1COeDuUb1iq4YDNhshekQY5RLaeeoed1ysv/xS43aDldFqBk2SQTKUDEenqPX/HVTEQx5uni42qNxQ5dnZyTx7aMoHagVLVQ0EYxXj7mO2oxLAPVm0Fv6htmr4m75irY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734105721; c=relaxed/simple; bh=Y+jl8fICPjJPTBlBvriWveQNF5Y6GNKCsIMoskeilno=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dtgilRu8m9Z2/ZhZY6y6yO+z60KSQNMfoQSw0Lumbm6F6E1k12gDlzIegMeHy7na5TSUIK+VdCxufM2AyLPzQleJ3n04FDyuPzU+zV5oih+/zDeIgX3ByaxldTrXxjPaptdIqqWi1zzuATt7M563QGOsGPyV3oPP92STbU5o9LU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=fNUU4ur4; arc=fail smtp.client-ip=209.222.82.102 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="fNUU4ur4" Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2044.outbound.protection.outlook.com [104.47.70.44]) by mx-outbound41-19.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 13 Dec 2024 16:01:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UXo085mgGMsRD1IUpMXqVB7tlIgWcOb1svCg6JyCQ7KDO0pofJ2Lf3y5Y+7NZhnIotI0xxdFiufA1rII7NoCJs3B7Aob0Otzsw5n0oK4GKb+JffztlHiwQDOMAEXlYOlslBnB9kUErdQw5VRr+nUOS2+3a7ei3haWwk/PkC2AieFpVXhg6u5C8jK/zF34oDfa9b+CgQdhFqWhvsCCqk46CpusltOZ4g3lsLSvKuVzJ803+IWTeqNo+rIUPw2EazzqUOuGTKSfZ4CTg9k7orl+cZvRAYJHUCGhj8/T3RLN1/woTAyqCT/SFSod0jyttnXzsdBbzN5eCs2z0R9Xp7Qjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZdSps3YBtV07uS+VoI+vP2dxi49kD12z1ukJ6D+LLZM=; b=jaMIvL/a8THGd6Vq7M9JG+gDOTdEmPzugMd468faxVCMpr1k5uS5/TUqdPGclvk/fUDZ57rpdadY5CRK78Q384chH3h73iwJysma5DmFFtmRsOePKJae8GwdfIFYwOC5/y7h/vwrOtbihwocHBUVYkqa5aqdGptMA9PFszbZrLIT7YgnrMMhpdv1NrPOy+1tsxgQhWnd34f8SGLdedYQqrZPFZKL08VxRQQ2+wbP3aVWkqs1vvEgfNGmIzg+D0tR9USg/pmFq5ezMBBLhXyjR4I8Adl0HlvpLv41mZLXA1E4Qp1zSP71yE01pRE0xJ1YxQjePzYUMKgW1ZpHQahQjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZdSps3YBtV07uS+VoI+vP2dxi49kD12z1ukJ6D+LLZM=; b=fNUU4ur47felVpZxz1N2ylUmO5mif5Y/n2sb5YjrBPAhyics5OWj1ruyHYLIEm6pJdHBcYR0SaLM+S6u3Nn3nISDfslChNZneSnFF4U7HTKkPf8235wCqWS/xJjBh/wacHllFDWZy3gFu6RpZWaAHGSHuorqkWbRdberdsl7D3w= Received: from SJ0PR13CA0009.namprd13.prod.outlook.com (2603:10b6:a03:2c0::14) by PH0PR19MB5575.namprd19.prod.outlook.com (2603:10b6:510:14c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.15; Fri, 13 Dec 2024 16:01:43 +0000 Received: from MWH0EPF000971E7.namprd02.prod.outlook.com (2603:10b6:a03:2c0:cafe::73) by SJ0PR13CA0009.outlook.office365.com (2603:10b6:a03:2c0::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8272.5 via Frontend Transport; Fri, 13 Dec 2024 16:01:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by MWH0EPF000971E7.mail.protection.outlook.com (10.167.243.75) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.15 via Frontend Transport; Fri, 13 Dec 2024 16:01:43 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 795B255; Fri, 13 Dec 2024 16:01:42 +0000 (UTC) From: Bernd Schubert Date: Fri, 13 Dec 2024 17:01:39 +0100 Subject: [PATCH v2 1/2] fuse: Allocate only namelen buf memory in fuse_notify_ Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241213-fuse_name_max-limit-6-13-v2-1-39fec5253632@ddn.com> References: <20241213-fuse_name_max-limit-6-13-v2-0-39fec5253632@ddn.com> In-Reply-To: <20241213-fuse_name_max-limit-6-13-v2-0-39fec5253632@ddn.com> To: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org, Shachar Sharon , Jingbo Xu , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1734105701; l=2235; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=Y+jl8fICPjJPTBlBvriWveQNF5Y6GNKCsIMoskeilno=; b=PaVxn/u7zmEPCgyOMAai/xQJ0tMZGJ2BJXo0fRlpqr69KDvJZBXaRcFs/4hZz6lQvwXh2uDEg nacXGCjv7dPB4DfvDNlKKQTh01TxKLhgNHL0RJtpqLbghSi+AWcF60D X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E7:EE_|PH0PR19MB5575:EE_ X-MS-Office365-Filtering-Correlation-Id: 81ed9d4c-2199-4e18-8831-08dd1b8f7027 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?HXAALQNe9EVjfmcNYBBLcV8wXRHouTQ?= =?utf-8?q?uSTXDx6ZhlG766Gw+BrAoy42IEdlXjKt4RALKzSJhaJZ0w0rSQ1POem/dCXsdkXkB?= =?utf-8?q?xqQb61l5kvylc2g0bcbt1spTowl1nVa8xDcZJ734lFcxPzNR6HXYVhvMZbV1RDN3G?= =?utf-8?q?NNNKwmWwe9CCAfD1ABTO/HlBwwKdLKamLDF5VwXiX0U2azBzfgUuYAOfcmnYriRAa?= =?utf-8?q?BpcWIf94l3reC1wUKuacHfZR2pFiyHNuQwiduQyfCRiOBh5hXceb769At1RtT4gGa?= =?utf-8?q?7S7QczdcDCPs9H33MMEcjNVEzLIS8WOMxHFGux40c5Wl4UEm2NR+eJ/pExkROnnCg?= =?utf-8?q?kIhnAm7ZKIom3DFwmOKyIFnYeEVg+azYq2oqctDkrc/s+39ZXf64VKX0tzBsDeyg0?= =?utf-8?q?2/O5VMJFdMHl/I5llTisDBr7ro0x1X1JnP2E4FZFC+ErxEPBxAiDxtr1Vo8jWehkq?= =?utf-8?q?3ZHMMFXLlvYPIa73KhyRd1PAc92q5gjX0mZC6RQeB+uJReMSgqw5rR7KojIIOzmI9?= =?utf-8?q?ZslqzEC0rRk8A5yBjdzm/F/PL04D7jc0vEgcn5mPUL6WGhUWFnNwS9QhYi8hqv/3k?= =?utf-8?q?Z+diEwy9TEglHivK9YvFsMWoWYPDu0uGfd+EWo20mgI9tuT2dh9hkCPGtsoLKViF3?= =?utf-8?q?hwQsoiFG/gefkBlBDp1uY98/nO7TQQgXp3XI4JULzRjeZvPDi7EAaa96P+Z84gGwA?= =?utf-8?q?5g55AWvnRrA3FKoYG4Nfh3tbkIFKgIVhHRMUUJAE6fDN+zdTnJvrAi+Wh0tGRMkEJ?= =?utf-8?q?9JjWhwCjeZRzQvOQZvG8LV7idD4SDl+8nhOG73PqoaVCYgpqwoDFnGkpt3R03jyIq?= =?utf-8?q?6S09SJonScgjJd/LHIEwMc6fSvHw4cTEq/gffuJRZFmZ2uyUjm7SERNTQMhHXEWKN?= =?utf-8?q?pt5w/cKmB2v7kh2KKpRMOo489GdtINbGsdtouZCjDnInfPz2gyHaA+PgXiRje2HbK?= =?utf-8?q?LFOay4sUflZ29y6CFeWoybIsoY9Jj6DrLFUaiRPzqM2Q1QBUbM+ColpxZEfaWcmkt?= =?utf-8?q?TVlbefBJ2UxkIJKrUNtWhlx1b28lbBDsUtVNzuDs6/YE9pJVatFM+jI2URXukqUCp?= =?utf-8?q?XI0Z+CaZrnwxdD7CfQJskMQaKg4/S8PoR6OoZtSRUJkdCVkVE49haygsfi+gFLjqy?= =?utf-8?q?e+V4UW6wRYp5GAk4NNpofSyIqoYveoLa9MvYaBRKaeIsejC9/3loDdQrr8nW6Yu36?= =?utf-8?q?0VB/o6OraOvnSu2xKW+r58uH3PhpdVL7FjvnVdjq59iLkFC9kTwCdLN8cRVRg05D6?= =?utf-8?q?J5f3Ob+ndGDG+62t7ykymisqmUw2JSHy4wFNzSJOfU1rSzbUYYqdsiDYzeA9kEl6W?= =?utf-8?q?Qk19uGAqYXhP6/cE58fSyMM3aCHH6pcoglnXagYV9QPQXj1XWaaLqyN/Y2vRfwG1r?= =?utf-8?q?wwH+ipi2EAG?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(36860700013)(1800799024)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: d6EJiUqTyOdNbgvLQ0Ti2bAp2l+f4nqOiVYJoSAMv7l4O0jePsaOreUrFYUFBKt58a6GBvR9zutImI1C6FeWjvjt12FpxyLhOP7QWKnOtPpaCa7hZNYZd461YI9EXB5YqM0bYm87lvjm1G5J5879m+fPCSxxPuEjTwdnrKK5q4GQ/q9hqX+oXfC5HF4Oe8qj5Zg6WYSUFW+k1M4PPTDq2T8c4WREXUIJaBeWS+g8PV1N9yikYYx81Bz280Q2y63fBg6nBU3ahU/oK9vuRcHtthvKS8uAHQjYiGHl43chFBS4dXL32egAsGw0v21YPa760JzQt2Psi64+8ffgUYDd8RsjUlUL1BjD6Oq2JmuArR9TFUkKRN2YBdnfvOiofLD4wZgdNwr22BtJhP4FBlKG3KFIV4U/33flynYBvTDro6OPJMeceYNRctZhCYtFL4ZkKHcdXvbNzxkHszgwXNaTz80/O7LlaJ+zkqnNU3gh2dSW1MGj6URUZqFVbaxtDLobKZ5Ec+quzjk4k7l2l+jOPsEiv9vgEWvSABy8UI7Vds0i1aoMLag9QDkqUDb85p83GtTy8K/eNixqRGiWC5m2SUZdbBw4oDcxrZrLHJm7exrrHDSLzT1pKZt0uXPVZtXGE4WHm1DUNKNlYo/nfhUiqA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2024 16:01:43.0671 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81ed9d4c-2199-4e18-8831-08dd1b8f7027 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000971E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR19MB5575 X-BESS-ID: 1734105706-110515-13346-27300-1 X-BESS-VER: 2019.1_20241205.2350 X-BESS-Apparent-Source-IP: 104.47.70.44 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkaGZgZAVgZQMM3U2CQxycLSMC kxMcnE1CA12dggNdEoJdksJcUkKSlZqTYWAOjb6fxBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261086 [from cloudscan15-9.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 fuse_notify_inval_entry and fuse_notify_delete were using fixed allocations of FUSE_NAME_MAX to hold the file name. Often that large buffers are not needed as file names might be smaller, so this uses the actual file name size to do the allocation. Signed-off-by: Bernd Schubert Reviewed-by: Jingbo Xu --- fs/fuse/dev.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 27ccae63495d14ea339aa6c8da63d0ac44fc8885..c979ce93685f8338301a094ac513c607f44ba572 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -1525,14 +1525,10 @@ static int fuse_notify_inval_entry(struct fuse_conn *fc, unsigned int size, struct fuse_copy_state *cs) { struct fuse_notify_inval_entry_out outarg; - int err = -ENOMEM; - char *buf; + int err; + char *buf = NULL; struct qstr name; - buf = kzalloc(FUSE_NAME_MAX + 1, GFP_KERNEL); - if (!buf) - goto err; - err = -EINVAL; if (size < sizeof(outarg)) goto err; @@ -1549,6 +1545,11 @@ static int fuse_notify_inval_entry(struct fuse_conn *fc, unsigned int size, if (size != sizeof(outarg) + outarg.namelen + 1) goto err; + err = -ENOMEM; + buf = kzalloc(outarg.namelen + 1, GFP_KERNEL); + if (!buf) + goto err; + name.name = buf; name.len = outarg.namelen; err = fuse_copy_one(cs, buf, outarg.namelen + 1); @@ -1573,14 +1574,10 @@ static int fuse_notify_delete(struct fuse_conn *fc, unsigned int size, struct fuse_copy_state *cs) { struct fuse_notify_delete_out outarg; - int err = -ENOMEM; - char *buf; + int err; + char *buf = NULL; struct qstr name; - buf = kzalloc(FUSE_NAME_MAX + 1, GFP_KERNEL); - if (!buf) - goto err; - err = -EINVAL; if (size < sizeof(outarg)) goto err; @@ -1597,6 +1594,11 @@ static int fuse_notify_delete(struct fuse_conn *fc, unsigned int size, if (size != sizeof(outarg) + outarg.namelen + 1) goto err; + err = -ENOMEM; + buf = kzalloc(outarg.namelen + 1, GFP_KERNEL); + if (!buf) + goto err; + name.name = buf; name.len = outarg.namelen; err = fuse_copy_one(cs, buf, outarg.namelen + 1); From patchwork Fri Dec 13 16:01:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13907412 Received: from outbound-ip191a.ess.barracuda.com (outbound-ip191a.ess.barracuda.com [209.222.82.58]) (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 259EE1422D4 for ; Fri, 13 Dec 2024 16:01:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734105728; cv=fail; b=ufaTRGAP83hFa6cn+cBIiiaOsl80JGOXUJtMko8fNPj3Kq1nuoCChEeFu/2kaUeMIdEQjk6VZE4yGmZC0cupes87B1jP/F36j0hD2jknB7D2Fz3r7d6yEgbSUwvxkdeADMOCWcWOC/rI6gU5aEUHwIY8d0EVAvo1Ild9VFKDwmc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734105728; c=relaxed/simple; bh=X6OIB2bYDd7oxNCztYJzfMCQe7eHrAwSQKRXsrPQ3aM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QL4uMfzYrzcIROZexh9mOM+sD97UhVYcjXReQmneAtbk51K/P2GV4cAyNNG3r6AuogjuOM4DFWGl7PB+Aewm+TlB+Awb6pAuh7P3YNv20xWiHniVmpC+QQW2fVtkgOCZhHtw8it5D19r+fgBPQpx+VEZ1u3ISHLYEPbJTZzjBv8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=0raaWW5M; arc=fail smtp.client-ip=209.222.82.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="0raaWW5M" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2170.outbound.protection.outlook.com [104.47.59.170]) by mx-outbound14-204.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 13 Dec 2024 16:01:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WusVqiNbUpAvk0RTiCPJIYYKopXpyfpPeTpfiI6uBfSNJ2pu02xizqQMoCgDD8Cbhy8rkDX1LqqjdCFOuhXvvO76Yecg8CIggI7lKR1/Kn8nk7RgGa4/1vbLaUo35U3ovnoPAEtwLRkdecLCNFwsx7qS/TRDl1C9EoA5JFf0/BMD5aVbv5FH6E+W92Dut0FRsrrWz6CzF6UqgeI5ZhZYKg/k5c7jwr7f4352Rlzd6myE4c5GeO4VvGaF5Lbndx2IDcdbuG5lTQXcNa1/VorunuGiG0w45hntGGJMRtugaWSEzvPeV7cG4Ye3eB4LkfA5HuPDHxe3/RMRpY9K07oF1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=e5GgVXxbtgnZT6r6AEmIhQT7BL7NEhAkO/rs5iOHZgw=; b=zGWLCUSQKaybb3SeGOjtTThHCQ3seb3jmai/1k/9seuj5srF469HXECbrCFIPi+LnGpmcz3JxgrO6n+seK0u6g2qummCG8q487eVtcOIGuRMPaLdE6QKIsjCjKDLpQQUsqy87jc61tLv7/hiV57hYMGoCLvpffrFnRC9CnFGqGKwJlzkbXggQ5Xn54GglvHBBW/99ywU2EWsDX7tztK/QXgUlsu32G8C5HTchbA7P9rnEzOcscN/TZW6NefWUzzSuzYbtvj+YpKoWFA5plkbUs/HuMbE4Bh6ROJT+DqKv6ISTT6kNH5ACU0j6CFEdIJ6M5S5CVhgoiw2YqsRrjb+0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e5GgVXxbtgnZT6r6AEmIhQT7BL7NEhAkO/rs5iOHZgw=; b=0raaWW5Ma9e7JYISBllGIQhIRxaHbFHplT+PHMtLYcDE77UgkHqBb9bygWdm5eVdsqSfLWEMc0MQhvdI1Y6U2K+sndI7ET3+2gFFVolhrL1XEQlm97Ge3+kbtR+N+GJWUcVd++4zufTHBYT8QNMBm+VwjQfZKJ1RNZmkLEmKGkw= Received: from SJ0PR13CA0011.namprd13.prod.outlook.com (2603:10b6:a03:2c0::16) by PH7PR19MB6063.namprd19.prod.outlook.com (2603:10b6:510:1de::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.16; Fri, 13 Dec 2024 16:01:44 +0000 Received: from MWH0EPF000971E7.namprd02.prod.outlook.com (2603:10b6:a03:2c0:cafe::bb) by SJ0PR13CA0011.outlook.office365.com (2603:10b6:a03:2c0::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8272.5 via Frontend Transport; Fri, 13 Dec 2024 16:01:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by MWH0EPF000971E7.mail.protection.outlook.com (10.167.243.75) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.15 via Frontend Transport; Fri, 13 Dec 2024 16:01:44 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 76C854A; Fri, 13 Dec 2024 16:01:43 +0000 (UTC) From: Bernd Schubert Date: Fri, 13 Dec 2024 17:01:40 +0100 Subject: [PATCH v2 2/2] fuse: Increase FUSE_NAME_MAX to PATH_MAX Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241213-fuse_name_max-limit-6-13-v2-2-39fec5253632@ddn.com> References: <20241213-fuse_name_max-limit-6-13-v2-0-39fec5253632@ddn.com> In-Reply-To: <20241213-fuse_name_max-limit-6-13-v2-0-39fec5253632@ddn.com> To: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org, Shachar Sharon , Jingbo Xu , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1734105701; l=1356; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=X6OIB2bYDd7oxNCztYJzfMCQe7eHrAwSQKRXsrPQ3aM=; b=OFx7d4QJB4ZvEUelY896yO1oW6mD0PaUWldOVqchVxpe1mYOpfkqjaQ4JxrEpapoZ3rV1Na2d mwSX0P47ss2B1sbQfXWXiVG4UNq3sdwR6TWiiepvazo+LXbl+ZePZPT X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E7:EE_|PH7PR19MB6063:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c127917-a025-4ec6-6e37-08dd1b8f70af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?XgYc2LronN8UB3fiaBiS4Kq4zvq3CvC?= =?utf-8?q?zVRTRA1LChjCeYii/Iqcfk8wjYafpgQypcm6QrzwfL79QFDY8xpzyi49pxetfS7bG?= =?utf-8?q?XaaDQZLZqFZqiBpfuU6MToFExsNECThfDqhLvqhVloHOulxOqkhFIu4DtClD5pvn1?= =?utf-8?q?zd6cOUGlRPd77FRiAoxiubVZD4L/kW+2wz9gVnGTKRTaT4lLXR3PRWJadJAJ/4NHA?= =?utf-8?q?xYTEkgFo6L2mL7DAVpPqd3o55GhB46QgdtpWEWvOBH4SrsVMtM5ynXQKwnvEwW1kq?= =?utf-8?q?K01+sN5bCsc4AlyOOSW2YO2f8BFo54vTK0/Js28oleAHVtLyZ8b9Bqvu6KdHU/ryu?= =?utf-8?q?MLuG5+Eos4KEu59fX5/guPxFRHZKPxt9KeL5fi1BOELmKVSbk8v6S05W2QsACd7uc?= =?utf-8?q?aBfHH03nz61Ai1LXQam2flf01clqU68QGkC6H7jWeJ4krHSDTmg75W0QiMN3Inn8l?= =?utf-8?q?MGag4pfoHm+q7CnPvpqRdjBhXZUYZJrnMXwR3tw4a6o1l6ipT0BPV4BQHUeHrvBzc?= =?utf-8?q?cWwzVRo1T2yLFIHPc1KI5yictysl1euzX61+yznVfxmM/x6/BhJVfuzurvbbAHFkE?= =?utf-8?q?meYv3udH2JAJUl+njwfCPtnp8vS1r2vA1IEZJ1ynW9t6Phaqz5tldGX8prJV9nIsq?= =?utf-8?q?YB7YCM4+mfQFqXQAoJ9d9wYnTgKLFt/+Yz1CjHXnVMSydF1TwVYdJSdfsAKjO0Q/o?= =?utf-8?q?j/YRr5MEzSKQiOEfJv1cZD3Ilk8/RJ5tCDwUxyodP/QkIkgpDimg/BvJa60Kc2WJT?= =?utf-8?q?btaxDEvNeLwPK+vSM/1OUiQwMan7R385E0d5UehjhEY1BYR7i0/wqUiB2tebCqtE9?= =?utf-8?q?V0KImEwAOkKnOSwKG4rEb640HOBbMpKXbfP8avVK+HbUBz1A4iR+rUbZukJ3Luss3?= =?utf-8?q?tLJeQjoQuQgtyPqxMo4yfs9ZF6WhZJ4QEWSow1Lf90M4fEvb+GAvS0tkK4o6gbqLg?= =?utf-8?q?pAUdva/j6Ro7uSAgsY5E5sDxpsJdp8qU5YvC+XdFYZPrzx51as/IE/DX6p0Up+XNK?= =?utf-8?q?fZ2rf2f+oXu02L87YOtB9gjyIYvzx1VAIXjNBi7J6riiMfOjZHJ5/I0zZce79X9Yq?= =?utf-8?q?yoGIJv6sUuHc1UGhFxeUDJfjp/nveXScn3/DGAyFgxDUmKJYjjhsaRc/1PhVcE7Ub?= =?utf-8?q?xRZhNLY8bFclfjE5lVR/8kQQyWQs87DlY/vuWFzlrCNV89xnF5e1EqlWu/D/NwvnT?= =?utf-8?q?lvvgVeyzzG37osF6hSx2w3USh6m6dpl23zOLbKzFQ5gsL+2vBIAUuDAam32Fh/HQq?= =?utf-8?q?q1BzwO2SqcdrpCPq5bMNZRwtsK8IV/Yt910tjXL3Mf9NzSWktxgO1HQbYUHBeeJYv?= =?utf-8?q?lw9QU9NqUSQ75mgMuqk106eZ7Cjb1x1nabVdIRrW+D0RNljhNRNCjll+/C7FeTm9l?= =?utf-8?q?5tZeKKSlNwv?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(36860700013)(1800799024)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: cDmY0DeCP0CGBiIS2qnfdBGG1EvdXl5uhXlD+UuqQJeihDSsS/EKuDOclP5WsCmaETXioEK+X2IPLLh8A8v+dTMgcVMtWyioVJF83B08iHwCaTsjaegA/4jl7UndCO9evtKGx+CEzK8iP2xeqqg02dxGW9idex/FFLk2n0EIUMMm9NgVsryKx0Sb4hiyaXXcadltOBA+GfQXllun6LovtfLVCL4hNePeGnqfHmtDHSOyOegCPEeexP0WXv0OcCSaykZgI0B94eAjebHx9m1rC0hvoGRdc89o+hQQrDL6s2zKwpwy83AueH62w7aGZbUIkgB+r9Yk8WH8b04HkbyOnf2yGJsqJsys1WxEzVuzXVJYpw5njO9HuO4LXe9R58c6ueTUAdpDdIDzegpS6ZJBXEHv8boLBx+k0T8L4VcKs9bZ5/3CbZX4z917hIfYwcX+XJ520BwnJect/pa9+ltYT8u4oicnCR4nhfY1i+gyPPxFaL7gKX2yMfeqLSLoS8UcUDSQ4SoindZzPCPxkWG8CBeqVybchQTh/BzLmOW61gyglMRu39/pHSlRQ2lXrQhO+aYNodQe4b5/bILbDUOvu6p1B0DxHmpe7p6V9nnczsRuAjvqMeVUCqMPPdIQyMh5CZsWjJFxgdVVFJ+1YnFDNw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2024 16:01:44.0203 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c127917-a025-4ec6-6e37-08dd1b8f70af X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000971E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR19MB6063 X-BESS-ID: 1734105707-103788-13490-6909-1 X-BESS-VER: 2019.1_20241205.2350 X-BESS-Apparent-Source-IP: 104.47.59.170 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVobGRoZAVgZQ0CzFNDnNyMQkKd EwOS3NKNnQ0Ngw0cDcPMkkLSXJNClRqTYWAJz6aMFBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261086 [from cloudscan18-105.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Our file system has a translation capability for S3-to-posix. The current value of 1kiB is enough to cover S3 keys, but does not allow encoding of %xx escape characters. The limit is increased to (PATH_MAX - 1), as we need 3 x 1024 and that is close to PATH_MAX (4kB) already. -1 is used as the terminating null is not included in the length calculation. Testing large file names was hard with libfuse/example file systems, so I created a new memfs that does not have a 255 file name length limitation. https://github.com/libfuse/libfuse/pull/1077 Signed-off-by: Bernd Schubert Reviewed-by: Jingbo Xu --- fs/fuse/fuse_i.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 74744c6f286003251564d1235f4d2ca8654d661b..a47a0ba3ccad7d9cbf105fcae728712d5721850c 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -38,8 +38,8 @@ /** Bias for fi->writectr, meaning new writepages must not be sent */ #define FUSE_NOWRITE INT_MIN -/** It could be as large as PATH_MAX, but would that have any uses? */ -#define FUSE_NAME_MAX 1024 +/** Maximum length of a filename, not including terminating null */ +#define FUSE_NAME_MAX (PATH_MAX - 1) /** Number of dentries for each connection in the control filesystem */ #define FUSE_CTL_NUM_DENTRIES 5