From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB563C3DA7D for ; Tue, 3 Jan 2023 17:55:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238241AbjACRzi (ORCPT ); Tue, 3 Jan 2023 12:55:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232749AbjACRzg (ORCPT ); Tue, 3 Jan 2023 12:55:36 -0500 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 168AA1057B for ; Tue, 3 Jan 2023 09:55:35 -0800 (PST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 81FE15C00D0; Tue, 3 Jan 2023 12:55:34 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 03 Jan 2023 12:55:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1672768534; x= 1672854934; bh=m+ncvU0PECkKfb0iCZYyliBBT0Yq5v7KR+Dy4Msbui0=; b=x rx/0ixOmhnDn40L38hOU9Q2iT0EP837yhfdrtRzrZ4djT4pubG3n7cVj/Lp+uEWM fGQ0FflGIBNAVQbT7N2PhII0d5kdruDlh0W9BW5KVHbN5wlRlnuu6KfmLuQYIhT0 DhcfbPKxhbPDAl12TvEfZcDffYK7SuBodwPjphP29V3uNP3BnJrcYX7Gv1uC8aOB VMD4iTxY+zC+tJSBWmwC/euk3zsovZlZwhdwcugzYzjBtzqAnxmvP/7lSsTeWIgb fTcLjfQhIdWLphy702tv/32rrTGDLRZaOLZ1jMmDb4x86YpklXKj7jIqzMfztfOM I5n+FAqkYv5badf2QOyvA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1672768534; x= 1672854934; bh=m+ncvU0PECkKfb0iCZYyliBBT0Yq5v7KR+Dy4Msbui0=; b=u B+vuV2YiHdwWIGKDLRXn1Qul4lUt1N1wVQCiIW5+LA0I/J52ewbjKR+f2/E7rNFx iiFvNM/49Nb5yMMO0w9icvg/uAZ2um2fsPsvNf7cGCakhDVelcuI3+qvUqJCC32o Akg3mmaS5y2VHp/+a35XoGgh6tn6LoipsXPZz/M/yZ1aYooX7FM0kSqGkcQrEGxJ pXUUPnGTfvZBOMP/EfTX/3q65GkhzOmKaTgQupgatbn1IAgk2Xrlg3cd/Z6plXBL V4feSEvJUdbvJfseutnCYvO+6PeUHblUwYK3Dpy66LQ2XC5r2Xn0wyXdbtLeCJ/M tUXfkrUH67lyv2GCchbug== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrjeeggddutdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpefurghm uhgvlhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenuc ggtffrrghtthgvrhhnpeekjeelleefiedthfdtgfekgeehudefudeugeffvdfhudekleel fedtteejhedutdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 3 Jan 2023 12:55:33 -0500 (EST) Message-ID: <059c87c4-9559-7bc2-4675-a243ed075c23@sholland.org> Date: Tue, 3 Jan 2023 11:55:32 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux ppc64le; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH v2] riscv: stacktrace: Fix missing the first frame Content-Language: en-US To: Liu Shixin , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Changbin Du Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org References: <20221207025038.1022045-1-liushixin2@huawei.com> From: Samuel Holland In-Reply-To: <20221207025038.1022045-1-liushixin2@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 Before: WARNING: CPU: 0 PID: 162 at drivers/regulator/core.c:5700 regulator_unregister+0xf0/0x106 ... [] devm_rdev_release+0xe/0x16 [] release_nodes+0x3c/0x98 [] devres_release_all+0x72/0x9e [] device_unbind_cleanup+0x10/0x4a ... After: WARNING: CPU: 0 PID: 165 at drivers/regulator/core.c:5700 regulator_unregister+0xf0/0x106 ... [] regulator_unregister+0xf0/0x106 [] devm_rdev_release+0xe/0x16 [] release_nodes+0x3c/0x98 [] devres_release_all+0x72/0x9e [] device_unbind_cleanup+0x10/0x4a ...