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 A69182629D for ; Thu, 15 Jan 2026 01:27:43 +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=1768440463; cv=none; b=VpDSPEgzeCib+HaWPzmTAYMXx5l78VeuRjoUDezEenNFnOIgJShiGqYyasWLMuKxCByyA+sFYTcEyLCyhAOjt0G1y8rCRucNw+R7rj3MtpK6Lkg+ATLFwE4mZ3PyFOZ9U+TnltPDG6k2M3Qy3RH1wYB9XhiF67Dh8E7IuRr9CHA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768440463; c=relaxed/simple; bh=pQ8j9Tn71UcjHmJ1kXhLWOF2qZTGUivD/SECa9XZwOg=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=GgbY3ag5tQbkELx8ozeKQ7w8IK4MNBktlN3hgeU9PhO3+xdQaICzPWcPbXeEkcKD9PCoV8BQ18qx/LU9DLpfJht/5CMke52Nqm3BpD0hwgFQ71fcrGVCkIUCtwVqedet/D7a2g5yrdKEbJ0dcL1dEDlH36Ss09kn8EUm7/PiPu0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=WaCZwQ2l; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="WaCZwQ2l" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 902FAC4CEF7; Thu, 15 Jan 2026 01:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1768440463; bh=pQ8j9Tn71UcjHmJ1kXhLWOF2qZTGUivD/SECa9XZwOg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=WaCZwQ2lpVB23m9mvRB7P1BdVy4CxTZrspTarWWH7iC1Y7Vm/y2UnRmacHj8EcHAi ILBqqksvYmtDVXZ3XjC5q4/lRdA6RQISezqaHVwQig0DO+PKG9cDjQodE6vsbkLH2g IIRxd/QP6TbOPmU3cW4acl9BGtSbgdbu/uCwtsCg= Date: Wed, 14 Jan 2026 17:27:41 -0800 From: Andrew Morton To: Cc: Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , Matthias Brugger , AngeloGioacchino Del Regno , , , , , , , , , , Subject: Re: [PATCH 1/1] Restore swap_space attr aviod krn panic Message-Id: <20260114172741.b8b6cb9aae39a5ae7a199eed@linux-foundation.org> In-Reply-To: <20260115001405.3513440-1-robin.kuo@mediatek.com> References: <20260115001405.3513440-1-robin.kuo@mediatek.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 15 Jan 2026 08:13:43 +0800 wrote: > From: "robin.kuo" > > Restore swap_space attr avoid krn panic Thanks, and welcome to Linux ;) > Commit 8b47299a411a ('mm, swap: mark swap address space ro and add > context debug check') made the swap address space read-only. > It may lead to kernel panic if arch_prepare_to_swap returns a failure > under heavy memory pressure as follows, > > el1_abort+0x40/0x64 > el1h_64_sync_handler+0x48/0xcc > el1h_64_sync+0x84/0x88 > errseq_set+0x4c/0xb8 (P) > __filemap_set_wb_err+0x20/0xd0 > shrink_folio_list+0xc20/0x11cc > evict_folios+0x1520/0x1be4 > try_to_shrink_lruvec+0x27c/0x3dc > shrink_one+0x9c/0x228 > shrink_node+0xb3c/0xeac > do_try_to_free_pages+0x170/0x4f0 > try_to_free_pages+0x334/0x534 > __alloc_pages_direct_reclaim+0x90/0x158 > __alloc_pages_slowpath+0x334/0x588 > __alloc_frozen_pages_noprof+0x224/0x2fc > __folio_alloc_noprof+0x14/0x64 > vma_alloc_zeroed_movable_folio+0x34/0x44 > do_pte_missing+0xad4/0x1040 > handle_mm_fault+0x4a4/0x790 > do_page_fault+0x288/0x5f8 > do_translation_fault+0x38/0x54 > do_mem_abort+0x54/0xa8 > > Restore swap address space as not ro to avoid the panic. Well damn. We have checking tools which should be able to detect this: we referenced something which was dropped from kernel memory in the calling function's context. i don't know who I should report this to. I shall add cc:stable to this patch, to help ensure that it is backported into 6.18.x.