Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2138206pxb; Mon, 22 Feb 2021 22:23:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCVThcGJ4uctkjDqouENYNJPnOPo0G5H/zFf278pnDFkz/q3Tqy3E4tR5Q0ZBLdcvyZ1wV X-Received: by 2002:a05:6402:424a:: with SMTP id g10mr26100300edb.236.1614061382589; Mon, 22 Feb 2021 22:23:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614061382; cv=none; d=google.com; s=arc-20160816; b=TCP23WN0Q6e7ScS6LM10H4TBd8yU8D0abk6lU6ht0w+WcoW9bEN5Br48uAK8HvYhXo x5n9ckpSrE1GP+nAn3ZiZEdfoY7XSIXEUhRRwocUwYDrk9HLRnhTbDpo7qRH/FOJWMLp sszwRJpmR1eOmJglHS8l8PFjS7oaxXJFSfBwNfu35zJmZonbeUBJNj9zMpvtR+2BGFGl Plw7MtbMigBFuExrVMhaZX+Cejio/eDDPUAwhopdnJ/jLlbT3aCalZZ0w5DXpp5/yHRf UvOoZMdAQWCtsNYJEqKPp5dklfWHiXKuWIkmBBDerBlWQpJV7ukQwrPg/Tqa+rWbF3KW qbFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=ImLZQIcWQieEHMY3TxwO0m9XRaXWF4TITl7z1/Z3xv4=; b=UMFa283EiLlwl3S4ZJ1yk0JBBQKpDtfOYNMLaaIBCeZOhmh5Df9Z9CLzMn50HpPxDu AQFxvINuX1ZsJyyzj5KRbURoVtXASYEICvHNVkFzj5NvWdZx7Fjfo4FmpWdrxbuTpKCT WqKDShk2AEYrb7V5wDF8iQB3OFL8+CeA207gtwQeU1mieu9iBGik/j3xpsIBwrEDADjC cv+QYsfZ/wLPc323ClQpvZwuTuEWNhxBYGm6qRQpMXfhlfpQZx3x+Yxshn4QUTzrbGsK mk4jONinoCTn7A/IcrYw2/UEEOUQ9J/c2EXxdLMOSanPuLM6MfVP2UevFKF9UinIBAZ5 mONQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jj18si2014229ejc.248.2021.02.22.22.22.36; Mon, 22 Feb 2021 22:23:02 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231326AbhBWFmi (ORCPT + 99 others); Tue, 23 Feb 2021 00:42:38 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:51165 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230470AbhBWFmh (ORCPT ); Tue, 23 Feb 2021 00:42:37 -0500 Received: from [192.168.1.100] (lfbn-lyo-1-457-219.w2-7.abo.wanadoo.fr [2.7.49.219]) (Authenticated sender: alex@ghiti.fr) by relay10.mail.gandi.net (Postfix) with ESMTPSA id CBC6E240003; Tue, 23 Feb 2021 05:41:52 +0000 (UTC) Subject: Re: [PATCH] riscv: Pass virtual addresses to kasan_mem_to_shadow To: Palmer Dabbelt Cc: aou@eecs.berkeley.edu, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, glider@google.com, rppt@kernel.org, Paul Walmsley , aryabinin@virtuozzo.com, akpm@linux-foundation.org, linux-riscv@lists.infradead.org, dvyukov@google.com References: From: Alex Ghiti Message-ID: Date: Tue, 23 Feb 2021 00:41:52 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Palmer, Le 2/22/21 ? 9:58 PM, Palmer Dabbelt a ?crit?: > On Mon, 22 Feb 2021 00:07:34 PST (-0800), alex@ghiti.fr wrote: >> kasan_mem_to_shadow translates virtual addresses to kasan shadow >> addresses whereas for_each_mem_range returns physical addresses: it is >> then required to use __va on those addresses before passing them to >> kasan_mem_to_shadow. >> >> Fixes: b10d6bca8720 ("arch, drivers: replace for_each_membock() with >> for_each_mem_range()") >> Signed-off-by: Alexandre Ghiti >> --- >> ?arch/riscv/mm/kasan_init.c | 4 ++-- >> ?1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/arch/riscv/mm/kasan_init.c b/arch/riscv/mm/kasan_init.c >> index 4b9149f963d3..6d3b88f2c566 100644 >> --- a/arch/riscv/mm/kasan_init.c >> +++ b/arch/riscv/mm/kasan_init.c >> @@ -148,8 +148,8 @@ void __init kasan_init(void) >> ???????????? (void *)kasan_mem_to_shadow((void *)VMALLOC_END)); >> >> ???? for_each_mem_range(i, &_start, &_end) { >> -??????? void *start = (void *)_start; >> -??????? void *end = (void *)_end; >> +??????? void *start = (void *)__va(_start); >> +??????? void *end = (void *)__va(_end); >> >> ???????? if (start >= end) >> ???????????? break; > > Thanks, but unless I'm missing something this is already in Linus' tree as > c25a053e1577 ("riscv: Fix KASAN memory mapping."). You're right, I missed this one: but for some reasons, this patch does not appear in for-next. Thanks, Alex > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv