From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-100.freemail.mail.aliyun.com (out30-100.freemail.mail.aliyun.com [115.124.30.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51C6A13B7AE for ; Mon, 6 Jul 2026 01:05:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783299931; cv=none; b=XK2PLIUKftAjLWRDNWBUnANFmn0ua6S9fwb/ET05PfkmDH7IHpAItdGRXeUT2pPzRJlraiT537purGsXm4irC/BN82ShsCg6KFR74b6CEV+twQpvw8Ls4QvRB0Tlqt6+pGjDo0shRbhB7YBF9BwOHwgwt93suWzZQxH7qIDEoH4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783299931; c=relaxed/simple; bh=01/pFL6Gsb7PxzMnSRRVWMIMKaedCqXzyH329V0+UEU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dRLu81yioKR94QA8qpGBy2jlvsF+qnWbwO36ikLnngsN2JpkYNsmiMO5Ha1L6WX9Zc+dxvcnTtJVDzGH3Nv+GDfaM0tb/rWAupuM/bsrC6taKjOct2Rh88ITap7N1QvwiFAAT0wn/t5z80eGwqPcoGRv602AQcsWJUws5H+vlZA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=BIHzjixm; arc=none smtp.client-ip=115.124.30.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="BIHzjixm" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1783299926; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=kOCNvl8EQR6ktCw0SI3mmPnpMy8PIkcXnPTPovWGLHg=; b=BIHzjixmIUI+RlkHWRNNp0lYZnWpEqolYlJTjUSaR9f1Xo9nD0c5RXj/W6Gpg1OLkXOmRcPwocxIzg2IS1aUFvn2u+GnqP9XGTvG0PSXp6fOCrxjZD1gOyQodelS/QXFajHtmUxxSMelQSKB43rM2p+OY2ZOHnzFGOXij1MQ7sI= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037033178;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=19;SR=0;TI=SMTPD_---0X6OzcpQ_1783299924; Received: from 30.246.104.96(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0X6OzcpQ_1783299924 cluster:ay36) by smtp.aliyun-inc.com; Mon, 06 Jul 2026 09:05:25 +0800 Message-ID: <2b7d965d-8079-431a-bb01-2f722eb02c47@linux.alibaba.com> Date: Mon, 6 Jul 2026 09:05:23 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] userfaultfd: wait on source PMD during UFFDIO_MOVE To: Usama Arif , Andrew Morton , baohua@kernel.org, david@kernel.org, dev.jain@arm.com, lance.yang@linux.dev, liam@infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ljs@kernel.org, npache@redhat.com, ryan.roberts@arm.com, ziy@nvidia.com, aarcange@redhat.com, shakeel.butt@linux.dev, hannes@cmpxchg.org, riel@surriel.com, kernel-team@meta.com Cc: sashiko-bot References: <20260705131231.1499198-1-usama.arif@linux.dev> From: Baolin Wang In-Reply-To: <20260705131231.1499198-1-usama.arif@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 7/5/26 9:12 PM, Usama Arif wrote: > move_pages_huge_pmd() snapshots src_pmdval under src_ptl, drops the lock, > and, for migration entries, waits with pmd_migration_entry_wait(). > > Passing &src_pmdval is wrong. pmd_migration_entry_wait() must lock and > re-read the real page-table PMD; on split-PMD-lock kernels, a stack > address also resolves to the wrong lock. softleaf_entry_wait_on_locked() > then waits without a folio reference, which is safe only while serialized > against migration-entry removal by the real PT lock. > > Pass src_pmd, matching __handle_mm_fault() and hmm_vma_walk_pmd(). > > Reported-by: sashiko-bot > Link: https://sashiko.dev/#/patchset/20260703173903.3789516-1-usama.arif%40linux.dev?part=8 > Fixes: adef440691ba ("userfaultfd: UFFDIO_MOVE uABI") > Signed-off-by: Usama Arif > --- Good catch. Agree with Andrew that we should cc stable. Reviewed-by: Baolin Wang