Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp56974imu; Tue, 27 Nov 2018 08:59:52 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wu4+mDxdO75WDj50D92SAKyzL1p5AlBWNqoQlY4/+fF6tQQa+znH0M1t5/oJcEqCZFq5jn X-Received: by 2002:a17:902:a983:: with SMTP id bh3-v6mr8955288plb.31.1543337992215; Tue, 27 Nov 2018 08:59:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543337992; cv=none; d=google.com; s=arc-20160816; b=QVh3Sc0bouN8Q/bCXPYS7KKtu0yDddXpLK6W4Xs2TAulGrr+bDCd0Y65DSdZedmC/4 pDrbM6xIeXokN9VLiokBsmiLsSB5pcYrnMP/3KAZA+7Jm457EMQde8op1AcmTC3K4nXA ojC5MzRmgtNeF3Qd9PACICVuPfUgNdjQQQOJpZrYmds+o7cPBg8WoG3b6ZNw3Y1FX+PS mBrw2TX7qcdmYU0Ts0KkhSq/vLBFBaXZXWrCwVhon0BzjltCHFSedjfhNd5/Pg+f+GNw 1X1P8sWMGVYhd8GlZF8iSkQIxo1WJxf9jV+BJkbb/z+w3qfuRzjkntnK4j6fJEbOp7R0 PuTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=y8jDgA1AyN3NE4eBg/lwMVayjAlQQavKYDtyjUMWkmY=; b=FBluCOzNytJXd3sW3mUsJlL33kz7uyLM87euAFZMWzW/Kv8EgqGrvTIs/ko0kFqK9b flFDVv3bowGIZhuuGE+ZtPYRJzTKJRr1vosypbwgRIpK26Txzbd17KTJJ9PiDvEAEJbh bmghK+ThQAocRsstllVbaUE784WK4hgybGjj/q/aGatrvQbKh0aobM7jfpvym6ednvZQ 5SYeuWLL+BskpuZU8LzRgM0WQ2H3243c0kyQLyLQbkyCvGUAVBqrjduzRqtxLpvTttAJ TT/m6BaYzuaupl6MoLe7nj6rYbmna3wCvVD3/itLkUmr0i8pY8weMB6QB0bLdfY3BJ51 zHTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Bxo3E4Rb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n4si4168593pgv.512.2018.11.27.08.59.36; Tue, 27 Nov 2018 08:59:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Bxo3E4Rb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731674AbeK1D4Y (ORCPT + 99 others); Tue, 27 Nov 2018 22:56:24 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:42581 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731398AbeK1Dyl (ORCPT ); Tue, 27 Nov 2018 22:54:41 -0500 Received: by mail-wr1-f65.google.com with SMTP id q18so23436625wrx.9 for ; Tue, 27 Nov 2018 08:56:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=y8jDgA1AyN3NE4eBg/lwMVayjAlQQavKYDtyjUMWkmY=; b=Bxo3E4Rb7z32spR+GjTU3/UkKTGzAZUE/6ScwrxnZHct9+8n6DhIPAlWfNPk4yvtAq PkF5qmbAKLUkwJhskz+edVmt8U0gNIS7JXhbzegEAAnxrdyJob+N+sL6TAIVBVcjvmD4 PwOc2fCWgzsAQX/lmgBsIe2l2PS+aXGvAZR8ehnhsFLiJngL0VkrxwD6JHkJ2PO4YGx3 XB9Nzoo5zvl1XhXpRJOFc0QeTA1hfU/SeQYwjx5psTSN9ZZuB3a0BO0gCZ+p/qF4b0oG tG+bFW16AGvNk5yTKTIM2JfWNcFnKaii4O5xUCK1MdbaQ2VOisQTBmWTaf8vD/SjaVeQ oypw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y8jDgA1AyN3NE4eBg/lwMVayjAlQQavKYDtyjUMWkmY=; b=JCUd7Q0ELkuFBxiUAc1Tva9Plm7GCPZ9kRyaxKKyu9dgq+etyY7P7uP3jbLn4cx1Ee WjWP2rxw7msaZn/AU/OA2ND+oaiT/KAan4kIcnrAnyKOEawILr5W7dqxIZNNv9wrvZHg 3SmLzWywe22S7MCdauXau+Ho7/BG3Ex0nhx71S1SFszB4tKaKhl0OGEAX3QXxs3pQnut rH1hlnYB69JCiBSTTMLpNvi9GZ15SPXqUcKgp+OUOVxAtP76ePGyTI5kFSOUy3FZGlYw PW8HRAQnD1g9tJz3n6x9zd2WjJZIUydR/R5Mp8dVuRnYsQjuW7B7gZrJorPA5Qdfz6Bi 1xCg== X-Gm-Message-State: AA+aEWaLiCysLmo2U8uYRpw6304XeRrTpKUXH05gHODDu/hg9/r/BkmV TIpU94E9+Ie3yvFqN2X0yV177g== X-Received: by 2002:adf:c711:: with SMTP id k17mr15658629wrg.197.1543337768904; Tue, 27 Nov 2018 08:56:08 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:3180:41f8:3010:ff61]) by smtp.gmail.com with ESMTPSA id k73sm6383099wmd.36.2018.11.27.08.56.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Nov 2018 08:56:07 -0800 (PST) From: Andrey Konovalov To: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Catalin Marinas , Will Deacon , Christoph Lameter , Andrew Morton , Mark Rutland , Nick Desaulniers , Marc Zyngier , Dave Martin , Ard Biesheuvel , "Eric W . Biederman" , Ingo Molnar , Paul Lawrence , Geert Uytterhoeven , Arnd Bergmann , "Kirill A . Shutemov" , Greg Kroah-Hartman , Kate Stewart , Mike Rapoport , kasan-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sparse@vger.kernel.org, linux-mm@kvack.org, linux-kbuild@vger.kernel.org Cc: Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Jann Horn , Mark Brand , Chintan Pandya , Vishwath Mohan , Andrey Konovalov Subject: [PATCH v12 11/25] kasan, arm64: untag address in _virt_addr_is_linear Date: Tue, 27 Nov 2018 17:55:29 +0100 Message-Id: X-Mailer: git-send-email 2.20.0.rc0.387.gc7a69e6b6c-goog In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org virt_addr_is_linear (which is used by virt_addr_valid) assumes that the top byte of the address is 0xff, which isn't always the case with tag-based KASAN. This patch resets the tag in this macro. Reviewed-by: Andrey Ryabinin Reviewed-by: Dmitry Vyukov Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/memory.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 83c1366a1233..5fe2353f111b 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -322,9 +322,10 @@ static inline void *phys_to_virt(phys_addr_t x) #endif #endif -#define _virt_addr_is_linear(kaddr) (((u64)(kaddr)) >= PAGE_OFFSET) -#define virt_addr_valid(kaddr) (_virt_addr_is_linear(kaddr) && \ - _virt_addr_valid(kaddr)) +#define _virt_addr_is_linear(kaddr) \ + (__tag_reset((u64)(kaddr)) >= PAGE_OFFSET) +#define virt_addr_valid(kaddr) \ + (_virt_addr_is_linear(kaddr) && _virt_addr_valid(kaddr)) #include -- 2.20.0.rc0.387.gc7a69e6b6c-goog