Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10633490imu; Thu, 6 Dec 2018 04:26:50 -0800 (PST) X-Google-Smtp-Source: AFSGD/WJs/7GQFb/GusRfM8zAinTzy1fGwwIamNoxBvoG+xZKEIqlRAn4Myucv0Lv6kUeiYe+qn/ X-Received: by 2002:a17:902:728c:: with SMTP id d12mr27625663pll.284.1544099210721; Thu, 06 Dec 2018 04:26:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544099210; cv=none; d=google.com; s=arc-20160816; b=I/b/9aECnGb0fy4Id9Hekfjd6NsQWmdrawCBkNLss9ZYDKJUrJrpbB04loW5t9AJhw m1E93+bWJOE0+6NHU1sxmptYo6MYANheEfAwCnCTD+zkQf/m9dgtPA1GkeR06DiUNyE0 YfJfv+2TICvWDzCg4ZyyUgmuX7MhVyLx9fVl9ctae/eDtNd16Qh8wynf9Al9YkQCmWJe +1bVO4sUwSX7gG3ZBvTxXk/4Hc/F5FPSUdw95zqtWWpAW4E1IJh+XM7M0oQaf4VrXHi0 Ab7+oJCB04C/sqKLUFy/fo1SzRn2Mv/rP3HW1TLUDiGUBGttQBbiHlUYOgjsGkSxEbmx WrIA== 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=UqMDiL5pFL/+tkei1G/AIx7zwZMP99eD4KugQS7K55g=; b=ujUoz9VKR9q2bmAF/sM5gbgaApCVS4Afvokc2eIA6hXfXh4Kr+0xnMn9HHNfzAbMjb JgHzIQiREouU2y6PpgtwpNiF2RUvnWLeR7k/QUFVhXZDOy8Wb1+YrkyhVvM2ay24K6K+ CWi2Tf5qBNaHh9LbVtozYaAdPBvrAE6ZKhE5Eq1X7bfYvhxE1j9oULG+MlLyCdIKULQK J657JXPhexSqf6aHO6WnN9wqbiccTTZLDxP1ScBLxV6xDGigWku4qvG0V97+s/53oj3j lJgaj6DJeGH6FMCrpRfpW5eWt1murP7XJNuzXa938e728B9AuB4h6PEubRsie8PcT0Fh WehQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Y2VohwGt; 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 72si181308pla.218.2018.12.06.04.26.33; Thu, 06 Dec 2018 04:26:50 -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=Y2VohwGt; 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 S1729692AbeLFMZJ (ORCPT + 99 others); Thu, 6 Dec 2018 07:25:09 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:56193 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729664AbeLFMZI (ORCPT ); Thu, 6 Dec 2018 07:25:08 -0500 Received: by mail-wm1-f65.google.com with SMTP id y139so774959wmc.5 for ; Thu, 06 Dec 2018 04:25:07 -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=UqMDiL5pFL/+tkei1G/AIx7zwZMP99eD4KugQS7K55g=; b=Y2VohwGtLIqo6t/3aMQeakdW1sJ7UgqyXRDUNidOjVdD5M1bxlNFiaWPSn1bXLUyyF mCCWKClMkXpRl/CkEYHFhkecgRkp6UBK6sfIgjgkARPZuNzpSqHnINsuMeuueMsTmNvD Mb970K6ZZtXOqMs4Gaek4O18mqjDkafHoZWEvQa4fKAWweR9DbpR2Q7eZR4APBPmIkFH N3qGtFuiC24t7PZgMXta7ZPzCIcCq8Yl7LCg8wCFP5JpIj2RfyVIiKy7tRwzK6WESWKq SjD/5xD4Wzs6YWFY2xHp4H4kAcqBkIOdh05TJR5kuzLQ14sH63IMtTkNdNhpUY1CH8hi OqTg== 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=UqMDiL5pFL/+tkei1G/AIx7zwZMP99eD4KugQS7K55g=; b=WpI3XvWxwC2tNSO6mL5MtMbP3AGr0a9FDcsPVXmMKhokV630NyrJRmK+rlxbEw83i/ 7IkE5adzOF1UQILiNrULxdHXs4z/pZ+BczukhpuNbGHltWnUI50qB8QpQHAZDukd3Ckr s7LcKQnofBPLeHbJ+DR0xPN7Wy1lLYZuG33pQZEKWOKigNsTgVwsLra58APN4o8HxVZ2 dl/SsRESdOj10wBPhzZnHYGVNOs26P3glKRu9lCwR2xE/13Cb3zEd21XCs4nbXuJdtvX MsrFyR5yrDfnjCYaoBB5gpkWJQYEcHm1kSDrge7otnSPOiXkF4MRCpMMjMlUwXomaDHj CMSA== X-Gm-Message-State: AA+aEWbOSB91MsnLmL3A099QGRQ71xJDtyCPemtoTC7y5OkRErvrvmwB MVMbODxXDwzkPGjVnw5T3zNUrQ== X-Received: by 2002:a1c:2007:: with SMTP id g7mr18924469wmg.79.1544099106379; Thu, 06 Dec 2018 04:25:06 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:3180:41f8:3010:ff61]) by smtp.gmail.com with ESMTPSA id j8sm339988wrt.40.2018.12.06.04.25.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 04:25:05 -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 v13 11/25] kasan, arm64: untag address in _virt_addr_is_linear Date: Thu, 6 Dec 2018 13:24:29 +0100 Message-Id: X-Mailer: git-send-email 2.20.0.rc1.387.gf8505762e3-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.rc1.387.gf8505762e3-goog