From: Andrew Morton <akpm@linux-foundation.org>
To: "jiajun.xie" <jiajun.xie.sh@gmail.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] mm: fix unmap_mapping_range high bits shift bug
Date: Wed, 20 Dec 2023 09:53:43 -0800 [thread overview]
Message-ID: <20231220095343.326584f605e8ce995ac151d0@linux-foundation.org> (raw)
In-Reply-To: <20231220052839.26970-1-jiajun.xie.sh@gmail.com>
On Wed, 20 Dec 2023 13:28:39 +0800 "jiajun.xie" <jiajun.xie.sh@gmail.com> wrote:
> From: Jiajun Xie <jiajun.xie.sh@gmail.com>
>
> The bug happens when highest bit of holebegin is 1, suppose
> holebign is 0x8000000111111000, after shift, hba would be
> 0xfff8000000111111, then vma_interval_tree_foreach would look
> it up fail or leads to the wrong result.
>
> error call seq e.g.:
> - mmap(..., offset=0x8000000111111000)
> |- syscall(mmap, ... unsigned long, off):
> |- ksys_mmap_pgoff( ... , off >> PAGE_SHIFT);
>
> here pgoff is correctly shifted to 0x8000000111111,
> but pass 0x8000000111111000 as holebegin to unmap
> would then cause terrible result, as shown below:
>
> - unmap_mapping_range(..., loff_t const holebegin)
> |- pgoff_t hba = holebegin >> PAGE_SHIFT;
> /* hba = 0xfff8000000111111 unexpectedly */
>
> turn holebegin to be unsigned first would fix the bug.
>
Thanks. Are you able to describe the runtime effects of this
(obviously bad, but it's good to spell it out) and under what
circumstances it occurs?
next prev parent reply other threads:[~2023-12-20 17:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-20 5:28 jiajun.xie
2023-12-20 17:53 ` Andrew Morton [this message]
2023-12-21 5:40 ` Jiajun Xie
2023-12-21 22:08 ` Andrew Morton
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=20231220095343.326584f605e8ce995ac151d0@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=jiajun.xie.sh@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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