* [PATCH] hugetlbfs: check dir in trace_hugetlbfs_alloc_inode
@ 2025-01-13 3:07 zhuxiaohui
2025-01-13 3:29 ` Hongbo Li
0 siblings, 1 reply; 3+ messages in thread
From: zhuxiaohui @ 2025-01-13 3:07 UTC (permalink / raw)
To: muchun.song, rostedt, mhiramat, linux-mm, linux-kernel,
linux-trace-kernel
Cc: lihongbo22, Xiaohui Zhu
From: Xiaohui Zhu <zhuxiaohui.400@bytedance.com>
Anonymous huge page has no corresponding directory inode,
which cause a null pointer crash when access dir with the stack
trace_hugetlbfs_alloc_inode
hugetlbfs_get_inode
hugetlb_file_setup
ksys_mmap_pgoff
Signed-off-by: Xiaohui Zhu <zhuxiaohui.400@bytedance.com>
---
include/trace/events/hugetlbfs.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/trace/events/hugetlbfs.h b/include/trace/events/hugetlbfs.h
index 8331c904a9ba..5daa52053edc 100644
--- a/include/trace/events/hugetlbfs.h
+++ b/include/trace/events/hugetlbfs.h
@@ -23,7 +23,9 @@ TRACE_EVENT(hugetlbfs_alloc_inode,
TP_fast_assign(
__entry->dev = inode->i_sb->s_dev;
__entry->ino = inode->i_ino;
- __entry->dir = dir->i_ino;
+ __entry->dir = 0;
+ if (dir)
+ __entry->dir = dir->i_ino;
__entry->mode = mode;
),
--
2.41.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] hugetlbfs: check dir in trace_hugetlbfs_alloc_inode
2025-01-13 3:07 [PATCH] hugetlbfs: check dir in trace_hugetlbfs_alloc_inode zhuxiaohui
@ 2025-01-13 3:29 ` Hongbo Li
2025-01-13 3:30 ` [External] " 朱晓辉
0 siblings, 1 reply; 3+ messages in thread
From: Hongbo Li @ 2025-01-13 3:29 UTC (permalink / raw)
To: zhuxiaohui, muchun.song, rostedt, mhiramat, linux-mm,
linux-kernel, linux-trace-kernel
Cc: Xiaohui Zhu
On 2025/1/13 11:07, zhuxiaohui wrote:
> From: Xiaohui Zhu <zhuxiaohui.400@bytedance.com>
>
> Anonymous huge page has no corresponding directory inode,
> which cause a null pointer crash when access dir with the stack
>
> trace_hugetlbfs_alloc_inode
> hugetlbfs_get_inode
> hugetlb_file_setup
> ksys_mmap_pgoff
>
> Signed-off-by: Xiaohui Zhu <zhuxiaohui.400@bytedance.com>
> ---
> include/trace/events/hugetlbfs.h | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/include/trace/events/hugetlbfs.h b/include/trace/events/hugetlbfs.h
> index 8331c904a9ba..5daa52053edc 100644
> --- a/include/trace/events/hugetlbfs.h
> +++ b/include/trace/events/hugetlbfs.h
> @@ -23,7 +23,9 @@ TRACE_EVENT(hugetlbfs_alloc_inode,
> TP_fast_assign(
> __entry->dev = inode->i_sb->s_dev;
> __entry->ino = inode->i_ino;
> - __entry->dir = dir->i_ino;
> + __entry->dir = 0;
> + if (dir)
> + __entry->dir = dir->i_ino;
It has been fixed in [1] by Muchun.
Thanks,
Hongbo
[1]
https://lore.kernel.org/lkml/20250106033118.4640-1-songmuchun@bytedance.com/T/
> __entry->mode = mode;
> ),
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [External] Re: [PATCH] hugetlbfs: check dir in trace_hugetlbfs_alloc_inode
2025-01-13 3:29 ` Hongbo Li
@ 2025-01-13 3:30 ` 朱晓辉
0 siblings, 0 replies; 3+ messages in thread
From: 朱晓辉 @ 2025-01-13 3:30 UTC (permalink / raw)
To: Hongbo Li
Cc: zhuxiaohui, muchun.song, rostedt, mhiramat, linux-mm,
linux-kernel, linux-trace-kernel
Got it, thanks
> From: "Hongbo Li"<lihongbo22@huawei.com>
> Date: Mon, Jan 13, 2025, 11:29
> Subject: [External] Re: [PATCH] hugetlbfs: check dir in trace_hugetlbfs_alloc_inode
> To: "zhuxiaohui"<zhuxiaohui400@gmail.com>, <muchun.song@linux.dev>, <rostedt@goodmis.org>, <mhiramat@kernel.org>, <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>, <linux-trace-kernel@vger.kernel.org>
> Cc: "Xiaohui Zhu"<zhuxiaohui.400@bytedance.com>
> On 2025/1/13 11:07, zhuxiaohui wrote:
> > From: Xiaohui Zhu <zhuxiaohui.400@bytedance.com>
> >
> > Anonymous huge page has no corresponding directory inode,
> > which cause a null pointer crash when access dir with the stack
> >
> > trace_hugetlbfs_alloc_inode
> > hugetlbfs_get_inode
> > hugetlb_file_setup
> > ksys_mmap_pgoff
> >
> > Signed-off-by: Xiaohui Zhu <zhuxiaohui.400@bytedance.com>
> > ---
> > include/trace/events/hugetlbfs.h | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/trace/events/hugetlbfs.h b/include/trace/events/hugetlbfs.h
> > index 8331c904a9ba..5daa52053edc 100644
> > --- a/include/trace/events/hugetlbfs.h
> > +++ b/include/trace/events/hugetlbfs.h
> > @@ -23,7 +23,9 @@ TRACE_EVENT(hugetlbfs_alloc_inode,
> > TP_fast_assign(
> > __entry->dev = inode->i_sb->s_dev;
> > __entry->ino = inode->i_ino;
> > - __entry->dir = dir->i_ino;
> > + __entry->dir = 0;
> > + if (dir)
> > + __entry->dir = dir->i_ino;
> It has been fixed in [1] by Muchun.
> Thanks,
> Hongbo
>
> [1]
> https://lore.kernel.org/lkml/20250106033118.4640-1-songmuchun@bytedance.com/T/
> > __entry->mode = mode;
> > ),
> >
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-13 3:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-13 3:07 [PATCH] hugetlbfs: check dir in trace_hugetlbfs_alloc_inode zhuxiaohui
2025-01-13 3:29 ` Hongbo Li
2025-01-13 3:30 ` [External] " 朱晓辉
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox