Whamcloud - gitweb
LU-18518 ldiskfs: fix htree_lock array-index-out-of-bounds 27/57327/2
authorJian Yu <yujian@whamcloud.com>
Fri, 6 Dec 2024 17:50:58 +0000 (09:50 -0800)
committerOleg Drokin <green@whamcloud.com>
Sun, 2 Feb 2025 06:27:32 +0000 (06:27 +0000)
This patch replaces 0-length trailing arrays with
flexible arrays in htree_lock.h to resolve the UBSAN
array-index-out-of-bounds runtime warnings.

Test-Parameters: mdtcount=4 mdscount=2 \
  clientdistro=ubuntu2404 testlist=sanity

Change-Id: I30b624a09f3f918ddaac105fb06db9fd4c693799
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57327
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Shuichi Ihara <sihara@ddn.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
ldiskfs/kernel_patches/patches/base/ext4-htree-lock.patch

index 2e76284..3601087 100644 (file)
@@ -152,7 +152,7 @@ Index: linux-3.10.0-229.1.2.fc21.x86_64/include/linux/htree_lock.h
 +      /* private data */
 +      void                    *lh_private;
 +      /* array of children locks */
-+      struct htree_lock_child lh_children[0];
++      struct htree_lock_child lh_children[];
 +};
 +
 +/* htree_lock_node_t is child-lock for a specific key (ln_value) */
@@ -180,7 +180,7 @@ Index: linux-3.10.0-229.1.2.fc21.x86_64/include/linux/htree_lock.h
 +      unsigned                lk_depth;
 +      htree_lock_mode_t       lk_mode;
 +      struct list_head        lk_blocked_list;
-+      struct htree_lock_node  lk_nodes[0];
++      struct htree_lock_node  lk_nodes[];
 +};
 +
 +/* create a lock head, which stands for a resource */