From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 653FF42BEBA for ; Wed, 12 Aug 2026 10:59:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786532400; cv=none; b=o20ZA+qsU2shwtQcJ3GTdhxI59/gdWPQb2V2GdpbzBr3155Y7NtKT6YtWUuSrM/BUbl+AptEqZUdgsF3uO7bDiQRgm9Cb0UVRU08lg/zaSd0zD5wSpXqxRx5pY7iFF7Y5+g0/8bXUVbkA5ohm3tw0W4zifhxEBOYZICHLRmBvxc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786532400; c=relaxed/simple; bh=6pSPMkQHCwoMzB+V2UGx3hmjPLEruAp/3PAgFK8zI/s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=n1ABtcAXGxul5R4M2gPmEP9es5GyxYC9eA7HPG1Pyd+KWEHn7f/1BTrmGQ8J2F4LzZbnk7OH2BIiY6l/OkfFLHv6s0sip7ZG0f1e/0jnxkcixtyuw4WSdnsna9HQQvLoWWvlv+ooWfC7KemUnfLonuS4q13UJMwTJ50SxV6MoU0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=xTmP5Qpg; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=QnF+b7tp; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=OyuT4XMr; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=4/YckPR1; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="xTmP5Qpg"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="QnF+b7tp"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="OyuT4XMr"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="4/YckPR1" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 221CC82269; Wed, 12 Aug 2026 10:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1786532390; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QswIT/rCI0cwQtVcS8lMq+TQBP18UyXHMFLt/8eLSNQ=; b=xTmP5QpgCWjnmFqwHeaCcaCSVqDoYDOSw5qtviOUvuRjYfKXskmGQqp2azXD9jTkI/Ifwo VlMIE80CCma98enNhKq0iKA4c+8VLCfK+m5Lno6GPPZN6qOj/MLjRn/QWLcvUR9jYuRU7/ m38xUuthh6M95bZwiCpyH6Z4QB/yKzg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1786532390; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QswIT/rCI0cwQtVcS8lMq+TQBP18UyXHMFLt/8eLSNQ=; b=QnF+b7tpmRhs+oViGdTXNhikTCZPxrgx7dIELfx7xGlyBQbF4SRJATas4+XHsxSig+KAoS r+UioboklOPeB9Ag== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=OyuT4XMr; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="4/YckPR1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1786532386; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QswIT/rCI0cwQtVcS8lMq+TQBP18UyXHMFLt/8eLSNQ=; b=OyuT4XMrdrjjGUnxk5suZMco9xrBJGrZMY9Jxf8Z25hZQjOxMmy6UuGiwFFg9nzxRQ6/I5 YzfCGuf1njQUkgaFKYVJmnJKMx5GWeX/3fg6hWPA1cj+8OVASJKFbSvgOwNM3JbtExC2E8 59HxA6sER6xXDJl9za3ZJNZ8DR7sarE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1786532386; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QswIT/rCI0cwQtVcS8lMq+TQBP18UyXHMFLt/8eLSNQ=; b=4/YckPR1pDvDmjE+MXaRyQyw4tGdbfM6JwvvMKTrT0v28ROgDz3/On4+FywHdusja5rfra CTnYENy60VwEpuCw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7E7D2779B2; Wed, 12 Aug 2026 10:59:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id sX6nGyBSfGr+UgAAD6G6ig (envelope-from ); Wed, 12 Aug 2026 10:59:44 +0000 Date: Wed, 12 Aug 2026 11:59:42 +0100 From: Pedro Falcato To: Breno Leitao Cc: Andrew Morton , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , Youngjun Park , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jann Horn , Hugh Dickins , Baolin Wang , Peter Xu , Johannes Weiner , Yosry Ahmed , Chengming Zhou , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCH 3/3] mm: fail the fault on a malformed swap entry instead of retrying it Message-ID: References: <20260810-swap-v1-0-375ef0767206@debian.org> <20260810-swap-v1-3-375ef0767206@debian.org> 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-Disposition: inline In-Reply-To: <20260810-swap-v1-3-375ef0767206@debian.org> X-Spamd-Result: default: False [-4.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; MISSING_XM_UA(0.00)[]; RCPT_COUNT_TWELVE(0.00)[26]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[linux-foundation.org,kernel.org,tencent.com,huaweicloud.com,gmail.com,linux.dev,lge.com,infradead.org,google.com,suse.com,linux.alibaba.com,redhat.com,cmpxchg.org,kvack.org,vger.kernel.org,meta.com]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo,suse.de:dkim]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_TRACE(0.00)[suse.de:+] X-Spam-Flag: NO X-Spam-Score: -4.01 X-Spam-Level: X-Rspamd-Queue-Id: 221CC82269 X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action On Mon, Aug 10, 2026 at 09:26:51AM -0700, Breno Leitao wrote: > do_swap_page() returns 0 when get_swap_device() fails, which the fault > handler reads as "handled". For an entry that can never become valid > the retry takes the same fault again, so the thread spins until it is > killed. > > Return VM_FAULT_SIGBUS for a malformed entry, as the sibling arm > already does for an unrecognised non-swap entry. A NULL return still > means swapoff, which is still worth retrying. What kind of SIGBUS do you get from this? as in the si_code. Out of all the options #define BUS_ADRALN 1 /* invalid address alignment */ #define BUS_ADRERR 2 /* non-existent physical address */ #define BUS_OBJERR 3 /* object specific hardware error */ /* hardware memory error consumed on a machine check: action required */ #define BUS_MCEERR_AR 4 /* hardware memory error detected in process but not consumed: action optional*/ #define BUS_MCEERR_AO 5 I would say this would fit none of them. The default (AFAICT) would be BUS_ADRERR, and I think that one is quite overloaded with meaning (namely, with regards to memory-mapped IO past EOF, or EIO on file IO). I wouldn't love to also use it for this, IMO. > > Signed-off-by: Breno Leitao > --- > mm/memory.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/mm/memory.c b/mm/memory.c > index 4238778b66c42..2842cd976f1d3 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -4957,6 +4957,9 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) > /* Prevent swapoff from happening to us. */ > si = get_swap_device(entry); > if (IS_ERR_OR_NULL(si)) { > + /* A malformed entry never becomes valid, so don't retry it. */ > + if (IS_ERR(si)) > + ret = VM_FAULT_SIGBUS; > si = NULL; > goto out; > } > > -- > 2.53.0-Meta > -- Pedro