mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-13 23:52:30 +00:00
do check for utmp checking at the right time
We were doing the check for whether we need to watch utmp from a thread cloned from that which will actually do the utmp watching. As a result, the utmp file was always being watched, even if it didn't need to be. Move the check to the parent thread. Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/948623 Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
parent
f9d0d2cbbf
commit
69182a318c
@ -503,16 +503,12 @@ static int do_start(void *data)
|
|||||||
if (lxc_sync_barrier_parent(handler, LXC_SYNC_CONFIGURE))
|
if (lxc_sync_barrier_parent(handler, LXC_SYNC_CONFIGURE))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (must_drop_cap_sys_boot()) {
|
if (handler->conf->need_utmp_watch) {
|
||||||
if (prctl(PR_CAPBSET_DROP, CAP_SYS_BOOT, 0, 0, 0)) {
|
if (prctl(PR_CAPBSET_DROP, CAP_SYS_BOOT, 0, 0, 0)) {
|
||||||
SYSERROR("failed to remove CAP_SYS_BOOT capability");
|
SYSERROR("failed to remove CAP_SYS_BOOT capability");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
handler->conf->need_utmp_watch = 1;
|
|
||||||
DEBUG("Dropped cap_sys_boot\n");
|
DEBUG("Dropped cap_sys_boot\n");
|
||||||
} else {
|
|
||||||
DEBUG("Not dropping cap_sys_boot or watching utmp\n");
|
|
||||||
handler->conf->need_utmp_watch = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup the container, ip, names, utsname, ... */
|
/* Setup the container, ip, names, utsname, ... */
|
||||||
@ -635,6 +631,14 @@ int __lxc_start(const char *name, struct lxc_conf *conf,
|
|||||||
handler->ops = ops;
|
handler->ops = ops;
|
||||||
handler->data = data;
|
handler->data = data;
|
||||||
|
|
||||||
|
if (must_drop_cap_sys_boot()) {
|
||||||
|
handler->conf->need_utmp_watch = 1;
|
||||||
|
DEBUG("Dropping cap_sys_boot and watching utmp\n");
|
||||||
|
} else {
|
||||||
|
DEBUG("Not dropping cap_sys_boot or watching utmp\n");
|
||||||
|
handler->conf->need_utmp_watch = 0;
|
||||||
|
}
|
||||||
|
|
||||||
err = lxc_spawn(handler);
|
err = lxc_spawn(handler);
|
||||||
if (err) {
|
if (err) {
|
||||||
ERROR("failed to spawn '%s'", name);
|
ERROR("failed to spawn '%s'", name);
|
||||||
|
Loading…
Reference in New Issue
Block a user