From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 653DA148FE6; Wed, 30 Jul 2025 09:55:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753869357; cv=none; b=HOjvvNtmD9HZx9L7MpzJMdY2jomm1hzUTp19b+wtvxBOlwZbc/Zj0pXlPOxcfZIk5b24FonpOayK4t8Psv3ywDV6RhsidO93G5xrVyaxkCWuROVKQx9HmyrgDKA+TZ8a8P3jynr7XOz8sJVrvf3Fw3WCI+jeHRJW2whFlIn7+pY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753869357; c=relaxed/simple; bh=zcVjJ4mPIFRW/sG+O326szUgsYTfKDIyEMUQKCRROUg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LKzKffIcH6/6PnsUJJR6338gTQ9hXzFjL4D0lTfrLX7PNdpH3TNcCDkCNvi7LleAdcLZJuul+DbbRP0AEzaXh8/FL5NU24YRVOiBfnY3+2OChd7m5BbJ0RSt0TEJStYgBXsHMbUuLvrC7TK0/j9P5X+e12nOcda9x2cHySXOP0U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XITdUOy2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XITdUOy2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D10F7C4CEE7; Wed, 30 Jul 2025 09:55:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1753869357; bh=zcVjJ4mPIFRW/sG+O326szUgsYTfKDIyEMUQKCRROUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XITdUOy2xm12dCAilMjkI6EjbmjeguGUGVAU3tG/RmGqKXHdhgO5K5WKJMD6DL7si w0ZokTsTjNEWHBl03/XzEdWa0fMPOzD16MWa03+Rch+p+0UiJ/2+JbxCogM4TC3t+P MhW9g4IFNI7j1oUktRGQL9G5mD58rxu9p3CPaj44= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Marco Elver , Uladzislau Rezki , Alexander Potapenko , Andrey Konovalov , Andrey Ryabinin , Sebastian Andrzej Siewior , Yeoreum Yun , Yunseong Kim , Andrew Morton Subject: [PATCH 6.15 71/92] kasan: use vmalloc_dump_obj() for vmalloc error reports Date: Wed, 30 Jul 2025 11:36:19 +0200 Message-ID: <20250730093233.502328054@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250730093230.629234025@linuxfoundation.org> References: <20250730093230.629234025@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marco Elver commit 6ade153349c6bb990d170cecc3e8bdd8628119ab upstream. Since 6ee9b3d84775 ("kasan: remove kasan_find_vm_area() to prevent possible deadlock"), more detailed info about the vmalloc mapping and the origin was dropped due to potential deadlocks. While fixing the deadlock is necessary, that patch was too quick in killing an otherwise useful feature, and did no due-diligence in understanding if an alternative option is available. Restore printing more helpful vmalloc allocation info in KASAN reports with the help of vmalloc_dump_obj(). Example report: | BUG: KASAN: vmalloc-out-of-bounds in vmalloc_oob+0x4c9/0x610 | Read of size 1 at addr ffffc900002fd7f3 by task kunit_try_catch/493 | | CPU: [...] | Call Trace: | | dump_stack_lvl+0xa8/0xf0 | print_report+0x17e/0x810 | kasan_report+0x155/0x190 | vmalloc_oob+0x4c9/0x610 | [...] | | The buggy address belongs to a 1-page vmalloc region starting at 0xffffc900002fd000 allocated at vmalloc_oob+0x36/0x610 | The buggy address belongs to the physical page: | page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x126364 | flags: 0x200000000000000(node=0|zone=2) | raw: 0200000000000000 0000000000000000 dead000000000122 0000000000000000 | raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 | page dumped because: kasan: bad access detected | | [..] Link: https://lkml.kernel.org/r/20250716152448.3877201-1-elver@google.com Fixes: 6ee9b3d84775 ("kasan: remove kasan_find_vm_area() to prevent possible deadlock") Signed-off-by: Marco Elver Suggested-by: Uladzislau Rezki Acked-by: Uladzislau Rezki (Sony) Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Andrey Ryabinin Cc: Sebastian Andrzej Siewior Cc: Yeoreum Yun Cc: Yunseong Kim Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/kasan/report.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -399,7 +399,9 @@ static void print_address_description(vo } if (is_vmalloc_addr(addr)) { - pr_err("The buggy address %px belongs to a vmalloc virtual mapping\n", addr); + pr_err("The buggy address belongs to a"); + if (!vmalloc_dump_obj(addr)) + pr_cont(" vmalloc virtual mapping\n"); page = vmalloc_to_page(addr); }