mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@kernel.org>
To: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: peterz@infradead.org, keescook@chromium.org,
	dave.hansen@linux.intel.com, bp@alien8.de, mingo@redhat.com,
	tglx@linutronix.de, rostedt@goodmis.org, x86@kernel.org,
	linux-kernel@vger.kernel.org,
	Chen Zhongjin <chenzhongjin@huawei.com>,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 1/2] x86: make profile_pc() use arch_stack_walk()
Date: Fri, 7 Apr 2023 21:56:19 -0700	[thread overview]
Message-ID: <20230408045619.m5zfbispodf4zjvz@treble> (raw)
In-Reply-To: <20230330081552.54178-2-zhengqi.arch@bytedance.com>

On Thu, Mar 30, 2023 at 04:15:51PM +0800, Qi Zheng wrote:
> The profile_pc() try to get pc by doing a trick to read
> the contents of the stack. This may cause false positives
> for KASAN, like the following:
> 
>  BUG: KASAN: stack-out-of-bounds in profile_pc+0x5b/0x90
>  Read of size 8 at addr ffff8881062a7a00 by task id/130040

I don't think this was actually a false positive.  The !FRAME_POINTER
code in profile_pc() has been badly broken for many years.

BTW, there was a similar patch here:

  https://lore.kernel.org/lkml/20230224021858.120078-1-chenzhongjin@huawei.com/

I thought CONFIG_PROFILING was obsolete but Andi said previously he
wants to keep it for at least boot-time profiling.

Andi did suggest removing the lock profiling hacks, which means all the
profile_pc() implementations can just be removed in favor of the generic
instruction_pointer().

-- 
Josh

  reply	other threads:[~2023-04-08  4:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30  8:15 [PATCH 0/2] some fixes and cleanups for x86 Qi Zheng
2023-03-30  8:15 ` [PATCH 1/2] x86: make profile_pc() use arch_stack_walk() Qi Zheng
2023-04-08  4:56   ` Josh Poimboeuf [this message]
2023-04-08  5:26     ` Qi Zheng
2023-03-30  8:15 ` [PATCH 2/2] x86: make __get_wchan() " Qi Zheng
2023-04-08  5:08   ` Josh Poimboeuf
2023-04-08  5:36     ` Qi Zheng
2023-04-08 22:12       ` Josh Poimboeuf
2023-04-09  6:30         ` Qi Zheng
2023-04-12  5:20           ` Josh Poimboeuf
2023-04-12  7:10             ` Qi Zheng
2023-04-12 13:15     ` Peter Zijlstra
2023-04-12 13:23       ` Peter Zijlstra
2023-04-12 17:24         ` Qi Zheng
2023-04-07  3:47 ` [PATCH 0/2] some fixes and cleanups for x86 Qi Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230408045619.m5zfbispodf4zjvz@treble \
    --to=jpoimboe@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=chenzhongjin@huawei.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=zhengqi.arch@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®