mseal cleanups
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest5 patches 14 repliesIn review 4 of 5 applied
- v35 patches 32 repliesSuperseded
- v25 patches 6 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 5 patches | 32 replies | Superseded |
Changes in v4 from the cover letter
* Propagated tags, thanks Jeff!
* Remove the change in semantics for MAP_PRIVATE, file-backed, mseal()'d mappings, as it turns out there is more complexity than expected here. Let's stick to a straight refactoring for now. Based on discussions with Jeff, Kees and David.
* Reinstated comment previously present in check_mm_seal() regarding expectations of input range in range_contains_unmapped() where this makes sense to locate, removing the redundant 'map is sealable' step, as per Jeff.
Patches in v4 4 of 5 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | mm/mseal: always define VM_SEALEDinclude/ tools/ | +8 | 0 replies | Applied |
| 2/5 | mm/mseal: update madvise() logicmm/ mm/ mm/ | +70 | 4 replies | Applied |
| 3/5 | mm/mseal: small cleanupsmm/ mm/ mm/ +3 more | +8 | 0 replies | Applied |
| 4/5 | mm/mseal: simplify and rename VMA gap checkmm/ | +16 | 10 replies | |
| 5/5 | mm/mseal: rework mseal apply logicmm/ | +20 | 0 replies | Applied |
Reviews trailers per patch
All 5 patches have a Reviewed-by or Acked-by.
| Patch | Liam R. Howlett | Pedro Falcato | David Hildenbrand | Jeff Xu |
|---|---|---|---|---|
| 1/5 | R-b | R-b | A-b | |
| 2/5 | R-b | R-b | A-b | |
| 3/5 | R-b | R-b | A-b | A-b |
| 4/5 | R-b | R-b | A-b | A-b |
| 5/5 | R-b | R-b | A-b | A-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.
Cover letter [PATCH v4 0/5] mseal cleanups
Perform a number of cleanups to the mseal logic. Firstly, VM_SEALED is treated differently from every other VMA flag, it really doesn't make sense to do this, so we start by making this consistent with everything else.
Next we place the madvise logic where it belongs - in mm/madvise.c. It really makes no sense to abstract this elsewhere. In doing so, we go to great lengths to explain very clearly the previously very confusing logic as to what sealed mappings are impacted here.
In doing so, we retain existing logic regarding treatment of madvise() discard operations for a sealed, read-only MAP_PRIVATE file-backed mapping. This is something we likely need to revisit.
We then abstract out and explain the 'are there are any gaps in this range in the mm?' check being performed as a prerequisite to mseal being performed.
Finally, we simplify the actual mseal logic which is really quite straightforward.
No functional change is intended.
NOTE - this replaces the previous "mseal cleanups, fixup MAP_PRIVATE file-backed case" series (linked below under v3), I renamed to 'mseal cleaups' only as now we do not adjust MAP_PRIVATE behaviour.
v4:
* Propagated tags, thanks Jeff!
* Remove the change in semantics for MAP_PRIVATE, file-backed, mseal()'d mappings, as it turns out there is more complexity than expected here. Let's stick to a straight refactoring for now. Based on discussions with Jeff, Kees and David.
* Reinstated comment previously present in check_mm_seal() regarding expectations of input range in range_contains_unmapped() where this makes sense to locate, removing the redundant 'map is sealable' step, as per Jeff.
v3:
* Propagated more tags, thanks everyone!
* Updated 5/5 to assign curr_start in a smarter way as per Liam. Adjust code to more sensibly handle already-sealed case at the same time.
* Updated 4/5 to not move range_contains_unmapped() for better diff.
* Renamed can_modify_vma() to vma_is_sealed() and inverted the logic - this is far clearer than the nebulous 'can modify VMA'.
https://lore.kernel.org/all/[email protected]/
v2:
* Propagated tags, thanks everyone!
* Updated can_madvise_modify() to a more logical order re: the checks performed, as per David.
* Replaced vma_is_anonymous() check (which was, in the original code, a vma->vm_file or vma->vm_ops check) with a vma->vm_flags & VM_SHARED check - to explicitly check for shared mappings vs private to preclude MAP_PRIVATE-mapping file-baked mappings, as per David.
* Made range_contains_unmapped() static and placed in mm/mseal.c to avoid encouraging any other internal users towards this rather silly pattern, as per Pedro and Liam.
https://lore.kernel.org/all/[email protected]/
v1:
https://lore.kernel.org/all/[email protected]/
Lorenzo Stoakes (5):
mm/mseal: always define VM_SEALED
mm/mseal: update madvise() logic
mm/mseal: small cleanups
mm/mseal: simplify and rename VMA gap check
mm/mseal: rework mseal apply logic
include/linux/mm.h | 6 +- mm/madvise.c | 71 +++++++++++++- mm/mprotect.c | 2 +- mm/mremap.c | 2 +- mm/mseal.c | 160 +++++++------------------------ mm/vma.c | 4 +- mm/vma.h | 27 +----- tools/testing/vma/vma_internal.h | 6 +- 8 files changed, 119 insertions(+), 159 deletions(-)
--
2.50.1