Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5637560pxb; Tue, 16 Feb 2021 03:56:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwYfjDL+QVROpNkk6/zja4kDkXaHCNCrYtCExDnjWBj6vJjPANVpc68Xkk3ELsIL5QW9PWd X-Received: by 2002:a17:906:c049:: with SMTP id bm9mr19504050ejb.535.1613476606329; Tue, 16 Feb 2021 03:56:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613476606; cv=none; d=google.com; s=arc-20160816; b=Hrfq4sD7+Gs/2mCwA172vDwP9T9+snPNz+ehvVtCAUlUd5jXB0yDEBCXfMM+d/QW1e bOK4r6CqCG48LfknqUt1ofx+uBqrhm06Sb7828tRWWrkU7M9ew/zPO6nSR/dMIASdV+N VLEmK+JhNFgKOEpVhSyLhO98WMyUjq/nmFS5iSpCaDHTwCC3/k6E1yf2W+riIREfMEwt H3yZo0txUF7vhHPxc1vXxIfihOR7VRHIMF0+F1rk4eDtQLxYIKi64boDuJVMzESnqFYj DwdRkydnP8sXqIAtVpL856crI2UmFztOmt57VUSsOhOvimhLivq8PIeR7Jbb3PB0lCEu HNWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=JI6oJbG/nyEVCtflWRrZpiNs3kDuguGzsrSuUiS30Ss=; b=JtmGLlVNYPETsd5C1P75h5GPPVD2sbItlSIqnSN7WHwmFetUObFDhEm/vDe9adHvmY XfCw1IVwaMkIwcN+B03dDtnPrfG489lgB6SShuq09voIpUyWcu5lVPZOPkrnWZPahsu0 PRwI1zoEHYMdSTSvo48FgMSyFvOUeJsEEz8vvHqlY2uk2jFcTGQWFRzVBhhmgJUIyA9K NNmuFcyEqgx/2G3bpVCZB5g1DdTQ6ykivj+J1Kefd00fuvdeHLlBC0/rGvY4tswOAgpz J5PDOmaIyjCiFRNv8UWj14trcUlMF+wvHsUC/EyCuTN9zPXOdF+n9cDUJylWV5TcPg3g xoiA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r25si17688854edc.395.2021.02.16.03.56.23; Tue, 16 Feb 2021 03:56:46 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230357AbhBPLxU (ORCPT + 99 others); Tue, 16 Feb 2021 06:53:20 -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--