From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) (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 1AB4836402D for ; Wed, 1 Apr 2026 02:37:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775011083; cv=none; b=GP5uyt++cKl8oGFvPLN7Tw6r9E3RnMNgbWpP+2pEAz21ui6jDiFf6maJTE33reRWBinL3CgY2SE18/uIsPq0QgaRggV5I9PldL+Xey5ulbqjfPSruYfIk7xTCoBuzsUi/PsRtXDIv7X6Uw7eVsPcMBKzCQmrHxJykA95dXV+5JY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775011083; c=relaxed/simple; bh=YIdiyi2W+tjOYIkyRZMrsH8N+P+27Zu/avJTfkQi6HY=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=cCKIKRDZKlZXPredV5uyLMDZIyRSs+LqNT+ZNaVlxfdQlUk9PRyLffoowBZxoLQRZ3QE+x/pWb9C6D/pi7TFvfWzuxYDi6TwKki+GJhXPOBGMqc9sNj+/i6EMUCIE9l7iLUrwpu2M+Z9j+Fn7U/qY+hDy+9+Eoc1GH0mQfxfDWE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=eUkfkE49; arc=none smtp.client-ip=95.215.58.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="eUkfkE49" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1775011065; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V/AgBuplD7pnvBkbFJrPZhea+7Gp1573Ry9VeaVLzLo=; b=eUkfkE494scS5DpjMexgKp4GRacwUJesJZUh/YUI7JSBAtUQhARYvX74hu0/pEuhyfXYLU 0H7/S25yVJQZZJiWmyxagB95WKmdz/rPUGK9GdYAolRCAslHL3Ue7048AxPW2HhY8NbtB+ HJFc2mJ/zryp76I6GeQyjHWKY778Z7Y= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: Re: [PATCH] mm/sparse: fix preinited section_mem_map clobbering on failure path X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <20260331131054.0164f3b3ab6f7868add37cd3@linux-foundation.org> Date: Wed, 1 Apr 2026 10:37:01 +0800 Cc: Muchun Song , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Frank van der Linden , linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <0D1D7025-7DF4-41DB-83A4-6AA800FBAAD6@linux.dev> References: <20260331113724.2080833-1-songmuchun@bytedance.com> <20260331131054.0164f3b3ab6f7868add37cd3@linux-foundation.org> To: Andrew Morton X-Migadu-Flow: FLOW_OUT > On Apr 1, 2026, at 04:10, Andrew Morton = wrote: >=20 > On Tue, 31 Mar 2026 19:37:24 +0800 Muchun Song = wrote: >=20 >> sparse_init_nid() is careful to leave alone every section whose = vmemmap >> has already been set up by sparse_vmemmap_init_nid_early(); it only >> clears section_mem_map for the rest: >>=20 >> if (!preinited_vmemmap_section(ms)) >> ms->section_mem_map =3D 0; >>=20 >> A leftover line after that conditional block >>=20 >> ms->section_mem_map =3D 0; >>=20 >> was supposed to be deleted but was missed in the failure path, = causing the >> field to be overwritten for all sections when memory allocation = fails, >> effectively destroying the pre-initialization check. >>=20 >> Drop the stray assignment so that preinited sections retain their >> already valid state. >=20 > Here I go again ;) Are there userspace impacts? Those pre-inited sections (HugeTLB pages) are not activated. However, = such failures are extremely rare, so I don't see any major issues. >=20 > AI review thinks it found a different bug: > = https://sashiko.dev/#/patchset/20260331113724.2080833-1-songmuchun@bytedan= ce.com I don't think the issue reported by AI is a real problem, because the allocation of sparse_usagebuf has already taken these hugetlb sections into account. Thanks.