From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C6F4189 for ; Mon, 8 Sep 2025 10:21:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757326869; cv=none; b=L44vYU5+Tku2aamzhvIn3eS2a8RmQuRdvf912V8WTnfLSvHnjNXmzfhnMMa2GeM8oPpf3mImzQt8+LwwoH2lEcyMdD9M4a0hvM6UOCN98UocOqOszf/hlmBaIcbf36hY1HasNK4b7TxbbyEWj9UvLZ73VB4c01ex64IJPz3FupA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757326869; c=relaxed/simple; bh=e973tNPGEdZHvYjO9hlP1Vglri7GnrxhaS7wj4OqwR4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WAzfuxaNR5r/d3E9nL2uk1DoYRi7x2Y3XSYpXRWbMZJXsO0ZVuAq1tppARzvOsg3LtqxsX0AuSE12rwZNNJK8mZvLVH1C0hq0Nef40w2bsz/mNCiD3RSKWDkGtKPTcd9h4YmpYjgg2EZyldI/BoMKL6kwWtMU+dY5VHHxS9qFd8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 784C41692; Mon, 8 Sep 2025 03:20:58 -0700 (PDT) Received: from e129823.cambridge.arm.com (e129823.arm.com [10.1.197.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 50E5A3F66E; Mon, 8 Sep 2025 03:21:05 -0700 (PDT) From: Yeoreum Yun To: stable@vger.kernel.org Cc: Yeoreum Yun , Alexander Potapenko , Andrey Konovalov , Andrey Ryabinin , Dmitriy Vyukov , Vincenzo Frascino , Andrew Morton Subject: [PATCH 6.1.y] kunit: kasan_test: disable fortify string checker on kasan_strings() test Date: Mon, 8 Sep 2025 11:20:35 +0100 Message-Id: <20250908102034.2186174-2-yeoreum.yun@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <2025090616-departed-guidance-d285@gregkh> References: <2025090616-departed-guidance-d285@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Similar to commit 09c6304e38e4 ("kasan: test: fix compatibility with FORTIFY_SOURCE") the kernel is panicing in kasan_string(). This is due to the `src` and `ptr` not being hidden from the optimizer which would disable the runtime fortify string checker. Call trace: __fortify_panic+0x10/0x20 (P) kasan_strings+0x980/0x9b0 kunit_try_run_case+0x68/0x190 kunit_generic_run_threadfn_adapter+0x34/0x68 kthread+0x1c4/0x228 ret_from_fork+0x10/0x20 Code: d503233f a9bf7bfd 910003fd 9424b243 (d4210000) ---[ end trace 0000000000000000 ]--- note: kunit_try_catch[128] exited with irqs disabled note: kunit_try_catch[128] exited with preempt_count 1 # kasan_strings: try faulted: last ** replaying previous printk message ** # kasan_strings: try faulted: last line seen mm/kasan/kasan_test_c.c:1600 # kasan_strings: internal error occurred preventing test case from running: -4 Link: https://lkml.kernel.org/r/20250801120236.2962642-1-yeoreum.yun@arm.com Fixes: 73228c7ecc5e ("KASAN: port KASAN Tests to KUnit") Signed-off-by: Yeoreum Yun Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Andrey Ryabinin Cc: Dmitriy Vyukov Cc: Vincenzo Frascino Cc: Signed-off-by: Andrew Morton (cherry picked from commit 7a19afee6fb39df63ddea7ce78976d8c521178c6) Signed-off-by: Yeoreum Yun --- mm/kasan/kasan_test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/kasan/kasan_test.c b/mm/kasan/kasan_test.c index df9658299a08..4bb5159b4a41 100644 --- a/mm/kasan/kasan_test.c +++ b/mm/kasan/kasan_test.c @@ -993,6 +993,7 @@ static void kasan_strings(struct kunit *test) ptr = kmalloc(size, GFP_KERNEL | __GFP_ZERO); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); + OPTIMIZER_HIDE_VAR(ptr); kfree(ptr); -- LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}