Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4130707rwl; Mon, 10 Apr 2023 06:41:09 -0700 (PDT) X-Google-Smtp-Source: AKy350a/+OwuKAuHagTr684q4vc5BXL2EfBf+Ryi4UOc3FjuVgy1rIlsVd5Ak0VmrdnDQNp76WLy X-Received: by 2002:a17:906:32d1:b0:8b1:fc1a:7d21 with SMTP id k17-20020a17090632d100b008b1fc1a7d21mr8413693ejk.5.1681134069638; Mon, 10 Apr 2023 06:41:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681134069; cv=pass; d=google.com; s=arc-20160816; b=t6S4Q2Yv+OXtdkm5vIfBamI9b62BT0NdsgE4N7fgW/IK6lO9vaTJbzpb/8oVrWPPHD PKb9z7wE20iYBEMnIkmHHJRL8XU7zFiRf7UPxZTgxbUQWGcGub/fItgow9RIP2htNQlw dbkPP3fHJW28MGtbppPeSCXKBmUifzmg/TYoXXd+jnn2d1Beb82ojlSZPiwQvPBmWL5Z JfcDCNP3r7XS3AC4Ma+kKL/5SW0W2R3hDR77CcxtS9viQJpsk8QJbeIZ+0elrHUDa8KI 9Sf/PYGdjtB7wz29KReknnqax7IeL/eUhJYQ1fvf5rOBy3oxOu1cKiQPZJdBA/q7/BBY ioDw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:in-reply-to :content-transfer-encoding:content-disposition:references :mail-followup-to:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=tqjR24dulXcubzU3N9mythttLC5Hsbq9He86L/610Ow=; b=gMsCWFhRN7+P5bFffla87aXuADovbNu++m5claB43dRcgBANoBel5gVXGl/df/Zl/y mW3/nrtNkESFBVK/8BVFDVtvTrIFy9jhOCoi5X2A8IufeiixQYvlli1hlWCxbbfGOVJq MEed18BIUWYfPYGOyaF8p3le+2pTCJfNIOZvhy6Im3fIPO81O8ezCC4dgwRX7SkadXfE /bsHkqp18UQkiinyTLWvSSdjrlWEcAwcuZRJDiZG06vRyi+VparTnmkar+vvUC0RWzUv bdZ0w7AYR76+5uyv/lYfPUV35hFf5AVCQ3WFvvOjyeUNgCvfshTDl4Ui6+9kAJ0nyOqI wrWQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=P3atcdEB; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=MJJi9WiI; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.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=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v19-20020aa7d813000000b005004ce1b26fsi6704802edq.593.2023.04.10.06.40.44; Mon, 10 Apr 2023 06:41:09 -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=@oracle.com header.s=corp-2022-7-12 header.b=P3atcdEB; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=MJJi9WiI; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.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=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229879AbjDJNNd (ORCPT + 99 others); Mon, 10 Apr 2023 09:13:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229872AbjDJNNb (ORCPT ); Mon, 10 Apr 2023 09:13:31 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF78E55BA; Mon, 10 Apr 2023 06:13:29 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33ACo0Qh002751; Mon, 10 Apr 2023 13:13:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : content-type : content-transfer-encoding : in-reply-to : mime-version; s=corp-2022-7-12; bh=tqjR24dulXcubzU3N9mythttLC5Hsbq9He86L/610Ow=; b=P3atcdEBgim5BOy9N7gR0KVbmv1l/vmJ1svHaMcwx7Sg1FaGpP8PuXAY5cTFb51EwD/m 0q+TrG6JoKVNtOCBk5SYaEy4nyrcooXT6WWsD8nRoYRr2pBcq8d/k7uY9lr+yBh7IsBM sjLdd+iasps6JEnmYPqXNetrTmC95yMCNUcFKwd2qfcPklQkNNoagvCDam9eETY6c9J9 6sjvcr+ogwyGtA4mB21e1f6bdkDxb0L5zxe7990tOiEePqj8S49es1nah235sCDS0ihn fYG5XXx8YBHZmZFny+l9A1A2ECsBT425y5RkGzuvRBIxFsTQY6cP5mBySZvahA3OQ94Y HQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3pu0eq2sbj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 10 Apr 2023 13:13:04 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 33ABRvS0001726; Mon, 10 Apr 2023 13:13:04 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2169.outbound.protection.outlook.com [104.47.57.169]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3puwe55a2s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 10 Apr 2023 13:13:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wb/Kg9izQQG7c0bnqRM28V9E9i/sM/Zt7qdOsZiLSgvPJCUI/hMicpGPWA0dNXk/gB2d873BAyW5tyRTE3yfNW5XLkpYIfO9CX21+wbh/pbKYwEpW5l6vqrFarJ+Vu/7k/eK8P0WzYJCZpMUCyvqVwV0wcmszD8ZV7C39t8V09LeDLqZcKXKVymLDSXiJwkEbwVkwoQJ5OXq8m9hVbyxG50+0Cbg+4O3WikM7yWjNG32+pAuS4EYGHiPzSOBvs01kZjGd23bFP+j0hbPJvRXaG65wbv6XlPiveO+myegmJfalfmD7AHQ0L1w1ZMlEs6lfFw7wTElUF7vQykAME6p1w== 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=tqjR24dulXcubzU3N9mythttLC5Hsbq9He86L/610Ow=; b=NnoBWBrvrM4o6IkAxY/VmAz1xQZuDouqT+YlgdmtQxPsZC9yXVuq1idmituP/KoTyiTea/3jGV1n8vjJBWtXB/NNebNgrAXK030PyI1iiPhbJCy8pIt/wNQKMARD5NRtp+/p2TxlzSJ1kMmlW1atIWrnsTsK800PmVDOo0+fsOGoXeVkV+TLeTdlm0Ze94vIhl/O8wkL2XnLk3LyGWGXRCP5SLsTzC7JzwejUh2KlKAff3sifY2kxfuxif5fOMTdZz6PI+Dz2G/e6RqTcgDLyG+kabVNT+BBDQh4uK64/0S0RUrDksfdHL891X8K8HW+AGlxRPFmTTSRlWFwg5QweA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tqjR24dulXcubzU3N9mythttLC5Hsbq9He86L/610Ow=; b=MJJi9WiIl5N+bET8kxLml1NNwPYGah6MFZyIkRfSVK3dZAfIEhrqY+Vjs9D/WGRZwlMHbG90bSKBEm6ADmALyY0GDuV/MzH6LGAjciKLbdJ1FEFaxLB4QiOZzRwQMRd5VDS1doEbl1TBP9Ulawb2tkj+u6HGvuZfKb+9GaC1ZOs= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SJ0PR10MB6399.namprd10.prod.outlook.com (2603:10b6:a03:44b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.36; Mon, 10 Apr 2023 13:13:02 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::8bb9:2bb7:3930:b5da%7]) with mapi id 15.20.6277.035; Mon, 10 Apr 2023 13:13:01 +0000 Date: Mon, 10 Apr 2023 09:12:58 -0400 From: "Liam R. Howlett" To: Peng Zhang Cc: Peng Zhang , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, stable@vger.kernel.org Subject: Re: [PATCH 2/2] maple_tree: Fix a potential memory leak, OOB access, or other unpredictable bug Message-ID: <20230410131258.txkiqa5eudgsrmht@revolver> Mail-Followup-To: "Liam R. Howlett" , Peng Zhang , Peng Zhang , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, stable@vger.kernel.org References: <20230407040718.99064-1-zhangpeng.00@bytedance.com> <20230407040718.99064-2-zhangpeng.00@bytedance.com> <20230410124331.kijufkik2qlxoxjz@revolver> <84c50299-5b5b-867e-1e96-2d3a0c6ade2a@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <84c50299-5b5b-867e-1e96-2d3a0c6ade2a@gmail.com> User-Agent: NeoMutt/20220429 X-ClientProxiedBy: YT1PR01CA0064.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2e::33) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SJ0PR10MB6399:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f61d187-f95d-49c2-6900-08db39c54fe4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k+36yNk+qO3DaDWXM56KPyLfu2eY9DRVtR8EoOj3kxqkCgsxSFwtCnHTIMVJJBq7tMUxGzVV+Ck1M8dPH/Q2iMW4jTrfBWWTGxs157vwKiH7AAKVg/C9F6nK2cC5lOM1pcslvOc8UnrHI1GYWHdnx4wk+5IyIjsJPkESkhpHOs/KPgdI65cZazUQvY5cPzJjf3bZKhFvM175zQ9Vp0kCFMoNA5/S1SbfaxSD9+LkBofBbq2BCO54EnbzwiqZRJyzqzLRNkxu+w53ihWgRFINK5O14do+cCcjJVXCsYNVL4frWuZtP8g8qQxtIDCVA44nqs8d3vukOPiepJ5TfAgO9P0nLf6nezOk4K+qOs3epgwD1bkFytGMFuI8M3n9gnmcpVdBUe495Tukt3rlwUKd8cmwR5moPrprEhuYaGmOyRVE9WD//cA7SLLk/f63vAOPKCSmIyYekOj4Ybh2SPgzh3aF4nzIphBWX47dHOTtnEchlFO1El+P0yAblulHNdKx2RxcKs4dte3j4qng8TZrkapK4AbOj4JVLcHCeEN8THNbsCDmD2mP5LgXfINbm/2o X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(7916004)(396003)(376002)(136003)(39860400002)(346002)(366004)(451199021)(66476007)(6916009)(66946007)(66556008)(4326008)(478600001)(316002)(5660300002)(41300700001)(8936002)(38100700002)(8676002)(186003)(83380400001)(6486002)(6666004)(9686003)(6512007)(6506007)(26005)(1076003)(33716001)(86362001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VExiYy90ZmcvcVRiZ2FoTTR3WFQxblZhTFdSaklNcFArbzFrWkVyc0d0YWFC?= =?utf-8?B?YVI5bUM2NUJua0NBR1B5dE9WejQ0RlFrcUFQcktWSTVPRDlKRkNTMk94d2pn?= =?utf-8?B?NnZicFd0Y1Z0djdnRDgwNkVtOVM5cEJGa1R2RG5UYU01MnBrTFRrZE14UGRI?= =?utf-8?B?NXFXU0RDdHVEblF3V1BadjVicytoQXk3V3JXMzhVRm9xY1VUNlBsQWlmWUpw?= =?utf-8?B?cmxMb2ZCcnl2WlNhNld3b29vczI5MzJldzdkV01YaEFBMEpEd3IwYWwzMllr?= =?utf-8?B?elZQcEhoN2pXcHNqWTF5U3p0b0pWTlpaUUtDZVk4OTZZZjhjNFRhWWVFRmtq?= =?utf-8?B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8?B?MTBtRy81b0UvNUhkU1JNTGR0ekRHQ0JqVVhJb1hNOTlxUjFGYktPQUVrRVFM?= =?utf-8?B?b0NlUWZvV0dpQU5EV0F5RnViM3RXSjFDckYxZG9ZaG8vaUwzVmJQWG9HMmpo?= =?utf-8?B?RXNqaEtMWmxlTnhWUHdBMWcyU2Y2WWFpWlhFSEhUNXAxdm5zajErdjEydHBN?= =?utf-8?B?VUViL1ozdXRhT0t5aUVqMGtYc2xzMW5CT1ZlZ1hWRVFpdkpRRndwblI2L1Zy?= =?utf-8?B?TUhUSVFNNWR2RWJYQUR3b2tvRDBubENCM3ptemN4dEJ2dEYyRHBOakFSMUJz?= =?utf-8?B?b04ybTJKSkxxV0JDUkRTbEFuOThQdkwwWWFUa1JkdDJ6eEFwa0tRNkh2RGg4?= =?utf-8?B?bkdiazZyaXdHelRHQVpFVXBOSmF4M001UGorOEhEeFRSYmFudDZYczYvbTZm?= =?utf-8?B?aTlURW9vcmhrbWRSN2N1bUlUbE82OVgzcFpSNEhXNkNhaTMwekhpYlJweU56?= =?utf-8?B?dDNDTmVxWVNnME51QWtDYmlTREx0ZVpxQmM4YzVXZ0RNV3FkZz09?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f61d187-f95d-49c2-6900-08db39c54fe4 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2023 13:13:01.6153 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: E7nSe64BtATdB905FHdhMZLyUpktwdlfICKSUT0bPwzeUK2xHrb2vFT2VOcINn74/31NkO144DjJTY+kJYfTSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB6399 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-10_09,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 adultscore=0 spamscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304100111 X-Proofpoint-GUID: CD4JBnVto8CXDckAz_yWNWch0u6w75UD X-Proofpoint-ORIG-GUID: CD4JBnVto8CXDckAz_yWNWch0u6w75UD X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 * Peng Zhang [230410 08:58]: >=20 > =E5=9C=A8 2023/4/10 20:43, Liam R. Howlett =E5=86=99=E9=81=93: > > * Peng Zhang [230407 00:10]: > > > In mas_alloc_nodes(), there is such a piece of code: > > > while (requested) { > > > ... > > > node->node_count =3D 0; > > > ... > > > } > > You don't need to quote code in your commit message since it is > > available in the change log or in the file itself. > Ok, I will change it in the next version. > >=20 > > > "node->node_count =3D 0" means to initialize the node_count field of = the > > > new node, but the node may not be a new node. It may be a node that > > > existed before and node_count has a value, setting it to 0 will cause= a > > > memory leak. At this time, mas->alloc->total will be greater than the > > > actual number of nodes in the linked list, which may cause many other > > > errors. For example, out-of-bounds access in mas_pop_node(), and > > > mas_pop_node() may return addresses that should not be used. > > > Fix it by initializing node_count only for new nodes. > > >=20 > > > Fixes: 54a611b60590 ("Maple Tree: add new data structure") > > > Signed-off-by: Peng Zhang > > > Cc: > > > --- > > > lib/maple_tree.c | 16 ++++------------ > > > 1 file changed, 4 insertions(+), 12 deletions(-) > > >=20 > > > diff --git a/lib/maple_tree.c b/lib/maple_tree.c > > > index 65fd861b30e1..9e25b3215803 100644 > > > --- a/lib/maple_tree.c > > > +++ b/lib/maple_tree.c > > > @@ -1249,26 +1249,18 @@ static inline void mas_alloc_nodes(struct ma_= state *mas, gfp_t gfp) > > > node =3D mas->alloc; > > > node->request_count =3D 0; > > > while (requested) { > > > - max_req =3D MAPLE_ALLOC_SLOTS; > > > - if (node->node_count) { > > > - unsigned int offset =3D node->node_count; > > > - > > > - slots =3D (void **)&node->slot[offset]; > > > - max_req -=3D offset; > > > - } else { > > > - slots =3D (void **)&node->slot; > > > - } > > > - > > > + max_req =3D MAPLE_ALLOC_SLOTS - node->node_count; > > > + slots =3D (void **)&node->slot[node->node_count]; > > Thanks, this is much cleaner. > >=20 > > > max_req =3D min(requested, max_req); > > > count =3D mt_alloc_bulk(gfp, max_req, slots); > > > if (!count) > > > goto nomem_bulk; > > > + if (node->node_count =3D=3D 0) > > > + node->slot[0]->node_count =3D 0; > > > node->node_count +=3D count; > > > allocated +=3D count; > > > node =3D node->slot[0]; > > > - node->node_count =3D 0; > > > - node->request_count =3D 0; > > Why are we not clearing request_count anymore? > Because the node pointed to by the variable "node" > must not be the head node of the linked list at > this time, we only need to maintain the information > of the head node. Right, at this time it is not the head node, but could it become the head node with invalid data? I think it can, because we don't explicitly set it in mas_pop_node()? In any case, be sure to mention that you make a change like this in the change log, like "Drop setting the resquest_count as it is unnecessary because.." in a new paragraph, so that it is not missed. > >=20 > > > requested -=3D count; > > > } > > > mas->alloc->total =3D allocated; > > > --=20 > > > 2.20.1 > > >=20