All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org, surenb@google.com
Cc: Sasha Levin <sashal@kernel.org>
Subject: Re: [PATCH 6.12.y] mm: fix kernel BUG when userfaultfd_move encounters swapcache
Date: Thu, 13 Mar 2025 05:01:33 -0400	[thread overview]
Message-ID: <20250312204738-b4e540aab6e495cb@stable.kernel.org> (raw)
In-Reply-To: <20250310185747.1238197-1-surenb@google.com>

[ Sasha's backport helper bot ]

Hi,

Summary of potential issues:
⚠️ Found matching upstream commit but patch is missing proper reference to it
ℹ️ Patch is missing in 6.13.y (ignore if backport was sent)
⚠️ Commit missing in all newer stable branches

Found matching upstream commit: c50f8e6053b0503375c2975bf47f182445aebb4c

WARNING: Author mismatch between patch and found commit:
Backport author: Suren Baghdasaryan<surenb@google.com>
Commit author: Barry Song<v-songbaohua@oppo.com>

Status in newer kernel trees:
6.13.y | Not found

Note: The patch differs from the upstream commit:
---
1:  c50f8e6053b05 ! 1:  8c54f12bcedaa mm: fix kernel BUG when userfaultfd_move encounters swapcache
    @@ Commit message
         Cc: Tangquan Zheng <zhengtangquan@oppo.com>
         Cc: <stable@vger.kernel.org>
         Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    +    (cherry picked from commit c50f8e6053b0503375c2975bf47f182445aebb4c)
    +    [surenb: resolved merged conflict caused by the difference in
    +    move_swap_pte() arguments]
    +    Signed-off-by: Suren Baghdasaryan <surenb@google.com>
     
      ## mm/userfaultfd.c ##
     @@
    @@ mm/userfaultfd.c: static int move_present_pte(struct mm_struct *mm,
      			 unsigned long dst_addr, unsigned long src_addr,
      			 pte_t *dst_pte, pte_t *src_pte,
      			 pte_t orig_dst_pte, pte_t orig_src_pte,
    - 			 pmd_t *dst_pmd, pmd_t dst_pmdval,
     -			 spinlock_t *dst_ptl, spinlock_t *src_ptl)
     +			 spinlock_t *dst_ptl, spinlock_t *src_ptl,
     +			 struct folio *src_folio)
    @@ mm/userfaultfd.c: static int move_present_pte(struct mm_struct *mm,
     -
      	double_pt_lock(dst_ptl, src_ptl);
      
    - 	if (!is_pte_pages_stable(dst_pte, src_pte, orig_dst_pte, orig_src_pte,
    + 	if (!pte_same(ptep_get(src_pte), orig_src_pte) ||
     @@ mm/userfaultfd.c: static int move_swap_pte(struct mm_struct *mm,
      		return -EAGAIN;
      	}
    @@ mm/userfaultfd.c: static int move_pages_pte(struct mm_struct *mm, pmd_t *dst_pmd
      	pte_t src_folio_pte;
      	spinlock_t *src_ptl, *dst_ptl;
     @@ mm/userfaultfd.c: static int move_pages_pte(struct mm_struct *mm, pmd_t *dst_pmd, pmd_t *src_pmd,
    - 				       orig_dst_pte, orig_src_pte, dst_pmd,
    - 				       dst_pmdval, dst_ptl, src_ptl, src_folio);
    + 				       orig_dst_pte, orig_src_pte,
    + 				       dst_ptl, src_ptl, src_folio);
      	} else {
     +		struct folio *folio = NULL;
     +
    @@ mm/userfaultfd.c: static int move_pages_pte(struct mm_struct *mm, pmd_t *dst_pmd
      			goto out;
      		}
      
    --		err = move_swap_pte(mm, dst_addr, src_addr, dst_pte, src_pte,
    --				    orig_dst_pte, orig_src_pte, dst_pmd,
    --				    dst_pmdval, dst_ptl, src_ptl);
    +-		err = move_swap_pte(mm, dst_addr, src_addr,
    +-				    dst_pte, src_pte,
    +-				    orig_dst_pte, orig_src_pte,
    +-				    dst_ptl, src_ptl);
     +		if (!pte_swp_exclusive(orig_src_pte)) {
     +			err = -EBUSY;
     +			goto out;
    @@ mm/userfaultfd.c: static int move_pages_pte(struct mm_struct *mm, pmd_t *dst_pmd
     +			}
     +		}
     +		err = move_swap_pte(mm, dst_vma, dst_addr, src_addr, dst_pte, src_pte,
    -+				orig_dst_pte, orig_src_pte, dst_pmd, dst_pmdval,
    ++				orig_dst_pte, orig_src_pte,
     +				dst_ptl, src_ptl, src_folio);
      	}
      
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.12.y       |  Success    |  Success   |

      reply	other threads:[~2025-03-13  9:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-09 18:16 FAILED: patch "[PATCH] mm: fix kernel BUG when userfaultfd_move encounters swapcache" failed to apply to 6.12-stable tree gregkh
2025-03-10 18:57 ` [PATCH 6.12.y] mm: fix kernel BUG when userfaultfd_move encounters swapcache Suren Baghdasaryan
2025-03-13  9:01   ` Sasha Levin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250312204738-b4e540aab6e495cb@stable.kernel.org \
    --to=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=surenb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.