Re: [External] Re: [PATCH] mm: memcontrol: Fix out-of-bounds on the buf returned by memory_stat_format

2020-09-14 Thread Muchun Song
On Mon, Sep 14, 2020 at 7:57 PM Michal Hocko wrote: > > On Mon 14-09-20 19:46:36, Muchun Song wrote: > > On Mon, Sep 14, 2020 at 6:32 PM Michal Hocko wrote: > > > > > > On Mon 14-09-20 17:43:42, Muchun Song wrote: > > > > On Mon, Sep 14, 2020 at 5:18 PM Michal Hocko wrote: > > > > > > > > > >

Re: [External] Re: [PATCH] mm: memcontrol: Fix out-of-bounds on the buf returned by memory_stat_format

2020-09-14 Thread Michal Hocko
On Mon 14-09-20 19:46:36, Muchun Song wrote: > On Mon, Sep 14, 2020 at 6:32 PM Michal Hocko wrote: > > > > On Mon 14-09-20 17:43:42, Muchun Song wrote: > > > On Mon, Sep 14, 2020 at 5:18 PM Michal Hocko wrote: > > > > > > > > On Mon 14-09-20 12:02:33, Muchun Song wrote: > > > > > On Sun, Sep 13,

Re: [External] Re: [PATCH] mm: memcontrol: Fix out-of-bounds on the buf returned by memory_stat_format

2020-09-14 Thread Muchun Song
On Mon, Sep 14, 2020 at 6:32 PM Michal Hocko wrote: > > On Mon 14-09-20 17:43:42, Muchun Song wrote: > > On Mon, Sep 14, 2020 at 5:18 PM Michal Hocko wrote: > > > > > > On Mon 14-09-20 12:02:33, Muchun Song wrote: > > > > On Sun, Sep 13, 2020 at 8:42 AM Andrew Morton > > > > wrote: > > > > > >

Re: [External] Re: [PATCH] mm: memcontrol: Fix out-of-bounds on the buf returned by memory_stat_format

2020-09-14 Thread Chris Down
Michal Hocko writes: > > Yeah, I think we should cc:stable. > > Is this a real problem? The buffer should contain 36 lines which makes > it more than 100B per line. I strongly suspect we are not able to use > that storage up. Before memory_stat_format() return, we should call seq_buf_putc(,

Re: [External] Re: [PATCH] mm: memcontrol: Fix out-of-bounds on the buf returned by memory_stat_format

2020-09-14 Thread Michal Hocko
On Mon 14-09-20 17:43:42, Muchun Song wrote: > On Mon, Sep 14, 2020 at 5:18 PM Michal Hocko wrote: > > > > On Mon 14-09-20 12:02:33, Muchun Song wrote: > > > On Sun, Sep 13, 2020 at 8:42 AM Andrew Morton > > > wrote: > > > > > > > > On Sat, 12 Sep 2020 23:51:00 +0800 Muchun Song > > > >

Re: [External] Re: [PATCH] mm: memcontrol: Fix out-of-bounds on the buf returned by memory_stat_format

2020-09-14 Thread Muchun Song
On Mon, Sep 14, 2020 at 5:18 PM Michal Hocko wrote: > > On Mon 14-09-20 12:02:33, Muchun Song wrote: > > On Sun, Sep 13, 2020 at 8:42 AM Andrew Morton > > wrote: > > > > > > On Sat, 12 Sep 2020 23:51:00 +0800 Muchun Song > > > wrote: > > > > > > > The memory_stat_format() returns a format

Re: [PATCH] mm: memcontrol: Fix out-of-bounds on the buf returned by memory_stat_format

2020-09-14 Thread Michal Hocko
On Sat 12-09-20 23:51:00, Muchun Song wrote: > The memory_stat_format() returns a format string, but the return buf > may not including the trailing '\0'. So the users may read the buf > out of bounds. > > Fixes: c8713d0b2312 ("mm: memcontrol: dump memory.stat during cgroup OOM") > Signed-off-by:

Re: [External] Re: [PATCH] mm: memcontrol: Fix out-of-bounds on the buf returned by memory_stat_format

2020-09-14 Thread Michal Hocko
On Mon 14-09-20 12:02:33, Muchun Song wrote: > On Sun, Sep 13, 2020 at 8:42 AM Andrew Morton > wrote: > > > > On Sat, 12 Sep 2020 23:51:00 +0800 Muchun Song > > wrote: > > > > > The memory_stat_format() returns a format string, but the return buf > > > may not including the trailing '\0'. So

Re: [External] Re: [PATCH] mm: memcontrol: Fix out-of-bounds on the buf returned by memory_stat_format

2020-09-13 Thread Muchun Song
On Sun, Sep 13, 2020 at 8:42 AM Andrew Morton wrote: > > On Sat, 12 Sep 2020 23:51:00 +0800 Muchun Song > wrote: > > > The memory_stat_format() returns a format string, but the return buf > > may not including the trailing '\0'. So the users may read the buf > > out of bounds. > > That sounds

Re: [PATCH] mm: memcontrol: Fix out-of-bounds on the buf returned by memory_stat_format

2020-09-12 Thread Andrew Morton
On Sat, 12 Sep 2020 23:51:00 +0800 Muchun Song wrote: > The memory_stat_format() returns a format string, but the return buf > may not including the trailing '\0'. So the users may read the buf > out of bounds. That sounds serious. Is a cc:stable appropriate?

[PATCH] mm: memcontrol: Fix out-of-bounds on the buf returned by memory_stat_format

2020-09-12 Thread Muchun Song
The memory_stat_format() returns a format string, but the return buf may not including the trailing '\0'. So the users may read the buf out of bounds. Fixes: c8713d0b2312 ("mm: memcontrol: dump memory.stat during cgroup OOM") Signed-off-by: Muchun Song --- mm/memcontrol.c | 12 +++- 1