#include <linux/init.h>
#include <linux/bootmem.h>
#include <linux/hash.h>
+#include <linux/vs_cvirt.h>
#define pid_hashfn(nr) hash_long((unsigned long)nr, pidhash_shift)
static struct hlist_head *pid_hash;
return NULL;
}
-int fastcall attach_pid(task_t *task, enum pid_type type, int nr)
+int fastcall attach_pid(struct task_struct *task, enum pid_type type, int nr)
{
struct pid_link *link;
struct pid *pid;
return 0;
}
-void fastcall detach_pid(task_t *task, enum pid_type type)
+void fastcall detach_pid(struct task_struct *task, enum pid_type type)
{
struct pid_link *link;
struct pid *pid;
first = rcu_dereference(pid->tasks[type].first);
if (first)
result = hlist_entry(first, struct task_struct, pids[(type)].node);
+ if (result && (pid->nr != 1) &&
+ !vx_check(vx_task_xid(result), VX_WATCH|VX_ADMIN|VX_IDENT)) {
+ vxwprintk((type == PIDTYPE_PID) && (current->xid),
+ "pid_task(%d,%d): task %p[#%u,%u] did lookup %p[#%u,%u]",
+ pid->nr, type, current, vx_current_xid(), current->pid,
+ result, vx_task_xid(result), result->pid);
+ result = NULL;
+ }
}
return result;
}
/*
* Must be called under rcu_read_lock() or with tasklist_lock read-held.
*/
-task_t *find_task_by_pid_type(int type, int nr)
+struct task_struct *find_task_by_pid_type(int type, int nr)
{
+ if (type == PIDTYPE_PID)
+ nr = vx_rmap_pid(nr);
+ else if (type == PIDTYPE_REALPID)
+ type = PIDTYPE_PID;
return pid_task(find_pid(nr), type);
}