Skip to content

postprocess: hailo: Workaround an exception in the hailort library#907

Merged
naushir merged 1 commit intomainfrom
hailo_fix
Mar 20, 2026
Merged

postprocess: hailo: Workaround an exception in the hailort library#907
naushir merged 1 commit intomainfrom
hailo_fix

Conversation

@naushir
Copy link
Copy Markdown
Collaborator

@naushir naushir commented Mar 20, 2026

The Hilao post-processing stage segfaults at process exit due to a static destruction order bug in libhailort. The VDevice singleton is held in a static unique_ptr which gets destroyed during exit() teardown, but by that point other statics inside libhailort that the VDevice destructor depends on have already been destroyed, causing a use-after-free crash in Buffer::~Buffer().

The fix is to intentionally leak the VDevice by storing it as a raw pointer instead of a unique_ptr. The OS reclaims the memory at process exit anyway, and this avoids triggering the buggy libhailort destructor.

The Hilao post-processing stage segfaults at process exit due to a
static destruction order bug in libhailort. The VDevice singleton is
held in a static unique_ptr which gets destroyed during exit() teardown,
but by that point other statics inside libhailort that the VDevice
destructor depends on have already been destroyed, causing a
use-after-free crash in Buffer::~Buffer().

The fix is to intentionally leak the VDevice by storing it as a raw
pointer instead of a unique_ptr. The OS reclaims the memory at process
exit anyway, and this avoids triggering the buggy libhailort destructor.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
@naushir naushir merged commit 593f63b into main Mar 20, 2026
2 checks passed
@naushir naushir deleted the hailo_fix branch March 20, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant