CVE-2024-43882 exec: Fix ToCToU between perm check and set-uid/gid usage