Skip to content

Fix double free when exec fails in a namespace - #82

Merged
jhuntwork merged 1 commit into
mainfrom
fix-exec-failure-double-free
Nov 3, 2026
Merged

jhuntwork merged 1 commit into
mainfrom
fix-exec-failure-double-free

Conversation

@jhuntwork

Copy link
Copy Markdown
Owner

execCommand freed the argument strings, argv and the default command
itself after execve returned, then returned ExecError, which ran the
errdefer blocks that free the same memory again. Running a command that
does not exist in the profile crashed with a general protection exception
and exit status 128 instead of reporting ExecError.

Return ExecError and let the errdefer blocks do the freeing. Add a test
that runs a nonexistent absolute path; it crashed before this change.

execCommand freed the argument strings, argv and the default command
itself after execve returned, then returned ExecError, which ran the
errdefer blocks that free the same memory again. Running a command that
does not exist in the profile crashed with a general protection exception
and exit status 128 instead of reporting ExecError.

Return ExecError and let the errdefer blocks do the freeing. Add a test
that runs a nonexistent absolute path; it crashed before this change.
@jhuntwork
jhuntwork merged commit e4ccc26 into main Nov 3, 2026
2 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.

1 participant