From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796306508; b=dODmO5BMxhluxdN3IGv1ovu+6Ujsdgl/8HzAFL6JyiAPmW9WPm61UDtzD8XLIA2L/ItL XcEKXnzaNGFaH/QcMWuQiYEB5elI3si39qw6xyj25ZZZI4XeHeKQlRnbHtyNaXq2QSeWZ 8JP1BGexyss43uREXnD/lXXocylxpKIM6YVX9hUJ1HKf2Y9eSDQhl5/x+8OasP93HzJ20 oP0lpwnNiZYE4uvs0zwT6RsShexWrtYGwuANclPvj1UJ6NqnWXIQNvQ+q6+dDMxV7iRv7 3fumDY1Ne1cj9qDjoqrdTb3oeP0fP/XkJBJHn2LvnrP/6SyAgMJZ2IKahKCpZrL78Vg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796306508; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=A4yWCD5Je4P4yqwy48CF0bbednLVkzikf3ooJHJp6CU=; b=lf/tAAFux1BymGKwAF27+vI075cfPgEg+Y3TTiG5Ocka042ZbR/PdacciDRPtomks0KC CkfdIZPUlOvjj8TryFIh3mNXt9D2yBGxRflWpUDgFRPMJLz1De6p9Tl/xM3/HO3jqnJtK hUS0o88fcc3dUqDz8k7reBWZCsbxyux0PGo5G3K6//bseKvzcKqtKm9LGJQ6dqp+WmXjz TvW/r3mxtkLmxIBKJsDIQoFcWjNKz4zTGEcBVdO6TwZUsouNXx9vHpYKqwXMr13ZJ7x+W IPNvUJAH7EeeC4MguVAeW4VTF+pKJs7ad41Fmrv+avJGbWizJTc9K5LgxCqB9CaN1jg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JPUD+OT3; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BB1E606A322 for ; Thu, 3 Dec 2026 14:01:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=JPUD+OT3 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A245F1F00893; Thu, 3 Dec 2026 14:01:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796306507; bh=A4yWCD5Je4P4yqwy48CF0bbednLVkzikf3ooJHJp6CU=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=JPUD+OT3EcarwuAkefk5qqn/BrwbVJaiP7OLHHlKbANttfCUYRe1Imaujmp/GTT+X DPZbjf59BOx8aqF9z0dtzZJ8xgkZo+hM5kKXr3jFlwmQMoYUGwinbcl6RqPl3GxrKS 3XjwuJTmAbxLLIYn418tximC0cXLs5VXkY7Xgm0EAI0IRMVCLu+xDL37OAWYKxXfBl zkN9mMlRYiYsg+g+CI7Hf5oTadHjDOWReUryhZmmXGp4Nh9pDxLIiGUzJzz8O/MEgQ cvfrbQGSTM9+EbZHEw93nEyjtnbkBAiRAwMzLXwWrFYHuIcLfRwvbo8vfdZsWeoTsK 0sFjxpDJh//yQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v1 bpf-next 2/3] bpf: Add a bpf_get_inode_xattr kfunc Reply-To: sashiko-reviews@lists.linux.dev To: "Anton Protopopov" , bpf@vger.kernel.org In-Reply-To: <20261203134411.1092433-3-a.s.protopopov@gmail.com> References: <20261203134411.1092433-1-a.s.protopopov@gmail.com> <20261203134411.1092433-3-a.s.protopopov@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 14:01:47 +0000 X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] bpf: bpf_get_inode_xattr() ignores hashed aliases via d_find_any_alias() -- commit 411b1cdf4c29cccf8363d8423d9bb02ec61b59b9 Author: Anton Protopopov bpf: Add a bpf_get_inode_xattr kfunc This commit adds the sleepable bpf_get_inode_xattr() kfunc to read an extended attribute from an inode by looking up one of its dentries with d_find_any_alias(). > diff --git a/fs/bpf_fs_kfuncs.c b/fs/bpf_fs_kfuncs.c > index 1b973bd4e5355..654340a0bc70e 100644 > --- a/fs/bpf_fs_kfuncs.c > +++ b/fs/bpf_fs_kfuncs.c > @@ -169,6 +169,35 @@ __bpf_kfunc int bpf_get_file_xattr(struct file *file= , const char *name__str, [ ... ] > +__bpf_kfunc int bpf_get_inode_xattr(struct inode *inode, const char *nam= e__str, > + struct bpf_dynptr *value_p) > +{ > + struct dentry *dentry; > + int ret; > + > + dentry =3D d_find_any_alias(inode); > + if (!dentry) > + return -ENOENT; > + ret =3D bpf_get_dentry_xattr(dentry, name__str, value_p); > + dput(dentry); > + return ret; > +} [Severity: Medium] Should this try d_find_alias() before falling back to d_find_any_alias()? d_find_any_alias() returns the first alias on inode->i_dentry without skipping unhashed or disconnected dentries. Path-based filesystems rely on the dentry in their xattr callbacks; for example, cifs_xattr_get() builds the server path from it via build_path_from_dentry(). When an inode has an open unlinked hard link ahead of a live hard link on inode->i_dentry, bpf_get_inode_xattr() passes the unhashed alias to __vfs_getxattr() and spuriously fails even though a hashed alias exists. Trying d_find_alias(inode) first and falling back to d_find_any_alias(inode) on NULL, as inode_doinit_with_dentry() in security/selinux/hooks.c does, avoids this while still handling unlinked open files. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203134411.1092= 433-1-a.s.protopopov@gmail.com?part=3D2