Looked at commit 36ee1313199b and the math behind this panic is actually
hilarious...

In iomap_write_end():
iomap->length <= PAGE_SIZE - offset_in_page(iomap->inline_data)

The old ntfs code was using kmemdup() to allocate memory for small
resident files. But kmemdup grabs memory from the slab, so the pointer
rarely starts at the beginning of a physical page (offset_in_page > 0).
The moment a small file length + that random offset spilled over 4096
bytes, iomap thought the buffer overflowed the page and dropped the
hammer with BUG()!

Namjae Jeon's patch just swaps kmemdup() for alloc_page(), so
page_address() is always perfectly page-aligned (offset is always 0).

The fix is literally ~20 lines only in fs/ntfs/iomap.c. Clean and safe
to cherry-pick straight into the Ubuntu 7.0 kernel updates instead of
having Artem test whole 7.3-rc1 builds

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2165844

Title:
  linux 7.0.0-30: kernel BUG at fs/iomap/buffered-io.c:1061 in
  iomap_write_end() on ntfs3 buffered write

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2165844/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to