From nobody Thu Apr 2 23:54:46 2026 Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.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 793091FC7C5 for ; Sun, 15 Feb 2026 18:52:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771181554; cv=none; b=kaYF6vY2JjqnPsINH8AsNPsGbhatPmYqcSvna+WFTLXqFQIdP03xVAX+bVE14pStgdcoTCN6X26TsWYxLOnzSJyu8VSlPzLhdj4vkQiuguRmw4DsG1e3f9HYQtZo+D9uOEzQCwqmqCX4BZDWvX+VkScd6of1lIV9vvGJvOFOWrU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771181554; c=relaxed/simple; bh=NoNskTe3uZW4RgcxjeNpjg/9c7kZ6FWlUlEfAyhmGRM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=g+IAilSJikD1d0j/WR2w7vdKop/lwi4BLfVWzOo4kd0ROK1toOpF3sENI6S0EBFDQBFmqhsONSfRGSDTwqsQxDzwCgar1+5cSjoX8ZD3KZbew1XcpEwzRBuVl6xSDwgP6dnG+BW59KfOifEBnow5RjrYwZssdLIL4Lofm4h++jc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SMGThPyE; arc=none smtp.client-ip=209.85.222.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SMGThPyE" Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-8c6f21c2d81so284767985a.2 for ; Sun, 15 Feb 2026 10:52:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771181552; x=1771786352; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=EsfzKYmpLSxAAOTiptt7aFVx1ktWi2rGfqaYFT6oD3Q=; b=SMGThPyEWfxaa8U9PKlPyLmaQ/Wmp9rzH6U6QxYwUZPiMq1S0l/AEahnWcbrBh6hRc G2seRBToawPiC7DGAJMRj9WMxLd3jZbYULmNmKGX5Kula36ZSDPGF+uLvgrZgpe+zkBa lfZfzatsjb78aIHg+7MhqeupKEdbtAfl3cm+SK7TFlEOE9jCHE9YsIkJXqMQMN2nZ7a9 /dnny39dXsoxNdd1ojVI50jwCv3zGTs+Q0Y3oZSlv1WDaxyTSIClm+J/8j0xHNjM4YYu ASkbbQRuku0O7T2g2ncfwxvfY32pAfgeqIcPkDhrAqeXXBDLxF2BoU5c//IbI+fn11N9 pb9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771181552; x=1771786352; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EsfzKYmpLSxAAOTiptt7aFVx1ktWi2rGfqaYFT6oD3Q=; b=nxVjeI/gG7wk2UoiOkZoMLIsKbRnm9MOm8/puTPZgEqsU9vjrBztegz3kKQBbJayM0 yULbZ6HfdV/ypKS52r7pdJYIEZyLlivJuPl1auvaHCM1Bf9FrNUgJmDdCwyip1yrd1zI nhxCAeBf679MpRTrCuO5Vk24siu8AUpZlmmGdGwm1eoN+nlFStOXiRjJ0MXgiTCAbmQ/ BNy1rPKmldyzxOlKRsvSyIMi2h9VKVK+bIFaW6B1dPfDRW8ej3uX1VsreM55wtRBc6Yd /nPZiaQRxxGy9E/9S4GfdkRXqTao1hRs58rEe+3oML1GbNbdtwW8PWz4xu2XNlMabYXz ztVQ== X-Forwarded-Encrypted: i=1; AJvYcCWA3MyDfSyd/27dbSnc3c0tdmaxiPBsUFx4MsEZ0sB9/5c2EqGOX2pkfBoz7kUYHuvXtrVbcXeYYqzNlgc=@vger.kernel.org X-Gm-Message-State: AOJu0YyE3LKeOY6T5GaWW9qwzRnPUEo1FeNOHHeq+R2SJI95X1mw5Piq BsjNfZP0tviNDTBXGcswBuX5K54IdFTtZbKqaOQB1X8TyNUXCiyuGCZw X-Gm-Gg: AZuq6aJEnMwqBCRaRSP3VHI9SKn5DWZzWN+09f7jhYQWNuVN0neK4iAzMAPoatYquzn EsQa4xHrcc6+VWSORmLwsDKMk38/MIsM2iDbmIILu6A50NX7uV8SbnT7GFYatrT26EL+eB21hTs QKTPf//+yGtDpkYxGkZbWII9WrdlQgcuEROl7XaKJXGFjM0AVWnP17InFuz5+COUsXQHwPKxmma yzg5KjyojQruIOpxzlJdg7/JswQAJ2v90uljMdjYc9lU942LWFAb9ccBbaTi/FUddg4lsPy1SMk Ucr7fQdzP42pcHn4kGA220jjsvJu8DYWIKHVWH2VIkP2KOO6J7wLCnvPl4MzJhieFCNzYyjVk+s JGSoqgEyjcoDXatAbtn/Dxd40UWgQiGeJaBTeixVM2X8F+HRlPIBSjrSVULkneZId8yc4pvTPfu WBqCU8O6RLm5QB5aFr4NyORvYfzQ== X-Received: by 2002:a05:620a:290c:b0:8b2:ea5a:4149 with SMTP id af79cd13be357-8cb4248158dmr1092505385a.65.1771181552160; Sun, 15 Feb 2026 10:52:32 -0800 (PST) Received: from new-nest ([94.19.228.143]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8971cd8ca6esm113306766d6.33.2026.02.15.10.52.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Feb 2026 10:52:30 -0800 (PST) From: Andrey Skvortsov To: Kees Cook , Tony Luck , "Guilherme G. Piccoli" , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, Steven Rostedt , Masami Hiramatsu , Mark Rutland , linux-trace-kernel@vger.kernel.org Cc: Andrey Skvortsov Subject: [PATCH] pstore: fix ftrace dump, when ECC is enabled Date: Sun, 15 Feb 2026 21:51:55 +0300 Message-ID: <20260215185156.317394-1-andrej.skvortzov@gmail.com> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" total_size is sum of record->size and record->ecc_notice_size (ECC: No errors detected). When ECC is not used, then there is no problem. When ECC is enabled, then ftrace dump is decoded incorrectly after restart. First this affects starting offset calculation, that breaks reading of all ftrace records. CPU:66 ts:51646260179894273 3818ffff80008002 fe00ffff800080f0 0x3818fff= f80008002 <- 0xfe00ffff800080f0 CPU:66 ts:56589664458375169 3818ffff80008002 ff02ffff800080f0 0x3818fff= f80008002 <- 0xff02ffff800080f0 CPU:67 ts:13194139533313 afe4ffff80008002 1ffff800080f0 0xafe4ffff80008= 002 <- 0x1ffff800080f0 CPU:67 ts:13194139533313 b7d0ffff80008001 100ffff80008002 0xb7d0ffff800= 08001 <- 0x100ffff80008002 CPU:67 ts:51646260179894273 8de0ffff80008001 202ffff80008002 0x8de0ffff= 80008001 <- 0x202ffff80008002 Second ECC notice message is printed like ftrace record and as a result couple of last records are completely wrong. For example, when the starting offset is fixed: CPU:0 ts:113 ffffffc00879bd04 ffffffc0080dc08c cpuidle_enter <- do_idle+= 0x20c/0x290 CPU:0 ts:114 ffffffc00879bd04 ffffffc0080dc08c cpuidle_enter <- do_idle+= 0x20c/0x290 CPU:100 ts:28259048229270629 6f4e203a4343450a 2073726f72726520 0x6f4e203= a4343450a <- 0x2073726f72726520 Signed-off-by: Andrey Skvortsov Tested-by: Guilherme G. Piccoli --- fs/pstore/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index b4e55c90f8dc2..9c2d5e5f31d65 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c @@ -74,9 +74,9 @@ static void *pstore_ftrace_seq_start(struct seq_file *s, = loff_t *pos) if (!data) return NULL; =20 - data->off =3D ps->total_size % REC_SIZE; + data->off =3D ps->record->size % REC_SIZE; data->off +=3D *pos * REC_SIZE; - if (data->off + REC_SIZE > ps->total_size) + if (data->off + REC_SIZE > ps->record->size) return NULL; =20 return_ptr(data); @@ -94,7 +94,7 @@ static void *pstore_ftrace_seq_next(struct seq_file *s, v= oid *v, loff_t *pos) =20 (*pos)++; data->off +=3D REC_SIZE; - if (data->off + REC_SIZE > ps->total_size) + if (data->off + REC_SIZE > ps->record->size) return NULL; =20 return data; --=20 2.51.0