Re: [PATCH 1/3] mm/mseal: remove superfluous comments, fix confusion around mm

From: David Hildenbrand (Arm)

Date: Fri Jul 17 2026 - 06:35:52 EST


On 7/16/26 15:43, Lorenzo Stoakes (ARM) wrote:
> Remove comment blocks that don't add value and eliminate any confusion
> about whether or not we permit mseal()'ing of remote mm's by explicitly
> referencing current->mm consistently.
>
> Also avoid ugly goto by using an else branch.
>
> No functional change intended.
>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
> ---
> mm/mseal.c | 48 ++++++++----------------------------------------
> 1 file changed, 8 insertions(+), 40 deletions(-)
>
> diff --git a/mm/mseal.c b/mm/mseal.c
> index 9781647483d1..207fea89c61e 100644
> --- a/mm/mseal.c
> +++ b/mm/mseal.c
> @@ -16,28 +16,7 @@
> #include <linux/sched.h>
> #include "internal.h"
>
> -/*
> - * mseal() disallows an input range which contain unmapped ranges (VMA holes).
> - *
> - * It disallows unmapped regions from start to end whether they exist at the
> - * start, in the middle, or at the end of the range, or any combination thereof.
> - *
> - * This is because after sealing a range, there's nothing to stop memory mapping
> - * of ranges in the remaining gaps later, meaning that the user might then
> - * wrongly consider the entirety of the mseal()'d range to be sealed when it
> - * in fact isn't.
> - */
> -
> -/*
> - * Does the [start, end) range contain any unmapped memory?
> - *
> - * We ensure that:
> - * - start is part of a valid VMA.
> - * - end is part of a valid VMA.
> - * - no gap (unallocated memory) exists between start and end.
> - */
> -static bool range_contains_unmapped(struct mm_struct *mm,
> - unsigned long start, unsigned long end)
> +static bool range_contains_unmapped(unsigned long start, unsigned long end)
> {
> struct vm_area_struct *vma;
> unsigned long prev_end = start;
> @@ -53,11 +32,10 @@ static bool range_contains_unmapped(struct mm_struct *mm,
> return prev_end < end;
> }
>
> -static int mseal_apply(struct mm_struct *mm,
> - unsigned long start, unsigned long end)
> +static int mseal_apply(unsigned long start, unsigned long end)
> {
> struct vm_area_struct *vma, *prev;

I guess using

struct mm_struct *mm = current->mm;

would reduce the churn?


Anyhow

Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>

--
Cheers,

David