You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The system was encountering a critical kernel panic, manifesting as:
*** KERNEL PANIC (-16370) – heap corruption or invalid free
The core problem stemmed from a conflict between two memory management
strategies for linked-list nodes. The timer module utilized a custom
static memory pool for its nodes, while the generic list manipulation
functions performed their own malloc() and free() operations. This
architectural mismatch led to two critical bugs.
Firstly, a double-free occurred in mo_timer_destroy(). The generic
list_remove() function would free a list node's memory, and then the
same function would attempt to return this already-freed node to the
custom memory pool.
Secondly, a use-after-free vulnerability existed in the
_timer_tick_handler(). If an expired timer's callback function
destroyed the timer, the handler would subsequently attempt to access
the now-freed timer's memory to check its auto-reload status.
Fix these issues by removing the custom memory pool and unifying all
node memory management under the generic list API. The
_timer_tick_handler() now also re-validates the timer's existence after
its callback executes to prevent accessing freed memory.
0 commit comments