tracing/selftests: Add ownership modification tests for eventfs
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Fri, 22 Dec 2023 16:34:59 +0000 (11:34 -0500)
committerShuah Khan <skhan@linuxfoundation.org>
Fri, 22 Dec 2023 17:01:41 +0000 (10:01 -0700)
commitee9793be08b1a1c29308a099c01790a3befb390a
tree42ba61f1b8b97e542988a4d4e2cb641dca67f086
parent130a83879954a9fed35cf4474d223b4fcfd479fa
tracing/selftests: Add ownership modification tests for eventfs

As there were bugs found with the ownership of eventfs dynamic file
creation. Add a test to test it.

It will remount tracefs with a different gid and check the ownership of
the eventfs directory, as well as the system and event directories. It
will also check the event file directories.

It then does a chgrp on each of these as well to see if they all get
updated as expected.

Then it remounts the tracefs file system back to the original group and
makes sure that all the updated files and directories were reset back to
the original ownership.

It does the same for instances that change the ownership of he instance
directory.

Note, because the uid is not reset by a remount, it is tested for every
file by switching it to a new owner and then back again.

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Tested-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc [new file with mode: 0644]