Whamcloud - gitweb
LU-17034 quota: lqeg_arr memmory corruption
authorSergey Cheremencev <scherementsev@ddn.com>
Fri, 25 Aug 2023 06:22:26 +0000 (10:22 +0400)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 24 Feb 2024 03:49:06 +0000 (03:49 +0000)
commit7c6d08994b23cc3ef112e3626f9402dbccf0bc2c
tree02f7a0b3b17b28815129eadd854a9f7d4b84b214
parent1d7d61e5444715f0e376b2d5aef0f1b994c50a92
LU-17034 quota: lqeg_arr memmory corruption

Fix memory corruption caused by accessing memory
out of array lqeg_arr. It could happen when at least
one of OSTs has index larger than the whole number
of OSTs. For example, if the system has 4 OSTs with
indexes 0001, 0002, 00c9, 00ca. This issue more often
corrupted bucket_table in obd_uuid_hash or obd_nid_hash
causing to crash rhashtable code. However, it could
be the reason of other panics depending on the type
of corrupted neighbour memory region.

This patch adds an lge_idx field to each lqe global entry
to store index of the OST. It is needed to map OST index
to the array index to avoid out-of-bound array access.

This patch also add locking to protect lqe_glbl_data in
qmt_set_revoke and qmt_clear_lgeg_arr_nu. This was
forgotten in 50ff4d1da6.

This patch begins to store all connected MDTs in the quota
global pool. Thus handling MDTs beginning from this patch
is the same with OSTs stored in the global pool. It is the
1st step to introduce MDT pools.

Add conf-sanity_33c that reproduces mentioned memory
corruption without the fix.

Lustre-change: https://review.whamcloud.com/52094
Lustre-commit: 67f90e42889ff22d574e82cc647f6076e48c65a5

Fixes: 50ff4d1da6 ("LU-16772 quota: protect lqe_glbl_data in qmt_site_recalc_cb")
Signed-off-by: Sergey Cheremencev <scherementsev@ddn.com>
Change-Id: Id6e4bcde09d9f32726d69f711eedb82729a2266e
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53810
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/include/obd_target.h
lustre/quota/lquota_internal.h
lustre/quota/qmt_entry.c
lustre/quota/qmt_internal.h
lustre/quota/qmt_lock.c
lustre/quota/qmt_pool.c
lustre/target/tgt_pool.c
lustre/tests/conf-sanity.sh