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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EBD5DCFC287 for ; Tue, 15 Oct 2024 10:39:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:CC:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=o4wujNjsyAr/oziHHMv1TomMdx6alK8Rc8OFlafH9JQ=; b=qLPmpii+D4Mue+HgvLKUoj43Yv HcHg3/jzKXBxI5WvSN52Fmd21yWr/wZsXakofmhKGZzXtMs70OKKNGedOiXUOCLvUkm+4WEXSeVos D3zxtvZK9I2LCYi/0ieGW1MS14kJFdHB4r+aS+/Gsn3ehjZb1gpePVubQeQ3OK10Tbe1rHaoRsvZp nC2cqAskM//YtTCs81Ehkx9TJ4IMS+Oi1KAn2HcXG+lTTKxcdM6uWbts4UOa1pHs8wssq/RZh8F1V AiuPYY75N4FmSdhU9QPLpqQyyUqAEJknJLQkKMbANemennjw/oLWJ5IbH3/KPGezKDmWOZlQH4Tzh tv+PUd6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0exR-00000007sBH-2R0W; Tue, 15 Oct 2024 10:39:17 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t0ew0-00000007s1h-3zE8 for linux-arm-kernel@lists.infradead.org; Tue, 15 Oct 2024 10:37:50 +0000 Received: from pps.filterd (m0369458.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49F8KQH4007049; Tue, 15 Oct 2024 12:37:26 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= o4wujNjsyAr/oziHHMv1TomMdx6alK8Rc8OFlafH9JQ=; b=e4NJuH315dwJ8n7/ YGY11mL7yVPKLmIsSb1pdwnVtQYZbco3vyV9t5GZt+Ye9hBMeI/v2/NnbkMfFCk1 RCjfV7ZRYN1wx7Goysl/rR7xQPBYLfYFbM7dQNSYDf87iwrOi+k2FypEUwOTgEDe +RIETaAP5z3fNXT0JCo2/+LJtLGXysFema7ZlE2snL8WHlnjleYsqaSjC8V4nqWo qLZtslBjxn89R4lXznW/SU4Bun+XYcJgamlgjmfyZzsEI9I7pTQ+RG3toJ2i6nqL iRUhKn6l1VxSGdxhSVwaRIvTzyxztHGtI1VO2/3TU3aWxZPqy+K3DdCG5/eH/dQR tw2MUA== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 4282p12871-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Oct 2024 12:37:26 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id C303340051; Tue, 15 Oct 2024 12:36:04 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id A489D21A689; Tue, 15 Oct 2024 12:35:21 +0200 (CEST) Received: from [10.48.86.107] (10.48.86.107) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Tue, 15 Oct 2024 12:35:18 +0200 Message-ID: <324d6a90-8f9a-4916-981b-ac1253f5057b@foss.st.com> Date: Tue, 15 Oct 2024 12:35:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Crash on armv7-a using KASAN To: Linus Walleij CC: Russell King , "Russell King (Oracle)" , Kees Cook , AngeloGioacchino Del Regno , Mark Brown , , , Ard Biesheuvel , , Antonio Borneo References: Content-Language: en-US From: Clement LE GOFFIC In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.48.86.107] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241015_033749_572806_6F8DB1F5 X-CRM114-Status: GOOD ( 15.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 10/15/24 09:55, Linus Walleij wrote:> On Mon, Oct 14, 2024 at 3:21 PM Clement LE GOFFIC > wrote: > >> I have detected a kernel crash in latest kernel on armv7-a when Kasan is >> enabled. > (...) >> Crash log with recent kernel (v6.12-rc3) : >> >> ~ # Insufficient stack space to handle exception! > > The crash looks pretty "expected", as you say you start a lot of > parallel processes > and whoops, you run out of memory on the stack. No software can add more > memory to the machine. > > KASAN uses a lot of extra memory for intercepting all memory accesses, > nominally one > extra byte per 8 bytes. This is further restricted by the complex > nature of the virtual > memory space on ARM32. > > That said, we increase the size of per-thread storage when using KASAN, > THREAD_SIZE_ORDER is 2 instead of 1. Maybe the interrupt stacks need > to be scaled similarly to manage the increased load? Hi Linus, Thanks for your reply. Once I found the issue in latest kernel, with Antonio we firstly tried to increase the stack size, but it kept crashing. Then we identified the offending commit and we noticed that it does not change at all the stack layout. In fact Ard patch only modifies the way to unwind frames for backtrace. As far as we understand, KASAN enabled causes the generation of several backtraces (hashed) on alloc and free to track all the allocation. The offending commit seams responsible of the crash due to incorrect unwind. Best regards, Clément