OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] Fix input validation issues in SBI ecall handlers
@ 2026-07-31 10:33 liutong
  2026-07-31 10:34 ` [PATCH v2 1/6] lib: sbi_dbtr: fix integer overflow in read_trig bounds check liutong
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: liutong @ 2026-07-31 10:33 UTC (permalink / raw)
  To: opensbi; +Cc: Rahul Pathak, liutong

This series fixes input validation and shared memory handling issues
found across multiple SBI extension handlers: DBTR, PMU, SSE, and MPXY.

The fixes fall into three categories:

1. Integer overflow in bounds checks (patches 1, 4, 6)
   Arithmetic overflow in endpoint calculations allows out-of-bounds
   access from S-mode via crafted ecall parameters.

2. TOCTOU / double-fetch from shared memory (patches 2, 5)
   S-mode shared memory is read twice --once to validate, once to apply.
   S-mode can modify the memory between reads, bypassing M-mode
   validation.

3. Insufficient address range validation (patch 3)
   Single-address domain check does not cover the full shared memory
   region, allowing cross-domain access.

These patches were previously sent individually. Per reviewer feedback,
they are now consolidated into a single series.

Changes in v2:
- Reorganized as a unified patch series (per Rahul Pathak's suggestion)
- All patches now include Fixes tags
- install_trig: fixed rollback to also cover SBI_ERR_NOT_SUPPORTED path

liutong (6):
  lib: sbi_dbtr: fix integer overflow in read_trig bounds check
  lib: sbi_dbtr: fix shared memory double-fetch in install_trig
  lib: sbi_dbtr: use range check for shared memory domain validation
  lib: sbi_pmu: fix integer overflow and zero-address in event_get_info
  lib: sbi_sse: fix shared memory double-fetch in sse_write_attrs
  lib: sbi_mpxy: fix integer overflow in attribute range endpoint

 lib/sbi/sbi_dbtr.c | 91 +++++++++++++++++++++++-----------------------
 lib/sbi/sbi_mpxy.c |  6 ++-
 lib/sbi/sbi_pmu.c  | 10 ++++-
 lib/sbi/sbi_sse.c  | 14 ++++---
 4 files changed, 66 insertions(+), 55 deletions(-)

-- 
2.34.1


-- 
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

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

end of thread, other threads:[~2026-09-03  9:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-31 10:33 [PATCH v2 0/6] Fix input validation issues in SBI ecall handlers liutong
2026-07-31 10:34 ` [PATCH v2 1/6] lib: sbi_dbtr: fix integer overflow in read_trig bounds check liutong
2026-09-03  7:54   ` Himanshu Chauhan
2026-07-31 10:34 ` [PATCH v2 2/6] lib: sbi_dbtr: fix shared memory double-fetch in install_trig liutong
2026-09-03  8:49   ` Himanshu Chauhan
2026-07-31 10:34 ` [PATCH v2 3/6] lib: sbi_dbtr: use range check for shared memory domain validation liutong
2026-09-03  9:01   ` Himanshu Chauhan
2026-07-31 10:34 ` [PATCH v2 4/6] lib: sbi_pmu: fix integer overflow and zero-address in event_get_info liutong
2026-07-31 10:34 ` [PATCH v2 5/6] lib: sbi_sse: fix shared memory double-fetch in sse_write_attrs liutong
2026-09-03  9:07   ` Himanshu Chauhan
2026-07-31 10:34 ` [PATCH v2 6/6] lib: sbi_mpxy: fix integer overflow in attribute range endpoint liutong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox