imagemap: Fix boot errors and resource lifetimes
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest9 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/9 | boot: Return distinct errors for ordinary bootm failuresarch/ arch/ arch/ +4 more | +19 | 0 replies | |
| 2/9 | sandbox: bootm: Reject unsupported subcommandsarch/ | +5 | 0 replies | |
| 3/9 | test: boot: bootm: Check ordinary failurestest/ | +53 | 0 replies | |
| 4/9 | boot: imagemap: Preserve mappings when an extend failsboot/ | +87 | 0 replies | |
| 5/9 | test: boot: imagemap: Check a failed extendtest/ | +45 | 0 replies | |
| 6/9 | boot: imagemap: Clarify region replacementboot/ include/ | +12 | 0 replies | |
| 7/9 | mtd: Unbind the block device when removing a masterdrivers/ | +45 | 0 replies | |
| 8/9 | test: dm: sf: Check the block count after re-probingtest/ | +32 | 0 replies | |
| 9/9 | boot: imagemap: Copy cached data when moving a regionboot/ test/ | +43 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/9] imagemap: Fix boot errors and resource lifetimes
This series fixes bootm error handling and resource lifetime issues found while testing the imagemap boot path. It applies on top of main.
Ordinary allocation failures and unsupported bootm subcommands return -1, which is also BOOTM_ERR_RESET. Return -ENOMEM and -ENOSYS for these failures so they return to the shell. Sandbox gains the same subcommand behaviour, with tests for unsupported subcommands and failed ramdisk allocation.
A failed imagemap extension can leave the original mapping pointing at unreserved memory, which cleanup may free after another user has allocated it. Keep the original mapping and reservation until the larger region has been read successfully. When the region moves, copy its cached data and read only the added range. Document region replacement and pointer lifetime, and add regression coverage for failed extensions and relocation.
Removing and re-probing a SPI flash leaves its old mtd_blk device bound, so each probe adds another block device. Unbind it and free its pointer storage when deleting the MTD master, with a test for the block count after re-probing.
Built for sandbox and qemu_arm64. The sandbox bootm and imagemap suites pass all nine and 16 tests respectively. On QEMU, checked that unsupported bdt and cmdline subcommands and a ramdisk allocation failure return to the shell.
Daniel Golle (9):
boot: Return distinct errors for ordinary bootm failures
sandbox: bootm: Reject unsupported subcommands
test: boot: bootm: Check ordinary failures
boot: imagemap: Preserve mappings when an extend fails
test: boot: imagemap: Check a failed extend
boot: imagemap: Clarify region replacement
mtd: Unbind the block device when removing a master
test: dm: sf: Check the block count after re-probing
boot: imagemap: Copy cached data when moving a region
arch/arc/lib/bootm.c | 5 +- arch/arm/lib/bootm.c | 3 +- arch/microblaze/lib/bootm.c | 3 +- arch/mips/lib/bootm.c | 3 +- arch/riscv/lib/bootm.c | 3 +- arch/sandbox/lib/bootm.c | 5 ++ arch/x86/lib/bootm.c | 2 +- boot/image-board.c | 13 ++-- boot/imagemap.c | 151 ++++++++++++++++++++++-------------- drivers/mtd/mtdcore.c | 48 +++++++++++- include/imagemap.h | 13 +++- test/boot/bootm.c | 53 +++++++++++++ test/boot/imagemap.c | 85 ++++++++++++++++++++ test/dm/sf.c | 32 ++++++++ 14 files changed, 340 insertions(+), 79 deletions(-)
base-commit: 6487c50b8a40f2668ab98a892b9300ad5c181f38
Signature · 1 line
2.56.0