[RH7,2/2] Revert "proc/pid: Don't show kernel threads inside Containers"

Submitted by Vasily Averin on Jan. 12, 2021, 9:47 a.m.

Details

Message ID bde9479f-8287-017e-e104-54584bf951c4@virtuozzo.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Vasily Averin Jan. 12, 2021, 9:47 a.m.
This reverts commit 685ba4589e1bea845e3234fd14ce0dce295ba3de.
if kernel threads are not visible inside container,
nfsd service cannot find them and cannot properly report own status.

The probelm fixed by  reverted pacth should be fixed by another patch
improved vps_dumpable check in __ptrace_may_access()

https://jira.sw.ru/browse/PSBM-92107
https://bugs.openvz.org/browse/OVZ-7245
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 fs/proc/base.c | 14 --------------
 1 file changed, 14 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 965a746..dbf5a84 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3300,15 +3300,6 @@  static struct dentry *proc_pid_instantiate(struct inode *dir,
 	return error;
 }
 
-static bool is_visible_task_ve(struct pid_namespace *ns, struct task_struct *task)
-{
-	/* Don't show kthreads inside Containers. */
-	if ((task->flags & PF_KTHREAD) && (ns != &init_pid_ns))
-		return false;
-
-	return true;
-}
-
 struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags)
 {
 	struct dentry *result = NULL;
@@ -3323,8 +3314,6 @@  struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, unsign
 	ns = dentry->d_sb->s_fs_info;
 	rcu_read_lock();
 	task = find_task_by_pid_ns(tgid, ns);
-	if (task && !is_visible_task_ve(ns, task))
-		task = NULL;
 	if (task)
 		get_task_struct(task);
 	rcu_read_unlock();
@@ -3421,9 +3410,6 @@  int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
 	for (iter = next_tgid(ns, iter);
 	     iter.task;
 	     iter.tgid += 1, iter = next_tgid(ns, iter)) {
-		if (!is_visible_task_ve(ns, iter.task))
-			continue;
-
 		if (is_visible_task(ns, iter.task))
 			__filldir = filldir;
 		else