From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6B37345ED3 for ; Wed, 19 Aug 2026 13:03:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787144605; cv=none; b=GkYa0AZ8y6BVW59M7cHtNriW1WIJg67LfT5DQaouu+aBcd3qIcHJE9Emyw4XbKbTHlzIKiPlvarzmDfOhXbC5s6VuZPcEjScs2b/Pg1zMpsCKJH1rQ1I4A7UV2SiI0miA3A5K/A1klO+x1vSyQbwCt96XkUHiHI0L4EpJ7pqqYA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787144605; c=relaxed/simple; bh=WxtUFMQheEK0+9+vO3wducy8yRjA9+2PgmYFwwDaa+Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UdcJQixnoT5AeoLj6K5O1TK/COvAbaAZE/aZjP0hd7L5eXwf3SjdA77USPFPW7iQkP4r4AkhiVy8zqWNeAJcn4uTpC9Qq2I6UQS1ttSrogp8ihsnmD0cNPLEswFTHDW7zHvbcvkRtiourGEOrhDtqdTG9hW0kwz6EbVc9WLawA0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TenDGLOn; arc=none smtp.client-ip=209.85.208.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TenDGLOn" Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-39ca0a30148so9983461fa.3 for ; Wed, 19 Aug 2026 06:03:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787144600; x=1787749400; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=p8lfaCFmNaWdgZAGCTvVDVA3Zoz9GOtBOEP81J60daI=; b=TenDGLOnF5jqgtjwCnCwwiXbg9KlG59wcdx/Vf/xEF9c5C+fKOiOZVz/xP00vo8/8J BPamLZ/Z6yq7YpdUSWGOAjU5/RhQ7nnDtzQa8hN7JF6LV6rIbvif/ujClcddQWxabpO/ L2GcAiePs41QPUir3/sS6MB4GKXqhTDCx/uwyxc9N9wcReUcilXMzHS2YJekIoTHvblS G/wKW3nNP7hxBuCXoxNLIU/EX50MpmEkLhqmQQhJKINDVjPJvTx/ayCV/iBZjpYIMcgb EIxbtfzjq1ScYllvl2i4lXriAYlsOZXb/sW0qrxEpA7x4E/9BodLzYs9gpo5ePgyuS2V uJaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787144600; x=1787749400; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=p8lfaCFmNaWdgZAGCTvVDVA3Zoz9GOtBOEP81J60daI=; b=tA0gBNtEpfA/tu+n4au6RgOoTXObSJ2L1F1ddR4qMvqX9TXPETLLWSU/O/BrJSdlhQ bOue5dBR7xuLry7CwpAMdVg/D5FQfib+Fvwh671fBPwEYy/m4e39eltcXHsE6k6PfDas g/k7Kfb4i7PwlzK28iWtxvlx7kj6wDYSra3sqTE40PPIqG54qebjrrJ+zA9ICLmkexl0 Rqg7FSg7IJEmDwaq7L4k23CjNmbg7reeMN/Xf3dhFI8dSXqBDUaCTDw21HlW9tGTV7B+ TMXTTEgKZzfl/YgFeloSqp2KQNbeW+RA3paPpjlebsWryYptJogCOOpMoEsIgOYW57rQ w5kw== X-Forwarded-Encrypted: i=1; AHgh+RrduIc9ZvrR0DwT9+hdigvmuKIMRv9lVjwCCAhHpXzCvHjvsutQWuOg4TlwfhB1gaSbgPBsFLXSOYHAXeM=@vger.kernel.org X-Gm-Message-State: AOJu0Yz8PvWsVUCUhYA/KzblWepbyQdw6bAJzb7AVrrKxiKi+ytFp+DP w1T0TallW0eMDKILF8Pkdc8TzlkpWBnpDx11K1zkEhBFDCunlNZMOyeI X-Gm-Gg: AR+sD13TiCKEM784rMZCYzyf0VO6uj3oP2KEqbDhrABRVwsANQgr0By7ObCnyU2vJ4X T4657Q2UCpGJMokdcBWVCs2ESlFufW+FIeTx0eu6zj8zCjyi0E/NANeh6xWlXBXhNNVVCUR1+MU gqvVwXBwMSIAnJ2kUNJJ1E/nO25L5AbLtALG0QI3LdDxSrDmtLRxPUkS0DjV4ULJr3hPnucTjjc CzHzKFEk+K4zhaRzmQYZMZhnW/hkLntqHurfMMiKHrDXFzZSdwqcSS96Nd+Po/kioV3zq/rgmux IWw9UJjDzUXg707CD0NKU7imsSkFpiInyemYuyeg6NZ7OVzFtUnTilnu+CXD2ZM6YZh94WAtTUf 0zK6dbCXe8NDSl/Jff5ftHtW0pkMfYmJ2mvOyXb/gTvW+WDOe1s3gwNhs3SmWjH5fphd/M490LR jujiKPTylswiNTBWA7Bu9zeD1ScKG4EbByHrDJsclPaGoe X-Received: by 2002:a05:651c:19a0:b0:39a:d7f7:981d with SMTP id 38308e7fff4ca-3a1899e7070mr11061561fa.12.1787144600089; Wed, 19 Aug 2026 06:03:20 -0700 (PDT) Received: from c.. ([213.165.253.80]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-3a189e43938sm4935901fa.41.2026.08.19.06.03.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Aug 2026 06:03:19 -0700 (PDT) From: Narek Jilavyan To: Jan Kara Cc: Mateusz Guzik , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] fs: do not cache a symlink length that disagrees with the string Date: Wed, 19 Aug 2026 13:03:17 +0000 Message-ID: <20260819130317.2864113-1-njilav@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: <20260817161730.699293-1-njilav@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Tue 18-08-26 23:35:53, Jan Kara wrote: > I don't know but to me this looks like overly defensive programming... If > we call strlen() in inode_set_cached_link(), then why pass the length to it > as an argument in the first place? You're right, and so was Mateusz. Please drop this one. Going back over the callers: erofs and ext4 both run strlen()/strnlen() themselves and reject the inode as corrupted before they ever call the helper, and shmem and ext4's create path pass a length derived from the string they just wrote. Every caller already guarantees the contract, and the two that take the length from untrusted on-disk metadata verify it independently of this helper. I cited those same two callers in the commit message as evidence that the API was fragile. That was backwards - they are evidence that it works as documented. What actually remained was "a future caller might get it wrong", which does not justify a strlen() on every symlink setup, and, as you point out, leaves the length parameter with no purpose. Sorry for the noise. Thanks, Narek