Skip to content

Fix potential use-after-free at shutdown - #2488

Open
UncleGrumpy wants to merge 1 commit into
atomvm:release-0.7from
UncleGrumpy:fix_teardown_order
Open

UncleGrumpy wants to merge 1 commit into
atomvm:release-0.7from
UncleGrumpy:fix_teardown_order

Conversation

@UncleGrumpy

Copy link
Copy Markdown
Collaborator

Correct the order at shutdown so that platform_data is not accessed after it has been freed.
When sys_free_platform(glb) was called before select_events synclist was destroyed at shutdown, it lead to a use after free, which was demonstrated in some CI runs under valgrind that fail, even if all tests passed.

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

Correct the order at teardown so that platform_data is not accessed
after it has been freed.

Signed-off-by: Winford <winford@object.stream>
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.

2 participants