[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] daemon: Break CHROOT_ENABLED into CHROOT_ENABLED and CLONE_ENABL
From: |
Manolis Ragkousis |
Subject: |
[PATCH] daemon: Break CHROOT_ENABLED into CHROOT_ENABLED and CLONE_ENABLED. |
Date: |
Mon, 8 Aug 2016 15:25:30 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
Hello everyone,
This patch breaks CHROOT_ENABLED into CHROOT_ENABLED and CLONE_ENABLED.
If you check the code below, you will see that in case clone() is not
available it will use fork(), which is the case on Hurd.
But because CHROOT_ENABLED checks for others things, like mount.h and
pivot_root(), it never actually got to the second part of the code
below. This is fixed with my patch.
#if CHROOT_ENABLED
if (useChroot) {
char stack[32 * 1024];
int flags = CLONE_NEWPID | CLONE_NEWNS | CLONE_NEWIPC | CLONE_NEWUTS |
SIGCHLD;
if (!fixedOutput) flags |= CLONE_NEWNET;
pid = clone(childEntry, stack + sizeof(stack) - 8, flags, this);
if (pid == -1)
throw SysError("cloning builder process");
} else
#endif
{
pid = fork();
if (pid == 0) runChild();
}
Thank you,
Manolis
0001-daemon-Break-CHROOT_ENABLED-into-CHROOT_ENABLED-and-.patch
Description: Text Data
- [PATCH] daemon: Break CHROOT_ENABLED into CHROOT_ENABLED and CLONE_ENABLED.,
Manolis Ragkousis <=