mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] soc: qcom: mdt_loader: Fix integer overflows in segment bounds checks
@ 2026-12-05 22:26 Abel Vesa
  2026-12-05 22:26 ` [PATCH 1/2] soc: qcom: mdt_loader: Fix segment bounds check overflow on 32-bit Abel Vesa
  2026-12-05 22:26 ` [PATCH 2/2] soc: qcom: mdt_loader: Validate metadata sizes against the firmware Abel Vesa
  0 siblings, 2 replies; 3+ messages in thread
From: Abel Vesa @ 2026-12-05 22:26 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Andy Gross, Jeffrey Hugo
  Cc: Jeff Hugo, linux-arm-msm, linux-kernel, Abel Vesa, Sashiko

Sashiko reported that the segment bounds check in
qcom_mdt_load_no_init() can be bypassed on 32-bit platforms, where
offset + p_memsz is computed in 32 bits and can wrap around, letting a
crafted firmware image zero memory beyond the end of the memory region.
Patch 1 fixes that by doing the check in 64 bits, which also covers the
offset getting truncated with LPAE.

While looking at it, qcom_mdt_read_metadata() turned out to have similar
issues: it copies the ELF header using a size taken from the image
without checking it against the size of the firmware, which reads out
of bounds on any platform, and its other size computations can wrap on
32-bit. Patch 2 fixes these.

Prepared with help from an LLM-based assistant.

Signed-off-by: Abel Vesa <abel.vesa@oss.qualcomm.com>
---
Abel Vesa (2):
      soc: qcom: mdt_loader: Fix segment bounds check overflow on 32-bit
      soc: qcom: mdt_loader: Validate metadata sizes against the firmware

 drivers/soc/qcom/mdt_loader.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
---
base-commit: 29beb21c21ada7207692b2d69fc58dcd15dab6e9
change-id: 20261205-mdt-loader-overflow-fa009fc16041

Best regards,
-- 

Abel


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

end of thread, other threads:[~2026-12-05 22:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-05 22:26 [PATCH 0/2] soc: qcom: mdt_loader: Fix integer overflows in segment bounds checks Abel Vesa
2026-12-05 22:26 ` [PATCH 1/2] soc: qcom: mdt_loader: Fix segment bounds check overflow on 32-bit Abel Vesa
2026-12-05 22:26 ` [PATCH 2/2] soc: qcom: mdt_loader: Validate metadata sizes against the firmware Abel Vesa

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®