From nobody Wed Dec 17 04:16:37 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA8E4C32771 for ; Mon, 26 Sep 2022 11:57:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238521AbiIZL5l (ORCPT ); Mon, 26 Sep 2022 07:57:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239208AbiIZLyv (ORCPT ); Mon, 26 Sep 2022 07:54:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D53D877EAB; Mon, 26 Sep 2022 03:50:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5F4B360A55; Mon, 26 Sep 2022 10:44:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51BF6C433D6; Mon, 26 Sep 2022 10:44:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189057; bh=nDbKPYGv0WWIC0OECH+w6mx4S1VD3cKtTgv94nJ/WmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mj9hKwcpn5688w6VqDuSsGdEPIxjeBBREbWp17NaAj6SnEXjRd/gK5xRdwPheX+Ll K0bxVVykpRp8a3bITvIMilhdni7iI+LCm0YHR+0hVgqZdT7tglaEaC0BEVoor0eKhY CN4azfgQ24FbyEFzemjWmU7NHtbCBXbg3u/+BdK8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Collingbourne , Vlastimil Babka Subject: [PATCH 5.19 059/207] kasan: call kasan_malloc() from __kmalloc_*track_caller() Date: Mon, 26 Sep 2022 12:10:48 +0200 Message-Id: <20220926100809.246523707@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Collingbourne commit 5373b8a09d6e037ee0587cb5d9fe4cc09077deeb upstream. We were failing to call kasan_malloc() from __kmalloc_*track_caller() which was causing us to sometimes fail to produce KASAN error reports for allocations made using e.g. devm_kcalloc(), as the KASAN poison was not being initialized. Fix it. Signed-off-by: Peter Collingbourne Cc: # 5.15 Signed-off-by: Vlastimil Babka Signed-off-by: Greg Kroah-Hartman --- mm/slub.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/mm/slub.c +++ b/mm/slub.c @@ -4950,6 +4950,8 @@ void *__kmalloc_track_caller(size_t size /* Honor the call site pointer we received. */ trace_kmalloc(caller, ret, size, s->size, gfpflags); =20 + ret =3D kasan_kmalloc(s, ret, size, gfpflags); + return ret; } EXPORT_SYMBOL(__kmalloc_track_caller); @@ -4981,6 +4983,8 @@ void *__kmalloc_node_track_caller(size_t /* Honor the call site pointer we received. */ trace_kmalloc_node(caller, ret, size, s->size, gfpflags, node); =20 + ret =3D kasan_kmalloc(s, ret, size, gfpflags); + return ret; } EXPORT_SYMBOL(__kmalloc_node_track_caller);