/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
+#include <linux/prctl.h>
#include <sched.h>
#include <stdlib.h>
+#include <sys/prctl.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sysexits.h>
if (r == 0) {
p[0] = safe_close(p[0]);
ASSERT_OK(fully_set_uid_gid(1, 1, NULL, 0));
+
+ /* After successfully changing id/gid DEATHSIG is reset, so it has to be set again */
+ ASSERT_OK_ERRNO(prctl(PR_SET_PDEATHSIG, SIGKILL));
+
ASSERT_OK_EQ_ERRNO(write(p[1], &(const char[]) { 'x' }, 1), 1);
p[1] = safe_close(p[1]);
freeze();
ASSERT_OK(reset_uid_gid());
+ /* After successfully changing id/gid DEATHSIG is reset, so it has to be set again */
+ ASSERT_OK_ERRNO(prctl(PR_SET_PDEATHSIG, SIGKILL));
+
ASSERT_OK_EQ_ERRNO(write(p[1], &(const char[]) { 'x' }, 1), 1);
p[1] = safe_close(p[1]);
freeze();