Proposing SELinux support in strace
Dmitry V. Levin
ldv at altlinux.org
Thu Mar 25 02:45:02 UTC 2021
On Wed, Mar 24, 2021 at 03:52:21PM +0100, Renaud Métrich wrote:
> Hi Dmitry,
> Sorry for the delay, I was busy this week.
> I pushed the new code with updated test suite.
> Still I have an issue regarding 1 test: test_personality_64
> I don't understand what is supposed to be checked here, the strace runs
> on "getcwd" but fails because now some tests (including "execveat") use
> getcwd() internally.
I haven't looked into details yet, but your guess about the reason why
test_personality_* started to fail is correct. I'm not sure why do you
need getcwd in the first place, though. If you need a descriptor
referring to the current directory, you can open "." instead of the result
of getcwd. If you need to chdir back, you can fchdir using that
descriptor. You probably can replace SELINUX_FILECONTEXT(cwd) with
SELINUX_FILECONTEXT(".") and save the result for later use if the current
workdir is changed in the test. It doesn't mean that you cannot use
getcwd, but this would exclude the test from test_personality_* which
is not very nice, so we should try to avoid unnecessary use of getcwd.
More information about the Strace-devel