Skip to content

ci: Update aggressive GC settings for Lua 5.5, fix potential use-after-frees#820

Merged
squeek502 merged 4 commits intoluvit:masterfrom
squeek502:ci-gc-lua-5.5
Mar 30, 2026
Merged

ci: Update aggressive GC settings for Lua 5.5, fix potential use-after-frees#820
squeek502 merged 4 commits intoluvit:masterfrom
squeek502:ci-gc-lua-5.5

Conversation

@squeek502
Copy link
Copy Markdown
Member

@squeek502 squeek502 commented Mar 30, 2026

The previous call only switches to the incremental GC in Lua 5.5; the numbers afterwards are the Lua 5.4-specific way of setting the pause and stepmul.

The previous call only switched to the incremental GC, the numbers afterwards are the Lua 5.4-specific way of setting the pause and stepmul.
@squeek502
Copy link
Copy Markdown
Member Author

squeek502 commented Mar 30, 2026

Wasn't expecting this to find actual failures 🙃

Looks to be scandir related

EDIT: This is actually finding quite a bit. I guess previous Lua versions never really let us tune the GC to be this aggressive (Lua 5.5 allows "producing a non-incremental, stop-the-world collector"). Or we just didn't tune it as aggressively as possible.

…lled

Previously, it was technically possible for the userdata to be garbage collected before the fulfill_req call, leading to a use-after-free.
This assert is not guaranteed to always be correct, e.g. with a maximally aggressive/stop-the-world incremental GC.
…o GC it

It was technically possible for the luv_dir_t to be garbage collected, which would lead to the dirent data being unref'ed and that *also* could garbage collected, before one of the luv_push_dirent calls that use the dirent data (i.e. a possible use-after-free). Seems very unlikely in real-world usage, but 100% reproducible with a maximally aggressive/stop-the-world GC.
@squeek502 squeek502 changed the title ci: Update aggressive GC settings for Lua 5.5 ci: Update aggressive GC settings for Lua 5.5, fix potential use-after-frees Mar 30, 2026
@squeek502 squeek502 merged commit 8bc42e2 into luvit:master Mar 30, 2026
15 checks passed
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