Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2649335rwd; Mon, 15 May 2023 14:59:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4T+FXbdRHt0+8J+ZGUVEy+MqY3gJ13mp1jsK8Nr/bPZcB4jKs86YhFi+d9P64053F9j+8W X-Received: by 2002:a05:6a20:914c:b0:103:f331:cee9 with SMTP id x12-20020a056a20914c00b00103f331cee9mr20322050pzc.24.1684187982112; Mon, 15 May 2023 14:59:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684187982; cv=none; d=google.com; s=arc-20160816; b=0UcDR0IVz8mDcvpLENbXF7P1YWohPTlMMiq29go6a/iB4Am3UwLz+W+8cWB07k0Hhz qfw8jBlrfaVGtvjRviyplnc8IE7qYD6C3sJmO5+88SVUihDLav2nUs8jqS595CeMmaT0 JlcrcnheJrVDvfSHmMezHkFUbUuli4tfsqmsdergqg8nhQcsm8dK/b/1XH9yUoeNkfzq QUwpSLSKXnxbUgABlU978AyOtp+LLrA8+54Da5Lk0QXYrv2ZJBkMufrYwcGwVi4KBCfw obMRLs7XebrwKIzXNc7u5gDRTUotLkCFiLQSLCzuqfd/cNgZYhM9/JGGeRuaFq4NUHvV glBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mvQ6YPEhi1yH4GPYfF4puSk1qA1jVN6Q6/XNFDL2370=; b=wadB8EFMbEcSeMyXq5G+8Qg/Js49i3mzl9DhDK+IH9dKmvVMUT0Ue+3wrR5AgnY7Z+ qBMMXbne1954zPzX1+Wu1qanUmuuDCr7aO4z/6bcEVWSUYGbIb4ahN9GqQ5jZ5wP0ioB BnwyEVy2WsJA7lpj5UmjOx/1lRY+uWj1Bo36H/elhgrvUGEfA+VXUj//qtHFlixHywTs erLhqGgNWiQlFMlvsWDYaOBrbrtBjV/Qv2R4F2v8krVN1cG6bcOLk/6p58b+wabGXJiG rUif/woOgztRW7/DWHnJ+m+F2zwc08EJDOT110k1gvSxNp+Whk1cZ1leVy6gwn1QJABj 2kKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XF7A7Q5m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv187-20020a632ec4000000b0050726756edesi16094001pgb.76.2023.05.15.14.59.29; Mon, 15 May 2023 14:59:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XF7A7Q5m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245276AbjEOVkR (ORCPT + 99 others); Mon, 15 May 2023 17:40:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245027AbjEOVkN (ORCPT ); Mon, 15 May 2023 17:40:13 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 336855B80 for ; Mon, 15 May 2023 14:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684186769; 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: in-reply-to:in-reply-to:references:references; bh=mvQ6YPEhi1yH4GPYfF4puSk1qA1jVN6Q6/XNFDL2370=; b=XF7A7Q5mqdxG9lu1Lf9srDXvijn/nSHppY7M0P5cNbvopfQVQR+wV+Ye4A/P9OWVh30dJb 8w+cviEE9mtSYoNLM27AobVCt/uew3SPwxxa5DicVNBaDLr0l5q5uZnFtFukSBXXlbbnOm 2mmGHdW1RiaeN+0NkVzyB/EVw/e3fBQ= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-539-4Di73UE0OsWR2qdVwN66Rw-1; Mon, 15 May 2023 17:39:27 -0400 X-MC-Unique: 4Di73UE0OsWR2qdVwN66Rw-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-61a3c7657aeso20850856d6.0 for ; Mon, 15 May 2023 14:39:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684186767; x=1686778767; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mvQ6YPEhi1yH4GPYfF4puSk1qA1jVN6Q6/XNFDL2370=; b=QmCziWmD7vBUXQLcJ+jyday3xx4XiT2K7lxQogJJmviZGjLnrT3kvsgayLzaBnTymh ArhfUcUMQxPZWY/A4R9Zo+Qfyvp/hVdjZqYoeYYI3ZgP98dxBDLxX6UIEnX84Y513BXG whj71aUGZ1EZAZllq3yc9+dUkQ+58ov6aj1JVa93o8wuqLSo0k6KiRR3jHALoLLOVcKY CeLKK4kPE4W7FR4gdTd0P6fXkr/QKjZXlX58dYQWXEq3IXZE621AopmpcFQR41zcpBTG x0qjAlAdpuJRsA1dMvDDEbna4p36h+caMeHR0BqHz6564N+mHRDci5fpmQvoGd6oXRW/ 5fKw== X-Gm-Message-State: AC+VfDyiAzA4r7AvesdFvGKYW2EhnhVslHD1DGsCWA5KHoENNjADVIRD 6FVwU42n5j4SaOVkJ0dt6CfRA5dPl1KsNQQ3FW8WNGciv/gQLfZpf65OpRfiS9QDL+xS18RGHmo aK7Ek59xtlRaPv9MiTkrIUGGv X-Received: by 2002:a05:622a:1884:b0:3f5:1def:67f9 with SMTP id v4-20020a05622a188400b003f51def67f9mr11458015qtc.6.1684186767412; Mon, 15 May 2023 14:39:27 -0700 (PDT) X-Received: by 2002:a05:622a:1884:b0:3f5:1def:67f9 with SMTP id v4-20020a05622a188400b003f51def67f9mr11457997qtc.6.1684186767161; Mon, 15 May 2023 14:39:27 -0700 (PDT) Received: from x1n (bras-base-aurron9127w-grc-62-70-24-86-62.dsl.bell.ca. [70.24.86.62]) by smtp.gmail.com with ESMTPSA id x25-20020a05620a14b900b0075941df3365sm102177qkj.52.2023.05.15.14.39.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 14:39:26 -0700 (PDT) Date: Mon, 15 May 2023 17:39:25 -0400 From: Peter Xu To: Lorenzo Stoakes Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Mike Rapoport , Mark Rutland , "Liam R . Howlett" , Alexander Viro , Christian Brauner Subject: Re: [PATCH v2] mm: userfaultfd: avoid passing an invalid range to vma_merge() Message-ID: References: <20230515193232.67552-1-lstoakes@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230515193232.67552-1-lstoakes@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 15, 2023 at 08:32:32PM +0100, Lorenzo Stoakes wrote: > As well as fixing the repro described in [1] this also continues to pass > uffd unit tests. Side note on testing, not directly relevant to the patch itself.. I'm wondering whether do we have tests somewhere to just test vma operations on split and merge, then verify it using smap or whatever. The uffd unit test in this case is probably not gonna trigger anything because we always mostly register with a whole vma over the testing ranges, so not immediately helpful. The trick here is we have quite a few ops that will call vma merge/split in different ways, but logically we can still category them into: (1) add/del vmas, or (2) modify vma flags, so at least for case (2) we can have a framework to cover all the cases (mbind, mprotect, uffd reg/unreg, mlock, etc.), the difference will be the flags we'll be looking at for different cases, however how vmas merge/split should be somehow in the same pattern. -- Peter Xu