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=-12.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 55E59C4320E for ; Tue, 17 Aug 2021 08:24:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0B6D960F58 for ; Tue, 17 Aug 2021 08:24:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0B6D960F58 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 9B52A6B0073; Tue, 17 Aug 2021 04:24:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 965226B0074; Tue, 17 Aug 2021 04:24:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 853C78D0001; Tue, 17 Aug 2021 04:24:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0140.hostedemail.com [216.40.44.140]) by kanga.kvack.org (Postfix) with ESMTP id 695CA6B0073 for ; Tue, 17 Aug 2021 04:24:49 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1A7781F349 for ; Tue, 17 Aug 2021 08:24:49 +0000 (UTC) X-FDA: 78483886698.36.48B6A1B Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf06.hostedemail.com (Postfix) with ESMTP id 2290880249E5 for ; Tue, 17 Aug 2021 08:24:47 +0000 (UTC) Received: from dggeme703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4GpkbT5FY4z876x; Tue, 17 Aug 2021 16:24:37 +0800 (CST) Received: from [10.174.179.72] (10.174.179.72) by dggeme703-chm.china.huawei.com (10.1.199.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Tue, 17 Aug 2021 16:24:43 +0800 Subject: Re: [PATCH 2/4] mm/hwpoison: fix potential pte_unmap_unlock pte error To: =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= CC: "akpm@linux-foundation.org" , "sfr@canb.auug.org.au" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" References: <20210814105131.48814-1-linmiaohe@huawei.com> <20210814105131.48814-3-linmiaohe@huawei.com> <20210817072900.GA452155@hori.linux.bs1.fc.nec.co.jp> From: Miaohe Lin Message-ID: <4b0a5fcd-0b1b-6198-b6a7-d9cab5b9fae2@huawei.com> Date: Tue, 17 Aug 2021 16:24:43 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210817072900.GA452155@hori.linux.bs1.fc.nec.co.jp> Content-Type: text/plain; charset="utf-8" Content-Language: en-US X-Originating-IP: [10.174.179.72] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggeme703-chm.china.huawei.com (10.1.199.99) X-CFilter-Loop: Reflected Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=none) header.from=huawei.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 2290880249E5 X-Stat-Signature: ewdcay7hagzaw97wioz8oxtguw8ju1jc X-HE-Tag: 1629188687-227469 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000390, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2021/8/17 15:29, HORIGUCHI NAOYA(=E5=A0=80=E5=8F=A3 =E7=9B=B4=E4=B9=9F= ) wrote: > On Sat, Aug 14, 2021 at 06:51:29PM +0800, Miaohe Lin wrote: >> If the first pte is equal to poisoned_pfn, i.e. check_hwpoisoned_entry= () >> return 1, the wrong ptep - 1 would be passed to pte_unmap_unlock(). >> >> Fixes: ad9c59c24095 ("mm,hwpoison: send SIGBUS with error virutal addr= ess") >> Signed-off-by: Miaohe Lin >=20 > I agree with the change itself, so >=20 > Acked-by: Naoya Horiguchi >=20 Many thanks for your review and Acked-by tag! > One question is that according to "grep -r pte_unmap_unlock ." command = over > whole kernel source code, pte_unmap_unlock() is called with "ptep - 1" = in some places. > I think that none of them seems to have "break in for loop" in locked p= eriod, > so the same problem does not occur there. But I'm still not sure why s= ome place > call with "ptep - 1" and the others call with pte returned by pte_offse= t_map_lock(). IMO pte_unmap_unlock() works as long as the passed in pte belongs to the = same page returned from pte_offset_map_lock(). I have fixed some similar place where pte_unm= ap_unlock() is called with wrong "ptep - 1" when I was learning the related mm code. >