Commit edc73c72 authored by xu xin's avatar xu xin Committed by Andrew Morton
Browse files

kernel: make taskstats available from all net namespaces

If getdelays runs in a non-init network namespace, it will fail in getting
delayacct stats even if it has privilege of root user, which seems to be
not very reasonable.  We can simply reproduce this by executing commands:

	unshare -n
	getdelays -d -p <pid>

I don't think net namespace should be an obstacle to the normal execution
of getdelay function.  So let's make it available from all net namespaces.

Link: https://lkml.kernel.org/r/20220412071946.2532318-1-xu.xin16@zte.com.cn


Signed-off-by: default avatarxu xin <xu.xin16@zte.com.cn>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Yang Yang <yang.yang29@zte.com.cn>
Cc: "Dr. Thomas Orgis" <thomas.orgis@uni-hamburg.de>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Ismael Luceno <ismael@iodev.co.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 0e0af57e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -688,6 +688,7 @@ static struct genl_family family __ro_after_init = {
	.module		= THIS_MODULE,
	.ops		= taskstats_ops,
	.n_ops		= ARRAY_SIZE(taskstats_ops),
	.netnsok	= true,
};

/* Needed early in initialization */