Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1988139pxb; Fri, 29 Jan 2021 10:02:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWNy+11aM+QBIYjsWg2x5LwpYU4ps2n/oqeA9hTHUWXnikrdqn4a1VGzZkGDp81nLFM0Nu X-Received: by 2002:aa7:d94b:: with SMTP id l11mr6524083eds.1.1611943338813; Fri, 29 Jan 2021 10:02:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611943338; cv=none; d=google.com; s=arc-20160816; b=aK9g89zeo6TZj2XDRAJe7vYJ3euhtxEAtzFQdxcO6Juxu0poMeKZTqrlCaU72kwKsy fWFDztybgz/w8Bl0qp6Deh6Ue21aoCxWqE2Nq+zqEt5laSvoF8ivE438UXQbKAlMyR9x 9353qUxwuvKrC3pJ5kHIZ3qB9k58GJOPjFu5P7ar9cF5eOkFJIFCpvNatw3myxPvyp39 ioyTaAEoV3WExCQY6Jf4yqWwmTYoRP98QpgGdBVO4rs9DY18t0RRtXQvUAXEEAHefhdv lQkwScKhXF0Hnjofc7tRRlFzoAC1aGc6jkNclakK/bxCHD1jDhJFo89ASbZd0GTrs8Xf Jn2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=3ioZcsqTLkWATtJ4YFb3L2F4JTbf/fGiKZOXOjZi4eQ=; b=Ga2lQIymckmMVWwADXWD5hHQf6PKD7jGawkdLPdSYlku5yDfNryBEnWl4tQHiItBhK 1ZRGGy4JCSql3PKtzol+Z9JFRnv7+ReBSeya36Vw9EkFZuK0hayrd9bfakjBAbYjYvgz IcAiSj9CfJhQsCstwdJK+x2fpTAcYpNxuCofOpK0wbqq/WufuccoBQcagRp1+gletxJs Nl+sAWVkjgSOCR7/N2oLG+2uxxpexFQgFn3l/raSYb1DEcs80e3cT1gYwwV1qpbUXTDV U390DM4vETupUf1a8yJXqQk2+czVkX3j4lzMkWzVNp4jcb5s/Pb28e3lRcT3IXOk7c6q rRIA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v26si5080367ejw.44.2021.01.29.10.01.53; Fri, 29 Jan 2021 10:02:18 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232331AbhA2R6Z (ORCPT + 99 others); Fri, 29 Jan 2021 12:58:25 -0500 Received: from foss.arm.com ([217.140.110.172]:52228 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231246AbhA2R6Y (ORCPT ); Fri, 29 Jan 2021 12:58:24 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AD3C913A1; Fri, 29 Jan 2021 09:57:38 -0800 (PST) Received: from [10.37.12.11] (unknown [10.37.12.11]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 956A93F885; Fri, 29 Jan 2021 09:57:36 -0800 (PST) Subject: Re: [PATCH v9 3/4] kasan: Add report for async mode To: Andrey Konovalov Cc: Linux ARM , LKML , kasan-dev , Andrew Morton , Catalin Marinas , Will Deacon , Dmitry Vyukov , Andrey Ryabinin , Alexander Potapenko , Marco Elver , Evgenii Stepanov , Branislav Rankov References: <20210126134603.49759-1-vincenzo.frascino@arm.com> <20210126134603.49759-4-vincenzo.frascino@arm.com> <77de8e48-6f68-bf27-0bed-02e49b69a12d@arm.com> From: Vincenzo Frascino Message-ID: <7da762df-6df3-e526-bec1-dc770709c00c@arm.com> Date: Fri, 29 Jan 2021 18:01:32 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/29/21 5:56 PM, Andrey Konovalov wrote: > On Fri, Jan 29, 2021 at 6:44 PM Vincenzo Frascino > wrote: >> >> >> >> On 1/29/21 5:40 PM, Andrey Konovalov wrote: >>> On Tue, Jan 26, 2021 at 2:46 PM Vincenzo Frascino >>> wrote: >>>> >>>> KASAN provides an asynchronous mode of execution. >>>> >>>> Add reporting functionality for this mode. >>>> >>>> Cc: Dmitry Vyukov >>>> Cc: Andrey Ryabinin >>>> Cc: Alexander Potapenko >>>> Cc: Andrey Konovalov >>>> Reviewed-by: Andrey Konovalov >>>> Signed-off-by: Vincenzo Frascino >>>> --- >>>> include/linux/kasan.h | 6 ++++++ >>>> mm/kasan/report.c | 13 +++++++++++++ >>>> 2 files changed, 19 insertions(+) >>>> >>>> diff --git a/include/linux/kasan.h b/include/linux/kasan.h >>>> index bb862d1f0e15..b6c502dad54d 100644 >>>> --- a/include/linux/kasan.h >>>> +++ b/include/linux/kasan.h >>>> @@ -360,6 +360,12 @@ static inline void *kasan_reset_tag(const void *addr) >>>> >>>> #endif /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS*/ >>>> >>>> +#ifdef CONFIG_KASAN_HW_TAGS >>>> + >>>> +void kasan_report_async(void); >>>> + >>>> +#endif /* CONFIG_KASAN_HW_TAGS */ >>>> + >>>> #ifdef CONFIG_KASAN_SW_TAGS >>>> void __init kasan_init_sw_tags(void); >>>> #else >>>> diff --git a/mm/kasan/report.c b/mm/kasan/report.c >>>> index 87b271206163..69bad9c01aed 100644 >>>> --- a/mm/kasan/report.c >>>> +++ b/mm/kasan/report.c >>>> @@ -360,6 +360,19 @@ void kasan_report_invalid_free(void *object, unsigned long ip) >>>> end_report(&flags, (unsigned long)object); >>>> } >>>> >>>> +#ifdef CONFIG_KASAN_HW_TAGS >>>> +void kasan_report_async(void) >>>> +{ >>>> + unsigned long flags; >>>> + >>>> + start_report(&flags); >>>> + pr_err("BUG: KASAN: invalid-access\n"); >>>> + pr_err("Asynchronous mode enabled: no access details available\n"); > > Could you also add an empty line here before the stack trace while at it? > Sure no problem. >>>> + dump_stack(); >>>> + end_report(&flags); >>> >>> This conflicts with "kasan: use error_report_end tracepoint" that's in mm. >>> >>> I suggest to call end_report(&flags, 0) here and check addr !=0 in >>> end_report() before calling trace_error_report_end(). >>> >> >> I just noticed and about to post a rebased version with end_report(&flags, 0). >> >> >>>> +} >>>> +#endif /* CONFIG_KASAN_HW_TAGS */ >>>> + >>>> static void __kasan_report(unsigned long addr, size_t size, bool is_write, >>>> unsigned long ip) >>>> { >>>> -- >>>> 2.30.0 >>>> >> >> -- >> Regards, >> Vincenzo -- Regards, Vincenzo