[llvm] [llvm] Add support for running tests as root (PR #75285)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 20 07:47:38 PST 2023


arichardson wrote:

> > > How about testing for the ACL bypassing behaviour instead of checking for username == root?
> > 
> > 
> > @arichardson How portable would this check be? Are there any scenarios where this check would return a different result than checking username == root?
> 
> binary with setuid bit will have getuser() return the user that ran the binary but the binary will behave as root.

But we are checking for the permissions that the python interpreter + spawned binaries have, so setuid binaries don't matter. If llvm-ar was setuid we would have a whole new set of problems regardless of current user privileges.

I don't feel strongly which check is used I just thought checking whether the behaviour that makes the test fail is present is slightly cleaner than doing so indirectly via getuid==0. The main problem I can think of with the ACL bypassing check is that Windows might behave weirdly but the tests are already disabled on Windows.

https://github.com/llvm/llvm-project/pull/75285


More information about the llvm-commits mailing list