From patchwork Thu Aug 17 19:15:04 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: 13356879 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 7E6CAC41513 for ; Thu, 17 Aug 2023 19:15:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CAC6B940011; Thu, 17 Aug 2023 15:15:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C5BFF940009; Thu, 17 Aug 2023 15:15:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AAEF7940011; Thu, 17 Aug 2023 15:15:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9ADF9940009 for ; Thu, 17 Aug 2023 15:15:22 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 1EE46A0A24 for ; Thu, 17 Aug 2023 19:15:22 +0000 (UTC) X-FDA: 81134550084.03.604CF72 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf04.hostedemail.com (Postfix) with ESMTP id CF2084000A for ; Thu, 17 Aug 2023 19:15:18 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=Bt9hF2yg; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=iJe6Zif1; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf04.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692299718; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=5RamWKiLdkEaDiqSBw2gtXgT+/BnWPl6WXQ6gnjpZNQ=; b=0hF7yEmb4nC79z2glEOC7tBuHy0mCZirGdJk6A+gFDI1NUXMx27DcS5bzrhfWg1YjwexkA C9VCAHJCU0UF/yDzoMyTFEru0x8z1OCjEspeu6+l6eBRuuJh9IwOefwIDH30H8genqwwhd Jsx6d/k4l0qDl25wa/mV23XgntRWG+w= ARC-Authentication-Results: i=2; imf04.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-03-30 header.b=Bt9hF2yg; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=iJe6Zif1; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf04.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1692299718; a=rsa-sha256; cv=pass; b=kzmkyOjgPnjzJmWxZ4k7EigFh7D+M/+SzefAtRADKxUK5o7g2YLRuG9nQWYKL/iOxRIs2Z sqZJDjdfF+dJEngp1fQDcyfJwRxo5Zn9LkHA73jjafSUiK3F0iJF2uRX+bbbAoYt0KcDVq exSfa5YVnQ8VGXRo0/Au5L07ksL8QJA= Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37HI4Rup011209; Thu, 17 Aug 2023 19:15:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=5RamWKiLdkEaDiqSBw2gtXgT+/BnWPl6WXQ6gnjpZNQ=; b=Bt9hF2ygN2EYaMfuptPb8RDabCzrGyM3704HaeKMxQMRzciFEn3LNCTUQmGzyZFOjdQO C6nqe6N+WXCcmnXuMx3jLcUUyOc1fEesP7TDS4evILYgJytWPDpN4zlgYlAz9+mp9B1v eCnpWjmbDEWlUc13JaSTeK/6TmMKlFx7mh7iX8IwqaYxNluspnKKxVEZ9o9dzRb9RTpU Es925KoxIlDKl31ARg13BszxYKQC2Q5od+TM2HLqumfFU5PI83c8FHGcIWNY1C1pyPIP 4ZZY57S/dMVTCFU+waLNXayM2RJYNnGCX3rAsqqPx20qf4HMKUm9wLr+YqrN/nxesTZ2 Uw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3se61ca8cu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Aug 2023 19:15:17 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 37HIfIlu040055; Thu, 17 Aug 2023 19:15:16 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2176.outbound.protection.outlook.com [104.47.57.176]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3sey0u0fgt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Aug 2023 19:15:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CPpvh4qRlKXyd3Nw5BQmfy+HHiawm0krlFYS2XMnpMtQ9iVt0uy9xStPG/CaTA0Pq0ZbTw1/DkxZIVOd6Q8kiFY9yDQZo7w/WOm2+XaCP/A3eVY5ZBdWfZX8hklt1dHeVYXFRoR0kOZ7Qt3iGuJYdvAOgEoFKqtbA0nYBXB1jfjyyicLg8T88K96UDpBT7A1pbrT/vHg0PSHhjRsbtzx4Qqc2ZYNhIOg5sJcEzTt7VtrXXZgXZTAFruuk5boozR9mSF7rrAlg22O7U3sehxeg+VUiB5/P8AUqj53cYTNAizAUHdV+U1id+NTONw2ah5SA7gjVudysXGgkIaRF8ifVQ== 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=5RamWKiLdkEaDiqSBw2gtXgT+/BnWPl6WXQ6gnjpZNQ=; b=cHD93fRGvfc6FWLp6QWfED74cNRTUexLwf2azf+iM7vcLMAQPgn0HDhLNZmuRCCh5l/yrEYNZG6LA9WrRI3PhY/MFvNmfbnK0p7XlG7TMon6Rzf9bwDJXmJohU6AqkZ+IILzOlhpeXAFjq3x58eh3FaPAfRe6LDcUxtuxjFgSwdO6Vr8sUuyYODWwqeAHNTNsDA9zKABVacwgOUKutm0jHLf0RS1o8cK/1kZJIryUG506fT6y9o7th5OZH+jNmTNTocmZge8kwJyWKqfczpVDjVBL3yrmBbdsd7O/8nJh4FjIsklrCCTG0U+6/v1KMblAd05pR9ywmqx4cRIl0gxgw== 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=5RamWKiLdkEaDiqSBw2gtXgT+/BnWPl6WXQ6gnjpZNQ=; b=iJe6Zif1iiMtHWc37SlFNjYVCIfnXOnfl2GRNq/9exC39pNOBaDCTKkmiPgqGgLURIDHzFiqmmQgPDVfZH2q5oMpDC+Gy3jXdzmYa1lTIiC1nJYAngsEN80m/BpzsMRp85sXZyDz5SdeOG9RAht3LmhArlgNSSQRBx9gZvpbpn0= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BY5PR10MB4148.namprd10.prod.outlook.com (2603:10b6:a03:211::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.30; Thu, 17 Aug 2023 19:15:13 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::26d3:6f41:6415:8c35]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::26d3:6f41:6415:8c35%3]) with mapi id 15.20.6678.031; Thu, 17 Aug 2023 19:15:13 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" , stable@vger.kernel.org Subject: [PATCH 1/2] maple_tree: Disable mas_wr_append() when other readers are possible Date: Thu, 17 Aug 2023 15:15:04 -0400 Message-Id: <20230817191505.1170876-1-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.39.2 X-ClientProxiedBy: YT3PR01CA0029.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:86::35) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|BY5PR10MB4148:EE_ X-MS-Office365-Filtering-Correlation-Id: d2698b26-6856-46b4-f896-08db9f564864 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A3TNhfrrI1QNnR8LO+eaB2lEXSpZisDXOTR6Z69V2NZHN8eSpjRMnOXO1tyPCitYNpx35pMGSQ+nDCnVfhKDPbPYHnrU/yl5ZbQlZ0TwouMRSTSWqWXr8vWs/XS2Ojf8NUd11vEhRqikSMH5U5eq9yCTb3zjxNWYmyGfjznJoBO0gJWzg6xLQCqtiFXF+i7wTT3ball3MNBUalgTyIxRfWLCemwEAscgLeGhmOIxkLF6VP0h1wNyiVMdNs+Qf/p/3T+HOsJbDHygptTthY2NBySV1RgVTarXEdM8/6BcxYfnqvko+PgAaPOrumj+OMhohuIADOvrXuchnFb/sic/6wy0yR1NI/scAIUNXqPy6NDUNuzfCkzZIXLiYWy+CHRDHPaJGTKd5vRqOkzYkLy4M7oxMlxXpBobLgZif2tAd+ll/lvOywnxqQHJpP7V/ZYLWTjQyC4qZ6FZx5nOeiON+sqEPL/eQ0KDwSnpsPLqUmlhgefBgvkDDf3Clqg2nuUzEyMvsvJd1WFpTBosC6ncTk6jVnW4hIC67voIbQw0PIDX8CZPMLZXz+X3jFZvry+k 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:(13230031)(366004)(376002)(396003)(346002)(136003)(39860400002)(186009)(451199024)(1800799009)(36756003)(86362001)(83380400001)(4326008)(8676002)(2906002)(5660300002)(8936002)(41300700001)(1076003)(6506007)(26005)(6486002)(6666004)(2616005)(6512007)(478600001)(316002)(66946007)(6916009)(66476007)(38100700002)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Jzh1YVnc1RB9GG0WXIfpVzsClJE+ecvUm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jx6n0voxYhKwANGUP5kAK3gPiLH99ltUyb3q+Ok9ic+4vOEHGxiQDj0vLR8caHnfy2g4M613mvyXtu/LVgwHY/2S1OT6U5cc8na1mxXNpw0OXPeRwGnHe2b0pKMXguX1la6NLaVlPkFC7G50qiRyWqgXZv4tcDBCo7FlpF8S8CY5XN4YfsXZyvG5m2PaULi5I7U3/DqJnMuoDxvjle7N15cILSxN10LRzFuYLyTYnCESSD7LDXM2biEC29ScADIFUisIf8DWH6cuWM4+smHBjGFekJpumiJwmhX4l5MfSfNUuJRNd8x20K+YU80eLNxTXFIExe/YsvxweLPeEigS6kiN38crAjP1XHEWbnsQXFq4MXrUN0fsr+YpdC/7xoPb7XO7n2zP2SQ0go2XSnkjaT9w== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2698b26-6856-46b4-f896-08db9f564864 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2023 19:15:13.5033 (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: OsNmT5gKt807h3iF3eq5KrIRRmpJLM5QxIDSh707zI7+v/MnJBHAyibsiVx8TWnMihI+RhTUtsGXy2JM+GR9ew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4148 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-17_15,2023-08-17_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 mlxscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308170173 X-Proofpoint-GUID: rlEViHo9uv0vmDzLaSXy7Tw_ZX0TS_t8 X-Proofpoint-ORIG-GUID: rlEViHo9uv0vmDzLaSXy7Tw_ZX0TS_t8 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: CF2084000A X-Stat-Signature: 6g6o8nx36uihp7jc1ju8biacyjec4if5 X-HE-Tag: 1692299718-382457 X-HE-Meta: U2FsdGVkX1/8aT/8P057A9MGZeiNqz5h0QMIqfPCIMd7k8pB/TMbR7mSIy+qvVSC69kX/drtbkEdRdhE7P98LNLOu8XYNpiUutDKOOTyC25NQIL5DA/heQ7zeX31aaDxuWSATI6tEbeqbvRtqQJzA9igyfzw62X1UkQlXj7jrEicpUbdTIu5IzXc/qSx5USsAxNsYxnQy5Pwo7gQGxhWYCvOjzGQaZuV0WiP4kCPD8+Uok9ZLj7TZNnd8F2sgtWW4iDtpugyYkSb/ytJdK/J57+2bXpzjLFArOwGwpq79BNLX9dGe6U2LrwnPAybDcIjgFaD1Ll9TkbYk06ix0x8u2/UKGYXvLnDVXnH53rYnPVWqoPszGZBWkoZlVD1z6zDHJSbET8dnx+ieZbf36htuLo2hOuZPHL5fn4YMfT4+kkL/1epNMEorVSpCKvoOLU6B9xWlC6EDKocIK/ZcCG03usMiWjzH8vBdn/HhDzHkbo+a9uVzch+BCpLck4rDhajSK4h1umNZzfYVamQatU7b9OFCuixWK2psQkEWGPImiL4S3JzAjeXMWZShPc4ycXqssQXNLpvwWY0b6dmxyY8Xmigmw3/UzyhMMjInswPqwxL+M0Di5iJQ+iSEvosk307UITQyF0Y9sD9OvXCZxXTmhJ9BFa1ig2n7/+Sgs317IaNOVR/kPUAkdtVLki4xVTuBmu5tSmG1fTKZZja28ls+thZr/Qi5IDmHJp7JvLOLX4F1Q9MmI2yRL3Awra5kkCDOFnEi47s4X7GtNGSznluvIYxpOqT0NT1Lm6OZktu69RAOTZoMZg97ISxuBU76RqUCqAWXMm/uIlYvD5QEUqugb09P2o9pwaq23Ts86ANA2EMacGiTCyE6kJlaSN0JpH8nyV+7KLSaWq7lZA+mcr/Q48sOfAk4wROTzWSJQaYKKUncrUwFnRBtYQjG2S0151rxuUe86xeT+6YLhgTzi6 mQSZqorD +tVJAF+G0RBvstw4yh0irKTKH4+TXGGbmy/zouThCaTnfGzqHgF3olGasoGVyvEfhm24lYwE72gCiyc8skwMSLAqF7ZqDM97Ulj9/R79jIUemxkx/GikL56G63sRfiWe3b8D2v4CHXyFPfNzbwvUvRWEelylwc4jmGbWCPDpWR9X5kYrHz2fZaigW+yHlUvweGXH91ipUN0fabFEcFLW7xtk1fL/czmB/9k4ZU+aITmWQP0W8oT3etHyFVr2IvGwk4QBXsjntwqvKYfn5Y23bEacWjiRzBFv4jQH8AlrEKzl0QHlIchfaldFtFhYNI0T3cCOmDtio9rlxoKfhfSwmkiPnEF7YT85MAgvhsJk1P07iODZaarGhMUs0YVXBzoFvTUlhfr2p0SvJhWIsihF0Qjh7cStuP/oXdWe1Y8umvK8xBoAv0EDKuImAC9VO11zGEriLS8J4Yc2760Y23KwR97dYY2rsI5knH4dJ 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: The current implementation of append may cause duplicate data and/or incorrect ranges to be returned to a reader during an update. Although this has not been reported or seen, disable the append write operation while the tree is in rcu mode out of an abundance of caution. During the analysis of the mas_next_slot() the following was artificially created by separating the writer and reader code: Writer: reader: mas_wr_append set end pivot updates end metata Detects write to last slot last slot write is to start of slot store current contents in slot overwrite old end pivot mas_next_slot(): read end metadata read old end pivot return with incorrect range store new value Alternatively: Writer: reader: mas_wr_append set end pivot updates end metata Detects write to last slot last lost write to end of slot store value mas_next_slot(): read end metadata read old end pivot read new end pivot return with incorrect range set old end pivot There may be other accesses that are not safe since we are now updating both metadata and pointers, so disabling append if there could be rcu readers is the safest action. Cc: stable@vger.kernel.org Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index ffb9d15bd815..05d5db255c39 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4107,6 +4107,10 @@ static inline unsigned char mas_wr_new_end(struct ma_wr_state *wr_mas) * mas_wr_append: Attempt to append * @wr_mas: the maple write state * + * This is currently unsafe in rcu mode since the end of the node may be cached + * by readers while the node contents may be updated which could result in + * inaccurate information. + * * Return: True if appended, false otherwise */ static inline bool mas_wr_append(struct ma_wr_state *wr_mas, @@ -4116,6 +4120,9 @@ static inline bool mas_wr_append(struct ma_wr_state *wr_mas, struct ma_state *mas = wr_mas->mas; unsigned char node_pivots = mt_pivots[wr_mas->type]; + if (mt_in_rcu(mas->tree)) + return false; + if (mas->offset != wr_mas->node_end) return false;