Commit b6d3314c authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

check: collect mounts of the current mntns

They are used for collecting unix sockets
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent f1b4c5ea
......@@ -28,6 +28,8 @@
#include "ptrace.h"
#include "kerndat.h"
#include "tun.h"
#include "namespaces.h"
#include "pstree.h"
static int check_tty(void)
{
......@@ -529,6 +531,7 @@ static int check_posix_timers(void)
int cr_check(void)
{
struct ns_id ns = { .pid = getpid(), .nd = &mnt_ns_desc };
int ret = 0;
log_set_loglevel(LOG_WARN);
......@@ -536,10 +539,20 @@ int cr_check(void)
if (!is_root_user())
return -1;
if (mntns_collect_root(getpid()) < 0) {
pr_err("Can't collect root mount point\n");
root_item = alloc_pstree_item();
if (root_item == NULL)
return -1;
root_item->pid.real = getpid();
if (collect_pstree_ids())
return -1;
ns.id = root_item->ids->mnt_ns_id;
mntinfo = collect_mntinfo(&ns);
if (mntinfo == NULL)
return -1;
}
if (collect_mount_info(getpid())) {
pr_err("Can't collect mount infos\n");
......
......@@ -998,7 +998,7 @@ err_close:
return -1;
}
static int collect_pstree_ids(void)
int collect_pstree_ids(void)
{
struct pstree_item *item;
......
#ifndef __CR_MOUNT_H__
#define __CR_MOUNT_H__
extern struct mount_info *mntinfo;
extern int mntns_collect_root(pid_t pid);
struct proc_mountinfo;
......
......@@ -67,4 +67,6 @@ extern CoreEntry *core_entry_alloc(int alloc_thread_info, int alloc_tc);
extern int pstree_alloc_cores(struct pstree_item *item);
extern void pstree_free_cores(struct pstree_item *item);
extern int collect_pstree_ids(void);
#endif /* __CR_PSTREE_H__ */
......@@ -32,7 +32,7 @@
/*
* Single linked list of mount points get from proc/images
*/
static struct mount_info *mntinfo;
struct mount_info *mntinfo;
/*
* Tree of mount points. When required is generated from
* the mntinfo list. Tree elements are sorted, so that it
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment