Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp473807pxb; Wed, 13 Jan 2021 08:06:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/3JeRSV7xDxm+F0+NxX+9qPqgHzXnkNyiub4nhPj7oxRDRtzuMRvDPLchlVpqE4r1ck3v X-Received: by 2002:a17:906:890:: with SMTP id n16mr1385948eje.195.1610553960030; Wed, 13 Jan 2021 08:06:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610553960; cv=none; d=google.com; s=arc-20160816; b=yxGxQf2d5lRk8YEDxcBO09DF3UTrWap1vwaBbKMmRTsLqpZp7frIp2smIPw/iqRpdC wbt4cU5urffJp9v+lRyUbNempC8EB8qSCCX+lv3AUuSY4SLHxDJW5fBkANp58sEEEivN rrvcIF4R4u8rz9y7Z7J9adlDvHrEdkB2WUoXKVPWeFKdQgmfjo/WmVakTyc0eIBdCGO8 fMnk00q5AtmQ6KkN4YilGfjmZ5xB5o9YCC7LEo11MYrYdjJ2l/nl8vh3jUxXuiYAgHzR wLTPuUW+uXx642sVYAgu0ifJfy/jBbaQE3MFdFLkbT6ykISsq+NVE1aeBZaqKD53rxPp 8x4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=TionkskhfJFUpeI/OKXUNvEID4OHoy9zg6Ffh7JmH8U=; b=dTzyp+z/kW7Pet4Lpo7KJGxBIHoyY7vcwPDV8DN/mkdpzIWRCn9uaj1f7ofM/lEfV4 XukLPFNAt+Tk/Y1+RiUs3Ta2GPeDHoszbRxu+2Yi/tLDYiH/C3Q5VdP2Bhk9SgSgfFK1 15qL4ozvZ2di0FpuNWv+JXqoo0pKbsqrQwbnsszVp1TWRaBkPwnBl3yy2FhmlRT8qU5N l8ITYyTC6R3xW0coRRaOPWMcUGkvtZIFNTJLX0X/pslhvxUz4MBr2z5znas7OoSYPsfh UjJaeWmQ+ZZdmJuxF2vDmV2voR/Hw4Wo1/210qoHJ5Zq5lzO4qFdDpOIdRFx7c7LM767 ENMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=CDyrzARr; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si1244301eje.690.2021.01.13.08.05.34; Wed, 13 Jan 2021 08:06:00 -0800 (PST) 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=@google.com header.s=20161025 header.b=CDyrzARr; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727051AbhAMQEV (ORCPT + 99 others); Wed, 13 Jan 2021 11:04:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725801AbhAMQEV (ORCPT ); Wed, 13 Jan 2021 11:04:21 -0500 Received: from mail-wr1-x44a.google.com (mail-wr1-x44a.google.com [IPv6:2a00:1450:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 011FEC061794 for ; Wed, 13 Jan 2021 08:03:41 -0800 (PST) Received: by mail-wr1-x44a.google.com with SMTP id q18so1156830wrc.20 for ; Wed, 13 Jan 2021 08:03:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=TionkskhfJFUpeI/OKXUNvEID4OHoy9zg6Ffh7JmH8U=; b=CDyrzARrVWFbuNifeul+Ll6GNbUn3MtdKoa0QdzHXSOPzMxbXAa7Z/FvEsSB2IPRrW enMrgXSKOeK3msMJO/vfXcb+9JOTd7R8a1VjRZ/ULWPr0g5AiDXOpZfbVIA7QbmrjjLC fpV17EGOTCPZOpybyXa7JbPD6CKpgp0WKU6sVKxPLH+PNidH+RTGfKve7sdwxM0Z16FB LWD2vekX5jUN8zAAl7Sf8PityLr6lD8t0vPjkwswCG6Ru8XRUIb2jRtx4a3ElWN9jXGD 4CcvIiyT7b2Su7QJuJPuGTsoEbbxb2hkmLg2nDCnYXnMLK7KB4hqQnZEwCeqZha6aiPI OYfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=TionkskhfJFUpeI/OKXUNvEID4OHoy9zg6Ffh7JmH8U=; b=pEXFt2T0CdsqQjX+kh8mLUSD9ozuNecfqk3vJdVTX+Nr53f+hwsWRmKP0BRPl6ywAX JT9cXqh0JsXIZt5aUI9yTCZ4xyivHh55I4tHGB5BTx7yGdlTdWBmyWkcmEtM3GGjVKL9 9tgWr4EczrKdZ1VFkw80YCMBT3+PZlkxXebbfyBARy/la4SEUf5S5NIV4rhGzRBzndkh MmddOQGF3gvI1HkIjjolv5mK1V96JGijgvJUjaYX37/5RmLxlc1csvzDLz4QcUE42XEa injf/i9Xt929YpdCzdMSlygv5ey03XnXm/pehNNmY6kyFsExBeBw1MKzf/Umb3ixG014 UwTw== X-Gm-Message-State: AOAM533/6a4oF5uqSeiKYYQRJH9HeVFpiDXC1DmLGixAnawOFf+ALIIN lXvutbA8RCWBI64Px+9Njk6Vf8EB3VS5OHVB Sender: "andreyknvl via sendgmr" X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a05:6000:222:: with SMTP id l2mr3287308wrz.392.1610553819541; Wed, 13 Jan 2021 08:03:39 -0800 (PST) Date: Wed, 13 Jan 2021 17:03:30 +0100 In-Reply-To: Message-Id: <1965508bcbec62699715d32bef91628ef55b4b44.1610553774.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog Subject: [PATCH 2/2] kasan, arm64: fix pointer tags in KASAN reports From: Andrey Konovalov To: Catalin Marinas , Vincenzo Frascino , Dmitry Vyukov , Alexander Potapenko , Marco Elver Cc: Andrew Morton , Will Deacon , Andrey Ryabinin , Peter Collingbourne , Evgenii Stepanov , Branislav Rankov , Kevin Brodsky , kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As of the "arm64: expose FAR_EL1 tag bits in siginfo" patch, the address that is passed to report_tag_fault has pointer tags in the format of 0x0X, while KASAN uses 0xFX format (note the difference in the top 4 bits). Fix up the pointer tag before calling kasan_report. Link: https://linux-review.googlesource.com/id/I9ced973866036d8679e8f4ae325de547eb969649 Fixes: dceec3ff7807 ("arm64: expose FAR_EL1 tag bits in siginfo") Fixes: 4291e9ee6189 ("kasan, arm64: print report from tag fault handler") Signed-off-by: Andrey Konovalov --- arch/arm64/mm/fault.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 3c40da479899..a218f6f2fdc8 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -304,6 +304,8 @@ static void report_tag_fault(unsigned long addr, unsigned int esr, { bool is_write = ((esr & ESR_ELx_WNR) >> ESR_ELx_WNR_SHIFT) != 0; + /* The format of KASAN tags is 0xF. */ + addr |= (0xF0UL << MTE_TAG_SHIFT); /* * SAS bits aren't set for all faults reported in EL1, so we can't * find out access size. -- 2.30.0.284.gd98b1dd5eaa7-goog