From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) (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 753D63AB48C for ; Tue, 11 Aug 2026 03:11:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.136 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786417898; cv=none; b=q9AU3bCcurUz7vgxpddkxnZ29hrjhpfp9G4zhrJlLCgL02rBNU1mAiXcOKcKa2lII/1l7AllCq5Vddu+TQMMgi6ocYFG3Vn4PX65gOEjol3Y7WTzVzD/dKcPpf93T1ups0wRtuwyzbPNNkfmQUPWGsO/zW1xLyHpnTsdaXQsKyg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786417898; c=relaxed/simple; bh=jRjHwZg/Gqsybkff1FBmu4vmqNSgzFAckpUJeyauGbo=; h=Date:From:To:CC:Subject:In-Reply-To:References:Message-ID: MIME-Version:Content-Type; b=UIri4vgvhMbOA3DHmeOWRNHjPTzSyFUWoe2ktnK4aOjrz78pUerTilFGK/APPvyRUNzh4Q8gJcyUFV1xlYh9mlITeTBTQGG90L4M93w+dg0pxhuLRxchnXa8ZHR6ytcU+xte1fOM/Bjl+iHFtioSdzBR03yabXXnIEMJ6ffzRF4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com; spf=pass smtp.mailfrom=zytor.com; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b=kB1wjtDZ; arc=none smtp.client-ip=198.137.202.136 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b="kB1wjtDZ" Received: from ehlo.thunderbird.net (c-76-133-66-138.hsd1.ca.comcast.net [76.133.66.138]) (authenticated bits=0) by mail.zytor.com (8.18.1/8.17.1) with ESMTPSA id 67B3BRAg2713831 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Mon, 10 Aug 2026 20:11:27 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 67B3BRAg2713831 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2026072801; t=1786417888; bh=LCuyLaKv/YTaZG6KRc2od4adEYxACmP4hStD6HXdvA8=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=kB1wjtDZP22aq/6UpSi6O9+uhv8ZH9CSu51bznvNfsCyRlDrbAHPBmB6a6BTiqyzW 7b4dL+dURwSDRugEM72temFm9hPuGtZdlye6Z7QGZhdCRG17ABq/flFs7rZDJiaV+o Ci7bI1pLYJXfPDiikJMAD+O2rrRXtArIbqrPEjdyGOMwTU4Ct2DZV2na+J4H0orjDS /WeB5JCP6CsyLjo/n7H5H9gfLQOsJNjuWXPpo2HWuNgW9n84RQhmS+4f6XQRVn1Qle PUtNRTvHsTJF3Ide41edsnPg/9ZvThqiF1yU5ijmKPNbzHZa2hHn3xxF/FvS1LkUfn GJJ21DqYouilQ== Date: Mon, 10 Aug 2026 20:11:20 -0700 From: "H. Peter Anvin" To: Sergey Senozhatsky CC: Thomas Gleixner , Peter Zijlstra , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: x86: missing FRED #PF event data? User-Agent: K-9 Mail for Android In-Reply-To: References: <29FD2DAB-C771-4E91-95C4-435B5DF90802@zytor.com> Message-ID: <507D6E38-4328-4DFB-BB9B-1CE220A22075@zytor.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=utf-8 Content-Transfer-Encoding: quoted-printable On August 10, 2026 6:47:13 PM PDT, Sergey Senozhatsky wrote: >On (26/08/10 08:40), H=2E Peter Anvin wrote: >> On August 10, 2026 1:58:18 AM PDT, Sergey Senozhatsky wrote: >> >On (26/08/10 16:38), Sergey Senozhatsky wrote: >> >> [=2E=2E] >> >> > All the crashes are reported as NULL ptr derefs, however, I believ= e this >> >> > is not exactly the case=2E In all crashes CR2 is 0x1000 aligned (= we always >> >> > crash accessing first byte of a page)=2E It seems that csum_parti= al() calls >> >> > load_unaligned_zeropad() and we hit what load_unaligned_zeropad() = comment >> >> > describes as very unlikely) case: "word being a page-crosser and t= he >> >> > next page not being mapped")=2E So instead of reading 4 remaining= bytes >> >> > of the page and zeroes for trailing 4 bytes, we panic()=2E It app= ears that >> >> > FRED #PF is set to 0 while CR2 points to a correct page address=2E= I added >> >> > a simple printk to exc_page_fault: >> >> >=20 >> >> > address =3D cpu_feature_enabled(X86_FEATURE_FRED) ? fred_e= vent_data(regs) : read_cr2(); >> >> > /* Fall back to CR2 if FRED event data was empty */ >> >> > if (unlikely(!address)) { >> >> > address =3D read_cr2(); >> >> > pr_err(":: fixed up address to %lx [[fred: %lx cr2= : %lx]]\n", address, fred_event_data(regs), read_cr2()); >> >> > } >> >> >=20 >> >> > and got the following while running my tests (and well, we don't c= rash >> >> > anymore): >> >> >=20 >> >> > [ 254=2E040223] :: fixed up address to ffff9c4d64af4000 [[fred: = 0 cr2: ffff9c4d64af4000]] >> >> > =2E=2E=2E >> >> > [ 1821=2E904563] :: fixed up address to ffff9c4e9dd0a000 [[fred: = 0 cr2: ffff9c4e9dd0a000]] >> >> >=20 >> >> > Does any of this make sense to you? >> >>=20 >> >> I think the explanation is some pKVM shenanigans=2E Sorry for the n= oise=2E >> > >> >No, I think we are back at square one=2E I thought that maybe pKVM >> >was disabling FRED and that was causing issues=2E But I actually see >> >that both cpu_feature_enabled(X86_FEATURE_FRED) and (cr4 & X86_CR4_FRE= D) >> >claim FRED is enabled, yet fred #PF data is 0 while CR2 holds the corr= ect >> >address=2E >>=20 >> What is pKVM? Paravirtualized KVM? > >Protected KVM=2E > >> In that case, it is most likely pKVM not filling in the relevant fields >> in the FRED stack frame, which would be a very serious bug=2E >>=20 >> I cannot think of any other way that that could possibly happen otherwi= se; >> on bare metal those fields are set by hardware and Linux only consumes = them=2E > >I agree=2E I'll look at it from the pKVM side=2E I was not aware of pKV= M >when I started this discussion, I found out about it later=2E If that code calls the FRED entry from KVM routine, that routine doesn't h= ave support for setting event_data in upstream=2E This would be fixed if ne= cessary=2E