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 522FC1E5B7B for ; Tue, 25 Nov 2025 01:18:15 +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=1764033497; cv=none; b=TYNkeRJvaR6H8W5xRkzc8z/x2Qvcg+EWtG+E+/wSxwnS0ml3Dqe1Yk6Bn/ouiv8fgIkBQGd/Ji15z9NpyGMHTsJaDoBz77ovHLLUGR2ih3iK2WIAaC/VEVSUZRp1qFqTrWg/Qwa8e/QoTF6Pn34NsRu0fhPuWVbwTiVkgyVti5o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764033497; c=relaxed/simple; bh=+2cgGufVo44/HmTgm2hDLVXFZxT+/fKOlp01kamj9o0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A792daCd5jaiPG6co4BW6ufIKp9X3UjXmb3TFTqA+bwhcqwZXWn6a2USPOUVBKPLJE115meDA5Qc64BDjSLyGJaX64as8jlOG+Wg1l4gfOH00oPPDLnQ5O6qSQqJC1kAmAEvapAJH2on4ToK6rzy5SwmvB3IPDmOqUX+iBUY3/M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AEut25SD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AEut25SD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9532BC4CEF1; Tue, 25 Nov 2025 01:18:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764033495; bh=+2cgGufVo44/HmTgm2hDLVXFZxT+/fKOlp01kamj9o0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AEut25SD+vng87R7XeaR2L7VNOmfVGVWR8pCR4lj6hxHh+55pTmQmBMT709BMzQLW CB/33no3pprN6vVOd2QzKCvVyeULRCz3POv7imFfjNXyGnZTpLULF7gmChlyxwBifx pBM03+YdvpYUyEb5DO+ZToSnYQnEoNcMiWFJC3HIx7Lt9yCKjPR8KvwMpxj8mVU4L5 Ltm+Q3RxvDJeHTPxK3sM8R/KE/U0juXpWlQchg5c9iqzn1pEyIyhtDISzxaM6ecoar 6N4e9v5BZe1yCJ2dlVWTg8rTnzyUCPkRtIwv1+4NfrhW73SqcchrVEgB77yJ5EWk8k zEwKllGgjkRyg== From: SeongJae Park To: Joshua Hahn Cc: SeongJae Park , Andrew Morton , Vlastimil Babka , Mike Rapoport , linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel-team@meta.com Subject: Re: [PATCH v2 2/2] mm/mm_init: decouple page checking and init_on_{alloc, free} Date: Mon, 24 Nov 2025 17:18:07 -0800 Message-ID: <20251125011808.74845-1-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251124225408.2243564-2-joshua.hahnjy@gmail.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Mon, 24 Nov 2025 14:54:07 -0800 Joshua Hahn wrote: > init_on_alloc and init_on_free protect the kernel by initializing > allocated and freed pages to 0 on allocation time / deletion. > Commit 700d2e9a36b93601270c1e15550acde2521386c5 ("mm, page_alloc: reduce I think 12 digits for commit hash id is enough. > page alloc/free sanity checks") removed page checking from hot pcp > drain and refill paths, and instead coupled it with CONFIG_DEBUG_VM, > debug_pagealloc, page poisoning, and init_on_{alloc, free}. > > As the commit suggests, the first three turn the kernel into a debug > kernel, while the last hardens the kernel against leaking sensitive memory. > While enabling page checking is relatively low-cost and tying it > together with page initialization is not unreasonable, it does feel like > a bit of a side-effect, rather than an obvious consequence. > > With page checking now pulled out as a boot time parameter that can be > set independently, let's decouple page checking and init_on_alloc and > init_on_free. > > As a direct side effect, systems that have init_on_alloc or init_on_free > will no longer have page checking enabled by default; they will either > have to pass the check_pages boot parameter, build the kernel with > CONFIG_DEBUG_VM, or enable debug_pagealloc / page poisoning. > > Suggested-by: Vlastimil Babka > Signed-off-by: Joshua Hahn Acked-by: SeongJae Park Thanks, SJ [...]