Page MenuHomeFreeBSD

Do not leak oldvmspace if image activation failed
ClosedPublic

Authored by kib on Sep 22 2020, 9:41 PM.

Details

Summary

and current address space is already destroyed, so kern_execve() terminates the process.

While there, clean up some internals of post_execve() inlined in init_main.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kib requested review of this revision.Sep 22 2020, 9:41 PM
sys/kern/kern_exec.c
981 ↗(On Diff #77376)

Why is it necessary to do this here? There is one caller where failure == true and in that case the following exit1() call handles it, if I understand correctly.

sys/kern/kern_exec.c
981 ↗(On Diff #77376)

I suspect that exit1() really does not handle it. exit1() does thread_single(SINGLE_EXIT) which silently overrides previous single-threading mode, because p_singlethread == curthread.

I can move drop failure case from exec_cleanup(), leaving only the handling of TDP_EXECVMSPC there, if you prefer it this way.

sys/kern/kern_exec.c
981 ↗(On Diff #77376)

Hmm, it is always compatible. I will update the patch in half a hour.

Previous single-threading mode is always SINGLE_BOUNDARY, if any. Drop code in exec_cleanup() that duplicates exit1().

This revision is now accepted and ready to land.Sep 23 2020, 4:14 PM
This revision was automatically updated to reflect the committed changes.