Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1979998pxb; Fri, 29 Jan 2021 09:49:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJw1kyO1+8xGcnnapjG9jlUjw3/1lu0uCKi1EIaaE550feNJyEOrYJwfZX84hvrQplGrm2oG X-Received: by 2002:a05:6402:1c0b:: with SMTP id ck11mr6426225edb.35.1611942576033; Fri, 29 Jan 2021 09:49:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611942576; cv=none; d=google.com; s=arc-20160816; b=XWEl+PzTRigq6cYcx4egTW2IQuKEs81Zd5+S+Hr9nhTJF1oO1gwepTTC9GiO4dzYkm EsejmCxFjOg9yphW2bNHc53bAXLt4lcvfi/H9SWcvHQaSTTHiEOMvf9ixuH6QrE4VKsU EXQJoJR4/hwhqu3lWlcKsIC7Ysf5oHGNqycOafl0EpW7GkRKFWyENO/PPvRaOfs0GL6j PClnwCs4zVDjUbqD+rWcjYDVM8k2zYk/+bvGSq5tfY9PGf8wetwIwm/wfPyuGEAGICUk abOAYA/BhlbNeKmhJRRC1TOQ9un1Bzq/ODhfxXzrN/aPKugLaq7p2fPupgzVFpVxB8Qn 8WLQ== 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=vTfvvOE54+cNKETYbp1mwbctVNyYriy80x7JIIpfUzE=; b=JE521PzBFBx0Th9M5W30+N1pC/u5enG3Q9C+MDe49/Fg5ohm9pfzpXHKO6BfElQnG2 VvMTZ02eOoxjIavBU0J5H5StNMED0hGQR9p1/uxVakUyjKpZvD7LVEKzB3U5rs9VeYM8 PmRZO2g/v3YqN1bntoiOH4SriZXUc9I+r9XZ8nj4jwYvI4R18OIGfO25JJ5szzCHnAYH BFjU1P0eO5TUwpFSHYpwNEZmOhHAMbZUHB/MROZI/liMicc7qhFSB1YVfYJlKr1cmnL2 W12VEC13nKJ4MeO29q4bfzXihl63sJ5+7jGh8DnZwUl11aSdnsc3268StTKE7FUn1Qln /SQA== 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 k17si5784921edr.594.2021.01.29.09.49.11; Fri, 29 Jan 2021 09:49:36 -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 S232326AbhA2RrO (ORCPT + 99 others); Fri, 29 Jan 2021 12:47:14 -0500 Received: from foss.arm.com ([217.140.110.172]:52030 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232347AbhA2RpH (ORCPT ); Fri, 29 Jan 2021 12:45:07 -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 2E54713A1; Fri, 29 Jan 2021 09:44:20 -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 133EB3F71B; Fri, 29 Jan 2021 09:44:17 -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> From: Vincenzo Frascino Message-ID: <77de8e48-6f68-bf27-0bed-02e49b69a12d@arm.com> Date: Fri, 29 Jan 2021 17:48:12 +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: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"); >> + 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