Re: [git pull] d_revalidate pile

Sasha Levin
2025-01-27T17:19:55Z

On Mon, Jan 27, 2025 at 04:47:21AM +0000, Al Viro wrote:
>->d_revalidate() series, along with ->d_iname preliminary work.
>One trivial conflict in fs/afs/dir.c - afs_do_lookup_one() has lost
>one argument in mainline and switched another from dentry to qstr
>in this series.
>
>The following changes since commit 40384c840ea1944d7c5a392e8975ed088ecf0b37:
>
> Linux 6.13-rc1 (2024-12-01 14:28:56 -0800)
>
>are available in the Git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git tags/pull-revalidate
>
>for you to fetch changes up to a8ea90bfec66b239dad9a478fc444aa32d3961bc:
>
> 9p: fix ->rename_sem exclusion (2025-01-25 11:51:57 -0500)
>
>----------------------------------------------------------------
>Provide stable parent and name to ->d_revalidate() instances
>
>Most of the filesystem methods where we care about dentry name
>and parent have their stability guaranteed by the callers;
>->d_revalidate() is the major exception.
>
>It's easy enough for callers to supply stable values for
>expected name and expected parent of the dentry being
>validated. That kills quite a bit of boilerplate in
>->d_revalidate() instances, along with a bunch of races
>where they used to access ->d_name without sufficient
>precautions.
>
>Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Hey Al,

With this pulled on top of Linus's tree, LKFT is managing to trigger
kfence warnings:

<3>[ 62.180289] BUG: KFENCE: out-of-bounds read in d_same_name+0x4c/0xd0
<3>[ 62.180289]
<3>[ 62.182647] Out-of-bounds read at 0x00000000eedd4b55 (64B right of kfence-#174):
<4>[ 62.184178] d_same_name+0x4c/0xd0
<4>[ 62.184717] d_lookup+0x40/0x78
<4>[ 62.185378] lookup_dcache+0x34/0xb0
<4>[ 62.185980] lookup_one_qstr_excl+0x2c/0xe0
<4>[ 62.186523] do_renameat2+0x324/0x568
<4>[ 62.186948] __arm64_sys_renameat+0x58/0x78
<4>[ 62.187484] invoke_syscall+0x50/0x120
<4>[ 62.188220] el0_svc_common.constprop.0+0x48/0xf0
<4>[ 62.189031] do_el0_svc_compat+0x24/0x48
<4>[ 62.189635] el0_svc_compat+0x34/0xd0
<4>[ 62.190018] el0t_32_sync_handler+0xb0/0x138
<4>[ 62.190537] el0t_32_sync+0x19c/0x1a0
<3>[ 62.190946]
<4>[ 62.191399] kfence-#174: 0x0000000012d508d5-0x0000000023355f7e, size=64, cache=kmalloc-rcl-64
<4>[ 62.191399]
<4>[ 62.192260] allocated by task 1 on cpu 0 at 62.177313s (0.014839s ago):
<4>[ 62.193504] __d_alloc+0x15c/0x1d0
<4>[ 62.193925] d_alloc+0x24/0x90
<4>[ 62.194204] lookup_one_qstr_excl+0x68/0xe0
<4>[ 62.194741] filename_create+0xc0/0x1b0
<4>[ 62.195129] do_symlinkat+0x68/0x150
<4>[ 62.195657] __arm64_sys_symlinkat+0x50/0x70
<4>[ 62.195954] invoke_syscall+0x50/0x120
<4>[ 62.196461] el0_svc_common.constprop.0+0x48/0xf0
<4>[ 62.197053] do_el0_svc_compat+0x24/0x48
<4>[ 62.197411] el0_svc_compat+0x34/0xd0
<4>[ 62.197849] el0t_32_sync_handler+0xb0/0x138
<4>[ 62.198422] el0t_32_sync+0x19c/0x1a0
<3>[ 62.198857]
<3>[ 62.199577] CPU: 0 UID: 0 PID: 1 Comm: systemd Not tainted 6.13.0 #1
<3>[ 62.200435] Hardware name: linux,dummy-virt (DT)

The full log is at: https://qa-reports.linaro.org/lkft/sashal-linus-next/build/v6.13-rc7-8584-gd4639f3659ae/testrun/27028572/suite/log-parser-test/test/kfence-bug-kfence-out-of-bounds-read-in-d_same_name/log

LMK if I should attempt a bisection.

--
Thanks,
Sasha