Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp97920pxv; Wed, 14 Jul 2021 19:57:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTM+2YVudnXG7HLBkd3UB2AfEzoqnTb6Anoi9PjX/QoSorRsEOx6n8oSVnSAwD0ucBvVZ6 X-Received: by 2002:a6b:f707:: with SMTP id k7mr1206971iog.125.1626317876864; Wed, 14 Jul 2021 19:57:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626317876; cv=none; d=google.com; s=arc-20160816; b=ChO+1CuV9ZbPy/8bw1N2efgUxrjT/zkRNcf0y7WdN3wNkUw7e340MswVMPc5NYOCe1 gvj8uUE9arWqgesuPhQ0XkoZ/z2jzeyP/X8Kocnz1iUhMhmgftm0cfA5IrQ5nDo0j5KW Kxn1F5drWDUy32b32gMucEmrlY8PNHfuZ4cNXkzn/OixZtoBHXwy87qzyiM94q7smcI7 FW/k/nlx2Maq3rrIMZRPxLrkt5NP4hOp2T14EQeuWY13RR93SVUNtX4skVNskFUivyCf bVu1uZvMOFnHem9dyxvxhWcoF8tCfMbN3TV6oYuazGwBBShX8qEQtNoe24wmVZzpGXwi rExQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=gjuvrPp38hHjwCISZ1zzoHGNuHOw/dO7utt0BiNQgE4=; b=KrZXEzSe+5qyGtqD1N7S5SS/MfZt3GjzU45LJ1YZC5o5MFP4gcb+hDYG91jhJL8N7G KQgUoIXP53TU9XWclXolHO9FF5ECcM3NUzKcR/DXeY6RDsPhFxJJtX/HNteHeenJgsPR n3ok3qS2vBCKNmI0kcFV3pYFP5i4TvLKVQA2fz344ubNfgJAXbShkxJG+wCy9Z5jRzgq 5yJpJgKIDRLAaTVeUMTS1P4rInAl6QaB+KBaqPep3ZPrhKRh8D+a5UeXagQu/CnDgM+N I5PqOH3kLcZ4B8PviUYcSbxpGyGIMgDbMzcY4VAd9Dw1gFhb+QBlKMp9f2DJN5cm/gOk Uadg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h21si4011212ila.73.2021.07.14.19.57.35; Wed, 14 Jul 2021 19:57:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231624AbhGOCGj (ORCPT + 99 others); Wed, 14 Jul 2021 22:06:39 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:6929 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230087AbhGOCGi (ORCPT ); Wed, 14 Jul 2021 22:06:38 -0400 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 Content-Transfer-Encoding: 8bit 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2021/7/15 7:29, Andrew Morton 写道: > On Wed, 14 Jul 2021 09:59:59 +0800 Chen Wandun 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 > .