mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-27 09:48:32 +00:00
don't fail lxc-init if we couldn't mount proc
In general proc gets mounted ahead of time, so init shouldn't have to do it. Without this patch, you cannot lxc-execute -n x1 -s lxc.cap.drop=sys_admin /bin/bash (See https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1253669 for a bug about this) Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com> Acked-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
parent
4355ab5fab
commit
ea0da52972
@ -154,8 +154,7 @@ int main(int argc, char *argv[])
|
|||||||
sigaction(i, &act, NULL);
|
sigaction(i, &act, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lxc_setup_fs())
|
lxc_setup_fs();
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
|
|
||||||
if (lxc_caps_reset())
|
if (lxc_caps_reset())
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -150,10 +150,10 @@ static int mount_fs(const char *source, const char *target, const char *type)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int lxc_setup_fs(void)
|
extern void lxc_setup_fs(void)
|
||||||
{
|
{
|
||||||
if (mount_fs("proc", "/proc", "proc"))
|
if (mount_fs("proc", "/proc", "proc"))
|
||||||
return -1;
|
INFO("failed to remount proc");
|
||||||
|
|
||||||
/* if we can't mount /dev/shm, continue anyway */
|
/* if we can't mount /dev/shm, continue anyway */
|
||||||
if (mount_fs("shmfs", "/dev/shm", "tmpfs"))
|
if (mount_fs("shmfs", "/dev/shm", "tmpfs"))
|
||||||
@ -163,14 +163,12 @@ extern int lxc_setup_fs(void)
|
|||||||
/* Sure, but it's read-only per config :) */
|
/* Sure, but it's read-only per config :) */
|
||||||
if (access("/dev/mqueue", F_OK) && mkdir("/dev/mqueue", 0666)) {
|
if (access("/dev/mqueue", F_OK) && mkdir("/dev/mqueue", 0666)) {
|
||||||
DEBUG("failed to create '/dev/mqueue'");
|
DEBUG("failed to create '/dev/mqueue'");
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* continue even without posix message queue support */
|
/* continue even without posix message queue support */
|
||||||
if (mount_fs("mqueue", "/dev/mqueue", "mqueue"))
|
if (mount_fs("mqueue", "/dev/mqueue", "mqueue"))
|
||||||
INFO("failed to mount /dev/mqueue");
|
INFO("failed to mount /dev/mqueue");
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* borrowed from iproute2 */
|
/* borrowed from iproute2 */
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
/* returns 1 on success, 0 if there were any failures */
|
/* returns 1 on success, 0 if there were any failures */
|
||||||
extern int lxc_rmdir_onedev(char *path);
|
extern int lxc_rmdir_onedev(char *path);
|
||||||
extern int lxc_setup_fs(void);
|
extern void lxc_setup_fs(void);
|
||||||
extern int get_u16(unsigned short *val, const char *arg, int base);
|
extern int get_u16(unsigned short *val, const char *arg, int base);
|
||||||
extern int mkdir_p(const char *dir, mode_t mode);
|
extern int mkdir_p(const char *dir, mode_t mode);
|
||||||
extern void remove_trailing_slashes(char *p);
|
extern void remove_trailing_slashes(char *p);
|
||||||
|
Loading…
Reference in New Issue
Block a user