From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A3545695 for ; Tue, 11 Aug 2026 01:47:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786412839; cv=none; b=NCc1XShCkmfICHWFSigGSYv3vjQraMFOgoPgEQzGPr9lSAVPVBfwFoM0vZpIY+P09jdExQcfumZESJOqOguk5ybmyZOYjeLLaMmWttbCWmcUZBrTF3/hlgYi2zqyPqe0kaDkI4LGlSraQUPNGLPyRynqQQtgK3oUlLxAs/RKh/o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786412839; c=relaxed/simple; bh=pYGwdIRHNtiM8KusblbwVMQpxeMyApsbw0l4am6nmJ4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=K9g8OIK5cb7W99POVMcU2Rj5Qmi+h7dh8uJb3B++aslCSSlfNQH+x4cBpzHujlOjxpWnUoiwfilHstYHNtNm6XukGG6qlQFNcd2CyOLxZ2bX/TiTaPV+PtezsCof4WzlN7Pq+Dl1G+TiNuMycERGUiEA4e0D89HRLD8mlLAoXvY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=XH4ISq6O; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="XH4ISq6O" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2d004f135b1so3918585ad.3 for ; Mon, 10 Aug 2026 18:47:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1786412837; x=1787017637; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=zP4f/suTGoWPqi0b3kK9GllIHrn9qAT58lgGLGRupGo=; b=XH4ISq6OqrpZPjSdJh7Fo1YM1zMgfePOzrP8Npjd+ma204k4cIfCmdfAs2A8hjnaKI gmR1U0uUAmDazS2wEoQXJMItjOw6FeiKqIfVnGeP2wTOqDOrEKBnxTi1R8qwGbFlO7p/ qNj8Aco59IcTlTPOOgec3bML+X3apn3x1CvBo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786412837; x=1787017637; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=zP4f/suTGoWPqi0b3kK9GllIHrn9qAT58lgGLGRupGo=; b=ik+O4CwHfzhUHaMYIG+LmPga5kqd3vciRQIe3JkG18cHFI/lgoBWXYlpfTHsbvVxDo WZyilcwwpcZoKIG2PO48F4oCKCU3lFHOpHPIEA7WlBJgt65zlf3/b+Z9vHDQp0xjsK35 ewGgHlXKX3ymYxWxAbDKcYS8XUjT6YVGXxSESMT8YzvkYhcyjfvBuYCXIOudP4p05W95 3aIHW1285e/Wjy484YjX59EuC0zaBmqEnVdp7VVj+C4EH3CdsuduzTA9ZH+Jvt0j9i1i x5yVlakJij5uqMhmuFu7wV9yp9sKwP2YcW+zz4FbkOEPDFmre/Pggubb+DrjiErQs/SA XidA== X-Forwarded-Encrypted: i=1; AHgh+Rrn+KtBsn/YetmSZMABROEjz3o4ngdkFWW4BxSkIGpE3D/qQktWnnUSWORs9ftR0s8O3L8ka7cO1xoJ3VA=@vger.kernel.org X-Gm-Message-State: AOJu0YxbQUawWHQaM1yDCittITk+OkLRMkdsJQNFkD0DwQOkkqHK+pMN EqqeJHy5Af3I53wZuX+vmpBCf4PDBQOBkbj+Ofo6Rj/cwyS/wjgWYthDlmFDoX+nQhRn9377u0K gZJs= X-Gm-Gg: AR+sD100SHf1dx1NkNA62Dw4WpC6THzsrSpmp/Jcq3vlm4NW25BkVQIbrOdyTKr+c1e BlrbLBjA1GQmBV67UPeLIew6GVyYJMkXElYN99nPL7b0a5uzzog40cbft8p5DKlCmcSCFN1u8fz g9EzHZJm8zUUy2Phc3g11zQU38buNtpmgXQJ75voJ1ghzV/8ZBH25a+Ms6XfoGTCjjFu4+oXwWF y7EHMxCWSWARdLNnHs6caDvrVl7h9kuxwJu1cHL0Nt3Tx595JqCvULAU2NLyf4tJEGbgKRq1puB O/5QrXQa9Zm3s0Zzne08f2mVFAAF8xwTwhcZMJBPX7B+7TnzAhQSEundepmtgN8yJtUPco6UGxA 3L5kwQAiE/hg46fV+y8zP2QDRuy4Y0U65TsvzY1S+TNlCg9U9C5JcZXO4lV7zvMC15EWMxkcaIA hyblp5X6bkFDCkFx7n2pHSnK+IlUt4s9WxdUILybQhED9K6t1YcFOlNlq7iaC84+2o0+1a3KhRj Zix2RvG0ySpV+bIFM/yA6daVi5h X-Received: by 2002:a17:903:4688:b0:2cc:f5aa:9513 with SMTP id d9443c01a7336-2d0ca7fbc9amr593683145ad.10.1786412837482; Mon, 10 Aug 2026 18:47:17 -0700 (PDT) Received: from google.com ([2a00:79e0:2031:6:ddfb:e755:8f7f:81af]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d315f45873sm218485ad.34.2026.08.10.18.47.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 18:47:16 -0700 (PDT) Date: Tue, 11 Aug 2026 10:47:13 +0900 From: Sergey Senozhatsky To: "H. Peter Anvin" Cc: Sergey Senozhatsky , Thomas Gleixner , Peter Zijlstra , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: x86: missing FRED #PF event data? Message-ID: References: <29FD2DAB-C771-4E91-95C4-435B5DF90802@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=us-ascii Content-Disposition: inline In-Reply-To: <29FD2DAB-C771-4E91-95C4-435B5DF90802@zytor.com> On (26/08/10 08:40), H. Peter Anvin wrote: > On August 10, 2026 1:58:18 AM PDT, Sergey Senozhatsky wrote: > >On (26/08/10 16:38), Sergey Senozhatsky wrote: > >> [..] > >> > All the crashes are reported as NULL ptr derefs, however, I believe this > >> > is not exactly the case. In all crashes CR2 is 0x1000 aligned (we always > >> > crash accessing first byte of a page). It seems that csum_partial() calls > >> > load_unaligned_zeropad() and we hit what load_unaligned_zeropad() comment > >> > describes as very unlikely) case: "word being a page-crosser and the > >> > next page not being mapped"). So instead of reading 4 remaining bytes > >> > of the page and zeroes for trailing 4 bytes, we panic(). It appears that > >> > FRED #PF is set to 0 while CR2 points to a correct page address. I added > >> > a simple printk to exc_page_fault: > >> > > >> > address = cpu_feature_enabled(X86_FEATURE_FRED) ? fred_event_data(regs) : read_cr2(); > >> > /* Fall back to CR2 if FRED event data was empty */ > >> > if (unlikely(!address)) { > >> > address = read_cr2(); > >> > pr_err(":: fixed up address to %lx [[fred: %lx cr2: %lx]]\n", address, fred_event_data(regs), read_cr2()); > >> > } > >> > > >> > and got the following while running my tests (and well, we don't crash > >> > anymore): > >> > > >> > [ 254.040223] :: fixed up address to ffff9c4d64af4000 [[fred: 0 cr2: ffff9c4d64af4000]] > >> > ... > >> > [ 1821.904563] :: fixed up address to ffff9c4e9dd0a000 [[fred: 0 cr2: ffff9c4e9dd0a000]] > >> > > >> > Does any of this make sense to you? > >> > >> I think the explanation is some pKVM shenanigans. Sorry for the noise. > > > >No, I think we are back at square one. I thought that maybe pKVM > >was disabling FRED and that was causing issues. But I actually see > >that both cpu_feature_enabled(X86_FEATURE_FRED) and (cr4 & X86_CR4_FRED) > >claim FRED is enabled, yet fred #PF data is 0 while CR2 holds the correct > >address. > > What is pKVM? Paravirtualized KVM? Protected KVM. > 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. > > I cannot think of any other way that that could possibly happen otherwise; > on bare metal those fields are set by hardware and Linux only consumes them. I agree. I'll look at it from the pKVM side. I was not aware of pKVM when I started this discussion, I found out about it later.