cgroup: Correct the address format specifier
Amulya Y [Thu, 5 Apr 2018 21:30:07 +0000 (14:30 -0700)]
The format specifier %p can leak kernel addresses
while not valuing the kptr_restrict system
settings.The fix is designed to use %pK instead
of %p, which also evaluates whether
kptr_restrict is set.

Bug 1823317
Bug 1935735

Change-Id: I19dc309e7f5341663add987f5d0b47ee32e1be50
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Signed-off-by: Amulya Yarlagadda <ayarlagadda@nvidia.com>
Reviewed-on: http://git-master/r/1260110
(cherry picked from commit d018ef6518a7527562bedae1eab86838cfcc0570)
Reviewed-on: https://git-master.nvidia.com/r/1690299
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: Winnie Hsu <whsu@nvidia.com>

kernel/cgroup.c

index 05b36e7..1e2c358 100644 (file)
@@ -5449,7 +5449,7 @@ static int cgroup_css_links_read(struct cgroup *cont,
                struct css_set *cg = link->cg;
                struct task_struct *task;
                int count = 0;
-               seq_printf(seq, "css_set %p\n", cg);
+               seq_printf(seq, "css_set %pK\n", cg);
                list_for_each_entry(task, &cg->tasks, cg_list) {
                        if (count++ > MAX_TASKS_SHOWN_PER_CSS) {
                                seq_puts(seq, "  ...\n");