* [PATCH] cgroup: fix psi_show() crash on 32bit ino archs
@ 2020-02-24 3:00 Qian Cai
[not found] ` <20200224030007.3990-1-cai-J5quhbR+WMc@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Qian Cai @ 2020-02-24 3:00 UTC (permalink / raw)
To: tj; +Cc: lizefan, hannes, cgroups, linux-kernel, Qian Cai
Similar to the commit d7495343228f ("cgroup: fix incorrect
WARN_ON_ONCE() in cgroup_setup_root()"), cgroup_id(root_cgrp) does not
equal to 1 on 32bit ino archs which triggers all sorts of issues with
psi_show() on s390x. For example,
BUG: KASAN: slab-out-of-bounds in collect_percpu_times+0x2d0/
Read of size 4 at addr 000000001e0ce000 by task read_all/3667
collect_percpu_times+0x2d0/0x798
psi_show+0x7c/0x2a8
seq_read+0x2ac/0x830
vfs_read+0x92/0x150
ksys_read+0xe2/0x188
system_call+0xd8/0x2b4
Fix it by using cgroup_ino().
Fixes: 743210386c03 ("cgroup: use cgrp->kn->id as the cgroup ID")
Signed-off-by: Qian Cai <cai@lca.pw>
---
kernel/cgroup/cgroup.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 75f687301bbf..cd5f41289f7d 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -3542,21 +3542,21 @@ static int cpu_stat_show(struct seq_file *seq, void *v)
static int cgroup_io_pressure_show(struct seq_file *seq, void *v)
{
struct cgroup *cgrp = seq_css(seq)->cgroup;
- struct psi_group *psi = cgroup_id(cgrp) == 1 ? &psi_system : &cgrp->psi;
+ struct psi_group *psi = cgroup_ino(cgrp) == 1 ? &psi_system : &cgrp->psi;
return psi_show(seq, psi, PSI_IO);
}
static int cgroup_memory_pressure_show(struct seq_file *seq, void *v)
{
struct cgroup *cgrp = seq_css(seq)->cgroup;
- struct psi_group *psi = cgroup_id(cgrp) == 1 ? &psi_system : &cgrp->psi;
+ struct psi_group *psi = cgroup_ino(cgrp) == 1 ? &psi_system : &cgrp->psi;
return psi_show(seq, psi, PSI_MEM);
}
static int cgroup_cpu_pressure_show(struct seq_file *seq, void *v)
{
struct cgroup *cgrp = seq_css(seq)->cgroup;
- struct psi_group *psi = cgroup_id(cgrp) == 1 ? &psi_system : &cgrp->psi;
+ struct psi_group *psi = cgroup_ino(cgrp) == 1 ? &psi_system : &cgrp->psi;
return psi_show(seq, psi, PSI_CPU);
}
--
2.21.0 (Apple Git-122.2)
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <20200224030007.3990-1-cai-J5quhbR+WMc@public.gmane.org>]
* Re: [PATCH] cgroup: fix psi_show() crash on 32bit ino archs [not found] ` <20200224030007.3990-1-cai-J5quhbR+WMc@public.gmane.org> @ 2020-02-24 16:29 ` Johannes Weiner [not found] ` <20200224162906.GB1674-druUgvl0LCNAfugRpC6u6w@public.gmane.org> 2020-03-04 16:16 ` Tejun Heo 1 sibling, 1 reply; 4+ messages in thread From: Johannes Weiner @ 2020-02-24 16:29 UTC (permalink / raw) To: Qian Cai Cc: tj-DgEjT+Ai2ygdnm+yROfE0A, lizefan-hv44wF8Li93QT0dZR+AlfA, cgroups-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Sun, Feb 23, 2020 at 10:00:07PM -0500, Qian Cai wrote: > Similar to the commit d7495343228f ("cgroup: fix incorrect > WARN_ON_ONCE() in cgroup_setup_root()"), cgroup_id(root_cgrp) does not > equal to 1 on 32bit ino archs which triggers all sorts of issues with > psi_show() on s390x. For example, > > BUG: KASAN: slab-out-of-bounds in collect_percpu_times+0x2d0/ > Read of size 4 at addr 000000001e0ce000 by task read_all/3667 > collect_percpu_times+0x2d0/0x798 > psi_show+0x7c/0x2a8 > seq_read+0x2ac/0x830 > vfs_read+0x92/0x150 > ksys_read+0xe2/0x188 > system_call+0xd8/0x2b4 > > Fix it by using cgroup_ino(). > > Fixes: 743210386c03 ("cgroup: use cgrp->kn->id as the cgroup ID") > Signed-off-by: Qian Cai <cai-J5quhbR+WMc@public.gmane.org> Acked-by: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org> ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <20200224162906.GB1674-druUgvl0LCNAfugRpC6u6w@public.gmane.org>]
* Re: [PATCH] cgroup: fix psi_show() crash on 32bit ino archs [not found] ` <20200224162906.GB1674-druUgvl0LCNAfugRpC6u6w@public.gmane.org> @ 2020-03-04 13:36 ` Qian Cai 0 siblings, 0 replies; 4+ messages in thread From: Qian Cai @ 2020-03-04 13:36 UTC (permalink / raw) To: Johannes Weiner Cc: tj-DgEjT+Ai2ygdnm+yROfE0A, lizefan-hv44wF8Li93QT0dZR+AlfA, cgroups-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Mon, 2020-02-24 at 11:29 -0500, Johannes Weiner wrote: > On Sun, Feb 23, 2020 at 10:00:07PM -0500, Qian Cai wrote: > > Similar to the commit d7495343228f ("cgroup: fix incorrect > > WARN_ON_ONCE() in cgroup_setup_root()"), cgroup_id(root_cgrp) does not > > equal to 1 on 32bit ino archs which triggers all sorts of issues with > > psi_show() on s390x. For example, > > > > BUG: KASAN: slab-out-of-bounds in collect_percpu_times+0x2d0/ > > Read of size 4 at addr 000000001e0ce000 by task read_all/3667 > > collect_percpu_times+0x2d0/0x798 > > psi_show+0x7c/0x2a8 > > seq_read+0x2ac/0x830 > > vfs_read+0x92/0x150 > > ksys_read+0xe2/0x188 > > system_call+0xd8/0x2b4 > > > > Fix it by using cgroup_ino(). > > > > Fixes: 743210386c03 ("cgroup: use cgrp->kn->id as the cgroup ID") > > Signed-off-by: Qian Cai <cai-J5quhbR+WMc@public.gmane.org> > > Acked-by: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org> Tejun, can you take a look at this when you had a chance? ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cgroup: fix psi_show() crash on 32bit ino archs [not found] ` <20200224030007.3990-1-cai-J5quhbR+WMc@public.gmane.org> 2020-02-24 16:29 ` Johannes Weiner @ 2020-03-04 16:16 ` Tejun Heo 1 sibling, 0 replies; 4+ messages in thread From: Tejun Heo @ 2020-03-04 16:16 UTC (permalink / raw) To: Qian Cai Cc: lizefan-hv44wF8Li93QT0dZR+AlfA, hannes-druUgvl0LCNAfugRpC6u6w, cgroups-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Sun, Feb 23, 2020 at 10:00:07PM -0500, Qian Cai wrote: > Similar to the commit d7495343228f ("cgroup: fix incorrect > WARN_ON_ONCE() in cgroup_setup_root()"), cgroup_id(root_cgrp) does not > equal to 1 on 32bit ino archs which triggers all sorts of issues with > psi_show() on s390x. For example, > > BUG: KASAN: slab-out-of-bounds in collect_percpu_times+0x2d0/ > Read of size 4 at addr 000000001e0ce000 by task read_all/3667 > collect_percpu_times+0x2d0/0x798 > psi_show+0x7c/0x2a8 > seq_read+0x2ac/0x830 > vfs_read+0x92/0x150 > ksys_read+0xe2/0x188 > system_call+0xd8/0x2b4 > > Fix it by using cgroup_ino(). > > Fixes: 743210386c03 ("cgroup: use cgrp->kn->id as the cgroup ID") > Signed-off-by: Qian Cai <cai-J5quhbR+WMc@public.gmane.org> Applied to cgroup/for-5.6-fixes. Thanks. -- tejun ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-04 16:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-24 3:00 [PATCH] cgroup: fix psi_show() crash on 32bit ino archs Qian Cai
[not found] ` <20200224030007.3990-1-cai-J5quhbR+WMc@public.gmane.org>
2020-02-24 16:29 ` Johannes Weiner
[not found] ` <20200224162906.GB1674-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2020-03-04 13:36 ` Qian Cai
2020-03-04 16:16 ` Tejun Heo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).