lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250901153032.737442-1-chenguanxi11234@163.com>
Date: Mon,  1 Sep 2025 23:30:32 +0800
From: chenguanxi11234@....com
To: kees@...nel.org
Cc: tony.luck@...el.com,
	gpiccoli@...lia.com,
	linux-hardening@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	haonan.chen@....com,
	xiaocheng.yan@....com
Subject: [PATCH linux-next v2] pstore/ram: Fix pstore lost information

From: Chen Haonan <haonan.chen@....com>

Background
==========
persistent_ram_zap() is used to prevent the corresponding file from 
still appearing after an unlink operation in the next boot, but 
this is unnecessary for console, pmsg, and ftrace. Worse yet, it 
causes the system to only show logs generated after the deletion 
operation the next time it reboots, following the removal of the 
corresponding file under /sys/fs/pstore.

Solution
==========
Before executing persistent_ram_zap(), check the file type and 
perform this operation only for dmesg logs. 

Result View
==========
Before patch:

root@...ntu:/sys/fs/pstore# echo test1 > /dev/pmsg0 
root@...ntu:/sys/fs/pstore# rm pmsg-ramoops-0 
root@...ntu:/sys/fs/pstore# echo test2 > /dev/pmsg0 
root@...ntu:/sys/fs/pstore# reboot
...
root@...ntu:/sys/fs/pstore# cat pmsg-ramoops-0 
test2

After patch:

root@...ntu:/sys/fs/pstore# echo test1 > /dev/pmsg0 
root@...ntu:/sys/fs/pstore# rm pmsg-ramoops-0 
root@...ntu:/sys/fs/pstore# echo test2 > /dev/pmsg0 
root@...ntu:/sys/fs/pstore# reboot
...
root@...ntu:/sys/fs/pstore# cat pmsg-ramoops-0
test1
test2

Signed-off-by: Chen Haonan <haonan.chen@....com>
---
 fs/pstore/ram.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index bc68b4de5287..48e4abd5dcad 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -436,7 +436,8 @@ static int ramoops_pstore_erase(struct pstore_record *record)
 	}
 
 	persistent_ram_free_old(prz);
-	persistent_ram_zap(prz);
+	if (record->type == PSTORE_TYPE_DMESG)
+		persistent_ram_zap(prz);
 
 	return 0;
 }
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ