[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230419154335.4vc7rouxl4gsynzm@treble>
Date: Wed, 19 Apr 2023 08:43:35 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Chen Zhongjin <chenzhongjin@...wei.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com,
hpa@...or.com, akpm@...ux-foudation.org, ben-linux@...ff.org,
wuchi.zero@...il.com
Subject: Re: [PATCH 1/2] x86: profiling: remove lock functions hack for
!FRAME_POINTER
On Mon, Apr 10, 2023 at 10:22:25AM +0800, Chen Zhongjin wrote:
> Syzbot has been reporting the problem of stack-out-of-bounds in
> profile_pc for a long time:
> https://syzkaller.appspot.com/bug?extid=84fe685c02cd112a2ac3
>
> profile_pc tries to get pc if current regs is inside lock function. For
> !CONFIG_FRAME_POINTER it used a hack way to get the pc from stack, which
> is not work with ORC. It makes profile_pc read illeagal address, return
> wrong result, and frequently triggers KASAN.
>
> Since lock profiling can be handled with much better other tools, It's
> reasonable to remove lock functions hack for !FRAME_POINTER kernel.
>
> Suggested-by: Andi Kleen <ak@...ux.intel.com>
> Signed-off-by: Chen Zhongjin <chenzhongjin@...wei.com>
> ---
> arch/x86/kernel/time.c | 14 +-------------
> 1 file changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
> index e42faa792c07..e08fac7bb71e 100644
> --- a/arch/x86/kernel/time.c
> +++ b/arch/x86/kernel/time.c
> @@ -29,22 +29,10 @@ unsigned long profile_pc(struct pt_regs *regs)
> {
> unsigned long pc = instruction_pointer(regs);
>
> - if (!user_mode(regs) && in_lock_functions(pc)) {
> #ifdef CONFIG_FRAME_POINTER
> + if (!user_mode(regs) && in_lock_functions(pc))
If lock profiling is no longer useful then we should just remove it
altogether, not just for ORC.
--
Josh
Powered by blists - more mailing lists