From patchwork Wed Jan 15 00:49:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viacheslav Dubeyko X-Patchwork-Id: 13939712 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E66EC35949; Wed, 15 Jan 2025 00:49:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.158.5 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736902176; cv=fail; b=uLEdcNjwJ5hU1tm/6JZ4ISEsyryBzqZOL8ezLYEqz5X9JB8/JVx2MVvZ9sngbmYZA284z2Vsh4HSFN/23y10W2QikVaNsAeZwFNv8/uivtim+VigVhrbcCYmRyjAWJemRAYTdnHo866bspkk6ZjlsdN6vzK2lr40HwhGYv39cDs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736902176; c=relaxed/simple; bh=iuaq7yH0giZVBuxMBKyl+4YS0Ebr7ilNj49nJWwsDqc=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=nWqla/kUkPfDxxtn1OuXp/ElWp1QQbSiywMYNuD4KH9qclwCtYJH2LzmV96ACRLdc/H5sDGQgpoB3RM9yOZFD4n3SPAdRN0IMFWnySFuGlxWUbpS3ixfAOJl8nxu9bucd70hIrG9EbTyoTnMCnlshQRB0yiRf2DB8IVqo+6wWM4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ibm.com; spf=pass smtp.mailfrom=ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=qMBaQXe+; arc=fail smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="qMBaQXe+" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50EJsTIH022211; Wed, 15 Jan 2025 00:49:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-id:content-transfer-encoding:content-type:date:from :message-id:mime-version:subject:to; s=pp1; bh=iuaq7yH0giZVBuxMB Kyl+4YS0Ebr7ilNj49nJWwsDqc=; b=qMBaQXe+boE+Em1j1LnpIoSsjqEiQG3PM CzJUKDeSmfozgafoBBXwNN6uHFhBixiWonV5fUE03TJzU4fjxUIp1HOg6LGDXEJT h9CIVbWXgs/iNxc1ConVUZ7elAMRxzVLgSvYa1Qs027C2Gd/Pu+Y3m6In71tMcNF z4Pu4BM7Om236ySvYuAEANuAYdkggw1qAhB+JyHkI8tx7zsqlRDaTzU0In4thSg+ 9TiWnW48vMmpZqax0Gfvw887dPfhvLzfUG4En3wptscHAZp6eeht56Q3rzxUSXkY J6ysBNgqlL0xJSeznCub+cDuBVcL+bei33DqELprRliqe5pNZZ/Lg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 445m433ugj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Jan 2025 00:49:31 +0000 (GMT) Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 50F0kZa0032479; Wed, 15 Jan 2025 00:49:30 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 445m433ugg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Jan 2025 00:49:30 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EghohZ8M2hY5C018HJN5I02QW6bpUpcMCBOw8gyLoXhtxHUDO3YeP3U7JsMmZ8NL1CH1GDmMdBFhB+MIKnxIrg1Mmpti4ivDvCftCZBnM0AVDeZvrN+p+V032J6yG24yTU+uMXeRr31EQOWpugChazAuxfFX0NkU0WTlnA0gEQRzVBw0gdIA6nVxVs6aODJyEWmaphEnPI2T285BjttV910t+9+Nr3EZAGpw2PLoQUvaVF9Eit9IlbG52YdDmEhdCaLqZ+Ha7XiD0++iPBTKfE2Nz+z6Ov8tRdo5H0FRhWDwIShv0mwTAIzx8RxmzdUczEIzl+in2cnPly9M/QlzBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=iuaq7yH0giZVBuxMBKyl+4YS0Ebr7ilNj49nJWwsDqc=; b=Knib+W5ybA+SHLaVkO6lmZaOWaoejGVftdYFy79QNFsFMx6VKVTPmBqECvX+XsrnGEOink4mzeC82MpZu5bMVorgDOJWnvZoHVjKWUyt63obx1+RzdDONIaKs8E/anADduT4YX+b/qKQAyQRHR0KavS4k3gSx5mhWsfKshNip6OkQQNEfu+p9K91PsbfMtfLTeT1gox9YJzUxNj07AJqJTo4OLa3LWeZ+UCF7L+WkE3DuGzTpkXI0LkBN7Tb36CGyDUHv1CVQ7e7vspuiNNdYUcT8cMS3QaUVQHk6SVrG1Uar7RftdtVrUZ1Na4S+Trn0IDgEwBxWJc9ds6Uviq3DQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ibm.com; dmarc=pass action=none header.from=ibm.com; dkim=pass header.d=ibm.com; arc=none Received: from SA1PR15MB5819.namprd15.prod.outlook.com (2603:10b6:806:338::8) by MW4PR15MB4617.namprd15.prod.outlook.com (2603:10b6:303:10a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.18; Wed, 15 Jan 2025 00:49:28 +0000 Received: from SA1PR15MB5819.namprd15.prod.outlook.com ([fe80::6fd6:67be:7178:d89b]) by SA1PR15MB5819.namprd15.prod.outlook.com ([fe80::6fd6:67be:7178:d89b%7]) with mapi id 15.20.8335.017; Wed, 15 Jan 2025 00:49:27 +0000 From: Viacheslav Dubeyko To: "ceph-devel@vger.kernel.org" CC: Alex Markuze , "linux-fsdevel@vger.kernel.org" , "slava@dubeyko.com" , "idryomov@gmail.com" Subject: [RFC PATCH] ceph: Fix kernel crash in generic/397 test Thread-Topic: [RFC PATCH] ceph: Fix kernel crash in generic/397 test Thread-Index: AQHbZudU+k3K5wcZb0uhK36QvE8a4Q== Date: Wed, 15 Jan 2025 00:49:27 +0000 Message-ID: <266c50167604c606c95a6efe575de5430c31168b.camel@ibm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SA1PR15MB5819:EE_|MW4PR15MB4617:EE_ x-ms-office365-filtering-correlation-id: 16968e63-b893-4f70-a0e6-08dd34fe7701 x-ld-processed: fcf67057-50c9-4ad4-98f3-ffca64add9e9,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|376014|1800799024|366016|10070799003|38070700018; x-microsoft-antispam-message-info: =?utf-8?q?uP5ZKJGz1K91sYiuwnsTJzblXfJe04b?= =?utf-8?q?EHtCMC5kuoTuwsSxGwqJ0t1isBAJin3ruHQA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h8RR/eJpHDHuUYDk0nJnrl+CAb?= =?utf-8?q?Hru7g5BTlt7jPlPKiV17rlTMSFIi99a6a72qfuNNyXHSBGCgr4eGvsh7CeNSVU39q?= =?utf-8?q?/RPQk22OpcDTDYu1vN02zoMp0Ix9wxHutVKQL6agDjFemcbhDyfbtxnU2IxKFyHtY?= =?utf-8?q?c5FNLjQ+6aGchcIKmaHcb7oqrJAVWl601T2fG/vDfgaA0C75Hb9IBZLPKGD7nrNyz?= =?utf-8?q?8Z85KK3VfPGDGHRTbFL4Hyu08fYmVJ6IPbkNy5y53qmZhZxJQAGyERg9YmX5Z/Oo9?= =?utf-8?q?MuymJJsMi1IG5ys8d1AOJ2b4SSVczFHZAwGEzC6g4ausLOeMriCF+txAInuItxDR2?= =?utf-8?q?Fv5cA8hemQO9H+EKaWXGaNuXTcb7fiu52ucr4HohThomH8xtMGpvyFLpXg652LZzm?= =?utf-8?q?6p2A2E7iWRlr1gEgGKHN4nQAQsytSq309UrFXqg3kxZsusbZb3UMMqRIjY4WYE1OS?= =?utf-8?q?JRV7BL3Rb2A?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR15MB5819.namprd15.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016)(10070799003)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?vQamPp5FhMYIVkM6xs43a/k+CLH5?= =?utf-8?q?9N5DFPSnPVjisuD0vh+B4WHECkH8GCUZiZCqM6AZuuMcDutHC8+5ReRxmfQdJpOmf?= =?utf-8?q?ezFXU/aIXr05xNCAYmxayrXlXYhSvT4sKuBLWPTbwdDnY2AmGQLNarC0EHdrdFCvU?= =?utf-8?q?D5Iy6YSyp8jXwawQXndUgoyd2o17wIwKn4+vM7EDL03LH1x1CZQuu7zUeMCdrXYhX?= =?utf-8?q?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n5gysJiB5N1i67Ov5ceNvDJC1W0nfweJII9Lbtainuf9e6ZnM00dVjat7eYpr?= =?utf-8?q?Q5wwRNL+v77qk9M9FC77/brYTGBtiyIRMlD5AEHfa3LFRL4tXTrpE52cxqgRQyuEo?= =?utf-8?q?kfz/dW1f5tw4S06LxofqfbOCzIWyUJlsjhifXIAvpI7ScET+pRA9X54CJO7L/ayQv?= =?utf-8?q?4pV8ORIzp6C3ajnoZSRMuG01oAi0B4AOeYtYJNshuGFWWlG31bdF6MjDqbczqEAiI?= =?utf-8?q?6UsmNZb/S4yzln4MYKVOFEn9upnexZCT3d7Vtlmfy9srro0FkTx7hoT07IuCGHgVa?= =?utf-8?q?jnXspiMVJXX0Gb49GKURBLNF9UOB/G/myN7cXg+qxlSnilyF99dCnKChNUgjwhSjF?= =?utf-8?q?Sd6UQKMVmq529TfAcAUiUn3Xs7TZcyvBKSaAXR0sfKbHKvcJxf9IKFEl2O4ln8hzZ?= =?utf-8?q?4PKfxGFKEprPj0iswBJRlQWluRwJxFTApjIzfT5m8cr7aKsD3rXlmtE=3D?= Content-ID: <9FF54251C4F0C0478A3BE273EA405AE4@namprd15.prod.outlook.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: ibm.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA1PR15MB5819.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16968e63-b893-4f70-a0e6-08dd34fe7701 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2025 00:49:27.9156 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: fcf67057-50c9-4ad4-98f3-ffca64add9e9 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: NLfPD3rWAiGoLXKfQo/klNp+mteqTn4XCDTeV38e/nFhW6NAXNerD6urGmvzsu/3HTGBqyCYLS1zUbwFraLzJw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR15MB4617 X-Proofpoint-ORIG-GUID: 7ZxNb4RIQzx8keHdZmfBTbeE5cB_qP3I X-Proofpoint-GUID: 9z6YqiNJeiOUNj2dYGrmXBBs2Fkf2i9E X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-14_08,2025-01-13_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 mlxscore=0 malwarescore=0 impostorscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 priorityscore=1501 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501150001 Hello, The generic/397 test generate kernel crash for the case of encrypted inode with unaligned file size (for example, 33K or 1K): Jan 3 12:34:40 ceph-testing-0001 root: run xfstest generic/397 Jan 3 12:34:40 ceph-testing-0001 kernel: [ 877.737811] run fstests generic/397 at 2025-01-03 12:34:40 Jan 3 12:34:40 ceph-testing-0001 systemd1: Started /usr/bin/bash c test -w /proc/self/oom_score_adj && echo 250 > /proc/self/oom_score_adj; exec ./tests/generic/397. Jan 3 12:34:40 ceph-testing-0001 kernel: [ 877.875761] libceph: mon0 (2)127.0.0.1:40674 session established Jan 3 12:34:40 ceph-testing-0001 kernel: [ 877.876130] libceph: client4614 fsid 19b90bca-f1ae-47a6-93dd-0b03ee637949 Jan 3 12:34:40 ceph-testing-0001 kernel: [ 877.991965] libceph: mon0 (2)127.0.0.1:40674 session established Jan 3 12:34:40 ceph-testing-0001 kernel: [ 877.992334] libceph: client4617 fsid 19b90bca-f1ae-47a6-93dd-0b03ee637949 Jan 3 12:34:40 ceph-testing-0001 kernel: [ 878.017234] libceph: mon0 (2)127.0.0.1:40674 session established Jan 3 12:34:40 ceph-testing-0001 kernel: [ 878.017594] libceph: client4620 fsid 19b90bca-f1ae-47a6-93dd-0b03ee637949 Jan 3 12:34:40 ceph-testing-0001 kernel: [ 878.031394] xfs_io (pid 18988) is setting deprecated v1 encryption policy; recommend upgrading to v2. Jan 3 12:34:40 ceph-testing-0001 kernel: [ 878.054528] libceph: mon0 (2)127.0.0.1:40674 session established Jan 3 12:34:40 ceph-testing-0001 kernel: [ 878.054892] libceph: client4623 fsid 19b90bca-f1ae-47a6-93dd-0b03ee637949 Jan 3 12:34:40 ceph-testing-0001 kernel: [ 878.070287] libceph: mon0 (2)127.0.0.1:40674 session established Jan 3 12:34:40 ceph-testing-0001 kernel: [ 878.070704] libceph: client4626 fsid 19b90bca-f1ae-47a6-93dd-0b03ee637949 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.264586] libceph: mon0 (2)127.0.0.1:40674 session established Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.265258] libceph: client4629 fsid 19b90bca-f1ae-47a6-93dd-0b03ee637949 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.374578] -----------[ cut here ]------------ Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.374586] kernel BUG at net/ceph/messenger.c:1070! Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.375150] Oops: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.378145] CPU: 2 UID: 0 PID: 4759 Comm: kworker/2:9 Not tainted 6.13.0-rc5+ #1 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.378969] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0- ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.380167] Workqueue: ceph- msgr ceph_con_workfn Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.381639] RIP: 0010:ceph_msg_data_cursor_init+0x42/0x50 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.382152] Code: 89 17 48 8b 46 70 55 48 89 47 08 c7 47 18 00 00 00 00 48 89 e5 e8 de cc ff ff 5d 31 c0 31 d2 31 f6 31 ff c3 cc cc cc cc 0f 0b <0f> 0b 0f 0b 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.383928] RSP: 0018:ffffb4ffc7cbbd28 EFLAGS: 00010287 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.384447] RAX: ffffffff82bb9ac0 RBX: ffff981390c2f1f8 RCX: 0000000000000000 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.385129] RDX: 0000000000009000 RSI: ffff981288232b58 RDI: ffff981390c2f378 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.385839] RBP: ffffb4ffc7cbbe18 R08: 0000000000000000 R09: 0000000000000000 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.386539] R10: 0000000000000000 R11: 0000000000000000 R12: ffff981390c2f030 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.387203] R13: ffff981288232b58 R14: 0000000000000029 R15: 0000000000000001 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.387877] FS: 0000000000000000(0000) GS:ffff9814b7900000(0000) knlGS:0000000000000000 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.388663] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.389212] CR2: 00005e106a0554e0 CR3: 0000000112bf0001 CR4: 0000000000772ef0 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.389921] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.390620] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.391307] PKRU: 55555554 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.391567] Call Trace: Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.391807] Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.392021] ? show_regs+0x71/0x90 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.392391] ? die+0x38/0xa0 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.392667] ? do_trap+0xdb/0x100 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.392981] ? do_error_trap+0x75/0xb0 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.393372] ? ceph_msg_data_cursor_init+0x42/0x50 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.393842] ? exc_invalid_op+0x53/0x80 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.394232] ? ceph_msg_data_cursor_init+0x42/0x50 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.394694] ? asm_exc_invalid_op+0x1b/0x20 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.395099] ? ceph_msg_data_cursor_init+0x42/0x50 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.395583] ? ceph_con_v2_try_read+0xd16/0x2220 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.396027] ? _raw_spin_unlock+0xe/0x40 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.396428] ? raw_spin_rq_unlock+0x10/0x40 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.396842] ? finish_task_switch.isra.0+0x97/0x310 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.397338] ? __schedule+0x44b/0x16b0 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.397738] ceph_con_workfn+0x326/0x750 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.398121] process_one_work+0x188/0x3d0 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.398522] ? __pfx_worker_thread+0x10/0x10 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.398929] worker_thread+0x2b5/0x3c0 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.399310] ? __pfx_worker_thread+0x10/0x10 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.399727] kthread+0xe1/0x120 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.400031] ? __pfx_kthread+0x10/0x10 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.400431] ret_from_fork+0x43/0x70 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.400771] ? __pfx_kthread+0x10/0x10 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.401127] ret_from_fork_asm+0x1a/0x30 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.401543] Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.401760] Modules linked in: hctr2 nhpoly1305_avx2 nhpoly1305_sse2 nhpoly1305 chacha_generic chacha_x86_64 libchacha adiantum libpoly1305 essiv authenc mptcp_diag xsk_diag tcp_diag udp_diag raw_diag inet_diag unix_diag af_packet_diag netlink_diag intel_rapl_msr intel_rapl_common intel_uncore_frequency_common skx_edac_common nfit kvm_intel kvm crct10dif_pclmul crc32_pclmul polyval_clmulni polyval_generic ghash_clmulni_intel sha256_ssse3 sha1_ssse3 aesni_intel joydev crypto_simd cryptd rapl input_leds psmouse sch_fq_codel serio_raw bochs i2c_piix4 floppy qemu_fw_cfg i2c_smbus mac_hid pata_acpi msr parport_pc ppdev lp parport efi_pstore ip_tables x_tables Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.407319] ---[ end trace 0000000000000000 ]--- Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.407775] RIP: 0010:ceph_msg_data_cursor_init+0x42/0x50 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.408317] Code: 89 17 48 8b 46 70 55 48 89 47 08 c7 47 18 00 00 00 00 48 89 e5 e8 de cc ff ff 5d 31 c0 31 d2 31 f6 31 ff c3 cc cc cc cc 0f 0b <0f> 0b 0f 0b 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.410087] RSP: 0018:ffffb4ffc7cbbd28 EFLAGS: 00010287 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.410609] RAX: ffffffff82bb9ac0 RBX: ffff981390c2f1f8 RCX: 0000000000000000 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.411318] RDX: 0000000000009000 RSI: ffff981288232b58 RDI: ffff981390c2f378 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.412014] RBP: ffffb4ffc7cbbe18 R08: 0000000000000000 R09: 0000000000000000 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.412735] R10: 0000000000000000 R11: 0000000000000000 R12: ffff981390c2f030 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.413438] R13: ffff981288232b58 R14: 0000000000000029 R15: 0000000000000001 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.414121] FS: 0000000000000000(0000) GS:ffff9814b7900000(0000) knlGS:0000000000000000 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.414935] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.415516] CR2: 00005e106a0554e0 CR3: 0000000112bf0001 CR4: 0000000000772ef0 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.416211] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.416907] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Jan 3 12:34:41 ceph-testing-0001 kernel: [ 878.417630] PKRU: 55555554 BUG_ON(length > msg->data_length) triggers the issue: (gdb) l *ceph_msg_data_cursor_init+0x42 0xffffffff823b45a2 is in ceph_msg_data_cursor_init (net/ceph/messenger.c:1070). 1065 1066 void ceph_msg_data_cursor_init(struct ceph_msg_data_cursor *cursor, 1067 struct ceph_msg *msg, size_t length) 1068 { 1069 BUG_ON(!length); 1070 BUG_ON(length > msg->data_length); 1071 BUG_ON(!msg->num_data_items); 1072 1073 cursor->total_resid = length; 1074 cursor->data = msg->data; The issue takes place because of this: Jan 6 14:59:24 ceph-testing-0001 kernel: [ 202.628853] libceph: pid 144:net/ceph/messenger_v2.c:2034 prepare_sparse_read_data(): msg- >data_length 33792, msg->sparse_read_total 36864 1070 BUG_ON(length > msg->data_length); msg->sparse_read_total 36864 > msg->data_length 33792 The generic/397 test (xfstests) executes such steps: (1) create encrypted files and directories; (2) access the created files and folders with encryption key; (3) access the created files and folders without encryption key. We have issue because there is alignment of length before calling ceph_osdc_new_request(): Jan 8 12:49:22 ceph-testing-0001 kernel: [ 301.522120] ceph: pid 8931:fs/ceph/crypto.h:148 ceph_fscrypt_adjust_off_and_len(): ino 0x100000009d5: encrypted 0x4000, len 33792 Jan 8 12:49:22 ceph-testing-0001 kernel: [ 301.523706] ceph: pid 8931:fs/ceph/crypto.h:155 ceph_fscrypt_adjust_off_and_len(): ino 0x100000009d5: encrypted 0x4000, len 36864 This patch uses unaligned size for retrieving file's content from OSD and, then, aligned the size of sparse extent in the case if inode is encrypted. ./check generic/397 FSTYP -- ceph PLATFORM -- Linux/x86_64 ceph-testing-0001 6.13.0-rc7+ #58 SMP PREEMPT_DYNAMIC Wed Jan 15 00:07:06 UTC 2025 MKFS_OPTIONS -- 127.0.0.1:40629:/scratch MOUNT_OPTIONS -- -o name=fs,secret=,ms_mode=crc,nowsync,copyfrom 127.0.0.1::/scratch /mnt/scratch generic/397 1s ... 1s Ran: generic/397 Passed all 1 tests Signed-off-by: Viacheslav Dubeyko --- fs/ceph/addr.c | 30 ++++++++++++++++++++++++------ fs/ceph/file.c | 20 +++++++++++++++++--- 2 files changed, 41 insertions(+), 9 deletions(-) + */ + req = ceph_osdc_new_request(osdc, &ci->i_layout, ci->i_vino, read_off, &read_len, 0, 1, sparse ? CEPH_OSD_OP_SPARSE_READ : @@ -1111,6 +1114,9 @@ ssize_t __ceph_sync_read(struct inode *inode, loff_t *ki_pos, break; } + /* determine new offset/length if encrypted */ + ceph_fscrypt_adjust_off_and_len(inode, &read_off, &read_len); + /* adjust len downward if the request truncated the len */ if (off + len > read_off + read_len) len = read_off + read_len - off; @@ -1168,7 +1174,15 @@ ssize_t __ceph_sync_read(struct inode *inode, loff_t *ki_pos, } if (IS_ENCRYPTED(inode)) { + struct ceph_sparse_extent *ext; int fret; + int i; + + for (i = 0; i < op->extent.sparse_ext_cnt; i++) { + ext = &op->extent.sparse_ext[i]; + ceph_fscrypt_adjust_off_and_len(inode, + &ext->off, &ext->len); + } fret = ceph_fscrypt_decrypt_extents(inode, pages, read_off, op- >extent.sparse_ext, diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 85936f6d2bf7..5a7a698ad8e8 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -235,6 +235,15 @@ static void finish_netfs_read(struct ceph_osd_request *req) subreq->rreq->origin != NETFS_DIO_READ) __set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq- >flags); if (IS_ENCRYPTED(inode) && err > 0) { + struct ceph_sparse_extent *ext; + int i; + + for (i = 0; i < op->extent.sparse_ext_cnt; i++) { + ext = &op->extent.sparse_ext[i]; + ceph_fscrypt_adjust_off_and_len(inode, + &ext->off, &ext->len); + } + err = ceph_fscrypt_decrypt_extents(inode, osd_data->pages, subreq- >start, op->extent.sparse_ext, @@ -357,13 +366,12 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq) if (ceph_has_inline_data(ci) && ceph_netfs_issue_op_inline(subreq)) return; - // TODO: This rounding here is slightly dodgy. It *should* work, for - // now, as the cache only deals in blocks that are a multiple of - // PAGE_SIZE and fscrypt blocks are at most PAGE_SIZE. What needs to - // happen is for the fscrypt driving to be moved into netfslib and the - // data in the cache also to be stored encrypted. + /* + * It needs to provide the real legth (not aligned) for network subsystem. + * Otherwise, ceph_msg_data_cursor_init() triggers BUG_ON() in the case + * if msg->sparse_read_total > msg->data_length. + */ len = subreq->len; - ceph_fscrypt_adjust_off_and_len(inode, &off, &len); req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout, vino, off, &len, 0, 1, sparse ? CEPH_OSD_OP_SPARSE_READ : CEPH_OSD_OP_READ, @@ -375,6 +383,16 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq) goto out; } + // TODO: This rounding here is slightly dodgy. It *should* work, for + // now, as the cache only deals in blocks that are a multiple of + // PAGE_SIZE and fscrypt blocks are at most PAGE_SIZE. What needs to + // happen is for the fscrypt driving to be moved into netfslib and the + // data in the cache also to be stored encrypted. + ceph_fscrypt_adjust_off_and_len(inode, &off, &len); + + doutc(cl, "%llx.%llx pos=%llu orig_len=%zu len=%llu\n", + ceph_vinop(inode), subreq->start, subreq->len, len); + if (sparse) { extent_cnt = __ceph_sparse_read_ext_count(inode, len); err = ceph_alloc_sparse_ext_map(&req->r_ops[0], extent_cnt); diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 851d70200c6b..9446a5f001aa 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -1093,12 +1093,15 @@ ssize_t __ceph_sync_read(struct inode *inode, loff_t *ki_pos, u64 read_len = len; int extent_cnt; - /* determine new offset/length if encrypted */ - ceph_fscrypt_adjust_off_and_len(inode, &read_off, &read_len); - doutc(cl, "orig %llu~%llu reading %llu~%llu", off, len, read_off, read_len); + /* + * It needs to provide the real legth (not aligned) for network subsystem. + * Otherwise, ceph_msg_data_cursor_init() triggers BUG_ON() in the case + * if msg->sparse_read_total > msg->data_length.