linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: wang lian <lianux.mm@gmail.com>
Cc: akpm@linux-foundation.org, baolin.wang@linux.alibaba.com,
	linux-kselftest@vger.kernel.org, linux-mm@kvack.org,
	lorenzo.stoakes@oracle.com, richard.weiyang@gmail.com,
	ziy@nvidia.com
Subject: Re: [Patch v2] selftests/mm: check content to see whether mremap corrupt data
Date: Mon, 1 Sep 2025 10:16:54 +0200	[thread overview]
Message-ID: <df27d5cc-bac8-47ee-a03d-eb1eff6dbe39@redhat.com> (raw)
In-Reply-To: <20250901081109.52460-1-lianux.mm@gmail.com>

On 01.09.25 10:11, wang lian wrote:
> 
>> I'm confused, don't we have that exact check later in the function?
> 
>> Your v1 might have been better, unless I am missing something.
> 
> Hi David,
> 
> Perhaps you missed this in the v1 feedback:
> https://lore.kernel.org/linux-mm/E0C570E7-C4CD-4E41-9590-DDB64757CA2C@nvidia.com/ ?

We have:

	/* smap does not show THPs after mremap, use kpageflags instead */
	thp_size = 0;
	for (i = 0; i < pagesize * 4; i++) {
		if (pte_mapped[i] != (char)i)
			ksft_exit_fail_msg("%ld byte corrupted\n", i);

		if (i % pagesize == 0 &&
		    !is_backed_by_folio(&pte_mapped[i], 0, pagemap_fd, kpageflags_fd))
			thp_size++;
	}

Sure, it's after the split, but if mremap would have corrupted the pages, surely
it would still be corrupt after the mremap+split.

-- 
Cheers

David / dhildenb


  reply	other threads:[~2025-09-01  8:17 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-31  2:27 [Patch v2] selftests/mm: check content to see whether mremap corrupt data Wei Yang
2025-09-01  2:08 ` wang lian
2025-09-01  7:22 ` David Hildenbrand
2025-09-01  8:11   ` wang lian
2025-09-01  8:16     ` David Hildenbrand [this message]
2025-09-01  8:34       ` wang lian
2025-09-01  8:43   ` Wei Yang
2025-09-01 12:56   ` Zi Yan
2025-09-01 13:03     ` David Hildenbrand
2025-09-01 17:04       ` Zi Yan
2025-09-01 19:10         ` David Hildenbrand
2025-09-02  2:51           ` Wei Yang
2025-09-02  7:49             ` David Hildenbrand
2025-09-02  8:13               ` Wei Yang
2025-09-02  8:23                 ` David Hildenbrand
2025-09-02  8:28                   ` Wei Yang
2025-09-02  8:16           ` Wei Yang
2025-09-02  8:26             ` David Hildenbrand
2025-09-02 14:56           ` Zi Yan
2025-09-02 15:28             ` David Hildenbrand
2025-09-02 15:39               ` Zi Yan
2025-09-02 15:40               ` David Hildenbrand
2025-09-02 15:42                 ` Zi Yan

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=df27d5cc-bac8-47ee-a03d-eb1eff6dbe39@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=lianux.mm@gmail.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=richard.weiyang@gmail.com \
    --cc=ziy@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).