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=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 CC819C433DB for ; Tue, 16 Feb 2021 11:54:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8968A64DA8 for ; Tue, 16 Feb 2021 11:54:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230144AbhBPLxj (ORCPT ); Tue, 16 Feb 2021 06:53:39 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:57416 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230355AbhBPLvQ (ORCPT ); Tue, 16 Feb 2021 06:51:16 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 69A331C0B81; Tue, 16 Feb 2021 12:50:31 +0100 (CET) Date: Tue, 16 Feb 2021 12:50:29 +0100 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Vincenzo Frascino , Andrey Konovalov , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Leon Romanovsky , Catalin Marinas , Will Deacon , Mark Rutland , "Paul E . McKenney" , Naresh Kamboju , Andrew Morton , Linus Torvalds , Sasha Levin Subject: Re: [PATCH 5.10 043/104] kasan: add explicit preconditions to kasan_report() Message-ID: <20210216115029.GA25795@amd> References: <20210215152719.459796636@linuxfoundation.org> <20210215152720.867409732@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gKMricLos+KVdGMg" Content-Disposition: inline In-Reply-To: <20210215152720.867409732@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --gKMricLos+KVdGMg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Vincenzo Frascino >=20 > [ Upstream commit 49c6631d3b4f61a7b5bb0453a885a12bfa06ffd8 ] >=20 > Patch series "kasan: Fix metadata detection for KASAN_HW_TAGS", v5. >=20 > With the introduction of KASAN_HW_TAGS, kasan_report() currently assumes > that every location in memory has valid metadata associated. This is > due to the fact that addr_has_metadata() returns always true. >=20 > As a consequence of this, an invalid address (e.g. NULL pointer > address) passed to kasan_report() when KASAN_HW_TAGS is enabled, leads > to a kernel panic. =2E.. > This patch (of 2): >=20 > With the introduction of KASAN_HW_TAGS, kasan_report() accesses the > metadata only when addr_has_metadata() succeeds. >=20 > Add a comment to make sure that the preconditions to the function are > explicitly clarified. As the other patch from the series is not applied, I don't believe we need this in stable. Changelog does not make any sense with just comment change cherry-picked... Best regards, Pavel > +++ b/include/linux/kasan.h > @@ -196,6 +196,13 @@ void kasan_init_tags(void); > =20 > void *kasan_reset_tag(const void *addr); > =20 > +/** > + * kasan_report - print a report about a bad memory access detected by K= ASAN > + * @addr: address of the bad access > + * @size: size of the bad access > + * @is_write: whether the bad access is a write or a read > + * @ip: instruction pointer for the accessibility check or the bad acces= s itself > + */ > bool kasan_report(unsigned long addr, size_t size, > bool is_write, unsigned long ip); > =20 --=20 http://www.livejournal.com/~pavelmachek --gKMricLos+KVdGMg Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAmArsYUACgkQMOfwapXb+vL16QCgwGjk5bVNHx2wt4tQeadsawcK dgkAnjv+tCzrSGev/VKMFDMwEZG4J8LY =I9ka -----END PGP SIGNATURE----- --gKMricLos+KVdGMg--