From patchwork Mon Jan 18 11:33:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 366019 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 1A2C4C433E6 for ; Mon, 18 Jan 2021 18:27:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E614A22D03 for ; Mon, 18 Jan 2021 18:27:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407604AbhARS1H (ORCPT ); Mon, 18 Jan 2021 13:27:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:36394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390744AbhARLlk (ORCPT ); Mon, 18 Jan 2021 06:41:40 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D343322573; Mon, 18 Jan 2021 11:41:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610970079; bh=thbQxZcpRcG6YQUeXHtrSfFQmzDOIk0PXEA3boSIkEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tobtOu8VcOYlFadKZhvXRA52FWAbaYr3ChXfw/HdWluMa9Sln2B/Kr9wZ4KrdqVqC mFTTawKQgd9g25/+lgCTdqzHSUG2KOv8v9dCrNgHUYCUujM36HSKMZgl8ssL4giKB2 PKOlTy3+sQr+HTb1dX3ajOS/eHtXcediipZRG/s0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Hu , Nylon Chen , Palmer Dabbelt Subject: [PATCH 5.10 028/152] riscv: Fix KASAN memory mapping. Date: Mon, 18 Jan 2021 12:33:23 +0100 Message-Id: <20210118113354.130434971@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210118113352.764293297@linuxfoundation.org> References: <20210118113352.764293297@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Nick Hu commit c25a053e15778f6b4d6553708673736e27a6c2cf upstream. Use virtual address instead of physical address when translating the address to shadow memory by kasan_mem_to_shadow(). Signed-off-by: Nick Hu Signed-off-by: Nylon Chen Fixes: b10d6bca8720 ("arch, drivers: replace for_each_membock() with for_each_mem_range()") Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/mm/kasan_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/riscv/mm/kasan_init.c +++ b/arch/riscv/mm/kasan_init.c @@ -93,8 +93,8 @@ void __init kasan_init(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;