Skip to content

remove mmap_action success, error hooks

Lorenzo Stoakes linux-mm lkml 3 versions – Applied

Status from this message: [merged mm-stable] mm-vma-eliminate-mmap_action-error_hook-introduce-error_override.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 7 repliesApplied 3/3
  2. v23 patches 9 repliesSuperseded
  3. v13 patches 1 replySuperseded

Changes in v3 from the cover letter

* Rename error_filter -> errror_override + update commit message as per David.

Patches in v3 All 3 applied

#Subject and filesSizeRepliesApplied
1/3drivers/char/mem: eliminate unnecessary use of success_hookdrivers/char/mem.c include/linux/mm.h mm/util.c +2 more+15 -122 repliesApplied
2/3mm/vma: remove mmap_action->success_hookinclude/linux/mm_types.h mm/util.c tools/testing/vma/include/dup.h+0 -222 repliesApplied
3/3mm/vma: eliminate mmap_action->error_hook, introduce error_overridedrivers/char/mem.c include/linux/mm_types.h mm/util.c +1 more+28 -272 repliesApplied

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchDavid Hildenbrand (Arm)Greg Kroah-HartmanOscar Salvador (SUSE)Oscar Salvador
1/3A-b A-b R-b
2/3A-b R-b
3/3A-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/3] remove mmap_action success, error hooks

The mmap_action->success_hook was a strange beast added to enable code which appeared to absolutely require access to a VMA pointer to work correctly.

Primarily this was for hugetlb, however a different approach will be taken there, as clearly more work is required to figure out a sensible way of converting hugetlb to use mmap_prepare.

The other user was the memory char driver, specifically /dev/zero which has the unusual property of explicitly setting file-backed VMAs anonymous.

Providing the success hook was always foolish, as it allowed drivers a way to workaround the restriction that they should not access a pointer to a not-yet-correctly-initialised VMA - which defeats the purpose of the mmap_prepare work.

We can achieve the same thing in memory char driver without needing the success hook, so this series removes that, then removes the success hook altogether.

The error hook is also unnecessary - the motivation for this was for functions which need to override the error code when performing an mmap action in order to avoid breaking userspace.

We can achieve this by just providing a field for the error code. Doing this means we don't have to worry about the hook doing anything odd.

We also add a check to ensure the error code is in fact valid.

Again the memory char driver is the only current user of this, so this series updates it to use that.

After this change mmap_action has no custom hooks at all, which seems rather more cromulent than before.

v3:
* Rename error_filter -> errror_override + update commit message as per David.

v2:
* Fold fix-patch in, defaulting the vma descriptor vm_ops field to the dummy VMA operations.
* Update commit message in 1/3 to reflect this.
https://lore.kernel.org/all/[email protected]

v1:
https://lore.kernel.org/all/[email protected]

Lorenzo Stoakes (3):
drivers/char/mem: eliminate unnecessary use of success_hook mm/vma: remove mmap_action->success_hook
mm/vma: eliminate mmap_action->error_hook, introduce error_override

 drivers/char/mem.c              | 25 ++++++-------------------
 include/linux/mm.h              |  5 +++++
 include/linux/mm_types.h        | 19 +++----------------
 mm/util.c                       | 32 ++++++++++++++++++++++----------
 mm/vma.c                        |  3 +++
 tools/testing/vma/include/dup.h | 20 ++++----------------
 6 files changed, 43 insertions(+), 61 deletions(-)

--
2.54.0