History

mm/vma: remove mmap_action->success_hook

This hook was introduced to work around code that seemed to absolutely require access to a VMA pointer upon mmap(). However, providing this hook leaves a backdoor to drivers getting access to the very thing mmap_prepare eliminates - a pointer to the VMA. Let's solve this contradiction by removing it. The key intended user was hugetlb, however it seems that the best course now is to avoid allowing all drivers the ability to work around mmap_prepare, and find a different solution there.

Lorenzo Stoakes committed 5 months ago

Commit 8876dc01 parent 17986193 files · +0 −22Browse files

Unified · Split

3 files
  1. include/linux/mm_types.h +0 −10
  2. mm/util.c +0 −2
  3. tools/testing/vma/include/dup.h +0 −10
include/linux/mm_types.h+0−10
@@ -843,16 +843,6 @@ struct mmap_action { · 842 unmodified lines
843843 };
844844 enum mmap_action_type type;
845845
846− /*
847− * If specified, this hook is invoked after the selected action has been
848− * successfully completed. Note that the VMA write lock still held.
849− *
850− * The absolute minimum ought to be done here.
851− *
852− * Returns 0 on success, or an error code.
853− */
854− int (*success_hook)(const struct vm_area_struct *vma);
855−
856846 /*
857847 * If specified, this hook is invoked when an error occurred when
858848 * attempting the selected action.
mm/util.c+0−2
@@ -1397,8 +1397,6 @@ static int mmap_action_finish(struct vm_area_struct *vma, · 1396 unmodified lines
13971397
13981398 if (!err)
13991399 err = call_vma_mapped(vma);
1400− if (!err && action->success_hook)
1401− err = action->success_hook(vma);
14021400
14031401 /* do_munmap() might take rmap lock, so release if held. */
14041402 maybe_rmap_unlock_action(vma, action);
tools/testing/vma/include/dup.h+0−10
@@ -482,16 +482,6 @@ struct mmap_action { · 481 unmodified lines
482482 };
483483 enum mmap_action_type type;
484484
485− /*
486− * If specified, this hook is invoked after the selected action has been
487− * successfully completed. Note that the VMA write lock still held.
488− *
489− * The absolute minimum ought to be done here.
490− *
491− * Returns 0 on success, or an error code.
492− */
493− int (*success_hook)(const struct vm_area_struct *vma);
494−
495485 /*
496486 * If specified, this hook is invoked when an error occurred when
497487 * attempting the selection action.