From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 26C3F1D5CC9 for ; Mon, 29 Jun 2026 20:18:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782764290; cv=none; b=TVLU5fQt2jOvNgHOoyl/FGHBMXHlgLVa3mTkP227Wbs2U421u50z7xuWbpLzOpqkopZQfVnT2UZM/fOtaBq1+Tf1W9ouvaexjbXlzR6Sc/oFZsL/RML/mRNo5DSUiCzzS/mfCcSnvLsJXnbNWiTmrJCxhVM9mbo1voTDhtZJcqo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782764290; c=relaxed/simple; bh=MIZ/lQoJlh1mdE3yIKVtWyukFBq2kvM8vuYVS93jGg0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ciE3A1NN3e1ueqGvkYSrVF/mh8Bj6QLu3OUJVk6GkEn6oGUYN8tGO5olnfmGrWG5MSgUlsccOKikDtMnar4xZmtcnsUnQe9T8SW05v8SIcSv0w96bOT16SB1wx2D5t4Lz0hXDBBiSrXoziFJdXNuK7VwFqRQsBt6LO/xeetRl/4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=pass smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=QDqBxaV+; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="QDqBxaV+" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=HNZ0qyY1NIkUeBVNfz2O0XGsUQ0RfZrNUaEdXxQ0jaE=; b=QDqBxaV+VaAcyGm2fZtZ/xYYNX eykSlBQjALG9c3qtEyuf6iXzzrvy5CW/I8X7sANPtN7z5foPE79fnluQp0OeH9YjJ0fD4UfBgkjS9 Uydkq/zlxgR/a51ixPPNdwhJlZa6OO/k8iYEFJfSau6Gfl+aWDQLFq8I0LYAFSQhUZDtk1AfNuHuy fwutNJLFA4BbVJPC7Bn63V1b8iJ3WNkWGg5A3g2nrEfqXgfstr6oq78AOXqfzwvIzXxt3GQDSwy3A 1Gm16NEOVIdfYefEPEcEz47oN2JKaxLyiCHlMyO/euuqqwNox+U5SEpk8v/qJaAOrqhxcnUBPRh1j voAdQNCA==; Received: from willy by casper.infradead.org with local (Exim 4.99.1 #2 (Red Hat Linux)) id 1weIQF-00000003mn1-16Yc; Mon, 29 Jun 2026 20:17:39 +0000 Date: Mon, 29 Jun 2026 21:17:39 +0100 From: Matthew Wilcox To: Dave Hansen Cc: Thomas Gleixner , Zach O'Keefe , "H. Peter Anvin" , David Stevens , Pasha Tatashin , Linus Walleij , Will Deacon , Quentin Perret , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Andy Lutomirski , Xin Li , Peter Zijlstra , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Uladzislau Rezki , Kees Cook , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2 00/13] Dynamic Kernel Stacks Message-ID: References: <87pl1md7h0.ffs@fw13> <87qzm2b39k.ffs@fw13> <87mrwon5uw.ffs@fw13> <87cxxgly12.ffs@fw13> <5604a47b-9457-4162-bd23-720e29cf1983@intel.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: <5604a47b-9457-4162-bd23-720e29cf1983@intel.com> On Mon, Jun 29, 2026 at 09:02:08AM -0700, Dave Hansen wrote: > It could be done with really little overhead if the vmalloc()'d stacks > set Accessed=0 on their PTEs and then checked them near vfree(). The > PTEs are already getting touched there, so the cachelines should be hot > anyway. > > The granularity would only be 4k, but it would be so cheap that we could > turn it on universally. It would also be 100% deterministic. > > There are, of course, more games that could be played with stack depth > checks on normal interrupts or NMIs. But those would be less deterministic. I mean, if we just memset64() the whole stack to 0x535441434b544f50 and then searched the stack for the lowest word that wasn't that value at process exit, we'd get a much more granular idea with vanishingly few false positives.