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 64765395AD5 for ; Thu, 14 May 2026 08:15:51 +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=1778746552; cv=none; b=CBRyu2OEiBWjtD/8ReTTp4B5vxzieDpyu3Pd/7F1dhSdaOUS6XEV34xRylYRgOMgHveBX5RbyWSnBPu3+i0K8qGVbebPOeAVL0I/Kc29ZazjZDBMl4YjzjbyJlEypevglWeQtZFmBGMqu6dfLa9VDAf7pSPxK7664M8ToTAfaC8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778746552; c=relaxed/simple; bh=SJ4IFr37vJySs76vKvyA3VRRn1PoL4eaZ4uwvMAODFg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QW14kgMWrrBIZ/n1i7W84tu0M6EnSmVy+lBM/QwGVpM7YdeoLWB5psH9NkcExh4yzo+sSF5uayYoehfEQy7FvAyhuJDO7sCCD6X6utsy8ewzW93W22pFw2ByXoD+4FVwEK7xzF2kExVzGH3KHa/zSx+RNrkpQRjNfzRjxEeg86s= 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=Yn7op8mE; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=33hUj/VH; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=Yn7op8mE; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=33hUj/VH; 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="Yn7op8mE"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="33hUj/VH"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Yn7op8mE"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="33hUj/VH" Received: from imap1.dmz-prg2.suse.org (unknown [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 8DD535E0E9; Thu, 14 May 2026 08:15:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1778746549; 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=GYHvhQh+aU5YKMg1lnuWAy6/GMx5Fj4JhjQmk8/RJkk=; b=Yn7op8mE2TAPVKVIpe9TijF6q8yc2mzF0AWBa8NOZ9bVRX7EtTlVdWm0s2eYsQUChIXqYV xzv3stRGxlkbwAYEIfM1n4YnEGu8gr6z3JBuxQsOekiRw6iNOqmDUttRnfg3fXEMeYx2Tg Cn0wdfZR//P1bZ4TxBjtiQ1PZzz6iN0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1778746549; 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=GYHvhQh+aU5YKMg1lnuWAy6/GMx5Fj4JhjQmk8/RJkk=; b=33hUj/VHkqcsJmfiuh7Ram0jOGYgvYjUOcsSaqakySsXvlWo9WD6kZCVsUEE5FS2z+AJrG 1aw6x8T4G5/L9qAg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1778746549; 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=GYHvhQh+aU5YKMg1lnuWAy6/GMx5Fj4JhjQmk8/RJkk=; b=Yn7op8mE2TAPVKVIpe9TijF6q8yc2mzF0AWBa8NOZ9bVRX7EtTlVdWm0s2eYsQUChIXqYV xzv3stRGxlkbwAYEIfM1n4YnEGu8gr6z3JBuxQsOekiRw6iNOqmDUttRnfg3fXEMeYx2Tg Cn0wdfZR//P1bZ4TxBjtiQ1PZzz6iN0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1778746549; 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=GYHvhQh+aU5YKMg1lnuWAy6/GMx5Fj4JhjQmk8/RJkk=; b=33hUj/VHkqcsJmfiuh7Ram0jOGYgvYjUOcsSaqakySsXvlWo9WD6kZCVsUEE5FS2z+AJrG 1aw6x8T4G5/L9qAg== 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 8338D593A9; Thu, 14 May 2026 08:15:48 +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 +oCGHbSEBWoGHgAAD6G6ig (envelope-from ); Thu, 14 May 2026 08:15:48 +0000 Date: Thu, 14 May 2026 10:15:47 +0200 From: Oscar Salvador To: Muchun Song Cc: Andrew Morton , David Hildenbrand , Muchun Song , Michael Ellerman , Madhavan Srinivasan , Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Nicholas Piggin , Christophe Leroy , Ackerley Tng , Frank van der Linden , aneesh.kumar@linux.ibm.com, joao.m.martins@oracle.com, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 06/69] mm/sparse: Panic on memmap and usemap allocation failure Message-ID: References: <20260513130542.35604-1-songmuchun@bytedance.com> <20260513130542.35604-7-songmuchun@bytedance.com> 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: <20260513130542.35604-7-songmuchun@bytedance.com> X-Spam-Level: X-Spamd-Result: default: False [-8.30 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_TWELVE(0.00)[21]; MISSING_XM_UA(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[linux-foundation.org,kernel.org,linux.dev,ellerman.id.au,linux.ibm.com,oracle.com,google.com,suse.com,gmail.com,kvack.org,lists.ozlabs.org,vger.kernel.org]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,bytedance.com:email,localhost.localdomain:mid,suse.de:email] X-Spam-Flag: NO X-Spam-Score: -8.30 On Wed, May 13, 2026 at 09:04:34PM +0800, Muchun Song wrote: > When vmemmap or usemap allocation fails, sparse_init_nid() currently > marks the section non-present and continues. Later boot-time code can > still walk PFNs in that section without checking for this partial setup, > which leads to invalid accesses. subsection_map_init() can also touch an > unallocated usemap. > > Auditing and fixing all early PFN walkers for this case is not worth the > complexity. These allocation failures are expected to be fatal anyway, > and other memory models already treat them that way. > > Make memmap and usemap allocation failures panic immediately instead of > trying to recover and crashing later in less obvious ways. This is also > consistent with how other memory model configurations handle memmap > allocation failures. > > Signed-off-by: Muchun Song > Acked-by: Mike Rapoport (Microsoft) Yes, one could argue that if we fail to allocate memory at that early stage we are already screwed. Acked-by: Oscar Salvador -- Oscar Salvador SUSE Labs