Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1399728rwd; Tue, 13 Jun 2023 08:38:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Akf0Frim2WAPPCvKFKJwPeyZbmWocax9YJWUvHnFwd1+gIaPIlQmnbo2gGId2ORgeSz4T X-Received: by 2002:a17:907:3f91:b0:978:8a30:a8b with SMTP id hr17-20020a1709073f9100b009788a300a8bmr13157075ejc.27.1686670711142; Tue, 13 Jun 2023 08:38:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686670711; cv=none; d=google.com; s=arc-20160816; b=Rh/MCdrJtaUIKvU4AF3Y8DT1Eq59b5+0h0wW+UlTIHsKGfVZ7//hlQ+4XYRids7giQ /pInqEbCNseWN8+ZAWv7mNftjXjuZ6VlFMg2qbsj9yScwH5doNzeqAibCj2e+UPHxJEU H1XbFpsMnDyEMnZtpTay5yGnBdoz6ZqvQ8ajf91FlHXW52t2+dPVpRBU4vzCp1GY8ela wgQfffYMPt1OfzKq7PSZgX6BYC8pHkk26towvdEhpXWFrujwBoumIi8ZigYnGfidjLYi VGxEQ1jOEGKhaFvMsaXbiAhZyWMKrExH1LZLK9Pw7v4wJCBjD9a1xNzruqgP6OSzKAIc 0cZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:to:subject:message-id :date:from:in-reply-to:references:mime-version:dkim-signature; bh=sP5idTvIDCNhphFxgMYPrqA/v5X6PDGt+hLyjhHCuqc=; b=EH8BaWPWYGkNAe4a/W/ISAZAJ/k9JRNNZOWsdKHvYdjtp4yr4ngGOlozaEjLt5176J fdBjPqBK1QsOsRIfkYil2kIL44u8DW8wqFhi69evrRIBjA/4DlxJt/4raRL98DlYlynL ZV4vXyVO2sCR6dlcB18kHMd1UPicT02oW6j/uzlyrf8oU7V2toBVPFWbCNNPG1oY3DmO E6gy61Bx53zkD+HjsLnH9W3bTJqscqI8UqTPv9vYV4CNuZuQumzAfjL2UomfoL/1g7XW g0P7lEtpdPEWZvAGxnosixjl3gzulUq3cR28mJxd7fB/1GpL3PRKCHKxlRHcsISS+Xqw HeMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=l33Kcibk; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lc10-20020a170906f90a00b00976b9b2f20fsi7006727ejb.537.2023.06.13.08.38.05; Tue, 13 Jun 2023 08:38:31 -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=@chromium.org header.s=google header.b=l33Kcibk; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242954AbjFMP0k (ORCPT + 99 others); Tue, 13 Jun 2023 11:26:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241165AbjFMP0j (ORCPT ); Tue, 13 Jun 2023 11:26:39 -0400 Received: from mail-oa1-x36.google.com (mail-oa1-x36.google.com [IPv6:2001:4860:4864:20::36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45C2F171F for ; Tue, 13 Jun 2023 08:26:38 -0700 (PDT) Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-1a6860fa9ffso2112569fac.2 for ; Tue, 13 Jun 2023 08:26:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1686669997; x=1689261997; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=sP5idTvIDCNhphFxgMYPrqA/v5X6PDGt+hLyjhHCuqc=; b=l33Kcibkx3maWuZGuU6K37uh3DEojYwaVDf/g/Fb7RX90PfwCiHwEjBIqfI9qzRFxF wx8oO4o7PNhBPw3C7eia6LgEALKqi7chYkMHYHQOl8RWFhvdK9hyUdvGFpRjPJSY56H/ L6zSuEgRgahgnb3Q0BJEP/I7jlOE/wIDajstk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686669997; x=1689261997; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sP5idTvIDCNhphFxgMYPrqA/v5X6PDGt+hLyjhHCuqc=; b=AIMPmfxQbt4l9EiyCBNxLRoSVy800lzZ0vtmi8XWT2MhwgtFseffaEuDOzCmmUa22t 0ciianO989pjLNckN6CGOc49i0CKOlp4IC1clcXnSHznK3eZZyy0PTMhkM3G5/e9xIVW 4h/v7wssxiCrwWNTakdrz6LRZmhv79hGEzbzub2p5RjiLVFUEFLD1bbVilUI9rMrgXkU CTjYCS+0tECjqPdMZlORuUS3jeGnAikAziJtM9Nr8PVsb6VEqxx5KffROaMe4g1h0AC5 UG/ZerbAjI5JaVWYs3FdupiUR5OOk3ipNzUFN61ngo5Vsi3B79KLFh0p+Xjm03oFY6sP XWhQ== X-Gm-Message-State: AC+VfDxafaK/ok1O4eLj1tHrc8vkPe0d9OmQp0UIbozMr1Gw8ndbvHuH pk7lvi4Bjjr9kImaJhgFVZKOwoJKj0QIzocRlSD8Tg== X-Received: by 2002:a05:6870:e905:b0:19a:2178:ee94 with SMTP id l5-20020a056870e90500b0019a2178ee94mr9499419oan.26.1686669997691; Tue, 13 Jun 2023 08:26:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jeff Xu Date: Tue, 13 Jun 2023 08:26:26 -0700 Message-ID: Subject: Re: inconsistence in mprotect_fixup mlock_fixup madvise_update_vma To: linux-mm@kvack.org, linux-hardening@vger.kernel.org, Liam.Howlett@oracle.com, peterx@redhat.com, zhangpeng.00@bytedance.com, akpm@linux-foundation.org, koct9i@gmail.com, david@redhat.com, ak@linux.intel.com, hughd@google.com, emunson@akamai.com, rppt@linux.ibm.com, aarcange@redhat.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 + more ppl to the list. On Mon, Jun 12, 2023 at 6:04=E2=80=AFPM Jeff Xu wrote= : > > Hello, > > There seems to be inconsistency in different VMA fixup > implementations, for example: > mlock_fixup will skip VMA that is hugettlb, etc, but those checks do > not exist in mprotect_fixup and madvise_update_vma. Wouldn't this be a > problem? the merge/split skipped by mlock_fixup, might get acted on in > the madvice/mprotect case. > > mlock_fixup currently check for > if (newflags =3D=3D oldflags || (oldflags & VM_SPECIAL) || > is_vm_hugetlb_page(vma) || vma =3D=3D get_gate_vma(current->mm) || > vma_is_dax(vma) || vma_is_secretmem(vma)) > > Should there be a common function to handle VMA merge/split ? > > Best > -Jeff