From patchwork Wed Aug 31 07:30:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Feng Tang X-Patchwork-Id: 12960464 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 002B5ECAAD1 for ; Wed, 31 Aug 2022 07:30:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 56CA08D0001; Wed, 31 Aug 2022 03:30:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 51B7F6B0072; Wed, 31 Aug 2022 03:30:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E3348D0001; Wed, 31 Aug 2022 03:30:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 2C3576B0071 for ; Wed, 31 Aug 2022 03:30:20 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E909D1A0D43 for ; Wed, 31 Aug 2022 07:30:19 +0000 (UTC) X-FDA: 79859064558.29.C971609 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by imf11.hostedemail.com (Postfix) with ESMTP id 48B1340034 for ; Wed, 31 Aug 2022 07:30:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661931019; x=1693467019; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=nyqBOBnh1y4bTRWgHvBEN5HxaABPuUxAhyQ2nrz2g/0=; b=n3sDF0WKerRKl4p/QVt69/tyPKueY19YgKm8PEJwjI6m34rUwlsZUKW6 8SaG7+k9o0MkcyR5OL8FMkSC0MI1csNN9y+/eHdJ0n68yw7WjN1FnlumW XoZvAw1m/b9ygpCueo1PY1d7ebbh66OjFanVO+SG/PT48QxjAUoIEN049 x7y+ghj/a3URabw7EQIjyOppvbogkjNOV6Q9GONtoqCA3Rg9AX5Yz9UgG mJKjLJxXWMfe5iSkp5BOAHuv5w+WJXEyACxG+M16WR9MyNe5GUs7pSZ6s uPKh3VfpQxkfZ9qFwqEBzUwY8cD+bPKx3YvMt4rzRK5bl/BBFFv1ge8Hs w==; X-IronPort-AV: E=McAfee;i="6500,9779,10455"; a="275795554" X-IronPort-AV: E=Sophos;i="5.93,277,1654585200"; d="scan'208";a="275795554" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2022 00:30:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,277,1654585200"; d="scan'208";a="680341142" Received: from shbuild999.sh.intel.com ([10.239.147.181]) by fmsmga004.fm.intel.com with ESMTP; 31 Aug 2022 00:30:15 -0700 From: Feng Tang To: Andrew Morton , Alexander Potapenko , Marco Elver , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Vlastimil Babka , kasan-dev@googlegroups.com, linux-mm@kvack.org Cc: Feng Tang Subject: [PATCH -next] mm: kence: add __kmem_cache_free to function skip list Date: Wed, 31 Aug 2022 15:30:51 +0800 Message-Id: <20220831073051.3032-1-feng.tang@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=n3sDF0WK; spf=pass (imf11.hostedemail.com: domain of feng.tang@intel.com designates 192.55.52.151 as permitted sender) smtp.mailfrom=feng.tang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661931019; a=rsa-sha256; cv=none; b=D3PRqbY4tByXaqTYBVCSA6nlfhR3vM9PcpQIMEcLDCYacMbrRnm2G1HkyATl25lmMdnMbT YAf2gnQYtIjBkEjjrDZTEgS++3t651mzIE8ISGRSV46OZBzIXspOnr8nKwfK5xmVMYMZ/e PAnobKx74PQ9W2ARVkDKR6qKf3LsCnI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661931019; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=shEyZ4ffTq52T5de9pugtA16ZoRuWyieNc6a+jK04JQ=; b=lCd5nlFB5yZxVvs5FvuhHJhbm8trI918ri+ISMO+dDrDGZ+O5bWu9Ck0SByjuHBpFkihwA dMmJnthR9wJuIfYJlPCX1OHe71kCzodN+4YZ7o+EJ+mT/OY+pQktFg/Is3yNuY/32rQH0Y Xij7RHd+eZ/FBSninYMOD5FYzmjS2wM= X-Rspam-User: Authentication-Results: imf11.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=n3sDF0WK; spf=pass (imf11.hostedemail.com: domain of feng.tang@intel.com designates 192.55.52.151 as permitted sender) smtp.mailfrom=feng.tang@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspamd-Server: rspam02 X-Stat-Signature: 8gsw7atk1ipb9gyfjgdxytjhid6eb4p1 X-Rspamd-Queue-Id: 48B1340034 X-HE-Tag: 1661931018-347945 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: When testing the linux-next kernel, kfence's kunit test reported some errors: [ 12.812412] not ok 7 - test_double_free [ 13.011968] not ok 9 - test_invalid_addr_free [ 13.438947] not ok 11 - test_corruption [ 18.635647] not ok 18 - test_kmalloc_aligned_oob_write Further check shows there is the "common kmalloc" patchset from Hyeonggon Yoo, which cleanup the kmalloc code and make a better sharing of slab/slub. There is some function name change around it, which was not recognized by current kfence function name handling code, and interpreted as error. Add new function name "__kmem_cache_free" to make it known to kfence. Signed-off-by: Feng Tang Reviewed-by: Marco Elver --- mm/kfence/report.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/kfence/report.c b/mm/kfence/report.c index f5a6d8ba3e21..7e496856c2eb 100644 --- a/mm/kfence/report.c +++ b/mm/kfence/report.c @@ -86,6 +86,7 @@ static int get_stack_skipnr(const unsigned long stack_entries[], int num_entries /* Also the *_bulk() variants by only checking prefixes. */ if (str_has_prefix(buf, ARCH_FUNC_PREFIX "kfree") || str_has_prefix(buf, ARCH_FUNC_PREFIX "kmem_cache_free") || + str_has_prefix(buf, ARCH_FUNC_PREFIX "__kmem_cache_free") || str_has_prefix(buf, ARCH_FUNC_PREFIX "__kmalloc") || str_has_prefix(buf, ARCH_FUNC_PREFIX "kmem_cache_alloc")) goto found;