Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1325331rdb; Mon, 2 Oct 2023 06:25:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGntsZMRvhsOoRxsNysbL/AVch8XSdPKQ5ctjpw8yGuGmzTgNjC+Wl34/yfZodop4nr6/ok X-Received: by 2002:a05:6871:7aa:b0:1d0:f84f:40d with SMTP id o42-20020a05687107aa00b001d0f84f040dmr13600281oap.34.1696253144114; Mon, 02 Oct 2023 06:25:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696253144; cv=none; d=google.com; s=arc-20160816; b=skuqC+du+n0cGHviLy7rVP5MqewxHNzLVb7kEn1kVN2z+SxnrbccQoDWY2dSHNLPH8 DFLITvxL2FpATXhyH+8elXG2qVPZB4VpBzFW0SZ61rod0Wc7K0nMw9pOwN6KrlfztOrr Pbb8Bq2f/QC/EQEeKV2tjMBuSNqOp+yVdC40VxOup2sbUYg2CcbhCYpnogEzG5ksC/DV WTymNFcIaDTBs0p89w/U8H+xz8g+rt4AliVJv0OnMFdIDxm7SETNxXNwS8PzqJhF0KA6 rizM7b65eO+8lJPw3L+ejt1qY1i1LkCrRxq8oW/FBDPvgxgdS3bqhj5rwHziFkg0r/43 B/UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=xSO+q4NguQnQDt6IX/K/Lh0EmckaVAVm5/00yWDrQR0=; fh=hOaN1/HlXWrx/vHluPQdqKKg6VbIVLaMJV2uvguRs3c=; b=Nu0Fhj32Cb9sZCrQGVt5CgM1c+gTbCt6YJphjZAI4PAnlOfOCNDC0WIH14i+vYYmWA zkz4okmRGojCKPk0zHCQrSNV2xROvym4fWViQTl1MLvWOvIfeyuZj2MpDtB06tbaUyJK M6XHE5KACLSP/yIoB57De2q5DqFA1iYzY0XlLHE0IhIv93kBdtHR87e7jpWjzgxMkWMe dCYdV4QUuDnr6K8+v8W/VU/bdaTfWzb7gpL3Qj2IVwjfKi5r73SY1p+QRXhMIVtpHtDI cX+vPMeN96zh77tD5FQJ8Fsloa2JvABDQ3m8LX5r7XdImqTyR1w39uXnIKcJa+vxhVv7 uKXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id bs65-20020a632844000000b005855bd1ebbasi12293818pgb.204.2023.10.02.06.25.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 06:25:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CF22A811299B; Mon, 2 Oct 2023 06:13:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237302AbjJBNNx convert rfc822-to-8bit (ORCPT + 99 others); Mon, 2 Oct 2023 09:13:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236163AbjJBNNw (ORCPT ); Mon, 2 Oct 2023 09:13:52 -0400 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A42C493 for ; Mon, 2 Oct 2023 06:13:49 -0700 (PDT) Received: from imladris.home.surriel.com ([10.0.13.28] helo=imladris.surriel.com) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qnIjv-00088s-2O; Mon, 02 Oct 2023 09:13:35 -0400 Message-ID: <5c6c554ad749531826e71083f56cde90f336942a.camel@surriel.com> Subject: Re: [PATCH 2/3] hugetlbfs: close race between MADV_DONTNEED and page fault From: Rik van Riel To: Mike Kravetz Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, linux-mm@kvack.org, akpm@linux-foundation.org, muchun.song@linux.dev, leit@meta.com, willy@infradead.org Date: Mon, 02 Oct 2023 09:13:35 -0400 In-Reply-To: <20231002043958.GB11194@monkey> References: <20231001005659.2185316-1-riel@surriel.com> <20231001005659.2185316-3-riel@surriel.com> <20231002043958.GB11194@monkey> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 Sender: riel@surriel.com X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 02 Oct 2023 06:13:54 -0700 (PDT) On Sun, 2023-10-01 at 21:39 -0700, Mike Kravetz wrote: > > Looks like vma->vm_file is NULL and __hugetlb_zap_begin is trying to > do > i_mmap_lock_write(vma->vm_file->f_mapping). > > Guess I did look closely. :) Ugh. It looks like the fix for this bug ended up getting pulled into patch 3, instead of patch 2. I've had it in my code for a while now :/ Let me move the fix for this thing into patch 2. void __hugetlb_zap_begin(struct vm_area_struct *vma, unsigned long *start, unsigned long *end) { adjust_range_if_pmd_sharing_possible(vma, start, end); hugetlb_vma_lock_write(vma); if (vma->vm_file) i_mmap_lock_write(vma->vm_file->f_mapping); } -- All Rights Reversed.