From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35AD5C83F1A for ; Mon, 14 Jul 2025 15:26:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CFDD06B00AD; Mon, 14 Jul 2025 11:26:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CAE576B00AE; Mon, 14 Jul 2025 11:26:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B9D456B00AF; Mon, 14 Jul 2025 11:26:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id A86B46B00AD for ; Mon, 14 Jul 2025 11:26:06 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7701780212 for ; Mon, 14 Jul 2025 15:26:06 +0000 (UTC) X-FDA: 83663245932.10.A5866C5 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf16.hostedemail.com (Postfix) with ESMTP id 4BD2B180004 for ; Mon, 14 Jul 2025 15:26:04 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CRR6Ps4b; dmarc=pass (policy=quarantine) header.from=redhat.com; spf=pass (imf16.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752506764; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1VHGCViQy1nmkV3DUJUcJGBuXbl9yxC8NPr6QML7nGo=; b=SZ1SC9F7Ox7JPY0V1PlAeqfZtK4GwByFPML3C4oHlEKNPtAfnOb7jr3SXw9s7Y44r3ng5z 4OIqF8gttJTT0ym57nUnifAiF7Et5qHElhMl0GNceO36YQdTIPG9oZMni9GmqL6ShV7B4P YcEVdoMEDNEly5pDIIWTR032aRnpNUw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752506764; a=rsa-sha256; cv=none; b=HkMWVml70P+kKbF1X4h/r/bAU07obMAXlTAfFQlXw+GafAKAjrL1YfDenzUS04WL6xSt9u BYI3IKxme/A0L26FvJ+h6ANjW/8P0mk29ECWZikxnjTV6TZfIuhB57AHv1XPdtN661PSSh oYSAAJRAkn1lcUEXutNVz79TrTkILE0= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CRR6Ps4b; dmarc=pass (policy=quarantine) header.from=redhat.com; spf=pass (imf16.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1752506763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1VHGCViQy1nmkV3DUJUcJGBuXbl9yxC8NPr6QML7nGo=; b=CRR6Ps4bD/h8RsZqhcY78lktfpcdIur87/ySfJu68LvME3bXuCB4jRTwwCHOSU/bMWqOp9 WPQd3qNZLiobCjEo50lw5aoIXliVi62cm5dQFtR+jWJvQlZVlnnbH5V4NiV4+W3DoLoND7 uyJiHz3tz0/K8PlvVc9JztgcGAYBQnU= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-62--T6ZvdtTPPe1iyDo2dZP1Q-1; Mon, 14 Jul 2025 11:26:02 -0400 X-MC-Unique: -T6ZvdtTPPe1iyDo2dZP1Q-1 X-Mimecast-MFC-AGG-ID: -T6ZvdtTPPe1iyDo2dZP1Q_1752506761 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-455f7b86aeeso13846975e9.0 for ; Mon, 14 Jul 2025 08:26:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752506761; x=1753111561; h=content-transfer-encoding:in-reply-to:organization:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1VHGCViQy1nmkV3DUJUcJGBuXbl9yxC8NPr6QML7nGo=; b=sbBv8+pUNXaqp/m75gElRrF2dAx4wA5RrleZmWPY/ciW5tBvkonqbEuLMMb+u/Ga6T CBSH4Z+O9PXI4OtRjpffjYzbKYC2xVM69ATfOFSahqOrKNAaXC3TuCZqGL/37J4gd6kq t811lb90Vr6U+Z3UxWO3foyEbtRyI3UFmRoREJiX6DJpa4LeGif0+NhLjXv2R8IQ46Rv 7fNptPCk6imgFB4MeM15C6jDSkZeW1tnTJ3kd7hgpZhmkbi3Tyd0twgrLnK/HGYgE896 f39JBrKd7p48SjYmBTBSwr3aBf9vnZDwiDI9XOsZ7rSyoxK7JnUvbVS85T7bWJFagBD3 9heQ== X-Forwarded-Encrypted: i=1; AJvYcCWTEJb+0iWH1ZLq0kqDZaS0imqo3LSUT4di2r0Gx7I3qaS1uWUankgtXtkW2cLU+MSPWaQkG3Zc+A==@kvack.org X-Gm-Message-State: AOJu0YwSGYXEKQxekeM/vqxBme5abGxsqdyOn5hf6bYuMVxhmiKnMYFo oxIJPhAkH4kQwSOS3o2JWDBgpxaWNiflWCzsDx8h8Bw+6NGDdu+T8r5Us6HFgiP68lfdjB+Enxq PF+zhevZ6CnX5WtuNwWA6EUgBxLvZZW+w7rA8yWZq4jEu0yqo7E/5 X-Gm-Gg: ASbGncthgpDo8XqyGehkPkYIj9o7D8LO/tr/AB+U4eLdWYLQUbLSiihOy1T2X3AYHjx cuwHJJWSaTwekVczO94sI6+pWkQiJt39QwPOpx6BJCV7GOmOa1bvozL3pGPfg/G+VbORJWTTB2m Ja/RYt92qSgYYxbzWDl+5LZZP3o8iPIlM62KLLBjI9DvCYQho6r51Hvpjq65S8gna4/U62rFzCx O+iYk/+iCB4/Cki6OTfAorEZDTY0AIssIo3/slGjLzZDmgYnrUiYZXXnlzJJCcc2R2Vwd7+bYoM +9cFlKn05tCd8IiUbC1wecuj9B/nStAma4PYKPnCeHqewYg6zNxTTMvaq/xkmCLO0fUDHB5B8AR MjdxzOj4e3rIkj6seiWpU68LdsKLWnx7T2wiNK1Mdimlh7vKc6lRAMm4HTk5mN974 X-Received: by 2002:a05:600c:8483:b0:440:6a1a:d89f with SMTP id 5b1f17b1804b1-455bd87a4a2mr110812195e9.4.1752506761045; Mon, 14 Jul 2025 08:26:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEuOWgnY869Vy5HqhGIQqeATnGreqOqbm0tJKMjayVDKE7oxj+d5bWRSPH3Beio9jC9kUAbgQ== X-Received: by 2002:a05:600c:8483:b0:440:6a1a:d89f with SMTP id 5b1f17b1804b1-455bd87a4a2mr110811915e9.4.1752506760617; Mon, 14 Jul 2025 08:26:00 -0700 (PDT) Received: from ?IPV6:2003:d8:2f38:ca00:ca3a:83da:653e:234? (p200300d82f38ca00ca3a83da653e0234.dip0.t-ipconnect.de. [2003:d8:2f38:ca00:ca3a:83da:653e:234]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4561d19a21dsm26792415e9.24.2025.07.14.08.25.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Jul 2025 08:26:00 -0700 (PDT) Message-ID: Date: Mon, 14 Jul 2025 17:25:59 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 4/5] mm/mseal: separate out and simplify VMA gap check To: Lorenzo Stoakes , Pedro Falcato Cc: Andrew Morton , "Liam R . Howlett" , Vlastimil Babka , Jann Horn , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Jeff Xu References: From: David Hildenbrand Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: mpkKbfq7lkdbYgKnE6lxp9swwWYbLI7KaZLxENpSqUQ_1752506761 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4BD2B180004 X-Stat-Signature: 11gnz6wbsojjk6dwcit5gjbzroywbtyz X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1752506764-806843 X-HE-Meta: U2FsdGVkX1/4Xhk8DIv9GchQO6BLxrZufFixxq0NdGkAsV7Xa32FjLE87+0kaDtzXk64qaWsEI7jSlxHpmBf+xYQMY3f3c3XfHSRfdXHlvHZr6Uh3m/uX493B9HUkGPoXH7KEIGscUll6wtlmhmA3EU8UUnUCDX4AbFqCC79szOgTqJ1ok9U4Cpdmmr24572WZT35QfDK/YU2TDiBvQy7MqMLHEgUz8mlllrQa+uww3ioRGRANS7KFtZ7QK2TLCwMteAxRKexMNZY0ljjzNJnux++GDR5Uw2s3oUOzNUmjNC+9bnbzKr+pKHKti9L6qsm9g1hp97dcOH+H5hXVly1IKZAG+eesjwAxsCT/MY5s4wlS4tNAp2ai35JB0W/f6R1rO/YeNPpd8EMfxOP7mAqseItkJ92y1I/k3PXQXYrb9EGd40x87hNzjPswwUy1zXwCcafXXIgbpSvXWMsL6iu9AhGCM85Bsf+vW9CCcdL+lCUJ4I8A2MxInpY37DDmaaZtVG42aG5i3F/adpzGu0hhIMzUUdH2iEakQ8I9VJ3HrDjwtMh7PnyT8BTf1x4qL63Z2qVXLWTPnVemqViD47Hw1oCzoK0REpLy+HEW/+psYtMQsYal+9rsJMIksFKG1A4RLpKaIsD+oHXCgXqU6/1Lp4du3LJQ565XxX3BnAZvQ/yL+iVCvbGMlwLNuQ0351hggkiA0VwwlJUe06IBlP0jNP2tiGeHhsvaWNl1x0eyeaez7eGeFVRZBVk7WG7cdXXg5J7WEMtH26XF2XMnfRaAcZaC64jEaw29fdi9Ev1ScKKL9ykamIEteeUbJMCPeyAEDSegdY6hSOpfnCWbSstjyuxkQ9/T6GOYrymj0wNvyw+i+7qJjAOg7CoQ5e3Fx9iNWyfaEzaQhE2QM4IHDRdubcKKlHjJzkJ0hmsof7ofc9sGjGNH86AJ9BS7A4Y7NyCjpRig/amfwCpJU3hkp fAoYExsi 49FmOoIcAI9KWoLFwDjKGzTe8+bxVru/GrZnwL29FGQSYvlVUCyXbSEKBOVD21kV0NOqEP3I39H+NROY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 14.07.25 17:23, Lorenzo Stoakes wrote: > On Mon, Jul 14, 2025 at 04:17:23PM +0100, Pedro Falcato wrote: >> On Mon, Jul 14, 2025 at 02:00:39PM +0100, Lorenzo Stoakes wrote: >>> The check_mm_seal() function is doing something general - checking whether >>> a range contains only VMAs (or rather that it does NOT contain any unmapped >>> regions). >>> >>> Generalise this and put the logic in mm/vma.c - introducing >>> range_contains_unmapped(). Additionally we can simplify the logic, we are >>> simply checking whether the last vma->vm_end has either a VMA starting >>> after it or ends before the end parameter. >>> >> >> I don't like this. Unless you have any other user for this in mind, >> we'll proliferate this awful behavior (and add this into core vma code). > > I'm not sure how putting it in an internal-only mm file perpetuates > anything. > > I'm naming the function by what it does, and putting it where it belongs in > the VMA logic, and additionally making the function less horrible. > > Let's not please get stuck on the isues with mseal implementation which > will catch-22 us into not being able to refactor. > > We can do the refactoring first and it's fine to just yank this if it's not > used. > > I'm not having a function like this sat in mm/mseal.c when it has > absolutely nothing to do with mseal specifically though. > >> >> I have some patches locally to fully remove this upfront check, and AFAIK >> we're somewhat in agreement that we can simply nuke this check (for >> various reasons, including that we *still* don't have a man page for the >> syscall). I can send them for proper discussion after your series lands. > > Yes I agree this check is odd, I don't really see why on earth we're > concerned with whether there are gaps or not, you'd surely want to just > seal whatever VMAs exist in the range? Probably because GAPs cannot be sealed. So user space could assume that in fact, nothing in that area can change after a successful mseal, while it can ... Not sure, though ... -- Cheers, David / dhildenb