<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/mm, branch linus/master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/mm?h=linus%2Fmaster</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/mm?h=linus%2Fmaster'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-06-23T16:22:00Z</updated>
<entry>
<title>filemap: Fix serialization adding transparent huge pages to page cache</title>
<updated>2022-06-23T16:22:00Z</updated>
<author>
<name>Alistair Popple</name>
<email>apopple@nvidia.com</email>
</author>
<published>2022-06-20T09:05:36Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=00fa15e0d56482e32d8ca1f51d76b0ee00afb16b'/>
<id>urn:sha1:00fa15e0d56482e32d8ca1f51d76b0ee00afb16b</id>
<content type='text'>
Commit 793917d997df ("mm/readahead: Add large folio readahead")
introduced support for using large folios for filebacked pages if the
filesystem supports it.

page_cache_ra_order() was introduced to allocate and add these large
folios to the page cache. However adding pages to the page cache should
be serialized against truncation and hole punching by taking
invalidate_lock. Not doing so can lead to data races resulting in stale
data getting added to the page cache and marked up-to-date. See commit
730633f0b7f9 ("mm: Protect operations adding pages to page cache with
invalidate_lock") for more details.

This issue was found by inspection but a testcase revealed it was
possible to observe in practice on XFS. Fix this by taking
invalidate_lock in page_cache_ra_order(), to mirror what is done for the
non-thp case in page_cache_ra_unbounded().

Signed-off-by: Alistair Popple &lt;apopple@nvidia.com&gt;
Fixes: 793917d997df ("mm/readahead: Add large folio readahead")
Reviewed-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Matthew Wilcox (Oracle) &lt;willy@infradead.org&gt;
</content>
</entry>
<entry>
<title>mm: Clear page-&gt;private when splitting or migrating a page</title>
<updated>2022-06-23T16:21:44Z</updated>
<author>
<name>Matthew Wilcox (Oracle)</name>
<email>willy@infradead.org</email>
</author>
<published>2022-06-19T14:37:32Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=b653db77350c7307a513b81856fe53e94cf42446'/>
<id>urn:sha1:b653db77350c7307a513b81856fe53e94cf42446</id>
<content type='text'>
In our efforts to remove uses of PG_private, we have found folios with
the private flag clear and folio-&gt;private not-NULL.  That is the root
cause behind 642d51fb0775 ("ceph: check folio PG_private bit instead
of folio-&gt;private").  It can also affect a few other filesystems that
haven't yet reported a problem.

compaction_alloc() can return a page with uninitialised page-&gt;private,
and rather than checking all the callers of migrate_pages(), just zero
page-&gt;private after calling get_new_page().  Similarly, the tail pages
from split_huge_page() may also have an uninitialised page-&gt;private.

Reported-by: Xiubo Li &lt;xiubli@redhat.com&gt;
Tested-by: Xiubo Li &lt;xiubli@redhat.com&gt;
Signed-off-by: Matthew Wilcox (Oracle) &lt;willy@infradead.org&gt;
</content>
</entry>
<entry>
<title>filemap: Handle sibling entries in filemap_get_read_batch()</title>
<updated>2022-06-20T20:37:45Z</updated>
<author>
<name>Matthew Wilcox (Oracle)</name>
<email>willy@infradead.org</email>
</author>
<published>2022-06-18T00:00:17Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=cb995f4eeba9d268fd4b56c2423ad6c1d1ea1b82'/>
<id>urn:sha1:cb995f4eeba9d268fd4b56c2423ad6c1d1ea1b82</id>
<content type='text'>
If a read races with an invalidation followed by another read, it is
possible for a folio to be replaced with a higher-order folio.  If that
happens, we'll see a sibling entry for the new folio in the next iteration
of the loop.  This manifests as a NULL pointer dereference while holding
the RCU read lock.

Handle this by simply returning.  The next call will find the new folio
and handle it correctly.  The other ways of handling this rare race are
more complex and it's just not worth it.

Reported-by: Dave Chinner &lt;david@fromorbit.com&gt;
Reported-by: Brian Foster &lt;bfoster@redhat.com&gt;
Debugged-by: Brian Foster &lt;bfoster@redhat.com&gt;
Tested-by: Brian Foster &lt;bfoster@redhat.com&gt;
Reviewed-by: Brian Foster &lt;bfoster@redhat.com&gt;
Fixes: cbd59c48ae2b ("mm/filemap: use head pages in generic_file_buffered_read")
Cc: stable@vger.kernel.org
Signed-off-by: Matthew Wilcox (Oracle) &lt;willy@infradead.org&gt;
</content>
</entry>
<entry>
<title>filemap: Correct the conditions for marking a folio as accessed</title>
<updated>2022-06-20T20:37:45Z</updated>
<author>
<name>Matthew Wilcox (Oracle)</name>
<email>willy@infradead.org</email>
</author>
<published>2022-06-10T18:44:41Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=5ccc944dce3df5fd2fd683a7df4fd49d1068eba2'/>
<id>urn:sha1:5ccc944dce3df5fd2fd683a7df4fd49d1068eba2</id>
<content type='text'>
We had an off-by-one error which meant that we never marked the first page
in a read as accessed.  This was visible as a slowdown when re-reading
a file as pages were being evicted from cache too soon.  In reviewing
this code, we noticed a second bug where a multi-page folio would be
marked as accessed multiple times when doing reads that were less than
the size of the folio.

Abstract the comparison of whether two file positions are in the same
folio into a new function, fixing both of these bugs.

Reported-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Reviewed-by: Kent Overstreet &lt;kent.overstreet@gmail.com&gt;
Signed-off-by: Matthew Wilcox (Oracle) &lt;willy@infradead.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'slab-for-5.19-fixup' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab</title>
<updated>2022-06-20T14:28:51Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2022-06-20T14:28:51Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=59b785fe2abbe21267516799f6c584cf4fe5f08b'/>
<id>urn:sha1:59b785fe2abbe21267516799f6c584cf4fe5f08b</id>
<content type='text'>
Pull slab fixes from Vlastimil Babka:

 - A slub fix for PREEMPT_RT locking semantics from Sebastian.

 - A slub fix for state corruption due to a possible race scenario from
   Jann.

* tag 'slab-for-5.19-fixup' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab:
  mm/slub: add missing TID updates on slab deactivation
  mm/slub: Move the stackdepot related allocation out of IRQ-off section.
</content>
</entry>
<entry>
<title>Merge tag 'fs_for_v5.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs</title>
<updated>2022-06-17T17:09:24Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2022-06-17T17:09:24Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=5c0cd3d4a976b906c3953ff0a0595ba37e04aaa6'/>
<id>urn:sha1:5c0cd3d4a976b906c3953ff0a0595ba37e04aaa6</id>
<content type='text'>
Pull writeback and ext2 fixes from Jan Kara:
 "A fix for writeback bug which prevented machines with kdevtmpfs from
  booting and also one small ext2 bugfix in IO error handling"

* tag 'fs_for_v5.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  init: Initialize noop_backing_dev_info early
  ext2: fix fs corruption when trying to remove a non-empty directory with IO error
</content>
</entry>
<entry>
<title>init: Initialize noop_backing_dev_info early</title>
<updated>2022-06-16T08:55:57Z</updated>
<author>
<name>Jan Kara</name>
<email>jack@suse.cz</email>
</author>
<published>2022-06-15T13:22:29Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=4bca7e80b6455772b4bf3f536dcbc19aac424d6a'/>
<id>urn:sha1:4bca7e80b6455772b4bf3f536dcbc19aac424d6a</id>
<content type='text'>
noop_backing_dev_info is used by superblocks of various
pseudofilesystems such as kdevtmpfs. After commit 10e14073107d
("writeback: Fix inode-&gt;i_io_list not be protected by inode-&gt;i_lock
error") this broke because __mark_inode_dirty() started to access more
fields from noop_backing_dev_info and this led to crashes inside
locked_inode_to_wb_and_lock_list() called from __mark_inode_dirty().
Fix the problem by initializing noop_backing_dev_info before the
filesystems get mounted.

Fixes: 10e14073107d ("writeback: Fix inode-&gt;i_io_list not be protected by inode-&gt;i_lock error")
Reported-and-tested-by: Suzuki K Poulose &lt;suzuki.poulose@arm.com&gt;
Reported-and-tested-by: Alexandru Elisei &lt;alexandru.elisei@arm.com&gt;
Reported-and-tested-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
</content>
</entry>
<entry>
<title>usercopy: Make usercopy resilient against ridiculously large copies</title>
<updated>2022-06-13T16:54:52Z</updated>
<author>
<name>Matthew Wilcox (Oracle)</name>
<email>willy@infradead.org</email>
</author>
<published>2022-06-12T21:32:27Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=1dfbe9fcda4afc957f0e371e207ae3cb7e8f3b0e'/>
<id>urn:sha1:1dfbe9fcda4afc957f0e371e207ae3cb7e8f3b0e</id>
<content type='text'>
If 'n' is so large that it's negative, we might wrap around and mistakenly
think that the copy is OK when it's not.  Such a copy would probably
crash, but just doing the arithmetic in a more simple way lets us detect
and refuse this case.

Signed-off-by: Matthew Wilcox (Oracle) &lt;willy@infradead.org&gt;
Reviewed-by: Uladzislau Rezki (Sony) &lt;urezki@gmail.com&gt;
Tested-by: Zorro Lang &lt;zlang@redhat.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20220612213227.3881769-4-willy@infradead.org
</content>
</entry>
<entry>
<title>usercopy: Cast pointer to an integer once</title>
<updated>2022-06-13T16:54:52Z</updated>
<author>
<name>Matthew Wilcox (Oracle)</name>
<email>willy@infradead.org</email>
</author>
<published>2022-06-12T21:32:26Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=35fb9ae4aa2e838b234323e6f7cf6336ff019e5a'/>
<id>urn:sha1:35fb9ae4aa2e838b234323e6f7cf6336ff019e5a</id>
<content type='text'>
Get rid of a lot of annoying casts by setting 'addr' once at the top
of the function.

Signed-off-by: Matthew Wilcox (Oracle) &lt;willy@infradead.org&gt;
Reviewed-by: Uladzislau Rezki (Sony) &lt;urezki@gmail.com&gt;
Tested-by: Zorro Lang &lt;zlang@redhat.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20220612213227.3881769-3-willy@infradead.org
</content>
</entry>
<entry>
<title>usercopy: Handle vm_map_ram() areas</title>
<updated>2022-06-13T16:54:52Z</updated>
<author>
<name>Matthew Wilcox (Oracle)</name>
<email>willy@infradead.org</email>
</author>
<published>2022-06-12T21:32:25Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=993d0b287e2ef7bee2e8b13b0ce4d2b5066f278e'/>
<id>urn:sha1:993d0b287e2ef7bee2e8b13b0ce4d2b5066f278e</id>
<content type='text'>
vmalloc does not allocate a vm_struct for vm_map_ram() areas.  That causes
us to deny usercopies from those areas.  This affects XFS which uses
vm_map_ram() for its directories.

Fix this by calling find_vmap_area() instead of find_vm_area().

Fixes: 0aef499f3172 ("mm/usercopy: Detect vmalloc overruns")
Signed-off-by: Matthew Wilcox (Oracle) &lt;willy@infradead.org&gt;
Reviewed-by: Uladzislau Rezki (Sony) &lt;urezki@gmail.com&gt;
Tested-by: Zorro Lang &lt;zlang@redhat.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20220612213227.3881769-2-willy@infradead.org
</content>
</entry>
</feed>
