util-lib: wrap personality() to fix up broken glibc error handling (#6766)

glibc appears to propagate different errors in different ways, let's fix
this up, so that our own code doesn't get confused by this.

See #6752 + #6737 for details.

Fixes: #6755
This commit is contained in:
Lennart Poettering
2017-09-08 17:16:29 +03:00
committed by Evgeny Vereshchagin
parent 5463fa0a88
commit 21022b9dde
5 changed files with 53 additions and 57 deletions
+5 -3
View File
@@ -2614,11 +2614,13 @@ static int exec_child(
return -errno;
}
if (context->personality != PERSONALITY_INVALID)
if (personality(context->personality) < 0) {
if (context->personality != PERSONALITY_INVALID) {
r = safe_personality(context->personality);
if (r < 0) {
*exit_status = EXIT_PERSONALITY;
return -errno;
return r;
}
}
if (context->utmp_id)
utmp_put_init_process(context->utmp_id, getpid_cached(), getsid(0),