From: Zhihao Cheng Date: Thu, 31 Oct 2019 09:19:17 +0000 (+0800) Subject: generic/317: Use relative paths to avoid traversal permission problems X-Git-Tag: v2022.05.01~964 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=220b7e35fe344ff54e7503df968098cde64dfab6;p=xfstests-dev.git generic/317: Use relative paths to avoid traversal permission problems generic/317 will fail because execvp(cmd) is executed without permission, where cmd is '$here/src/lstat64 $file', which is called by $here/src/nsexec -s -U -M "0 $qa_user_id 1000" -G "0 $qa_user_id 1000"\ $here/src/lstat64 $file So, you will see following output: From user_ns ... +execvp: Permission denied nsexec runs the instruction '$here/src/lstat64 $file' as a regular user, the regular user may not have permission to access path in '$here'. Actually, it has been fixed in 4818302fbf ("xfstests: generic/317 use relative paths..."), which then been modified by b7cecbea22 ("fstests: Add path $here before src/"). Fixes: b7cecbea22 ("fstests: Add path $here before src/") Signed-off-by: Zhihao Cheng Reviewed-by: Eryu Guan Signed-off-by: Eryu Guan --- diff --git a/tests/generic/317 b/tests/generic/317 index 509887da..8ea9d81c 100755 --- a/tests/generic/317 +++ b/tests/generic/317 @@ -61,7 +61,10 @@ _print_numeric_uid() $here/src/lstat64 $file |head -3 |_filter_output echo "From user_ns" - $here/src/nsexec -s -U -M "0 $qa_user_id 1000" -G "0 $qa_user_id 1000" $here/src/lstat64 $file |head -3 |_filter_output + # don't use $here/src/lstat64, as we're running cmd(src/lstat64) in + # nsexec as a regular user, and $here may contain path component that + # a regular user doesn't have search permission + $here/src/nsexec -s -U -M "0 $qa_user_id 1000" -G "0 $qa_user_id 1000" src/lstat64 $file |head -3 |_filter_output } _scratch_unmount >/dev/null 2>&1