From: Dominique Martinet <asmadeus(a)codewreck.org>
[ Upstream commit 38d222b3163f7b7d737e5d999ffc890a12870e36 ]
It's possible for v9fs_fid_find "find by dentry" branch to not turn up
anything despite having an entry set (because e.g. uid doesn't match),
in which case the calling code will generally make an extra lookup
to the server.
In this case we might have had better luck looking by inode, so fall
back to look up by inode if we have one and the lookup by dentry failed.
Message-Id: <20240523210024.1214386-1-asmadeus(a)codewreck.org>
Reviewed-by: Christian Schoenebeck <linux_oss(a)crudebyte.com>
Signed-off-by: Dominique Martinet <asmadeus(a)codewreck.org>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
---
fs/9p/fid.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index de009a33e0e26..f84412290a30c 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -131,10 +131,9 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any)
}
}
spin_unlock(&dentry->d_lock);
- } else {
- if (dentry->d_inode)
- ret = v9fs_fid_find_inode(dentry->d_inode, false, uid, any);
}
+ if (!ret && dentry->d_inode)
+ ret = v9fs_fid_find_inode(dentry->d_inode, false, uid, any);
return ret;
}
--
2.43.0
From: Dominique Martinet <asmadeus(a)codewreck.org>
[ Upstream commit 38d222b3163f7b7d737e5d999ffc890a12870e36 ]
It's possible for v9fs_fid_find "find by dentry" branch to not turn up
anything despite having an entry set (because e.g. uid doesn't match),
in which case the calling code will generally make an extra lookup
to the server.
In this case we might have had better luck looking by inode, so fall
back to look up by inode if we have one and the lookup by dentry failed.
Message-Id: <20240523210024.1214386-1-asmadeus(a)codewreck.org>
Reviewed-by: Christian Schoenebeck <linux_oss(a)crudebyte.com>
Signed-off-by: Dominique Martinet <asmadeus(a)codewreck.org>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
---
fs/9p/fid.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index de009a33e0e26..f84412290a30c 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -131,10 +131,9 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any)
}
}
spin_unlock(&dentry->d_lock);
- } else {
- if (dentry->d_inode)
- ret = v9fs_fid_find_inode(dentry->d_inode, false, uid, any);
}
+ if (!ret && dentry->d_inode)
+ ret = v9fs_fid_find_inode(dentry->d_inode, false, uid, any);
return ret;
}
--
2.43.0
This problem reported by Clement LE GOFFIC manifest when
using CONFIG_KASAN_IN_VMALLOC and VMAP_STACK:
https://lore.kernel.org/linux-arm-kernel/a1a1d062-f3a2-4d05-9836-3b098de9db…
After some analysis it seems we are missing to sync the
VMALLOC shadow memory in top level PGD to all CPUs.
Add some code to perform this sync, and the bug appears
to go away.
As suggested by Ard, also perform a dummy read from the
shadow memory of the new VMAP_STACK in the low level
assembly.
Signed-off-by: Linus Walleij <linus.walleij(a)linaro.org>
---
Changes in v4:
- Since Kasan is not using header stubs, it is necessary to avoid
kasan_*() calls using ifdef when compiling without KASAN.
- Lift a line aligning the end of vmalloc from Melon Liu's
very similar patch so we have feature parity, credit Melon
as co-developer.
- Include the atomic_read_acquire() patch in the series due
to context requirements.
- Verify that the after the patch the kernel still builds and boots
without Kasan.
- Link to v3: https://lore.kernel.org/r/20241017-arm-kasan-vmalloc-crash-v3-0-d2a34cd5b66…
Changes in v3:
- Collect Mark Rutlands ACK on patch 1
- Change the simplified assembly add r2, ip, lsr #n to the canonical
add r2, r2, ip, lsr #n in patch 2.
- Link to v2: https://lore.kernel.org/r/20241016-arm-kasan-vmalloc-crash-v2-0-0a52fd086ee…
Changes in v2:
- Implement the two helper functions suggested by Russell
making the KASAN PGD copying less messy.
- Link to v1: https://lore.kernel.org/r/20241015-arm-kasan-vmalloc-crash-v1-0-dbb23592ca8…
---
Linus Walleij (3):
ARM: ioremap: Sync PGDs for VMALLOC shadow
ARM: entry: Do a dummy read from VMAP shadow
mm: Pair atomic_set_release() with _read_acquire()
arch/arm/kernel/entry-armv.S | 8 ++++++++
arch/arm/mm/ioremap.c | 35 ++++++++++++++++++++++++++++++-----
2 files changed, 38 insertions(+), 5 deletions(-)
---
base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc
change-id: 20241015-arm-kasan-vmalloc-crash-fcbd51416457
Best regards,
--
Linus Walleij <linus.walleij(a)linaro.org>
On 2024/10/23 1:44, Sasha Levin wrote:
> This is a note to let you know that I've just added the patch titled
>
> selftests: mm: fix the incorrect usage() info of khugepaged
>
> to the 6.11-stable tree which can be found at:
> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
>
> The filename of the patch is:
> selftests-mm-fix-the-incorrect-usage-info-of-khugepa.patch
> and it can be found in the queue-6.11 subdirectory.
>
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable(a)vger.kernel.org> know about it.
Hi,
I don't think this patch needs to be added to the stable tree because
this just fixes usage
information, as Andrew had previously said:
https://lore.kernel.org/lkml/20241017001441.2db5adaaa63dc3faa0934204@linux-…
>
>
>
> commit ad8b93ffe0a86e3b6be297826cd34b12080fc877
> Author: Nanyong Sun <sunnanyong(a)huawei.com>
> Date: Tue Oct 15 10:02:57 2024 +0800
>
> selftests: mm: fix the incorrect usage() info of khugepaged
>
> [ Upstream commit 3e822bed2fbd1527d88f483342b1d2a468520a9a ]
>
> The mount option of tmpfs should be huge=advise, not madvise which is not
> supported and may mislead the users.
>
> Link: https://lkml.kernel.org/r/20241015020257.139235-1-sunnanyong@huawei.com
> Fixes: 1b03d0d558a2 ("selftests/vm: add thp collapse file and tmpfs testing")
> Signed-off-by: Nanyong Sun <sunnanyong(a)huawei.com>
> Reviewed-by: Baolin Wang <baolin.wang(a)linux.alibaba.com>
> Reviewed-by: Anshuman Khandual <anshuman.khandual(a)arm.com>
> Cc: Kefeng Wang <wangkefeng.wang(a)huawei.com>
> Cc: Shuah Khan <shuah(a)kernel.org>
> Cc: Zach O'Keefe <zokeefe(a)google.com>
> Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
> Signed-off-by: Sasha Levin <sashal(a)kernel.org>
>
> diff --git a/tools/testing/selftests/mm/khugepaged.c b/tools/testing/selftests/mm/khugepaged.c
> index 829320a519e72..89dec42986825 100644
> --- a/tools/testing/selftests/mm/khugepaged.c
> +++ b/tools/testing/selftests/mm/khugepaged.c
> @@ -1091,7 +1091,7 @@ static void usage(void)
> fprintf(stderr, "\n\t\"file,all\" mem_type requires kernel built with\n");
> fprintf(stderr, "\tCONFIG_READ_ONLY_THP_FOR_FS=y\n");
> fprintf(stderr, "\n\tif [dir] is a (sub)directory of a tmpfs mount, tmpfs must be\n");
> - fprintf(stderr, "\tmounted with huge=madvise option for khugepaged tests to work\n");
> + fprintf(stderr, "\tmounted with huge=advise option for khugepaged tests to work\n");
> fprintf(stderr, "\n\tSupported Options:\n");
> fprintf(stderr, "\t\t-h: This help message.\n");
> fprintf(stderr, "\t\t-s: mTHP size, expressed as page order.\n");
> .