Whamcloud - gitweb
LU-17110 llite: fix slab corruption with fm_extent_count=0 52/52352/4
authorEtienne AUJAMES <etienne.aujames@cea.fr>
Tue, 12 Sep 2023 16:06:25 +0000 (18:06 +0200)
committerOleg Drokin <green@whamcloud.com>
Thu, 28 Sep 2023 08:01:31 +0000 (08:01 +0000)
commita81dc7d0e158894e905ab3d309f7b92864a94378
tree5beafd796510480c2c4f5ddeb70f2c08d9ba347a
parentdbe4f860977455a9abe50165645a025bb6c46350
LU-17110 llite: fix slab corruption with fm_extent_count=0

If userspace uses fiemap with .fm_extent_count=0, .fm_extents[0] is
not allocated. Writing on the first entry without checking the extent
count could lead to memory corruption (slab).

This patch fix also the case when osc is disable: FIEMAP_EXTENT_LAST
should be set on the extent (fe_flags) and not on the fiemap struct.

Add a regression test sanityn 71d to test fiemap with
fm_extent_count=0.
Add a regression test sanity-hsm 408 to test fiemap on release files.

Fixes: 4097196 ("LU-11848 lov: FIEMAP support for PFL and FLR file")
Test-Parameters:testlist=sanityn
Test-Parameters:testlist=sanityn env=ONLY=71d,ONLY_REPEAT=20
Test-Parameters:testlist=sanity-hsm env=ONLY=408,ONLY_REPEAT=20
Signed-off-by: Etienne AUJAMES <etienne.aujames@cea.fr>
Change-Id: Id63c6973540187e678020977f2d555dfcbf3c634
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52352
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Feng Lei <flei@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/file.c
lustre/lov/lov_object.c
lustre/tests/Makefile.am
lustre/tests/checkfiemap.c
lustre/tests/sanity-hsm.sh
lustre/tests/sanityn.sh