Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3519876pxf; Mon, 15 Mar 2021 11:22:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwe5EHtWj2I6KS+MWrXSQ3OGeWC1a3CTsuvEXQzNc159ccwKGOV/JkjAaqcM1XrfGJ3o2cy X-Received: by 2002:aa7:cf02:: with SMTP id a2mr31115962edy.59.1615832526308; Mon, 15 Mar 2021 11:22:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832526; cv=none; d=google.com; s=arc-20160816; b=jJLFb1zKOy1HwmyZRutpdjfx2wGfgmz4166GctpLBkk9UbYB/Zy7lAgn5lqOnCftkx YxLKNavuD+W587gLdTe4/CTQ+Xj+lpF1/92fggK2w+AlRNdD4EVy8jhDzL5OxGD81MoF gcDEHXkFuTcszAgHduPP4BQpz9GB0fSnGCmEJr+OwHSkAyo0I0lyprHDk7fh7SomrRkp OfotM14iesk1bCyngAOoIrHKpJpI+AaXAu9Eer5jJ+mZgDqSCmnqq8H8xfvwIkBNJs6H QWUNk6ORke7nB65rKq+YxSMDBfN6la+ssh+Sh740TaXu3RsdPvu6RDlk5J7+RRW6Vnng ZGUQ== 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=BThHN7N+OGFXrY3WiJMSpJN/dCaR6lknH/g0XT79X2o=; b=NjYuIqFLfO+uXmRUG98nZR11e90ERTZFF0jn9BGzcKZ8qkEzCuO/Ak7G4m5eUdeuR0 pFKDGfOBU430idyAwq242gnaXsCXba+1Iiq32WGksl3loYx+9be4Dn3JTIwilGcAqjPf uK2ojDYoWafb/exftAEp1VzFBiRqeVvfzIMgZNVLRdLJ9JCDD6Xsj58EYLjSbA9t2fPz spCVW8gisBDrtz51uEEnFbAx7Z26+hI/Ggq+ZW0syX7aDjsO3ggtw+J6t2iduUqfmxmy 8bY/H3wTKevUsBDmHp2sRUR8tUZ56Vqj+Kl6RxBmN2kEHNb+X4XrczDVT/7TU847DrKD s9uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bm+PdGW2; 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 i26si8640337edb.84.2021.03.15.11.21.43; Mon, 15 Mar 2021 11:22:06 -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=bm+PdGW2; 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 S237610AbhCOOS7 (ORCPT + 99 others); Mon, 15 Mar 2021 10:18:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:37612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232468AbhCON7v (ORCPT ); Mon, 15 Mar 2021 09:59:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3DF5D64F2F; Mon, 15 Mar 2021 13:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816769; bh=DWkUTZJPYEwdrYvkqTCumpJfYkrmCHUOc9flC5P+QQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bm+PdGW23dQGkv6ZWYiEOuJukYM3b/vXVxJUVu7bsxSeriYWm90NAOLhQvrDpeTTV 50qtjk41wUTx3Y/rNJ7bwzErCNboR0cLonAvOu2jMGfB0NGj4vycjc7q4W2LUE656k pY//qRZpVZxja407+xE/gXwLB4tatqhNDOVu4wKI= 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.4 097/168] arm64: kasan: fix page_alloc tagging with DEBUG_VIRTUAL Date: Mon, 15 Mar 2021 14:55:29 +0100 Message-Id: <20210315135553.559811335@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@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 @@ -315,6 +315,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) ({ \