From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20399C43463 for ; Fri, 18 Sep 2020 12:26:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B112B235FD for ; Fri, 18 Sep 2020 12:26:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="AJCCnnw6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B112B235FD Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 01F8B6B0003; Fri, 18 Sep 2020 08:26:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EEA7F6B0055; Fri, 18 Sep 2020 08:26:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB2206B005A; Fri, 18 Sep 2020 08:26:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id C1FEA6B0003 for ; Fri, 18 Sep 2020 08:26:56 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 8B7A48249980 for ; Fri, 18 Sep 2020 12:26:56 +0000 (UTC) X-FDA: 77276106432.19.rings13_0106f0c2712b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 6D48B1AD1B7 for ; Fri, 18 Sep 2020 12:26:56 +0000 (UTC) X-HE-Tag: rings13_0106f0c2712b X-Filterd-Recvd-Size: 5353 Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Sep 2020 12:26:55 +0000 (UTC) Received: by mail-pj1-f68.google.com with SMTP id md22so4238829pjb.0 for ; Fri, 18 Sep 2020 05:26:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VtDuINtc2G9zXnT6yMkHKsVlqkwJ9oqFqRt0wDdeL5k=; b=AJCCnnw6tN19AAXWg3y1FLDWhgP3sqtVLj3UtkH7f5Gj5EBbXqJiaR76bYfgB5yW1j tWEk0FgH5vpUtFcFOesKYhV682HXzfo3Z0A34PgGF44tY5nNk+Px0apQRU6glvov9LQu p4bZD6g1GqqgtBaAeUOpeUpEu0TRyx8Ke+6r1FXgxr2zQkx5HE+F2ZpbboqjDAGSYRe+ viX6grNfng/GGxSAU9lPI/k/MAP6An+7vvjI3w52E+XJZsxRqr9yPl1eITgCQ5i4DtT/ LyXqyF4EL75ZLLTfnE5RhxhV80diK25ZXt7GBISXN8ampQT416w9K6nu8SY+RVhhmlsd BAYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VtDuINtc2G9zXnT6yMkHKsVlqkwJ9oqFqRt0wDdeL5k=; b=swtsyIRE2Zs5hW5hxUigkVJfw8nxNfRysZemO3GSoVmhuzRUVIdSsBx6jx5TtXu8PC W0IwoKiy0+91TNY21PQcV4hsm1qnmQdyBl2d3G8j0PDXqOC+0oaA/DNYyUARJ6RYcaJz EwVBylcwt9b7ZMqgrN+vqQixftbMYl3ZxvetXxW3+tu6/XH88yt2KsQnQiSrPg8jsdMi MgiIOqM8LWjkAXyoKgL47nAYG5hAlXye+eCZFLti8xRVx1CLGwNY93aRa55e4czCEnAA So6g+5IBnsotxnn/BIBCkk4oASvvBQ8eVCBXjvsQQhk/B5LVhB+ep+G8jLtu3STgjTNJ nT+Q== X-Gm-Message-State: AOAM5322EstP0HL5IiYyWt4Cx++CZPCcbxTmfs+fJfWd4T+fC+PlA7wb sWrHG8o2dXyFa6EFBIzyusqtB/1laZ6Ebi7W6DaPmQ== X-Google-Smtp-Source: ABdhPJyYLEBC1Xln3czd1Uy/zFGyusoJcCgkY1nP7tWnG45muc49K7pFb6HuBunJOrmB5mw4FOQtyVhIyRqFtb7C9Gk= X-Received: by 2002:a17:902:d888:b029:d0:cb2d:f274 with SMTP id b8-20020a170902d888b02900d0cb2df274mr32829839plz.13.1600432014609; Fri, 18 Sep 2020 05:26:54 -0700 (PDT) MIME-Version: 1.0 References: <20200917170418.GI10662@gaia> In-Reply-To: <20200917170418.GI10662@gaia> From: Andrey Konovalov Date: Fri, 18 Sep 2020 14:26:43 +0200 Message-ID: Subject: Re: [PATCH v2 34/37] kasan, arm64: print report from tag fault handler To: Catalin Marinas Cc: Dmitry Vyukov , Vincenzo Frascino , kasan-dev , Andrey Ryabinin , Alexander Potapenko , Marco Elver , Evgenii Stepanov , Elena Petrova , Branislav Rankov , Kevin Brodsky , Will Deacon , Andrew Morton , Linux ARM , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Sep 17, 2020 at 7:04 PM Catalin Marinas wrote: > > On Tue, Sep 15, 2020 at 11:16:16PM +0200, Andrey Konovalov wrote: > > diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c > > index cdc23662691c..ac79819317f2 100644 > > --- a/arch/arm64/mm/fault.c > > +++ b/arch/arm64/mm/fault.c > > @@ -14,6 +14,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -295,17 +296,23 @@ static void die_kernel_fault(const char *msg, unsigned long addr, > > do_exit(SIGKILL); > > } > > > > +#ifdef CONFIG_KASAN_HW_TAGS > > static void report_tag_fault(unsigned long addr, unsigned int esr, > > struct pt_regs *regs) > > { > > - bool is_write = ((esr & ESR_ELx_WNR) >> ESR_ELx_WNR_SHIFT) != 0; > > + bool is_write = ((esr & ESR_ELx_WNR) >> ESR_ELx_WNR_SHIFT) != 0; > > > > - pr_alert("Memory Tagging Extension Fault in %pS\n", (void *)regs->pc); > > - pr_alert(" %s at address %lx\n", is_write ? "Write" : "Read", addr); > > - pr_alert(" Pointer tag: [%02x], memory tag: [%02x]\n", > > - mte_get_ptr_tag(addr), > > - mte_get_mem_tag((void *)addr)); > > + /* > > + * SAS bits aren't set for all faults reported in EL1, so we can't > > + * find out access size. > > + */ > > + kasan_report(addr, 0, is_write, regs->pc); > > } > > +#else > > +/* Tag faults aren't enabled without CONFIG_KASAN_HW_TAGS. */ > > +static inline void report_tag_fault(unsigned long addr, unsigned int esr, > > + struct pt_regs *regs) { } > > +#endif > > So is there a point in introducing this function in an earlier patch, > just to remove its content here? I added it to make the first patch somewhat self-consistent. But we can drop it in v3 if you think it's not needed.