All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH xfstests] generic/317: Use relative paths to avoid traversal permission problems
@ 2019-10-31  9:19 Zhihao Cheng
  0 siblings, 0 replies; 8+ messages in thread
From: Zhihao Cheng @ 2019-10-31  9:19 UTC (permalink / raw)
  To: guaneryu, darrick.wong, ebiggers, yi.zhang; +Cc: fstests

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/<file>").

Fixes: b7cecbea22 ("fstests: Add path $here before src/<file>")
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
---
 tests/generic/317 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/generic/317 b/tests/generic/317
index 509887d..8ea9d81 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
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-10-31  9:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20131024161235.GA29381@infradead.org>
     [not found] ` <20131024162557.6dd72435@oracle.com>
2013-10-25  9:33   ` xfstests 317 Christoph Hellwig
2013-10-28 15:43     ` Dwight Engen
2013-10-30 16:19       ` Christoph Hellwig
2013-10-30 16:24         ` Christoph Hellwig
2013-10-30 18:30           ` [PATCH] xfstests: generic/317 use relative paths to avoid traversal permission problems Dwight Engen
2013-10-31 15:40             ` Christoph Hellwig
2013-11-04 20:43             ` Rich Johnston
2019-10-31  9:19 [PATCH xfstests] generic/317: Use " Zhihao Cheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.