Skip to content

Bounds hardening in NFS, TFTP and ext4

Sriram Sriram u-boot 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 13 repliesIn review
  2. v14 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Dropped "boot: image-fit: add overflow guard for FIT decompression buffer" (2/4 in v1). As Tom pointed out, max_decomp_len is used both as the allocation size and as the unc_len bound handed to image_decomp(), so a wrapped multiply cannot leave the bound larger than the buffer, and image_decomp() already fails cleanly on a bound that is too small. The claim in that commit message was wrong, so the patch is withdrawn rather than reworded.
- net: tftp: replaced the four bounded strncasecmp() comparisons with a single check that the packet ends in a NUL, per Tom's review. It is smaller (+16 bytes of .text on am335x_evm_defconfig instead of +24) and it also covers the dectoul() calls, which v1 left unbounded. Retitled to match.
- Rebased onto current master (a44f46af0aa).
- No change to the NFS and ext4 patches.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3net: nfs: add bounds checks on memcpy into stack-allocated rpc_pktnet/nfs-common.c+10 -01 reply
2/3net: tftp: verify the OACK packet is NUL terminatednet/tftp.c+7 -01 reply
3/3fs: ext4: widen ext4fs_update() block-group loop counterfs/ext4/ext4_write.c+1 -11 reply

Reviews trailers per patch

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

PatchTony DinhJerome Forissier
1/3R-b
2/3R-b
3/3R-b

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/3] Bounds hardening in NFS, TFTP and ext4

Three independent hardening fixes found by internal static analysis and code review. They do not depend on each other.

Changes in v2:
- Dropped "boot: image-fit: add overflow guard for FIT decompression buffer" (2/4 in v1). As Tom pointed out, max_decomp_len is used both as the allocation size and as the unc_len bound handed to image_decomp(), so a wrapped multiply cannot leave the bound larger than the buffer, and image_decomp() already fails cleanly on a bound that is too small. The claim in that commit message was wrong, so the patch is withdrawn rather than reworded.
- net: tftp: replaced the four bounded strncasecmp() comparisons with a single check that the packet ends in a NUL, per Tom's review. It is smaller (+16 bytes of .text on am335x_evm_defconfig instead of +24) and it also covers the dectoul() calls, which v1 left unbounded. Retitled to match.
- Rebased onto current master (a44f46af0aa).
- No change to the NFS and ext4 patches.

Daniel Munic (1):
fs: ext4: widen ext4fs_update() block-group loop counter

Drew Kluemke (2):
net: nfs: add bounds checks on memcpy into stack-allocated rpc_pkt
net: tftp: verify the OACK packet is NUL terminated

 fs/ext4/ext4_write.c |  2 +-
 net/nfs-common.c     | 10 ++++++++++
 net/tftp.c           |  7 +++++++
 3 files changed, 18 insertions(+), 1 deletion(-)
Signature · 1 line
2.49.0