linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/3] Avoid live-lock in btrfs fault-in+uaccess loop
@ 2022-04-23 10:07 Catalin Marinas
  2022-04-23 10:07 ` [PATCH v4 1/3] mm: Add fault_in_subpage_writeable() to probe at sub-page granularity Catalin Marinas
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Catalin Marinas @ 2022-04-23 10:07 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Linus Torvalds, Andreas Gruenbacher, Josef Bacik, Al Viro,
	Chris Mason, David Sterba, Will Deacon, linux-fsdevel,
	linux-arm-kernel, linux-btrfs, linux-kernel

Hi,

A minor update from v3 here:

https://lore.kernel.org/r/20220406180922.1522433-1-catalin.marinas@arm.com

In patch 3/3 I dropped the 'len' local variable, so the btrfs patch
simply replaces fault_in_writeable() with fault_in_subpage_writeable()
and adds a comment. I kept David's ack as there's no functional change
since v3.

Andrew, since there was no objection last time around, I'd like this
series to land in 5.19. As it touches arch, fs and mm, it should
probably go in via the mm tree but I'm also happy to merge the series
via arm64. Please let me know if you have any preference.

The btrfs search_ioctl() function can potentially live-lock on arm64
with MTE enabled due to a fault_in_writeable() + copy_to_user_nofault()
unbounded loop. The uaccess can fault in the middle of a page (MTE tag
check fault) even if a prior fault_in_writeable() successfully wrote to
the beginning of that page. The btrfs loop always restarts the fault-in
loop from the beginning of the user buffer, hence the live-lock.

The series introduces fault_in_subpage_writeable() together with the
arm64 probing counterpart and the btrfs fix.

Thanks.

Catalin Marinas (3):
  mm: Add fault_in_subpage_writeable() to probe at sub-page granularity
  arm64: Add support for user sub-page fault probing
  btrfs: Avoid live-lock in search_ioctl() on hardware with sub-page
    faults

 arch/Kconfig                     |  7 +++++++
 arch/arm64/Kconfig               |  1 +
 arch/arm64/include/asm/mte.h     |  1 +
 arch/arm64/include/asm/uaccess.h | 15 +++++++++++++++
 arch/arm64/kernel/mte.c          | 30 ++++++++++++++++++++++++++++++
 fs/btrfs/ioctl.c                 |  7 ++++++-
 include/linux/pagemap.h          |  1 +
 include/linux/uaccess.h          | 22 ++++++++++++++++++++++
 mm/gup.c                         | 29 +++++++++++++++++++++++++++++
 9 files changed, 112 insertions(+), 1 deletion(-)


base-commit: b2d229d4ddb17db541098b83524d901257e93845

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-04-25 16:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-23 10:07 [PATCH v4 0/3] Avoid live-lock in btrfs fault-in+uaccess loop Catalin Marinas
2022-04-23 10:07 ` [PATCH v4 1/3] mm: Add fault_in_subpage_writeable() to probe at sub-page granularity Catalin Marinas
2022-04-23 23:49   ` Andrew Morton
2022-04-23 10:07 ` [PATCH v4 2/3] arm64: Add support for user sub-page fault probing Catalin Marinas
2022-04-23 10:07 ` [PATCH v4 3/3] btrfs: Avoid live-lock in search_ioctl() on hardware with sub-page faults Catalin Marinas
2022-04-23 16:35 ` [PATCH v4 0/3] Avoid live-lock in btrfs fault-in+uaccess loop Linus Torvalds
2022-04-23 18:40   ` Catalin Marinas
2022-04-25 11:08     ` Andreas Gruenbacher
2022-04-25 16:13 ` Catalin Marinas

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).