Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-10 Thread Minchan Kim
On Tue, Apr 10, 2018 at 05:05:28AM -0700, Matthew Wilcox wrote: > On Tue, Apr 10, 2018 at 10:26:43AM +0200, Michal Hocko wrote: > > On Mon 09-04-18 12:40:44, Matthew Wilcox wrote: > > > The problem is that the mapping gfp flags are used not only for allocating > > > pages, but also for allocating

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-10 Thread Johannes Weiner
On Tue, Apr 10, 2018 at 05:05:28AM -0700, Matthew Wilcox wrote: > On Tue, Apr 10, 2018 at 10:26:43AM +0200, Michal Hocko wrote: > > On Mon 09-04-18 12:40:44, Matthew Wilcox wrote: > > > The problem is that the mapping gfp flags are used not only for allocating > > > pages, but also for allocating

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-10 Thread Michal Hocko
On Tue 10-04-18 05:05:28, Matthew Wilcox wrote: > On Tue, Apr 10, 2018 at 10:26:43AM +0200, Michal Hocko wrote: > > On Mon 09-04-18 12:40:44, Matthew Wilcox wrote: > > > The problem is that the mapping gfp flags are used not only for allocating > > > pages, but also for allocating the page cache

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-10 Thread Matthew Wilcox
On Tue, Apr 10, 2018 at 10:26:43AM +0200, Michal Hocko wrote: > On Mon 09-04-18 12:40:44, Matthew Wilcox wrote: > > The problem is that the mapping gfp flags are used not only for allocating > > pages, but also for allocating the page cache data structures that hold > > the pages. F2FS is the

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-10 Thread Matthew Wilcox
On Tue, Apr 10, 2018 at 11:59:03AM +0900, Minchan Kim wrote: > Okay, I hope this version clear current concerns. It doesn't. The right place to warn about GFP_ZERO used with a constructor is _slab_, like the patch I already sent. We have no idea what other places might have the same bug, and

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-10 Thread Jan Kara
On Tue 10-04-18 11:59:03, Minchan Kim wrote: > On Mon, Apr 09, 2018 at 07:41:52PM -0700, Matthew Wilcox wrote: > > On Tue, Apr 10, 2018 at 11:33:39AM +0900, Minchan Kim wrote: > > > @@ -522,7 +532,7 @@ EXPORT_SYMBOL(radix_tree_preload); > > > */ > > > int radix_tree_maybe_preload(gfp_t

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-10 Thread Michal Hocko
On Mon 09-04-18 12:40:44, Matthew Wilcox wrote: > On Mon, Apr 09, 2018 at 11:38:27AM -0700, Jaegeuk Kim wrote: > > On 04/09, Minchan Kim wrote: > > > On Mon, Apr 09, 2018 at 04:14:03AM -0700, Matthew Wilcox wrote: > > > > On Mon, Apr 09, 2018 at 12:09:30PM +0900, Minchan Kim wrote: > > > > > On

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Minchan Kim
On Mon, Apr 09, 2018 at 07:41:52PM -0700, Matthew Wilcox wrote: > On Tue, Apr 10, 2018 at 11:33:39AM +0900, Minchan Kim wrote: > > @@ -522,7 +532,7 @@ EXPORT_SYMBOL(radix_tree_preload); > > */ > > int radix_tree_maybe_preload(gfp_t gfp_mask) > > { > > - if (gfpflags_allow_blocking(gfp_mask))

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Matthew Wilcox
On Tue, Apr 10, 2018 at 11:33:39AM +0900, Minchan Kim wrote: > @@ -522,7 +532,7 @@ EXPORT_SYMBOL(radix_tree_preload); > */ > int radix_tree_maybe_preload(gfp_t gfp_mask) > { > - if (gfpflags_allow_blocking(gfp_mask)) > + if (gfpflags_allow_blocking(gfp_mask) && !(gfp_mask &

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Minchan Kim
On Tue, Apr 10, 2018 at 11:33:39AM +0900, Minchan Kim wrote: > On Mon, Apr 09, 2018 at 06:12:11PM -0700, Matthew Wilcox wrote: > > On Tue, Apr 10, 2018 at 08:04:09AM +0900, Minchan Kim wrote: > > > On Mon, Apr 09, 2018 at 08:20:32AM -0700, Matthew Wilcox wrote: > > > > I don't think this is

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Minchan Kim
On Mon, Apr 09, 2018 at 06:12:11PM -0700, Matthew Wilcox wrote: > On Tue, Apr 10, 2018 at 08:04:09AM +0900, Minchan Kim wrote: > > On Mon, Apr 09, 2018 at 08:20:32AM -0700, Matthew Wilcox wrote: > > > I don't think this is something the radix tree should know about. > > > > Because shadow entry

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Matthew Wilcox
On Tue, Apr 10, 2018 at 08:04:09AM +0900, Minchan Kim wrote: > On Mon, Apr 09, 2018 at 08:20:32AM -0700, Matthew Wilcox wrote: > > I don't think this is something the radix tree should know about. > > Because shadow entry implementation is hidden by radix tree implemetation. > IOW, radix tree

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Minchan Kim
On Mon, Apr 09, 2018 at 08:20:32AM -0700, Matthew Wilcox wrote: > On Mon, Apr 09, 2018 at 11:49:58PM +0900, Minchan Kim wrote: > > On Mon, Apr 09, 2018 at 08:25:06PM +0800, Chao Yu wrote: > > > On 2018/4/9 19:25, Minchan Kim wrote: > > > > On Mon, Apr 09, 2018 at 04:14:03AM -0700, Matthew Wilcox

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Matthew Wilcox
On Mon, Apr 09, 2018 at 11:38:27AM -0700, Jaegeuk Kim wrote: > On 04/09, Minchan Kim wrote: > > On Mon, Apr 09, 2018 at 04:14:03AM -0700, Matthew Wilcox wrote: > > > On Mon, Apr 09, 2018 at 12:09:30PM +0900, Minchan Kim wrote: > > > > On Sun, Apr 08, 2018 at 07:49:25PM -0700, Matthew Wilcox wrote:

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Jaegeuk Kim
On 04/09, Minchan Kim wrote: > On Mon, Apr 09, 2018 at 04:14:03AM -0700, Matthew Wilcox wrote: > > On Mon, Apr 09, 2018 at 12:09:30PM +0900, Minchan Kim wrote: > > > On Sun, Apr 08, 2018 at 07:49:25PM -0700, Matthew Wilcox wrote: > > > > On Mon, Apr 09, 2018 at 10:58:15AM +0900, Minchan Kim wrote:

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread David Sterba
On Mon, Apr 09, 2018 at 03:52:15PM +0200, Michal Hocko wrote: > On Mon 09-04-18 06:41:14, Matthew Wilcox wrote: > > On Mon, Apr 09, 2018 at 02:48:52PM +0200, Michal Hocko wrote: > > > On Mon 09-04-18 20:25:06, Chao Yu wrote: > > > [...] > > > > diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c > > >

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Matthew Wilcox
On Mon, Apr 09, 2018 at 11:49:58PM +0900, Minchan Kim wrote: > On Mon, Apr 09, 2018 at 08:25:06PM +0800, Chao Yu wrote: > > On 2018/4/9 19:25, Minchan Kim wrote: > > > On Mon, Apr 09, 2018 at 04:14:03AM -0700, Matthew Wilcox wrote: > > >> On Mon, Apr 09, 2018 at 12:09:30PM +0900, Minchan Kim

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Minchan Kim
On Mon, Apr 09, 2018 at 08:25:06PM +0800, Chao Yu wrote: > On 2018/4/9 19:25, Minchan Kim wrote: > > On Mon, Apr 09, 2018 at 04:14:03AM -0700, Matthew Wilcox wrote: > >> On Mon, Apr 09, 2018 at 12:09:30PM +0900, Minchan Kim wrote: > >>> On Sun, Apr 08, 2018 at 07:49:25PM -0700, Matthew Wilcox

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Michal Hocko
On Mon 09-04-18 06:41:14, Matthew Wilcox wrote: > On Mon, Apr 09, 2018 at 02:48:52PM +0200, Michal Hocko wrote: > > On Mon 09-04-18 20:25:06, Chao Yu wrote: > > [...] > > > diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c > > > index c852e800..cc63f8c448f0 100644 > > > --- a/fs/f2fs/inode.c > >

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Christoph Hellwig
On Mon, Apr 09, 2018 at 06:41:14AM -0700, Matthew Wilcox wrote: > It's worth noting that this is endemic in filesystems. For the rationale in XFS take a look at commit ad22c7a043c2cc6792820e6c5da699935933e87d -- Check

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Matthew Wilcox
On Mon, Apr 09, 2018 at 02:48:52PM +0200, Michal Hocko wrote: > On Mon 09-04-18 20:25:06, Chao Yu wrote: > [...] > > diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c > > index c852e800..cc63f8c448f0 100644 > > --- a/fs/f2fs/inode.c > > +++ b/fs/f2fs/inode.c > > @@ -339,10 +339,10 @@ struct inode

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Michal Hocko
On Mon 09-04-18 20:25:06, Chao Yu wrote: [...] > diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c > index c852e800..cc63f8c448f0 100644 > --- a/fs/f2fs/inode.c > +++ b/fs/f2fs/inode.c > @@ -339,10 +339,10 @@ struct inode *f2fs_iget(struct super_block *sb, > unsigned long ino) > make_now: >

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Chao Yu
On 2018/4/9 19:25, Minchan Kim wrote: > On Mon, Apr 09, 2018 at 04:14:03AM -0700, Matthew Wilcox wrote: >> On Mon, Apr 09, 2018 at 12:09:30PM +0900, Minchan Kim wrote: >>> On Sun, Apr 08, 2018 at 07:49:25PM -0700, Matthew Wilcox wrote: On Mon, Apr 09, 2018 at 10:58:15AM +0900, Minchan Kim

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Minchan Kim
On Mon, Apr 09, 2018 at 04:14:03AM -0700, Matthew Wilcox wrote: > On Mon, Apr 09, 2018 at 12:09:30PM +0900, Minchan Kim wrote: > > On Sun, Apr 08, 2018 at 07:49:25PM -0700, Matthew Wilcox wrote: > > > On Mon, Apr 09, 2018 at 10:58:15AM +0900, Minchan Kim wrote: > > > > It assumes shadow entry of

Re: [f2fs-dev] [PATCH] mm: workingset: fix NULL ptr dereference

2018-04-09 Thread Matthew Wilcox
On Mon, Apr 09, 2018 at 12:09:30PM +0900, Minchan Kim wrote: > On Sun, Apr 08, 2018 at 07:49:25PM -0700, Matthew Wilcox wrote: > > On Mon, Apr 09, 2018 at 10:58:15AM +0900, Minchan Kim wrote: > > > It assumes shadow entry of radix tree relies on the init state > > > that node->private_list