From patchwork Tue Mar 7 18:02:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 65781 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2624462wrd; Tue, 7 Mar 2023 11:41:10 -0800 (PST) X-Google-Smtp-Source: AK7set9PNaPktnkGjGGEpvMwKsL62ZPBtSyCvWTja+sduO51mdGzVe7dkFZ4JHY/3DVRDCK4/Lzi X-Received: by 2002:a17:907:2ce1:b0:8b1:32dd:3af with SMTP id hz1-20020a1709072ce100b008b132dd03afmr21987369ejc.28.1678218070032; Tue, 07 Mar 2023 11:41:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1678218070; cv=pass; d=google.com; s=arc-20160816; b=rqtBz+akYmWjSVq2dtQ8ceTiEwRgG6IWxxVfOYDEKz/mt2eZWBdS2LqqekfdUgT/9k rsz1kCHjp6Yb+FtTLNthV803q/H5uwOTrYcBi2jn/SrYkBPtADaEp3mROiKi+rwCf18a 7ZznzEHnVr9ymsEUu1feqj2p1drJow9qbP9pafyPhxBbRuNkuEVE4ud9G9Xl+haojAxS HXxcR/ESdOpopOzchI9J9YfvMm389595G3/sKMZDwzpoImCujU8S6T74lBNeZA4Q9BeV yGT8ORH0cCTk5P8Jdw5rlm2fMDtLOmRKcT1ZN6Tag1NQL/u7GvS2aDQeRLUT46TcEvJV SeIQ== 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:dkim-signature; bh=myk864uxv7PQ66OQH5z6ZuRs8bZGMnaNKR8rsm4mdNo=; b=IO6el5kUNeDqwdY5dX8+1s8gYxOcp5nqLe03PfeDVN2Ckb1dlZ42qDObm7KvxOlo4F ah+4yYdQuyAKhZwOS8WJfdprQM7Qnq9N9Z8CANXErmGFTSXXX7tabJJTxP8/YzO0ZCH9 jpHjhvE9iAmsLY6jzwFD49GuHwexQIqT26tl03gpNMmw4qjMk7AOZDCoaRJJaFifCrXX DxDO7r5lMBFm8oAEUkdmPts8mbaGhjewinjDHZ++L/ki/3qI8STnaPBem5c04Mm1BHjW 4+E3wp/pDdHepeP9b8R9hXoZBU9tlGu1HcpEp7EPBhDKOhVmW3W3pSWtxBMIXs/k4yOA GGOw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=ZYb8noM6; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=axorLpRb; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d23-20020a05640208d700b004c4ce189cb0si644362edz.253.2023.03.07.11.40.45; Tue, 07 Mar 2023 11:41:10 -0800 (PST) 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=ZYb8noM6; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=axorLpRb; 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 S232365AbjCGSJW (ORCPT + 99 others); Tue, 7 Mar 2023 13:09:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232005AbjCGSJF (ORCPT ); Tue, 7 Mar 2023 13:09:05 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F5F096609; Tue, 7 Mar 2023 10:03:19 -0800 (PST) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 327HwvTr031006; Tue, 7 Mar 2023 18:02:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=myk864uxv7PQ66OQH5z6ZuRs8bZGMnaNKR8rsm4mdNo=; b=ZYb8noM6ggrUvBkUyJmJYhhkjnYRgPHGxUmCSyCuCuEdFU80jArWmu0Ku+URBu3Rtoj7 6gdLU/ZowyetIvrVqkE3WI4ME0+Yko11HnX+c5e8T1a8ii6NXJMhf6y7TAx3UT+EKjp1 UwOFzrCzVc9H5YmUI3xGoJnQ9y3zmrdZZSKcT9sTC0cbb6vdpMv77k79zkcVS7H1vn5A Dw5wQpMGluo9i1BZWA9TN+unoMCSAkHujXZuHk0aOoQF3EzYOzO20XGwqKMKF7CGTgo7 vRhTQoHgwrYNN4MyrMfBvGfCXy31sCKTuFQw9RJUtVFV0JDYxgmWoa9wuXt9lke9WEiK zw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3p416wp7xk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 18:02:56 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 327H0btN029145; Tue, 7 Mar 2023 18:02:55 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2170.outbound.protection.outlook.com [104.47.73.170]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3p4u1fcrn7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 07 Mar 2023 18:02:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LI4pTNMoueRUPDqiW8NttLl3nJLCa7bz6OdPRC1uF7ilgfwB/PGVylxmKx50JU5nWjbXJ1F5sAaj+pfV70Zz1/SiOZAxQvv/NLdNRscXQm17Ii0zNytWPudpr5A4iQZ7EfjRMD2x54uwPkk7dT0F5A/f5UZfe2MX8xujBSLVCKliizD2ZqzOmzQCuAo4i29b97zKAZPprfIjj0sTJ9C5l7GHPbVZKXcSLMrVaO09hG6Y1kptzl5eM6xhfd/dZJcQq4IM/6zDdWR4DruZykinBcbyfG/DgH8vFmNKgAfFt0Q86frLyCEAyRWwE+MZo224B7jsl+p7oiSAToYSjKuhfw== 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=myk864uxv7PQ66OQH5z6ZuRs8bZGMnaNKR8rsm4mdNo=; b=lGreAkxELU0twyHuMV+RA1qkadq0t99TV3B6OYNUJOL60dhJYafCJjJO2gbgLqI/JPSnDF/jJgpuTZYHQNmCjaJT6PcOBbge2Q5/QbepI/hYK/Fdo1Nyb8YEmI2phKwNiiaKuV5jrm4XxFQQsAA2aoGopBpOWKlAPYMWVpNvizT8D3qXkBSkkKHpRJ8s+cF6U0LZknHGUl2f9MiIC1jK0pb088XDdLsyE3eqiUdGWrxmhU2rkzk0scJyAPw6VK3l3n9oTKXtfyBNHBQH3tvWgt8gtcTlt5itWCiQkZa/UHqh8Xe0nuUtWumUmK9VHXONiQ2+ahha2JRRjiBYqUBMNQ== 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=myk864uxv7PQ66OQH5z6ZuRs8bZGMnaNKR8rsm4mdNo=; b=axorLpRb7wqsVcSe4tqCgTLx0n1z2pPD448TVa02dRBAwkeIMfqeo1u476wSuOHZSJ8qfIdwBaP93JeSCrPzoPwfXpz/kFwWej1DM+9AcOqkRPn9FpiD3oWO0wPf4UERz9Jg+stwQ3BLY/vja7yG0KhVZ8s+DAeVUDhpT79UIKc= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SA2PR10MB4650.namprd10.prod.outlook.com (2603:10b6:806:f9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.29; Tue, 7 Mar 2023 18:02:52 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::93c9:c99e:5ab:4319]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::93c9:c99e:5ab:4319%7]) with mapi id 15.20.6156.028; Tue, 7 Mar 2023 18:02:52 +0000 From: "Liam R. Howlett" To: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Stable@vger.kernel.org, zhangpeng.00@bytedance.com, snild@sony.com Cc: "Liam R. Howlett" Subject: [PATCH v2 1/2] maple_tree: Fix mas_skip_node() end slot detection Date: Tue, 7 Mar 2023 13:02:46 -0500 Message-Id: <20230307180247.2220303-2-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307180247.2220303-1-Liam.Howlett@oracle.com> References: <20230307180247.2220303-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT3PR01CA0002.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:86::10) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SA2PR10MB4650:EE_ X-MS-Office365-Filtering-Correlation-Id: 896caedb-7582-458d-a5e0-08db1f362bd5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r+p0UdkSPNW7tna87xT4zlawE71TgJDLsTBBbVtvdbYjHFeJmxFE7RQgbYx5GRTf96zwCWOpe7dv6r0pwJwteRByX3yB1q1FFVBpLLmHse1YIRZ84zS1YwvoxrfJCrQX/v9GSSq1kGqFUsuJwwUGi5A5mVHe+10EdE6muwSA14RHWhNxcVvnYQmJymR/8DeKvhCSdO0VdD06RSTYsjtnsnZlzM+2JG6NXuo+wYciWW0ktfrb+I2lnxw2wySFpedKaGqT0wcAYpa6etbHUPAhPv6DnXh3wsTy+dd1HI5w6COwjMnhtGwk2VIB6D4Ou1UQyXxV1MeIX5PasiaXcameH1HpzKdZj9uINPxUkQlxSjo4qV8EFPMAy0ZX5HOYrG9LyTdJvZ5m7gAn8DfSxOmbftQYf7N4ZEcnfP4wZalS39lQFVjAnUfbvcuIF5FkwXD02riNrcMAS1kjDLUA/FIVlPzwOI/78/+lRzdC542UvJbOH70dZz8iNBDDLFZc3hJzMnOG/VZFRSCjIbyYijLvsiw+rpWHxKZ/AJvCXlp0UEaizcUWCTgd+lKmKqSnQ3CTyTDPF/FynroW/yQIFC14Q0qLmMIU1jllh390nVyL3cuuBOp+QIxZNTFfsbInPqyg 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:(13230025)(346002)(376002)(39860400002)(396003)(366004)(136003)(451199018)(86362001)(36756003)(2616005)(4326008)(66946007)(8676002)(66556008)(66476007)(316002)(26005)(107886003)(6666004)(6506007)(1076003)(6512007)(6486002)(478600001)(966005)(83380400001)(186003)(38100700002)(5660300002)(41300700001)(8936002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2eUfP/2qwNfbq31r3p/O50Ur+nDiVXuCOzjCnrqpAzipGyDdzAC9h5IThpQRjMvyCS5SKu11j6SfweD2mUgHB4yDQniOw6vslOkuuZAnVgUAiNF29xOs2dn0h87qoo3CcZCurzc1mPOPAkeP3LAySu/gr41tGW53ekIPPbZIuTzoU7sKWqJ34XQ7VSy0wDpe+Vw1JFnSs9482cpwcepoh9505zphKTlxxSblrx4yW94g8e20Nhq043xNNEY7qsV4TbLwM0MB1cR0SIazcBOhPHyYJbUrigDGsmSKUfCPIpAXDw8XSiAVGqm3pKbOjQFAPa1zXPchMtVHgh4LYzQSCVsHqy0M+Gydwd26MSyRk4sOjL2gfNt2wKek6Cb5tZR3V7nj4u3znuJTxTUDNk/BFlHf4uzTRhrdjMNTdva4GBTjaAm46W3Kh0jDKSuirykY0dmXqZyS/QpF9qLQh5baOVNvRDJgbWnYud+EEOLMDVDfcM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xD5yf1mAshz1hAqt/rco040PC1A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 896caedb-7582-458d-a5e0-08db1f362bd5 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 18:02:52.8111 (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: S7vlMuD6Z2clByMwPUHfJz/MbbwsFHdwj0IgsE83sJcTC3y8oYfsMEOl4e+bZ5NQAcJ6sZyShjbZbHdhbpB00Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4650 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-07_13,2023-03-07_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 adultscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070160 X-Proofpoint-GUID: YdmZPtyy1XFh38cGod2xytr6FYufmcMc X-Proofpoint-ORIG-GUID: YdmZPtyy1XFh38cGod2xytr6FYufmcMc X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759739190481235286?= X-GMAIL-MSGID: =?utf-8?q?1759739190481235286?= mas_skip_node() is used to move the maple state to the node with a higher limit. It does this by walking up the tree and increasing the slot count. Since slot count may not be able to be increased, it may need to walk up multiple times to find room to walk right to a higher limit node. The limit of slots that was being used was the node limit and not the last location of data in the node. This would cause the maple state to be shifted outside actual data and enter an error state, thus returning -EBUSY. The result of the incorrect error state means that mas_awalk() would return an error instead of finding the allocation space. The fix is to use mas_data_end() in mas_skip_node() to detect the nodes data end point and continue walking the tree up until it is safe to move to a node with a higher limit. The walk up the tree also sets the maple state limits so remove the buggy code from mas_skip_node(). Setting the limits had the unfortunate side effect of triggering another bug if the parent node was full and the there was no suitable gap in the second last child, but room in the next child. mas_skip_node() may also be passed a maple state in an error state from mas_anode_descend() when no allocations are available. Return on such an error state immediately. Reported-by: Snild Dolkow Link: https://lore.kernel.org/linux-mm/cb8dc31a-fef2-1d09-f133-e9f7b9f9e77a@sony.com/ Cc: Cc: Peng Zhang Fixes: 54a611b60590 ("Maple Tree: add new data structure") Signed-off-by: Liam R. Howlett Tested-by: Snild Dolkow --- lib/maple_tree.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 2be86368237d..b1db0bd71aed 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5188,35 +5188,21 @@ static inline bool mas_rewind_node(struct ma_state *mas) */ static inline bool mas_skip_node(struct ma_state *mas) { - unsigned char slot, slot_count; - unsigned long *pivots; - enum maple_type mt; + if (mas_is_err(mas)) + return false; - mt = mte_node_type(mas->node); - slot_count = mt_slots[mt] - 1; do { if (mte_is_root(mas->node)) { - slot = mas->offset; - if (slot > slot_count) { + if (mas->offset >= mas_data_end(mas)) { mas_set_err(mas, -EBUSY); return false; } } else { mas_ascend(mas); - slot = mas->offset; - mt = mte_node_type(mas->node); - slot_count = mt_slots[mt] - 1; } - } while (slot > slot_count); - - mas->offset = ++slot; - pivots = ma_pivots(mas_mn(mas), mt); - if (slot > 0) - mas->min = pivots[slot - 1] + 1; - - if (slot <= slot_count) - mas->max = pivots[slot]; + } while (mas->offset >= mas_data_end(mas)); + mas->offset++; return true; }