Re: [PATCH v2 03/12] rv: Reset per-task DA monitors before releasing the slot
From: Nam Cao
Date: Thu May 28 2026 - 04:55:29 EST
Gabriele Monaco <gmonaco@xxxxxxxxxx> writes:
> Per-task monitors use task_mon_slot to determine which slot in the array
> to use for the monitor. During destruction, this slot is returned but
> this is done before resetting the monitor. As a result, the monitor's
> reset is in fact resetting a slot that is outside of the array
> (RV_PER_TASK_MONITOR_INIT).
Oh crap.
> Release the slot only after the reset to avoid out-of-bound memory
> access.
I think KASAN can catch this type of issue.
> Fixes: f5587d1b6ec93 ("rv: Add Hybrid Automata monitor type")
> Suggested-by: Wen Yang <wen.yang@xxxxxxxxx>
> Reviewed-by: Wen Yang <wen.yang@xxxxxxxxx>
> Signed-off-by: Gabriele Monaco <gmonaco@xxxxxxxxxx>
Should we have
Cc: stable@xxxxxxxxxxxxxxx
?
Reviewed-by: Nam Cao <namcao@xxxxxxxxxxxxx>