Skip to content

makedumpfile: harden parsing of old prink buffer

Philipp Rudo kexec 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 0 repliesNew
  2. v13 patches 0 repliesSuperseded

Changes in v2 from the cover letter

* Rename 'idx' to 'ptr'
* Also print the non-loop part when a cycle was detected. Such a situation can happen when log_buf wrapped around in the kernel (log_first_idx != 0) and the corruption occurred on an idx < log_first_idx.
* Add patch 4 fixing a bug independent from the memory corruption but found while investigating it.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4makedumpfile: add generic cycle detectionMakefile detect_cycle.c detect_cycle.h+140 -10 replies
2/4makedumpfile: use pointer arithmetics for dump_dmesgmakedumpfile.c+13 -161 reply
3/4makedumpfile: use cycle detection when parsing the prink log_bufmakedumpfile.c+47 -10 replies
4/4makedumpfile: print error when reading with unsupported compressionmakedumpfile.c+48 -81 reply

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by.

PatchDave Wysochanski
SeriesReviewed-and-tested-by
1/4
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/4] makedumpfile: harden parsing of old prink buffer

Hi,

dumping the dmesg can cause an endless loop for the old prink mechanism (> v3.5.0 and < v5.10.0) when the log_buf got corrupted. This series fixes those cases by adding a cycle detection. The cycle detection is implemented in a generic way so that it can be reused in other parts of makedumpfile.

Thanks
Philipp

v2:
* Rename 'idx' to 'ptr'
* Also print the non-loop part when a cycle was detected. Such a situation can happen when log_buf wrapped around in the kernel (log_first_idx != 0) and the corruption occurred on an idx < log_first_idx.
* Add patch 4 fixing a bug independent from the memory corruption but found while investigating it.

Philipp Rudo (4):
makedumpfile: add generic cycle detection
makedumpfile: use pointer arithmetics for dump_dmesg
makedumpfile: use cycle detection when parsing the prink log_buf
makedumpfile: print error when reading with unsupported compression

 Makefile       |   2 +-
 detect_cycle.c |  99 +++++++++++++++++++++++++++++++++++++
 detect_cycle.h |  40 +++++++++++++++
 makedumpfile.c | 131 ++++++++++++++++++++++++++++++++++++++++---------
 4 files changed, 247 insertions(+), 25 deletions(-)
 create mode 100644 detect_cycle.c
 create mode 100644 detect_cycle.h
Signature · 1 line
2.35.1