Proposing SELinux support in strace

Renaud Métrich rmetrich at
Thu Mar 25 12:51:09 UTC 2021

Hi Dmitry,

I reworked all the tests to stop having getcwd() calls.

This means realpath() cannot be used.

Please check the PR, tests/ only, rest was already reviewed (since it's 
basically *your* code ...)

On 3/25/21 3:45 AM, Dmitry V. Levin wrote:
> Hi Renaud,
> 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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Strace-devel mailing list