mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Samuel Holland <samuel@sholland.org>
To: Liu Shixin <liushixin2@huawei.com>,
	Conor Dooley <conor@kernel.org>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Changbin Du <changbin.du@intel.com>
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] riscv: stacktrace: Fix missing the first frame
Date: Tue, 3 Jan 2023 11:55:32 -0600	[thread overview]
Message-ID: <059c87c4-9559-7bc2-4675-a243ed075c23@sholland.org> (raw)
In-Reply-To: <20221207025038.1022045-1-liushixin2@huawei.com>

On 12/6/22 20:50, Liu Shixin wrote:
> When running kfence_test, I found some testcases failed like this:
> 
>  # test_out_of_bounds_read: EXPECTATION FAILED at mm/kfence/kfence_test.c:346
>  Expected report_matches(&expect) to be true, but is false
>  not ok 1 - test_out_of_bounds_read
> 
> The corresponding call-trace is:
> 
>  BUG: KFENCE: out-of-bounds read in kunit_try_run_case+0x38/0x84
> 
>  Out-of-bounds read at 0x(____ptrval____) (32B right of kfence-#10):
>   kunit_try_run_case+0x38/0x84
>   kunit_generic_run_threadfn_adapter+0x12/0x1e
>   kthread+0xc8/0xde
>   ret_from_exception+0x0/0xc
> 
> The kfence_test using the first frame of call trace to check whether the
> testcase is succeed or not. Commit 6a00ef449370 ("riscv: eliminate
> unreliable __builtin_frame_address(1)") skip first frame for all
> case, which results the kfence_test failed. Indeed, we only need to skip
> the first frame for case (task==NULL || task==current).
> 
> With this patch, the call-trace will be:
> 
>  BUG: KFENCE: out-of-bounds read in test_out_of_bounds_read+0x88/0x19e
> 
>  Out-of-bounds read at 0x(____ptrval____) (1B left of kfence-#7):
>   test_out_of_bounds_read+0x88/0x19e
>   kunit_try_run_case+0x38/0x84
>   kunit_generic_run_threadfn_adapter+0x12/0x1e
>   kthread+0xc8/0xde
>   ret_from_exception+0x0/0xc
> 
> Fixes: 6a00ef449370 ("riscv: eliminate unreliable __builtin_frame_address(1)")
> Signed-off-by: Liu Shixin <liushixin2@huawei.com>
> ---
> v1->v2: Fix the incorrect Fixes tag found by Conor.
> 
>  arch/riscv/kernel/stacktrace.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Tested-by: Samuel Holland <samuel@sholland.org>

Before:

WARNING: CPU: 0 PID: 162 at drivers/regulator/core.c:5700
regulator_unregister+0xf0/0x106
...
[<ffffffff803a0794>] devm_rdev_release+0xe/0x16
[<ffffffff80427bac>] release_nodes+0x3c/0x98
[<ffffffff80428cac>] devres_release_all+0x72/0x9e
[<ffffffff80424054>] device_unbind_cleanup+0x10/0x4a
...

After:

WARNING: CPU: 0 PID: 165 at drivers/regulator/core.c:5700
regulator_unregister+0xf0/0x106
...
[<ffffffff8039d194>] regulator_unregister+0xf0/0x106
[<ffffffff803a0798>] devm_rdev_release+0xe/0x16
[<ffffffff80427bb0>] release_nodes+0x3c/0x98
[<ffffffff80428cb0>] devres_release_all+0x72/0x9e
[<ffffffff80424058>] device_unbind_cleanup+0x10/0x4a
...


  reply	other threads:[~2023-01-03 17:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07  2:50 Liu Shixin
2023-01-03 17:55 ` Samuel Holland [this message]
2023-02-09 19:40 ` patchwork-bot+linux-riscv

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=059c87c4-9559-7bc2-4675-a243ed075c23@sholland.org \
    --to=samuel@sholland.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=changbin.du@intel.com \
    --cc=conor@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=liushixin2@huawei.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.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®