From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 B129A26738C for ; Thu, 16 Jul 2026 05:54:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784181265; cv=none; b=aIpv4uxrSg2aQ3qMmB34N6dBv1s0JG7iCcjUwIaB/btBQIhAfzrPTCTVAGaEx1SoQe07pQ49026wZii/kW+5eB5In+3ttAOkObbe/FMZOuPG32c0mpXAgIHQauqRkIn05jP+V9Vr0FWU5YGcgvTpOvR1TM/TClpufqJofViid4c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784181265; c=relaxed/simple; bh=cLRs7G1S5ZhWRadUXmxHqUk+Yl5BIjRQXN92kSxdgCk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bl5+z5B8yqRjZ0B43ht/PyufgnF84H5/jkQ1Xm6m85qhkej/J/WwI5LA5xF71RrdMO7fWg3pjZfziqQuMFLmjSnvPqqkx3HCFp4ISNZXDP1+w85iSo8m+jgfaDuueWees+1VN/FBOE/7QMkPjTS74GMWEKAVyXboAsZLRBY1oU0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m0KOyMYF; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m0KOyMYF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0F711F000E9; Thu, 16 Jul 2026 05:54:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784181264; bh=vR2/E9B4yAw9/xqQaR2O5qPjoHQT1PjdYChR7pBCRHM=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=m0KOyMYFvW45M5yoP6w9PuR5cQM48U5sLUfAoQ2y650c6XarHdlWWzA1kbDr+8QqP 63Buw4Tb9HWaPHfCF4FJHrzzAqdyLvvtZIPd1tT4UOVoXT2zefIupF2/UUAynacAWm o9StzA1anM/5kIPk6S0uj2nxKA34J3g0pye0xPbFsylyG8wkAccYh6sknWrRN5cMbQ aWvSNNv01LSbR37lMpnWzBtmapZBF6UOrfX3JB5pa/DWyihvr4g83wpvwYYVx6O2vd ktSYw6vXqLuwDCmAU3nvF3vyOr925wktRe48RsQTUEHhkwYcwpr+Hi5yzM7AgOUZz6 BnuPRNWgr81ww== Date: Thu, 16 Jul 2026 08:54:17 +0300 From: Mike Rapoport To: "Denis V. Lunev" Cc: Dave Hansen , Andy Lutomirski , Peter Zijlstra , x86@kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Juergen Gross , Kiryl Shutsemau , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] x86/mm/pat: take cpa_lock around large-page collapse Message-ID: References: <20260715183453.2381141-1-den@openvz.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: <20260715183453.2381141-1-den@openvz.org> On Wed, Jul 15, 2026 at 08:34:52PM +0200, Denis V. Lunev wrote: > Loading and unloading modules concurrently on several CPUs on a KASAN > build, with a short delay injected at the CPA page-table lookup to > widen the window, faults within minutes: > > BUG: KASAN: use-after-free in __change_page_attr+0x7cc/0x7e0 > Write of size 8 at addr ffff888181139718 by task modprobe > ... > The buggy address belongs to the physical page: > pfn:0x181139 ... page_type: f2(table) ... > Serialize the collapse - the PMD rebuild, TLB flush and PTE-table > free - under cpa_lock, the same lock __change_page_attr() now takes > unconditionally since commit ("x86/mm/pat: stop gating cpa_lock on > debug_pagealloc_enabled()"), so a concurrent walker can no longer > hold a pointer into a table the collapse is about to free. > > Fixes: 41d88484c71c ("x86/mm/pat: restore large ROX pages after fragmentation") > Signed-off-by: Denis V. Lunev > Acked-by: Kiryl Shutsemau (Meta) I though I acked v1, but apparently I didn't :/ Acked-by: Mike Rapoport (Microsoft) -- Sincerely yours, Mike.