Received: by 2002:a05:6512:3d0e:0:0:0:0 with SMTP id d14csp41698lfv; Tue, 12 Apr 2022 16:28:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxV0c232Rh68XNb6j1osr/c3R3LumIj0bjyaBUcQ6URb+G5Vw2ZcgrdmAoLyc9MJWXFwckk X-Received: by 2002:a17:902:7794:b0:156:7641:a6cf with SMTP id o20-20020a170902779400b001567641a6cfmr40433545pll.35.1649806091429; Tue, 12 Apr 2022 16:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649806091; cv=none; d=google.com; s=arc-20160816; b=iI4xx+Cl96KbRzK6nfM0i6NhWSzGH/6KfufexCuQYj/khz6N3LkHprkVQxTeGuaV6F yDDBwtFgiisxT0tXXGszxV7O5KaYdy6hyaEbWyUls/SlBthvtU6VjDA06erqdwsQjpSE D5pPLpuCba/qZdfQslwt1U1TLK+yU1k1uaaQD/E2vKi1b3ar2Wj8+2J8FkAmrBXynHqZ xh8/AmZhmCnC32OjlRF/kZUw2KZCtqCyGel2QNepShSGD+aJoF4wV346ZMFUlkyZX2SQ RSLKB+nXPm1uS0e7EdcDrUwif9Tv+AYmvWZnm7M+2hetVL71YrFQsOliaz5gZQQ203+D ts3A== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=KcgXh2192LjUPQWs/rDBkAUXeR/iaz/svUGoB8zY+HE=; b=P5rIfxJ2zw5Yk06K1WyHbtjOwSHfFaDSXt2VfhY3HYrVeEIKuEmyC05xd7ks/Hmvj6 BebOFQO5VJc35YY3hIEttfaUecztzcUUV+smqfEcVjew2OVMS5TXUUG8u8O/po5cwz1z R3HPszGlCYWG8FNDwVRUakxE6mb/Zh07MAlE2C6HPEE04nOZe7+W9iAlrZfPZh+nPvUN 4yrScLNdhstskUYytB97Vanu6mZI0UUrEwOAv0kCVqGcWxJlYjLOjb9ZhLZ2fgkieSeY 0V9Bk148SR5IGs2AmYyHvgVoj3u+j0pb2GhIqz4XCbUJNiYFW/zXPprwxirKaJoM37sb Kw5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j190-20020a638bc7000000b0039d5b041820si3691011pge.11.2022.04.12.16.28.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 16:28:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 48DF21AD3B3; Tue, 12 Apr 2022 14:20:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352941AbiDLMd3 (ORCPT + 99 others); Tue, 12 Apr 2022 08:33:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352593AbiDLMdQ (ORCPT ); Tue, 12 Apr 2022 08:33:16 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81FC5D77 for ; Tue, 12 Apr 2022 04:50:41 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Kd3tj1KKKzdZLZ; Tue, 12 Apr 2022 19:50:05 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 12 Apr 2022 19:50:39 +0800 Received: from [10.174.177.243] (10.174.177.243) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.24; Tue, 12 Apr 2022 19:50:39 +0800 Message-ID: Date: Tue, 12 Apr 2022 19:50:38 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [RFC PATCH -next V3 2/6] arm64: fix types in copy_highpage() Content-Language: en-US To: Tong Tiangen , Mark Rutland , James Morse , Andrew Morton , Thomas Gleixner , "Ingo Molnar" , Borislav Petkov , Robin Murphy , Dave Hansen , "Catalin Marinas" , Will Deacon , "Alexander Viro" , , "H . Peter Anvin" CC: , , , Xie XiuQi References: <20220412072552.2526871-1-tongtiangen@huawei.com> <20220412072552.2526871-3-tongtiangen@huawei.com> From: Kefeng Wang In-Reply-To: <20220412072552.2526871-3-tongtiangen@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggeme707-chm.china.huawei.com (10.1.199.103) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/4/12 15:25, Tong Tiangen wrote: > In copy_highpage() the `kto` and `kfrom` local variables are pointers to > struct page, but these are used to hold arbitrary pointers to kernel memory > . Each call to page_address() returns a void pointer to memory associated > with the relevant page, and copy_page() expects void pointers to this > memory. > > This inconsistency was introduced in commit 2563776b41c3 ("arm64: mte: > Tags-aware copy_{user_,}highpage() implementations") and while this > doesn't appear to be harmful in practice it is clearly wrong. > > Correct this by making `kto` and `kfrom` void pointers. Reviewed-by: Kefeng Wang > Fixes: 2563776b41c3 ("arm64: mte: Tags-aware copy_{user_,}highpage() implementations") > Signed-off-by: Tong Tiangen > Acked-by: Mark Rutland > --- > arch/arm64/mm/copypage.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/mm/copypage.c b/arch/arm64/mm/copypage.c > index b5447e53cd73..0dea80bf6de4 100644 > --- a/arch/arm64/mm/copypage.c > +++ b/arch/arm64/mm/copypage.c > @@ -16,8 +16,8 @@ > > void copy_highpage(struct page *to, struct page *from) > { > - struct page *kto = page_address(to); > - struct page *kfrom = page_address(from); > + void *kto = page_address(to); > + void *kfrom = page_address(from); > > copy_page(kto, kfrom); >