Message ID | 11692A57-6A65-4ADE-BAE3-169D50A1FC16@meta.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:a59:b0:164:83eb:24d7 with SMTP id 25csp2315834rwb; Tue, 14 Nov 2023 17:17:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/CltEk+PXOwyOrzSpweL9oACRhwWLFbQLk8UsfnFo1xEiGCxtWA8puSPI+69jmxl3IyHD X-Received: by 2002:a17:90b:d97:b0:280:963d:9cb with SMTP id bg23-20020a17090b0d9700b00280963d09cbmr5877942pjb.23.1700011054666; Tue, 14 Nov 2023 17:17:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700011054; cv=pass; d=google.com; s=arc-20160816; b=Yn6A4bbvYJGqcK96tt/HjEUDotHIiLfFJBsMIgIew9gijyb/VzucsW2J3d8hrfMKqe QuKFRdhRivpCjoUiK33hJOGXKe4G8my7lux1IxQOyZWkP2JKV09+qzqu7dLxIq0OPb5A cGOTfBuSxppqvizJ/YKziNV9dp3YuNLFZEtlg+4k8FsCo2DuD+G7/2VSLQVadQCdZoDB d7rbZEEpXCsK9YINSZSRumrrvEZQGPL9A0VwS5UZhXJpOizu6AqhXj3JcaHfJRAB9dMh Xq4aUw1vpqiznN0Wjpf0SA2aNbfvW3Dp3WcJkjtVai4zzGV5AdGzTK54w6zmVkA6Ok40 9JHw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-id:content-language :accept-language:message-id:date:thread-index:thread-topic:subject :cc:to:from:dkim-signature; bh=n0qVFkp8+CRlhtgaViEaByzGlKNbf3wNq63IJmn23Vk=; fh=sDDeOovu2nnmth7OcFujtrwK5RALTG91wmLBLaQIw9o=; b=WkgjswRE/SHHrU/D2mCjRpwBrZMhtfPm3JJNmV40tBQdyvo7HGRM6BGB3wCGvNISyd 5OUtcnfSeKiT9eww/lKUkwDYg1mU0497pS6osclrmygV+/Sk2WE/lTPTBfYNgqWHCNrh S85YIILphNfkJ0RlZxIR/AtXIRlKe2ULSGr9/KEHrX4XXdhJzaozd4aAL3UmQIjTfEJm F63VcwlbRFoXWyWnk4UCH5w5cPtRJar7pS11WgKLLnyWvN/8ZUzB8oi51LGvV56onYKy 878c6W/egKLm3Aihn/F/xcCeTeVvF2Xf/4yNxC+wZB3Vz+KpDr/+YTdgFSofyQ0SsHM+ msBw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@meta.com header.s=s2048-2021-q4 header.b=XipbJeV7; arc=pass (i=1 spf=pass spfdomain=meta.com dkim=pass dkdomain=meta.com dmarc=pass fromdomain=meta.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=meta.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id ft4-20020a17090b0f8400b002806bdcaa5esi13742929pjb.110.2023.11.14.17.17.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 17:17:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@meta.com header.s=s2048-2021-q4 header.b=XipbJeV7; arc=pass (i=1 spf=pass spfdomain=meta.com dkim=pass dkdomain=meta.com dmarc=pass fromdomain=meta.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=meta.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4D5048029C46; Tue, 14 Nov 2023 17:17:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234221AbjKOBR1 (ORCPT <rfc822;heyuhang3455@gmail.com> + 28 others); Tue, 14 Nov 2023 20:17:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbjKOBR0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 14 Nov 2023 20:17:26 -0500 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 509B3C1 for <linux-kernel@vger.kernel.org>; Tue, 14 Nov 2023 17:17:23 -0800 (PST) Received: from pps.filterd (m0148460.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AF1B1jT005163 for <linux-kernel@vger.kernel.org>; Tue, 14 Nov 2023 17:17:22 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from : to : cc : subject : date : message-id : content-type : content-id : mime-version; s=s2048-2021-q4; bh=n0qVFkp8+CRlhtgaViEaByzGlKNbf3wNq63IJmn23Vk=; b=XipbJeV7nII0HCyTeEN5cl1YGEx1Zxg2z/lG9rP+n7dImUqI7ITsS2HAp99lyKrEs1s2 20CqBM1p0wBGc9DivS8twQNxye9SOeBPB7qqv2N+ZhZ5SxkAW0UEnU+8Ktu2T9igW3nG W1Ji+h/0a2r3tzMfGAm/JI8PeztBp6jfkBWVK+dBiBA129veAdCV9MdgdJyrP0g3k9oa 1A/x2nXTg7/MJIRUIJq3SXD8fWJZFjOA00guvlZDzv6NJkYqJS7pEajCXu5DpOIk58vq K+B+qlPYviDzSCETCtgmtXAEZ36dxoxE518ibK4R+pqj7MvKs5uBiLt6AWgZwGJH9tZm 9g== Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2041.outbound.protection.outlook.com [104.47.73.41]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3ucd3su7v8-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for <linux-kernel@vger.kernel.org>; Tue, 14 Nov 2023 17:17:22 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dmuMsw4F0JNQvYESFy2z2WklKqNNq7yuC6SNKOyH7J7sfBCZBbMH8SkuJF1da7A3zSyRrg9Rr/MCLXSYZSrqwo3WEuN8GaitDeW2Sv65hZmLFvBYuFhZyba9d/09FhwEmRM+YHDhQY0bIq+RuXQFZsCSE4gh1PmTs/3n3KETbc4ty5Pn5STXdcbYQejIwaXbeZMwgkqoEGm+B3fEXgXA4Mw+XYz4P0BffSY0mpAooBh10iYJbQdC1zu+yl9FpUSec/JbRswsQOfZOydNZUj1QYZvS+I/CCihmC2e95anqlFnuLmHTskrzQxPMNZrK9nnITszV9p14DEeZ2/n3Uu9/A== 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=n0qVFkp8+CRlhtgaViEaByzGlKNbf3wNq63IJmn23Vk=; b=kHKt7ZhMyE89nZ+fJp99AZnF0or2kzz5BNSE3b5c1aUrR9rLBFeYul6Z1ETmhnwl76QtqBFLGr6YZdxwDq+3vaiGn4W49DqKGuvqEMBKaUePM/PYAh6xE1AhAixRQNlIgRKJCXBQX/fMPhSB2M/z3lp15rZH2nlU6M1FrlUEJe0ZgZW3yCGO/CJZqTFsavhyARlUJ8bs528B+KaV/TVOZb91UD+XuXytlnzqQLeS8hYgXKD0lP0WWSYHGIDxyEyAAwKaiIym6Sh3e+/i39HnOhwBrmv5XYzda+bfXEjeT6ZFhVL8G1tDL0XGABLuzmWeMqMEugGXRLflGpb1ASft9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=meta.com; dmarc=pass action=none header.from=meta.com; dkim=pass header.d=meta.com; arc=none Received: from CH2PR15MB3672.namprd15.prod.outlook.com (2603:10b6:610:5::14) by BL3PR15MB5385.namprd15.prod.outlook.com (2603:10b6:208:3b0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.18; Wed, 15 Nov 2023 01:17:19 +0000 Received: from CH2PR15MB3672.namprd15.prod.outlook.com ([fe80::69fb:5834:35fc:767b]) by CH2PR15MB3672.namprd15.prod.outlook.com ([fe80::69fb:5834:35fc:767b%6]) with mapi id 15.20.7002.015; Wed, 15 Nov 2023 01:17:19 +0000 From: Nick Terrell <terrelln@meta.com> To: Linus Torvalds <torvalds@linux-foundation.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org> CC: Nick Terrell <terrelln@meta.com>, Nick Terrell <nickrterrell@gmail.com> Subject: [GIT PULL] Zstd fixes for v6.7 Thread-Topic: [GIT PULL] Zstd fixes for v6.7 Thread-Index: AQHaF2F6q9TPJrt0ikm0E0QPYbFUPw== Date: Wed, 15 Nov 2023 01:17:19 +0000 Message-ID: <11692A57-6A65-4ADE-BAE3-169D50A1FC16@meta.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CH2PR15MB3672:EE_|BL3PR15MB5385:EE_ x-ms-office365-filtering-correlation-id: d2e7e53d-18f2-401b-992c-08dbe5789cbf x-fb-source: Internal x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: FMbEaGUIhwM5xngzYAM1dv3o/jqVxVlPrqo5W/Qw8CF5nZ5xsJZVDU7fCjO4LlpKLfTGautGbiZvqHuC05AWOpWfuvTmWP2eJFgSv02+S1PL3PDWKS04gviu/I2IucunWbM0L1ww1BTHNTePqejyZiZK90FCPLaukW5QFn1cCxmXNTk+AOws65mN3LrIYjZguOrMMvAYdWlZV0NpEuHpoYSA0p7PG5OQP+f1Qt4kjKqGyZYTmBDUiwZWPieE9ebHVkdkKQN+xMODXN8/WNG3f8RGmzqYgtaWPVeFzfRZkyK9CMQkA9ELqJYfCRbr7CeqgyQGJTOJi3fOKWqgR8d7aS6QZHoEhhrTuaySVv2DkjEOv5Of/cbB4iKWvGCmPLVNfhOWU8HsU6OO+Agbnoh0VfCERFc0G6fj9HcKhdYcTj/5DXegyrG/mv0MieZ6TmoNJQxOM7p8vFvaF1F2slWaBy2rusYcj0BPO/p7oIPhmvYFppWRxjbFLIlW8zNTLEfN+FCFgDGRM7osqLx/t2Ge6QWpW5TiT/W7NKhGch4rV7AiPhh5kMyVT5kdjWXTdAjdtUO/uSj/sGW3L+JwVmTL2i0/cKtromT+26wNur3ms6ig7Wrd0XxEJcHLSzq6SVOvyaIUpArgmozN+4UjfqBnlAkc/M5vc8Q+arRTO2c1s8pIDoMesk8pPCgjaIVqiiYy x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH2PR15MB3672.namprd15.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(396003)(346002)(39860400002)(376002)(366004)(230173577357003)(230273577357003)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(36756003)(38070700009)(4001150100001)(2906002)(5660300002)(4744005)(122000001)(41300700001)(38100700002)(6506007)(8676002)(86362001)(71200400001)(316002)(4326008)(8936002)(83380400001)(966005)(6486002)(478600001)(2616005)(33656002)(6512007)(66446008)(66556008)(64756008)(26005)(66476007)(76116006)(54906003)(91956017)(110136005)(66946007)(45980500001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: L704trSp8vmc+curveQZ2hGLBcGDbdVijQdJrNdednBn3hm2C8koWmKxvsS3JCCq1wbu0URdLQmItmdONXyWZztrbxn5ALxaxrO67NwyCjwOAZlCk87jL774SUbNmlPHMV4rBqOHzd5dCtFm8dpFsEv371ot4gqsrkk37A46sPqHm/R3o/Pc/lOQ02PVXrrbeuBJ2UGEKC8Rwc8dyjKmMZ3STUpXIOcMU4kwY3NdBjlcHpDA6HKLgPf0hmqd9F3FKVPv8KvAVDH3Fb7NvYHgx+7SAI0py75I0fnCKK51snyi/OsD1aQmMVAIIOeSdI7Kd7APuQ3lqaCKAsnH1FJqZg45oFT6V862Hvsz9GDIZYYpiUKe/BsnBRFYe2RehIZAfDw7PitxqGo6cqsLZcJQ8EYc4J7hepXTjCcQXOwbK0t2J3DQHDStw4s+6+5hdVBD/ep+RIB7Ody3wTxyvmsf5m5mJ4jhbJ7OrGgAbVHXS193odXQJ+0UjQUxsb9wOUSZeGAWbv4vdCuqdKi7Ud3wqWE6x1Kx82Ca3CJ77GU8mmQ16P/Uh9Ujtin9VDkGWC0mRRfdqD8AxePEUJD1UWLP7zfvA3Y75mNSQMtr7H8FUGxMtQ5IO5O6RKyhZJGOX2UFx0kcugujCy0pwNthtR+kFBv1REidvnrPs0vfbem9t0YkZuGTTNT3OPQvh8d3d3oFOewRFgDVXbnGnNe1B/+7vvL6Q4EIhRaJsISouBYHkt3+VNZ4V4eaSejnZWHLZvPb1+D+A4zuj6wvVtU8aA4aLjmgg6GAY6FMZ1CKSpXVe/DtFdbdORyLRc/A7F5Rd+g7lst0Lisfx10Iscc5cz4eyAOh/VSRkHPrt0g/Y3t8hMjv2lYTWVwcLN15VeOOOrv4vJRlNv4Kc72u1LrCM4Vxhqv5Eiw2tWQRMikBscljDaHOUR6Xvj5AIPgw/LdB5hRcWoWWGtQTHZjkvNsdm0VyBBH2HBSgVdYPjvDEQl8//8a4tUsXMLbCaL8hvq8bvQvNk+OuMw+ZRcDZwY/BiXALQU64hfLYjKp5k2gfbDjUrDRSzayTwChM6LkL2lU9/2mBO1hQCS6tYijqXZMa+TAVUJzdxtGxuj/JYgx7SJensbBneQB4SKmeo14xeTAQ9PxhRS/gKKs+HZchRRb5b9IgXXl+QL6cx2kcoEJkiT24W/hvC5LOwcEfDCsGwx4NfeWEirK7ZeqgvxcWIajPy5zpw9r9Rmu0fJQRkPhYUSwsKxyJk5kbNdWdYCWNQzaro/6kXxdfEB2vp9eIH8B073nukDDBFiJF2uvm2Lf7gXYW/7c5aesvOTX7QxTJNyy1L4B4K/A0kdFmmWjJNCxIV1SmxmxD1rvlYRBZ7Kbw90an4Me/0qFxTyS2bWSYhmfbF92kB5Z9GKh9CTxx/4YH90wJvarwaFBCnUuxBVclb9oN6gLz0c7w+AVi9wA8QTFD25axlv9f2iyTObyKDNarun/tmcChzH5BwkDpaEPbb6BTkicuOziYzANigz5MBB3AFwIqvnUGerjwZcnckotXGO18+mIspQLd2jeJqIg29Qu1+8VmrrCGHMCZRWlafFcidb+4 Content-Type: text/plain; charset="us-ascii" Content-ID: <CBFCF571B0A5834DA0937FE281529EEF@namprd15.prod.outlook.com> X-OriginatorOrg: meta.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CH2PR15MB3672.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2e7e53d-18f2-401b-992c-08dbe5789cbf X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Nov 2023 01:17:19.1378 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0fNGIMoUf+MPh3UCEiBHY95g5n1sTka+ad1EbAOXQK7YlgrRO+mETL3WCpNoZO3LWR6g6WVL7jf3Q/NCeyEwFg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR15MB5385 X-Proofpoint-GUID: IeBMo0yV8FfaIk_BJQNCECcCvt8ZD1V4 X-Proofpoint-ORIG-GUID: IeBMo0yV8FfaIk_BJQNCECcCvt8ZD1V4 X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_01,2023-11-14_01,2023-05-22_02 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_NONE, T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 14 Nov 2023 17:17:33 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782590791717092087 X-GMAIL-MSGID: 1782590791717092087 |
Series |
[GIT,PULL] Zstd fixes for v6.7
|
|
Pull-request
https://github.com/terrelln/linux.git tags/zstd-linus-v6.7-rc2Message
Nick Terrell
Nov. 15, 2023, 1:17 a.m. UTC
The following changes since commit ffc253263a1375a65fa6c9f62a893e9767fbebfa:
Linux 6.6 (2023-10-29 16:31:08 -1000)
are available in the Git repository at:
https://github.com/terrelln/linux.git tags/zstd-linus-v6.7-rc2
for you to fetch changes up to 77618db346455129424fadbbaec596a09feaf3bb:
zstd: Fix array-index-out-of-bounds UBSAN warning (2023-11-14 17:12:52 -0800)
----------------------------------------------------------------
Zstd fixes for v6.7
Only a single line change to fix a benign UBSAN warning that has been
baking in linux-next for a month. I just missed the merge window, but I
think it is worthwhile to include this fix in the v6.7 kernel. If you
would like me to wait for v6.8 please let me know.
Signed-off-by: Nick Terrell <terrelln@fb.com>
----------------------------------------------------------------
Nick Terrell (1):
zstd: Fix array-index-out-of-bounds UBSAN warning
lib/zstd/common/fse_decompress.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, 14 Nov 2023 at 17:17, Nick Terrell <terrelln@meta.com> wrote: > > Only a single line change to fix a benign UBSAN warning that has been > baking in linux-next for a month. I just missed the merge window, but I > think it is worthwhile to include this fix in the v6.7 kernel. If you > would like me to wait for v6.8 please let me know. Hmm. You claim it's been in linux-next for a month, but why the hell was it then rebased *minutes* before you sent the pull request? That's really not ok. Rebasing literally removes the test coverage you had. What possible reason was there for rebasing? And why didn't you mention it? So stop doing these dodgy things. I have pulled this, but despite this being a "trivial" one-liner, I think there is a bug in there somewhere. In particular, we *used* to have typedef struct { short ncount[FSE_MAX_SYMBOL_VALUE + 1]; FSE_DTable dtable[1]; /* Dynamically sized */ } FSE_DecompressWksp; and in FSE_decompress_wksp_body() we have FSE_DecompressWksp* const wksp = (FSE_DecompressWksp*)workSpace; ... if (wkspSize < sizeof(*wksp)) return ERROR(GENERIC); ... wkspSize -= sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog); and note that "sizeof(*wksp)". Because it has *changed* with that one-liner fix, since now we have an unsized array there: typedef struct { short ncount[FSE_MAX_SYMBOL_VALUE + 1]; FSE_DTable dtable[]; /* Dynamically sized */ } FSE_DecompressWksp; so while the logic actually looks better to me with the change (no more off-by-one errors), the fact that it used to work with what looks like an off-by-one error in the sizeof() calculation just makes me go "Hmm". In particular, that wkspSize -= sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog); seems to have removed too much from the wkspSize variable, but it still ended up not triggering any limit checks. Hmm? End result: this may be a one-liner change, but honestly, I think it was done HORRIBLY BADLY. That one-liner has serious implications and just a trivial check of mine seems to say this code is or was seriosly buggy exactlky when it comes to that one-liner. And no, rebasing minutes before sending a pull request is not ok. Linus
The pull request you sent on Wed, 15 Nov 2023 01:17:19 +0000:
> https://github.com/terrelln/linux.git tags/zstd-linus-v6.7-rc2
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/86d11b0e20c09e0a91cd2aa57b115000274e2ac5
Thank you!
> On Nov 14, 2023, at 8:31 PM, Linus Torvalds <torvalds@linux-foundation.org> wrote: > > On Tue, 14 Nov 2023 at 17:17, Nick Terrell <terrelln@meta.com> wrote: >> >> Only a single line change to fix a benign UBSAN warning that has been >> baking in linux-next for a month. I just missed the merge window, but I >> think it is worthwhile to include this fix in the v6.7 kernel. If you >> would like me to wait for v6.8 please let me know. > > Hmm. You claim it's been in linux-next for a month, but why the hell > was it then rebased *minutes* before you sent the pull request? > > That's really not ok. Rebasing literally removes the test coverage you > had. What possible reason was there for rebasing? And why didn't you > mention it? > > So stop doing these dodgy things. I’m sorry, I will do better. Thanks for taking the time to point out my mistakes. > I have pulled this, but despite this being a "trivial" one-liner, I > think there is a bug in there somewhere. > > In particular, we *used* to have > > typedef struct { > short ncount[FSE_MAX_SYMBOL_VALUE + 1]; > FSE_DTable dtable[1]; /* Dynamically sized */ > } FSE_DecompressWksp; > > and in FSE_decompress_wksp_body() we have > > FSE_DecompressWksp* const wksp = (FSE_DecompressWksp*)workSpace; > ... > if (wkspSize < sizeof(*wksp)) return ERROR(GENERIC); > ... > wkspSize -= sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog); > > and note that "sizeof(*wksp)". > > Because it has *changed* with that one-liner fix, since now we have an > unsized array there: > > typedef struct { > short ncount[FSE_MAX_SYMBOL_VALUE + 1]; > FSE_DTable dtable[]; /* Dynamically sized */ > } FSE_DecompressWksp; > > so while the logic actually looks better to me with the change (no > more off-by-one errors), the fact that it used to work with what looks > like an off-by-one error in the sizeof() calculation just makes me go > "Hmm". > > In particular, that > > wkspSize -= sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog); > > seems to have removed too much from the wkspSize variable, but it > still ended up not triggering any limit checks. Hmm? > > End result: this may be a one-liner change, but honestly, I think it > was done HORRIBLY BADLY. That one-liner has serious implications and > just a trivial check of mine seems to say this code is or was seriosly > buggy exactlky when it comes to that one-liner. You’re right, the code previously had an off-by-one error where it consumed 4 bytes too much of the `wkspSize`. This workspace is a shared buffer that is sized to accommodate the largest use of it, which is not this function. So there was enough slack that the extra 4 bytes wasn’t noticed. But I absolutely should’ve mentioned why it is safe in the commit message. > And no, rebasing minutes before sending a pull request is not ok. > > Linus