mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
pid namespaces: changes to show virtual ids to user
This is the largest patch in the set. Make all (I hope) the places where the pid is shown to or get from user operate on the virtual pids. The idea is: - all in-kernel data structures must store either struct pid itself or the pid's global nr, obtained with pid_nr() call; - when seeking the task from kernel code with the stored id one should use find_task_by_pid() call that works with global pids; - when showing pid's numerical value to the user the virtual one should be used, but however when one shows task's pid outside this task's namespace the global one is to be used; - when getting the pid from userspace one need to consider this as the virtual one and use appropriate task/pid-searching functions. [[email protected]: build fix] [[email protected]: nuther build fix] [[email protected]: yet nuther build fix] [[email protected]: remove unneeded casts] Signed-off-by: Pavel Emelyanov <[email protected]> Signed-off-by: Alexey Dobriyan <[email protected]> Cc: Sukadev Bhattiprolu <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Paul Menage <[email protected]> Cc: "Eric W. Biederman" <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
3eb07c8c8a
commit
b488893a39
32 changed files with 241 additions and 144 deletions
|
|
@ -29,6 +29,8 @@
|
|||
#include <linux/audit.h>
|
||||
#include <linux/signal.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/nsproxy.h>
|
||||
#include <linux/pid.h>
|
||||
|
||||
#include <net/sock.h>
|
||||
#include "util.h"
|
||||
|
|
@ -330,7 +332,8 @@ static ssize_t mqueue_read_file(struct file *filp, char __user *u_data,
|
|||
(info->notify_owner &&
|
||||
info->notify.sigev_notify == SIGEV_SIGNAL) ?
|
||||
info->notify.sigev_signo : 0,
|
||||
pid_nr(info->notify_owner));
|
||||
pid_nr_ns(info->notify_owner,
|
||||
current->nsproxy->pid_ns));
|
||||
spin_unlock(&info->lock);
|
||||
buffer[sizeof(buffer)-1] = '\0';
|
||||
slen = strlen(buffer)+1;
|
||||
|
|
@ -507,7 +510,7 @@ static void __do_notify(struct mqueue_inode_info *info)
|
|||
sig_i.si_errno = 0;
|
||||
sig_i.si_code = SI_MESGQ;
|
||||
sig_i.si_value = info->notify.sigev_value;
|
||||
sig_i.si_pid = current->tgid;
|
||||
sig_i.si_pid = task_pid_vnr(current);
|
||||
sig_i.si_uid = current->uid;
|
||||
|
||||
kill_pid_info(info->notify.sigev_signo,
|
||||
|
|
|
|||
Loading…
Reference in a new issue