From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE25FC12002 for ; Thu, 15 Jul 2021 02:03:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5B3AB613C3 for ; Thu, 15 Jul 2021 02:03:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5B3AB613C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 607FF8D000D; Wed, 14 Jul 2021 22:03:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B7E68D000A; Wed, 14 Jul 2021 22:03:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4597D8D000D; Wed, 14 Jul 2021 22:03:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0125.hostedemail.com [216.40.44.125]) by kanga.kvack.org (Postfix) with ESMTP id 2239B8D000A for ; Wed, 14 Jul 2021 22:03:51 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 08CAA18175F8D for ; Thu, 15 Jul 2021 02:03:50 +0000 (UTC) X-FDA: 78363176220.05.3021BBA Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf19.hostedemail.com (Postfix) with ESMTP id 12F85B0001BA for ; Thu, 15 Jul 2021 02:03:48 +0000 (UTC) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4GQHd66V24z7ByX; Thu, 15 Jul 2021 10:00:10 +0800 (CST) Received: from dggpemm500002.china.huawei.com (7.185.36.229) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 15 Jul 2021 10:03:38 +0800 Received: from [10.174.179.191] (10.174.179.191) by dggpemm500002.china.huawei.com (7.185.36.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 15 Jul 2021 10:03:37 +0800 Subject: Re: [PATCH] mm/vmalloc: fix wrong behavior in vread To: Andrew Morton CC: , , , , , , Hulk Robot References: <20210714015959.3204871-1-chenwandun@huawei.com> <20210714162910.4cb5434f7745dcf7ce9d85c2@linux-foundation.org> From: Chen Wandun Message-ID: <1789353e-8507-a748-644c-cd3a34b5412b@huawei.com> Date: Thu, 15 Jul 2021 10:03:37 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210714162910.4cb5434f7745dcf7ce9d85c2@linux-foundation.org> Content-Type: text/plain; charset="UTF-8"; format=flowed X-Originating-IP: [10.174.179.191] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500002.china.huawei.com (7.185.36.229) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 12F85B0001BA X-Stat-Signature: 87kb1duhc8f6y6obcqpry8hrjhradyif Authentication-Results: imf19.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=huawei.com; spf=pass (imf19.hostedemail.com: domain of chenwandun@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=chenwandun@huawei.com X-HE-Tag: 1626314628-617728 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: =E5=9C=A8 2021/7/15 7:29, Andrew Morton =E5=86=99=E9=81=93: > On Wed, 14 Jul 2021 09:59:59 +0800 Chen Wandun = wrote: > >> commit f608788cd2d6 ("mm/vmalloc: use rb_tree instead of list for vrea= d() >> lookups") use rb_tree instread of list to speed up lookup, but functio= n >> __find_vmap_area is try to find a vmap_area that include target addres= s, >> 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_are= a. In such scenario,=C2=A0 f608788cd2d6 will read noting. > >> The correct way is find the first vmap_are that bigger than target add= r, >> 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 > .