linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen Wandun <chenwandun@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <serapheim.dimitro@delphix.com>, <urezki@gmail.com>,
	<wangkefeng.wang@huawei.com>, <weiyongjun1@huawei.com>,
	<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	Hulk Robot <hulkci@huawei.com>
Subject: Re: [PATCH] mm/vmalloc: fix wrong behavior in vread
Date: Thu, 15 Jul 2021 10:03:37 +0800	[thread overview]
Message-ID: <1789353e-8507-a748-644c-cd3a34b5412b@huawei.com> (raw)
In-Reply-To: <20210714162910.4cb5434f7745dcf7ce9d85c2@linux-foundation.org>


在 2021/7/15 7:29, Andrew Morton 写道:
> On Wed, 14 Jul 2021 09:59:59 +0800 Chen Wandun <chenwandun@huawei.com> wrote:
>
>> commit f608788cd2d6 ("mm/vmalloc: use rb_tree instead of list for vread()
>> lookups") use rb_tree instread of list to speed up lookup, but function
>> __find_vmap_area is try to find a vmap_area that include target address,
>> if target address is smaller than the leftmost node in vmap_area_root,
>> it will return NULL, then vread will read nothing. This behavior is
>> different from the primitive semantics.
> What is "the primitive semantics"?  Does this refer to behaviour prior
> to f608788cd2d6?

If address is smaller than the leftmost node in vmap_area_root and

the read size is big enough when reading [addr, addr + count),

"the primitive semantics" will fill holes by zero and copy valid vmap_area.

In such scenario,  f608788cd2d6 will read noting.

>
>> The correct way is find the first vmap_are that bigger than target addr,
>> that is what function find_vmap_area_exceed_addr does.
> Is this problem observable from userspace?  If so, what are the effects
> and what must an application do to trigger it?

Reading /proc/kcore will be affected.

Thanks,

Wandun

> .

  reply	other threads:[~2021-07-15  2:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14  1:59 [PATCH] mm/vmalloc: fix wrong behavior in vread Chen Wandun
2021-07-14 23:29 ` Andrew Morton
2021-07-15  2:03   ` Chen Wandun [this message]
2021-07-15 10:58 ` Uladzislau Rezki
2021-07-15 12:44   ` Chen Wandun

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=1789353e-8507-a748-644c-cd3a34b5412b@huawei.com \
    --to=chenwandun@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=hulkci@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=serapheim.dimitro@delphix.com \
    --cc=urezki@gmail.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=weiyongjun1@huawei.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).