Whamcloud - gitweb
LU-17110 llite: fix slab corruption with fm_extent_count=0 12/52512/4
authorEtienne AUJAMES <etienne.aujames@cea.fr>
Tue, 12 Sep 2023 16:06:25 +0000 (18:06 +0200)
committerOleg Drokin <green@whamcloud.com>
Sun, 16 Jun 2024 03:36:07 +0000 (03:36 +0000)
commit147632c2c5246a1ad5e5e4259d7f8f84211dba30
tree2b4177ec00a4d8d2020be38baae1c612553cccc1
parent22d34d786719f73f4814745c7175df8a07f8df06
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.

Lustre-change: https://review.whamcloud.com/52352
Lustre-commit: a81dc7d0e158894e905ab3d309f7b92864a94378

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/+/52512
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@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