Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3822628pxb; Tue, 26 Jan 2021 05:50:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJyG6LZFwt7YkxIsiHANtDPENKO7YFVbyfDcCGo2sgIyZK2bvERiUifuNKNtzOFItognhq+B X-Received: by 2002:a17:906:e48:: with SMTP id q8mr3449642eji.478.1611669025836; Tue, 26 Jan 2021 05:50:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611669025; cv=none; d=google.com; s=arc-20160816; b=jcQ9YpySyAQpnd2ljQXZ0fPHU86RrJz+2ObjO48bm7FqVXmm/M/Yjai8WYQZ7J2AD6 dH2UnyErws6jsBE0W+q8HAfhyqSLeEbh3a606PHU9UnNJsROhAoCTZcoVNBc3N5Roa7w 0k6f5GY5pbVY9w3ovVma2pvzQIv0NsWz3HPHL5Zrn/DGTCI8jCPcUGEmw0HQAY+/olOu lLFjrthF9Xnx9RfRAVBXHvLBPFt4Gv0DbPT0Ko9WB8UgUoVLEii0DxlpL3+m7/tapfqz mgo8xu/nl9fEYTwHb1khT1mJqJo6ydwzWYOQ07WBLaJ2A8iv1YMotVJ00QmhxsOEvy/y qywA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=9a41Zh1J44i7qGcPqzQ3xrwe9QCgt9EiGPgCYWjTe98=; b=qBpZWA4nzYU3Ls4BVGQdpwsRa5B5jZg4O1qg855gYCfrsB7tKviPJ37cNLK2HNennU kiWlQhetUKpac6VTHl/ZGkfFCoXC5m4V5voVtNUAM0jd04qYbXINOvf5g4LqYNKw477a SaoqTc1rPFEkUwiOS2TzWiKrPmZmDy8UclPHbb51mL4rxtg8VCs2OfRGk5WJwspnAPLO 0lUNQvf+kb3q6GR8IcYUEdoDjVinab196iR7X7VIypNcfDTNmlkc6O/xWDpoHi26F0yH Qx2IVZYn92KQopqm76z1tSi03wXocAYVgUqyfFhBfq628nDxkx9ozrwtc8ikhWGm/Nx9 dZfg== 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 e8si6994672ejj.540.2021.01.26.05.50.00; Tue, 26 Jan 2021 05:50:25 -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 S2404576AbhAZNsQ (ORCPT + 99 others); Tue, 26 Jan 2021 08:48:16 -0500 Received: from foss.arm.com ([217.140.110.172]:40586 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405207AbhAZNrI (ORCPT ); Tue, 26 Jan 2021 08:47:08 -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 8463511D4; Tue, 26 Jan 2021 05:46:22 -0800 (PST) Received: from e119884-lin.cambridge.arm.com (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BDCB83F68F; Tue, 26 Jan 2021 05:46:20 -0800 (PST) From: Vincenzo Frascino To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com Cc: Vincenzo Frascino , Andrew Morton , Catalin Marinas , Will Deacon , Dmitry Vyukov , Andrey Ryabinin , Alexander Potapenko , Marco Elver , Evgenii Stepanov , Branislav Rankov , Andrey Konovalov Subject: [PATCH v9 3/4] kasan: Add report for async mode Date: Tue, 26 Jan 2021 13:46:02 +0000 Message-Id: <20210126134603.49759-4-vincenzo.frascino@arm.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210126134603.49759-1-vincenzo.frascino@arm.com> References: <20210126134603.49759-1-vincenzo.frascino@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); +} +#endif /* CONFIG_KASAN_HW_TAGS */ + static void __kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip) { -- 2.30.0