Skip to content

kdb: Refactor and fix bugs in kdb_read()

Daniel Thompson lkml stable 3 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected] change-id 20240415-kgdb_read_refactor-2ea2dfc15dbb

Versions newest first

  1. v3 Latest7 patches 1 replyApplied
  2. v27 patches 13 repliesSuperseded
  3. v17 patches 0 repliesSuperseded

Changes in v3 from the cover letter

- Collected tags from v2
- Added comment to describe the hidden depths of kdb_position_cursor()
(thanks Doug)
- Fixed a couple of typos in the patch descriptions (thanks Doug)
- Link to v2: https://lore.kernel.org/r/[email protected]

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/7kdb: Fix buffer overflow during tab-completekernel/debug/kdb/kdb_io.c+13 -80 replies
2/7kdb: Use format-strings rather than '\0' injection in kdb_read()kernel/debug/kdb/kdb_io.c+34 -210 replies
3/7kdb: Fix console handling when editing and tab-completing commandskernel/debug/kdb/kdb_io.c+5 -00 replies
4/7kdb: Merge identical case statements in kdb_read()kernel/debug/kdb/kdb_io.c+1 -90 replies
5/7kdb: Use format-specifiers rather than memset() for padding in kdb_read()kernel/debug/kdb/kdb_io.c+3 -50 replies
6/7kdb: Replace double memcpy() with memmove() in kdb_read()kernel/debug/kdb/kdb_io.c+7 -120 replies
7/7kdb: Simplify management of tmpbuffer in kdb_read()kernel/debug/kdb/kdb_io.c+18 -230 replies

Reviews trailers per patch

All 7 patches have a Reviewed-by or Acked-by.

PatchDouglas AndersonJustin Stitt
1/7R-b R-b T-b
2/7R-b T-b
3/7R-b T-b
4/7R-b T-b
5/7R-b T-b
6/7R-b T-b
7/7R-b T-b

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

Read the v3 thread

Cover letter [PATCH v3 0/7] kdb: Refactor and fix bugs in kdb_read()

Inspired by a patch from [Justin][1] I took a closer look at kdb_read().

Despite Justin's patch being a (correct) one-line manipulation it was a tough patch to review because the surrounding code was hard to read and it looked like there were unfixed problems.

This series isn't enough to make kdb_read() beautiful but it does make it shorter, easier to reason about and fixes two buffer overflows and a screen redraw problem!

[1]: https://lore.kernel.org/all/20240403-strncpy-kernel-debug-kdb-kdb_io-c-v1-1-7f78a08e9ff4@google.com/

---
Changes in v3:
- Collected tags from v2
- Added comment to describe the hidden depths of kdb_position_cursor()
(thanks Doug)
- Fixed a couple of typos in the patch descriptions (thanks Doug)
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- No code changes!
- I belatedly realized that one of the cleanups actually fixed a buffer
overflow so there are changes to Cc: (to add stable@...) and to one
of the patch descriptions.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Daniel Thompson (7):
kdb: Fix buffer overflow during tab-complete
kdb: Use format-strings rather than '\0' injection in kdb_read()
kdb: Fix console handling when editing and tab-completing commands
kdb: Merge identical case statements in kdb_read()
kdb: Use format-specifiers rather than memset() for padding in kdb_read()
kdb: Replace double memcpy() with memmove() in kdb_read()
kdb: Simplify management of tmpbuffer in kdb_read()

 kernel/debug/kdb/kdb_io.c | 153 +++++++++++++++++++++++-----------------------
 1 file changed, 78 insertions(+), 75 deletions(-)

---
base-commit: dccce9b8780618986962ba37c373668bcf426866
change-id: 20240415-kgdb_read_refactor-2ea2dfc15dbb

Best regards,

Signature · 1 line
Daniel Thompson <[email protected]>