From patchwork Thu Aug 10 07:47:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: xiaolei wang X-Patchwork-Id: 133752 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp261658vqi; Thu, 10 Aug 2023 01:10:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7CpCmPsFTjfamLjIF7c9DlqPn8DOLPyfwBUEG3Bpnk6IrpYzif2JQ+5Run3GHiz+JVIBQ X-Received: by 2002:a05:6512:1142:b0:4fd:ba8d:d4ed with SMTP id m2-20020a056512114200b004fdba8dd4edmr1043719lfg.24.1691655029186; Thu, 10 Aug 2023 01:10:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691655029; cv=pass; d=google.com; s=arc-20160816; b=fRXIlZztjX8hGLH7tzYYh62hUXfwVgTZ2CkhZRJK3jley5OtRWjpon06A7xOWyNMi7 hpo/NEEq/YOkJ5yrWsZ5SG2mnUyCQ27BCEq4Kg2DAuBX3aWfzlRdLXwQsae4UlYtxORg f7cXR/Itlz0fZton3RB5CWw1PhwirKLiGMuqx98dXpRfOUFbU+ko2RsTzxd+tlbCz67k oQjpMJZ3MMgjH6FHi0UPQceuPB9tbYGg/RgwlrcU74DwrY435/y8dtUbRYbtpb8iA7vD kQAs2YovMq67JM+RPCxlp8zYx4BLTOOXFH9zXN7xxEhBWxfDQQFrm4FBjAV4JUbl7Ryo n2Vg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kO2unsl0pxbA2sfGTphXE1MHCO64iOliAz2mFZSmsc4=; fh=glBGht3B7KMhoGavPouAoC22VMdqX5IG52ihPt7JcDA=; b=aiiD4BBX4tVXZ5awLNFZ8mzGnmjbP+4dMagS4TPsmLaqhO2pf8mNOC9GYmmUZdCEzY BD81cB6Xf8kTKsmIBckmuVARY1KSVFstMakUVBYzVpL5SIsoXUkt8KcUuSOzimsUdiPr 2/EK1TduyzgWaBKlBnTCJQO7x8XSYUIn+AjgshQtdv8BB5N24os0d0cyLCfsC47dM37u 0153xS1FnQMxqbXPvbjNWLlKYkpRWeBBiFdjmn5987+a+G9+/ncS0/YIjVS2NYBkJoNQ 2UYyqhM7CkbPCzB9yyd0mWMLvqM1JrkZ+Z4oijE7ejEqAefv7iOn15wxuRzWpgyq/itr VlvQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@windriver.com header.s=PPS06212021 header.b="Hmtw/Eve"; arc=pass (i=1 spf=pass spfdomain=windriver.com dkim=pass dkdomain=windriver.com dmarc=pass fromdomain=windriver.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=windriver.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bo9-20020a0564020b2900b0052337ed4c3bsi1041260edb.151.2023.08.10.01.09.55; Thu, 10 Aug 2023 01:10:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@windriver.com header.s=PPS06212021 header.b="Hmtw/Eve"; arc=pass (i=1 spf=pass spfdomain=windriver.com dkim=pass dkdomain=windriver.com dmarc=pass fromdomain=windriver.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=windriver.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232289AbjHJHr4 (ORCPT + 99 others); Thu, 10 Aug 2023 03:47:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230457AbjHJHrx (ORCPT ); Thu, 10 Aug 2023 03:47:53 -0400 Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECD74211D for ; Thu, 10 Aug 2023 00:47:51 -0700 (PDT) Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 37A702ox014269; Thu, 10 Aug 2023 07:47:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=kO2unsl0pxbA2sfGTphXE1MHCO64iOliAz2mFZSmsc4=; b= Hmtw/EveHgAe+5MVMEvsozQMtUwCvVt5bmqc80EZLkynw2GdilhjXFIQpbG/QFxj wY3MlMvHfX0UvsPZjBcAvtff8DtIyypB3daNzdHsnQVZo+NTyvdega/ueZD3eshX vejFrvoMbKEm3dL4k/f0bc7C/eKzU5LmF3R/a9xWppQbMBmCVuNusMMYL1LM+Q+q H7zMDWLuD5uGD1s0y/E7JzSGbbfg5HwCATuoalKoPLo9k3AjJzdj3ejkoFoJLywG cc5RgzrVzvqf8Ee81iwapSDll98u0SxwJlseHgUwERvMS1t35GJ1Y65KuuhVk2E8 pKK0oYL3PfkmUCxf5xS+Dg== Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2049.outbound.protection.outlook.com [104.47.73.49]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3s9dd64msq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Aug 2023 07:47:27 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QszQvue1t7qm9J3IxwYscn1IY4OyTQ/8zyYqY6+CTiJj1Igf/3PHyEozJrnohNsG+flFUcuVfrxPBIeePQZSvBk4HzGKuvNgyiWZZ4VV46qZBc5CBRTd+/VvOR8gWZQ/39icTgGW+GrZeo6AVZqFjyhClTMPKQ/sDvazow8vCyTUcqJMt/Xbs3q4UC2yAFYZE+RH6l2DciJO9INLXAYS5YA3CSi2gpd5LQdWWncGSDl2oD+JiCKA6VpYxpTEvIAZd29YJ2uuSTHLiHy5dgMxxofNn/OFq1lSVTdFBHx5a1TrY2A3UcbwwZ1GxE4lsu0rbnVuvhpA76YY+bm4knbacg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kO2unsl0pxbA2sfGTphXE1MHCO64iOliAz2mFZSmsc4=; b=O/zeCeG64OMxsAdMOl5xgJRl7AD7f+9a9wypJpQNGeE0PHUcJS0/qpNNp4KGUdUBlsp8lSIGWytSPuwLsVYzQqsh5lFQPP8mus9VSrG18Px8OquaSmQTkCVZOBV9oCLHFjMlrIgUVclZiOerEpR7K733uQEfadW6Yg+YF3AK4Bkx3MKzkPz72O6kACBOZhZPdlMiLwYOhPyDoYYNX+OirOBij+LUSLWlTiaDvw9xACZn0RZjG1ieMD6BgB/nQZpJYi77ZBsBIj71QfrxpQJanRspBb+dg6mximan448h246Q02bqPNUuCM2NTWCgudoHPze8uqBPzGtCC3OHknDiYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from SJ0PR11MB5769.namprd11.prod.outlook.com (2603:10b6:a03:420::8) by PH7PR11MB7497.namprd11.prod.outlook.com (2603:10b6:510:270::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Thu, 10 Aug 2023 07:47:26 +0000 Received: from SJ0PR11MB5769.namprd11.prod.outlook.com ([fe80::1b5d:f77d:a3c1:ce4c]) by SJ0PR11MB5769.namprd11.prod.outlook.com ([fe80::1b5d:f77d:a3c1:ce4c%4]) with mapi id 15.20.6652.026; Thu, 10 Aug 2023 07:47:26 +0000 From: Xiaolei Wang To: catalin.marinas@arm.com, akpm@linux-foundation.org, glider@google.com, andreyknvl@gmail.com, vbabka@suse.cz, zhaoyang.huang@unisoc.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] lib/stackdepot: Bail out in __stack_depot_save() if the stack_table is not allocated Date: Thu, 10 Aug 2023 15:47:03 +0800 Message-Id: <20230810074704.2042664-2-xiaolei.wang@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230810074704.2042664-1-xiaolei.wang@windriver.com> References: <20230810074704.2042664-1-xiaolei.wang@windriver.com> X-ClientProxiedBy: SI2PR02CA0006.apcprd02.prod.outlook.com (2603:1096:4:194::8) To SJ0PR11MB5769.namprd11.prod.outlook.com (2603:10b6:a03:420::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR11MB5769:EE_|PH7PR11MB7497:EE_ X-MS-Office365-Filtering-Correlation-Id: 204e435a-0cae-4280-0c50-08db997609fc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ocYoDtvZvI2IdH4t1oJTzKBxV+B3mJkzys/E62kbmA7O7w7SBc+IJmF6+PLGdPpi0fbFYErk/hQ7zs7ZgE+bfBL96Dd63EvN04jLn2uer+e/mMQjRShjuHKFU3vfUn1c7ZfIgMTQS5Q4r1AwaqM0j3AyQnPQGJVQwTTFYVn3dd5EeHs7cw0RaJBF3kDB2r5jfidynt3rbK2SE8tAOTnMJfXh1KDCMSkaOCEA6EJ74vx+iz4l+tSQ61AQRJmuq2BsKLgvyxSUP3jXOpm6kT17hixQZ2obBFebKpGx1l52PdvIYdk2l5JVNLzaeSWyK9CfDRicqB7RVShX/Lm6TbSrQPPJV7iJzcW3nSvr+/VgO5c6Izo9kq85wj8VCZ7sVJZB8u/R4wN+I7Ovejz847BGP1I6jrQn+zo8xfjn9xTzPBf89nN+Gqqb5FnersNHTuHLGUEjE/OXZ5jWuQTpQJ7ZMBaWck8StV8xQYxZEdNCg0srs0C94dR3z3cwQJE8V3juk6W80CyycBPGG+z4GQvXdmqSIvLL6m3vCk2aMNc0gMkxeObyy6OVMrkLHCuA6H8M/mzv4jqazET+XJvzidRWv7fTlsqM0CXj2rLKu/s8kCM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR11MB5769.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(136003)(376002)(366004)(396003)(39850400004)(186006)(1800799006)(451199021)(2616005)(316002)(86362001)(478600001)(6666004)(6506007)(26005)(1076003)(36756003)(5660300002)(8936002)(8676002)(44832011)(6486002)(41300700001)(6512007)(52116002)(4326008)(2906002)(38350700002)(38100700002)(83380400001)(66476007)(66556008)(66946007)(4744005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iP3OaXL1JR7WFvIXLAnb1cnoK8BLABl86HmKV7icXHHPuSs7kvM/+oZPZchTEE3qAMJPPdJvmVnpghoxbLFqq/DjX3gh9jczg1plPamsnrclddcKsKWyyDPZKF1EcS9YJFwfNX3ymZwkB6Xsdpd0V/wzcLO2Cy6URXk/ZeGlTmD/zi73Mlsx8W4bUuV05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tc0KE08PNM4afkFzOJ4g9BxS9Un0540kkGrFrN4AYzCFRuig/+gigh4CgLoJ63bvRRxBbKfp1KpFVEQZw352ADvgE0Y4q4jXiyXy14hXoTM6l+sNoVyYwTyCsxw9U0IvCk94yursQi9AkH9qTuu9ywLgzhs2Xxs4woiLnZqOd7YysYmxfi6jnbnf22EGHXY18BzujI1nmzb1K8nlkHRl3gMXi1kFB8r/5/ZztbH4KN6YehzLtJtZqe74RmOdkYtAV9gQ5fA8IYKkT/nKGCak5ZqyOhCRAAAxWtVDrEELN5zhPKmLhe+0Fzwod6zzDMX+zudpzFAmrCTX1+pycsbK+Kr0fSXeVqMg== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 204e435a-0cae-4280-0c50-08db997609fc X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5769.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2023 07:47:25.9542 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CndRtmNA/YyU8Bcd65+FHXNLfmjaDsIwfNGEVoOcv7Hd4ANwPiCPhzpoP5yBz7At7xbbv//hG++hu0K4Pi9TJJX/3/nkgwh3brqHJ6GNonY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB7497 X-Proofpoint-GUID: 24tkBtBO4qCJRhzpj64h80Heo7lmGNAY X-Proofpoint-ORIG-GUID: 24tkBtBO4qCJRhzpj64h80Heo7lmGNAY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-10_07,2023-08-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 mlxlogscore=645 impostorscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 bulkscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2306200000 definitions=main-2308100065 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773828863887111727 X-GMAIL-MSGID: 1773828863887111727 The __stack_depot_save() may be used by some subsystems even before the stack depot is initialized. So add a check of stack_table in __stack_depot_save() to make sure no oops in this case. Fixes: 56a61617dd22 ("mm: use stack_depot for recording kmemleak's backtrace") Signed-off-by: Xiaolei Wang --- lib/stackdepot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/stackdepot.c b/lib/stackdepot.c index 2f5aa851834e..a0651d013a0d 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c @@ -376,7 +376,7 @@ depot_stack_handle_t __stack_depot_save(unsigned long *entries, */ nr_entries = filter_irq_stacks(entries, nr_entries); - if (unlikely(nr_entries == 0) || stack_depot_disabled) + if (unlikely(nr_entries == 0) || stack_depot_disabled || unlikely(!stack_table)) goto fast_exit; hash = hash_stack(entries, nr_entries); From patchwork Thu Aug 10 07:47:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: xiaolei wang X-Patchwork-Id: 133765 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp280433vqi; Thu, 10 Aug 2023 02:00:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExJM3VP/UxYnWRXlzrrMDKV6XpVDY2/g+Xh2GyJSMP7MLMhU/aXxPfqI49iN6Csx9PJfpc X-Received: by 2002:a17:902:690c:b0:1b8:4baa:52ff with SMTP id j12-20020a170902690c00b001b84baa52ffmr1596389plk.47.1691658008333; Thu, 10 Aug 2023 02:00:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691658008; cv=pass; d=google.com; s=arc-20160816; b=HeCVI0ZKHX8C6EE2b6+x24pqcwyfXntEoLs7IGUixmkoPfOYX4FCdwWIwmjIEAULQ8 Jen0Ui2nc6sjGrFJRdCWiU0dT4UUVIqXznBNADij7AHbt6D0CuzzjfwCEyXo4hWVTGTZ 5Qpr9buqFDgrWhZ4yR4lG5QTu/JgzjFC6GbJHghM7qZAztOOVeCHHUKa8Uv1fYV1hkvU zvoq2qmW3EVbCgNy4XSJr6zUJxunzYLAR3ACT/VnriWLaHA115b0zmrA2FbbGmFNyV6c fmPk5HUDFroZiYCfSvwr8BboSr3U8nlMkeyDVqA9H/YzgEWw0Q40mhI6uoQCCV6smN3X T22A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1AKwDMEuXmBcYBNJs59QytxQu62GZx7vOP8eohKBmGc=; fh=glBGht3B7KMhoGavPouAoC22VMdqX5IG52ihPt7JcDA=; b=ONHI+9cluJA0gEv7ozXVDpGj5Ut2kqZ6QwYumSRB0dMDG7DW0f2Sl5gCcDmfUgCE8h nf9ihFW9u7akj98ozT+tUuUvmygtmFRH8Ak1x4vQuDijnJ3vESt8hlxr92HHMMwBlmKj yLPdnzSrTDhbV5HkNxe6GnvuJ5AKblQ1TvY8ya6EHF2SH7JH08gFk2ZFgtDGa21KwwUh jMtEpXZLNSgnHENDpgy+jCan7LoNDKAvqZqMQgNOM7NnPHRe70dE0KtT59CG25PrrB9m tYProz0oyOrbBnF+Grby8AbkhssO9Q23dRA//bpVg5u54nM7mSWkvyDId2S4BbkwTDfa 39jg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@windriver.com header.s=PPS06212021 header.b=ffV9KOlw; arc=pass (i=1 spf=pass spfdomain=windriver.com dkim=pass dkdomain=windriver.com dmarc=pass fromdomain=windriver.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=windriver.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id li11-20020a170903294b00b001bda93595d9si305814plb.604.2023.08.10.01.59.54; Thu, 10 Aug 2023 02:00:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@windriver.com header.s=PPS06212021 header.b=ffV9KOlw; arc=pass (i=1 spf=pass spfdomain=windriver.com dkim=pass dkdomain=windriver.com dmarc=pass fromdomain=windriver.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=windriver.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233219AbjHJHrz (ORCPT + 99 others); Thu, 10 Aug 2023 03:47:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230030AbjHJHrx (ORCPT ); Thu, 10 Aug 2023 03:47:53 -0400 Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E70D3211C for ; Thu, 10 Aug 2023 00:47:51 -0700 (PDT) Received: from pps.filterd (m0250811.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 37A6pGa7011895; Thu, 10 Aug 2023 07:47:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=1AKwDMEuXmBcYBNJs59QytxQu62GZx7vOP8eohKBmGc=; b= ffV9KOlwjVgj2z3VEReeLMFXft/UuWLA1I/d5ijLQjxN+qVtHW8S2wScqu4c7AT5 IWwG67dPeuhkncmhBKB5EwwDpYzZMA+7dtkx6f92HlS1X5epxmSgoBI5Dq3K+87Q 65zG9ZpUSt+q1RgJing+RxpJK/V8y69fJNawzXwqPqkcXh8SchGBFcroPYaURV+S CkfTl3J3GY42awUeYarbDNvvHt/SqYT10nk8JxpYrfd9duLD2xKS5Ep+nxE5w/IW 5+D7K2kUSMZsd0J5eyn/MKCB0wozdHHHi1Xjb8pgZ1pqP2bW/3Ah14vFBXneRJUm LUysNxyTIMpq0zUfbKIUsA== Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2041.outbound.protection.outlook.com [104.47.73.41]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3schfmgf4f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Aug 2023 07:47:30 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MnJtUhncQcgHNeEXd0YsDgL0k7SA6LfHEPkii/K4RDF2G0x9/q5PIBk+0nuJH/v5GXrmDhGsqlOguOiS0b7yQk30B3UkqGVrS1PwENu6c88uEnxVuWfT9BeaAZM4dIQ7FJOStky/3ccMtTvjfho3EwfJuMM2N/OFBklIrl7ZvunjBPWvZIeUvlKnJzOqgVYgbUKBwZCnC4v4JY1eU7Gdvc1MWmzXXCOsUmn08HbKeN/VEP9xgqTO8G6aZvgKJWY+/Rza3K3o1XmRFl2IttNpHrkJX/g+js3hCVcDrXkvI/m0AM5JJwK1+dyCdcp3nw5THocZa6sERleZf0bGtjR7BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1AKwDMEuXmBcYBNJs59QytxQu62GZx7vOP8eohKBmGc=; b=nUyqEj0jY7EEY3NwiP79wXvfWBrJwcCm6ifOA1S4I18XptD9xBLPYyYsN8qr766dL2wGgOO4QH+23bQgO07vE70QngWNuQl3NlBtByQ5NvTkH+EmocFOYPEr7S6773uuouYnWv6J7uOJIOPkl99cxMWbw++YKX+b3kw5VQoCTpKjDBIVc8xq7I1XCTv6C4ACBsZ/emwW0EJhjDoZSpzly3tSvQv1MOjTUXl/AotVDCuDyn5MONHObnsaLzpVoTv8FMAGiEBElsS51DQU0SJFR3g08jzmQjhxUYt3qLnVu6VSCR5gwJkCqRY+bk2JS3Ttg2/8pUuJWFM6tjrpmWfNhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from SJ0PR11MB5769.namprd11.prod.outlook.com (2603:10b6:a03:420::8) by PH7PR11MB7497.namprd11.prod.outlook.com (2603:10b6:510:270::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Thu, 10 Aug 2023 07:47:29 +0000 Received: from SJ0PR11MB5769.namprd11.prod.outlook.com ([fe80::1b5d:f77d:a3c1:ce4c]) by SJ0PR11MB5769.namprd11.prod.outlook.com ([fe80::1b5d:f77d:a3c1:ce4c%4]) with mapi id 15.20.6652.026; Thu, 10 Aug 2023 07:47:29 +0000 From: Xiaolei Wang To: catalin.marinas@arm.com, akpm@linux-foundation.org, glider@google.com, andreyknvl@gmail.com, vbabka@suse.cz, zhaoyang.huang@unisoc.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] mm/kmemleak: No need to check kmemleak_initialized in set_track_prepare() Date: Thu, 10 Aug 2023 15:47:04 +0800 Message-Id: <20230810074704.2042664-3-xiaolei.wang@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230810074704.2042664-1-xiaolei.wang@windriver.com> References: <20230810074704.2042664-1-xiaolei.wang@windriver.com> X-ClientProxiedBy: SI2PR02CA0006.apcprd02.prod.outlook.com (2603:1096:4:194::8) To SJ0PR11MB5769.namprd11.prod.outlook.com (2603:10b6:a03:420::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR11MB5769:EE_|PH7PR11MB7497:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f03e3fe-dcfb-45f0-ca62-08db99760bd8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6UH5Ho/H5vbMwneRR/W/ovImbywRmfvn4PFNAhZP/DPR6q+QBKWPaZqZGfZuRm0hLzG3AFGKm95ySSH8hv6LuOsTWXZql4ub4vzZZ35aCtivvSdLMvj7v6XETkjj2W30N1zb0nq4N/Qfm8OPVxg960/+RSKVbGpl19zpV9vT5kmPmntuehbol2AXYVIBfEug7wC/Gfe48Sw+h/aZec1by6eru4AvIR0TdnkSR3uYn6GYBywaRSt374OmgbsgWCNt9dRe1YrlFNABhXKdTC5st/0/D9KWes6aYnv6PXfKu2KfUdGXND/3M2SS7ZOFVtm+w3xdmwHMsKY7rHRlQh9DGh/C6ErW2FebHkJqEA32oyoH0wvLXYXVCeDS3vUW7UdU743HEug0/Btxot5VGCH7JCziwlRAtP5jU774A+zNuiWs15nShFq5yFP7ygiB7l5FMRLB127+nmhVpU0NV8UtiAaD4zCqV8Fun0W7TG3G7zdk1Lu//k84ZNO3dfaYxgFHdY7VUYAPBrXmRkcnU1uJgePtC44SiGW7Ave/3Qn24gstC3NtGP+Q9YmeSKqw4WGLro+Wbkzr14hozUW0f92IdzeCI3KX+302V+wLl68yTKHPuZnLe6oHm/jBlZph4xq10rda40+ILonTe98E6bVDQw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR11MB5769.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(136003)(376002)(366004)(396003)(39850400004)(186006)(1800799006)(451199021)(2616005)(316002)(86362001)(478600001)(6666004)(6506007)(26005)(1076003)(36756003)(5660300002)(8936002)(8676002)(44832011)(6486002)(41300700001)(6512007)(52116002)(4326008)(2906002)(38350700002)(38100700002)(83380400001)(66476007)(66556008)(66946007)(505234007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: clKAeswkRpOgZG09A2/0hYWRDPzptEa9kK279DXCfG8ftj1aIkKGwCbHTJpARc9zDI3K0wuI+t9sMerAb7ZY9dOhXtQfStBpnNMibkYseR3kxTHgfDJasZqc+AAy0VM7yzOZFosLZeZMlOz0VSUFkubtWW/CuIqvask2bj+Y1V3ITAUqLm82v4Eomxet5l0FpW0hXbIje5BWqFU6DflgKXrSnuucZ0fNkSlsyeNmbcq4nXUASfXXGveJEN3DFTbJ2VIr2+caXexIo84tHrS+2SbbOuxkIRvRLktSI0iOYnakZBUWhSV9KYrfx/izrrL97K6j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KVrvi7wkXXvHRNxLHSGYIuPmxzvLirOMu/hESCK8B0zQOfe93EkXFM51TbtJHHAbHxdb87na+EHtttBj9QQiof/QWVUrEy/prTW9piNrsecs92GfD5KfB5EUv4oZJYuSgBtmMMrF6UlKP8AL6HAOBqnoCiLoykw5PR/+YznRyqszYY9pbTxObnrpH1Bs3M5Edvyj9cIf/UlXOIHTAKS4Kv6kd3RjCg== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f03e3fe-dcfb-45f0-ca62-08db99760bd8 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5769.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2023 07:47:28.9289 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +6+3MACJ+vZiYVgDlY20LeF2bT7YK7hRRtcsXHjWPNXGBqT/ZHELxSJbboyCayMiVoeMaICrKEJ9HAWsGguiAeeUlUswhT63bPq+z5AEVy8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB7497 X-Proofpoint-GUID: Yc2pXsIeBXjHWopBqFppm6UGCUQoORty X-Proofpoint-ORIG-GUID: Yc2pXsIeBXjHWopBqFppm6UGCUQoORty X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-10_07,2023-08-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 mlxscore=0 malwarescore=0 bulkscore=0 mlxlogscore=674 clxscore=1015 phishscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2306200000 definitions=main-2308100064 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773831987788696022 X-GMAIL-MSGID: 1773831987788696022 The kmemleak_late_init() is defined as a late_initcall. The current implementation of set_track_prepare() depends on the kmemleak init. That also means there is no call trace for the memory leak which object is created before the kmemleak_late_init(). In a previous patch, we have fixed a bug in stack_depot_save() so that it can be invoked even before stack depot is initialized. So there is no reason to check the kmemleak_initialized in set_track_prepare(). So delete the kmemleak_initialized judgment in set_track_prepare() unreferenced object 0xc674ca80 (size 64): comm "swapper/0", pid 1, jiffies 4294938337 (age 204.880s) hex dump (first 32 bytes): 80 55 75 c6 80 54 75 c6 00 55 75 c6 80 52 75 c6 .Uu..Tu..Uu..Ru. 00 53 75 c6 00 00 00 00 00 00 00 00 00 00 00 00 .Su.......... Fixes: 56a61617dd22 ("mm: use stack_depot for recording kmemleak's backtrace") Signed-off-by: Xiaolei Wang --- mm/kmemleak.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/kmemleak.c b/mm/kmemleak.c index a2d34226e3c8..c9f2f816db19 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -610,8 +610,6 @@ static noinline depot_stack_handle_t set_track_prepare(void) unsigned long entries[MAX_TRACE]; unsigned int nr_entries; - if (!kmemleak_initialized) - return 0; nr_entries = stack_trace_save(entries, ARRAY_SIZE(entries), 3); trace_handle = stack_depot_save(entries, nr_entries, GFP_NOWAIT);