Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3347167pxf; Mon, 15 Mar 2021 07:39:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDWuNqzwR09D0+W1gdq/OAmOvd033lV1xuZQsz1TanPbp9QyJkQc3ETgoPPfIS61TcxaWD X-Received: by 2002:a17:907:788e:: with SMTP id ku14mr24367515ejc.17.1615819198183; Mon, 15 Mar 2021 07:39:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615819198; cv=none; d=google.com; s=arc-20160816; b=v8cWE0zFxzCaLfFQLdDIAa90mIBh0kcXRbHkNvnBmbpkVgP4R/Ix/Vy2dQCtJ1WRfi y7kbUdHfZmyVDmalPmRe622IdLLzz3tpYF89P0JzlwjaVCqlpGnUSa+H6Ko8h1nFPp5A PAhZYVhRunaZHOQq6jeryidHtsWK2UGIFLUEhWm5aIM8Kg4jaO5tASUFtUuGD77E6aVN aABLInQdaygGXxMhPSqDS1Wic8K9Ax3n3IcPxf+ILv3c9dyfIUeqEB/2itSFyPJ77kGC 6+7pjfjTYBQt7wehdGz+QfmogJ0ZrrTXonjmsDg6H8FQx2fRmnn1R3zmb4QmFz9fa06N BCFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yTgqKEsYvrJlyek0zs7davJ8cNBPwAGz6hJqamK9ALk=; b=Exp3a9VBCFs7/0FujXl0hYHQvgYiZ9aXbJ0UeM88AsvvguUvEbmWPqu8hXWnXDK943 nlxX0e0LhOZKRZqh9yFmBgJ+tt5s0KFbQL2PsVkJS8UpvR9oRya244wdONa3wRKTbnBt 3MYBORPmyOdvVUSFVujz22G1No86U2ElIqDZmWI7nDbfYiluIZ6S8gLYyAcdFgfgYheH B1PJv8w9B2BW0FwhSvz7OZe+6nPhOGpwtrbZYOnlcqjdSspdmNGVtC+lxaDIsDx5hBgb FPCt1j+DUC5Cb/5D3gzRaX9mttvfsrsQ6FuC2J+ZfJbwwzj+HDHd9albZqCCVKLM4N2A L9EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fKjkNUKI; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si11071450eje.690.2021.03.15.07.39.35; Mon, 15 Mar 2021 07:39:58 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fKjkNUKI; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240728AbhCOOiT (ORCPT + 99 others); Mon, 15 Mar 2021 10:38:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:48452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233522AbhCOOBz (ORCPT ); Mon, 15 Mar 2021 10:01:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C9A3664EF3; Mon, 15 Mar 2021 14:01:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816915; bh=yARp1X1kXSt6bnt386wN7Re33IMYNmu2wEiiRyuu6bM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fKjkNUKIitgZfKM6+Ce09EisoolIXPvGqLR4EGpLa+qRYkLyj7lHYzs0xBw58Ffc7 tqnA8I8Fu4I+3/DYLUatCbPGaLSNeKq2nOnGRJshJZFaMbIrsy8IK37xGAT4xkCGTT aZQienWYk8e8soL5+Xdi1RAwsTUbRUkhtvdbuick= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Konovalov , Catalin Marinas , Will Deacon Subject: [PATCH 5.10 186/290] arm64: kasan: fix page_alloc tagging with DEBUG_VIRTUAL Date: Mon, 15 Mar 2021 14:54:39 +0100 Message-Id: <20210315135548.201063108@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Andrey Konovalov commit 86c83365ab76e4b43cedd3ce07a07d32a4dc79ba upstream. When CONFIG_DEBUG_VIRTUAL is enabled, the default page_to_virt() macro implementation from include/linux/mm.h is used. That definition doesn't account for KASAN tags, which leads to no tags on page_alloc allocations. Provide an arm64-specific definition for page_to_virt() when CONFIG_DEBUG_VIRTUAL is enabled that takes care of KASAN tags. Fixes: 2813b9c02962 ("kasan, mm, arm64: tag non slab memory allocated via pagealloc") Cc: Signed-off-by: Andrey Konovalov Reviewed-by: Catalin Marinas Link: https://lore.kernel.org/r/4b55b35202706223d3118230701c6a59749d9b72.1615219501.git.andreyknvl@google.com Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/memory.h | 5 +++++ 1 file changed, 5 insertions(+) --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -306,6 +306,11 @@ static inline void *phys_to_virt(phys_ad #define ARCH_PFN_OFFSET ((unsigned long)PHYS_PFN_OFFSET) #if !defined(CONFIG_SPARSEMEM_VMEMMAP) || defined(CONFIG_DEBUG_VIRTUAL) +#define page_to_virt(x) ({ \ + __typeof__(x) __page = x; \ + void *__addr = __va(page_to_phys(__page)); \ + (void *)__tag_set((const void *)__addr, page_kasan_tag(__page));\ +}) #define virt_to_page(x) pfn_to_page(virt_to_pfn(x)) #else #define page_to_virt(x) ({ \