mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] pstore: fix two ramoops error-path bugs
@ 2026-09-21 20:23 Andrea Parri
  2026-09-21 20:23 ` [PATCH 1/2] pstore: don't leave an ERR_PTR in the ramoops zone pointer Andrea Parri
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Andrea Parri @ 2026-09-21 20:23 UTC (permalink / raw)
  To: Kees Cook, Tony Luck, Guilherme G . Piccoli, Anton Vorontsov,
	Greg Kroah-Hartman, Colin Cross, John Stultz
  Cc: linux-kernel, Andrea Parri

Two bugs in the ramoops error paths, found by review and confirmed with
test-only reproducers against an unfixed kernel:

 - ramoops_init_prz() stores persistent_ram_new()'s ERR_PTR in the zone
   pointer and returns without clearing it; the probe error path then
   passes it to persistent_ram_free(), which dereferences it and oopses.

 - persistent_ram_buffer_map() computes buffer_size = size -
   sizeof(struct persistent_ram_buffer) with no lower bound, so a zone no
   larger than the header underflows buffer_size to a huge value and
   defeats the bounds checks in the write paths.

The second patch adds a new failure return from persistent_ram_new() for
undersized zones, which is exactly the error path that exposes the first
bug: a tiny zone now leaves an ERR_PTR behind on cleanup.  Applied
without the first patch, it turns the memory-corruption bug into a
probe-time panic on the same input, so the ERR_PTR fix is sent first.

Andrea Parri (2):
  pstore: don't leave an ERR_PTR in the ramoops zone pointer
  pstore: reject persistent RAM zones too small for the buffer header

 fs/pstore/ram.c      | 1 +
 fs/pstore/ram_core.c | 6 ++++++
 2 files changed, 7 insertions(+)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-09-21 23:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-21 20:23 [PATCH 0/2] pstore: fix two ramoops error-path bugs Andrea Parri
2026-09-21 20:23 ` [PATCH 1/2] pstore: don't leave an ERR_PTR in the ramoops zone pointer Andrea Parri
2026-09-21 20:23 ` [PATCH 2/2] pstore: reject persistent RAM zones too small for the buffer header Andrea Parri
2026-09-21 21:35   ` Kees Cook
2026-09-21 22:38     ` Andrea Parri
2026-09-21 23:11       ` Kees Cook
2026-09-21 21:38 ` [PATCH 0/2] pstore: fix two ramoops error-path bugs Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®