Tom Stellard via llvm-dev
2019-Jul-16 17:23 UTC
[llvm-dev] Usage of chmod 400 in lld lit tests causes failures when run by root user
Hi, There are 3 lld tests[1] that run the command `chmod 400` or `chmod u-w` and then check that lld generates a permission denied error when trying to write to the files. These tests fail when run as root, because `chmod 400` is not enough to prevent root from writing to files. Is there some other way we can tests this, or should we just not support running tests as root? A related question I have is how do these tests work on Windows since it doesn't have chmod? Thanks, Tom [1] ELF/lto/thinlto-emit-imports.ll ELF/lto/thinlto-cant-write-index.ll COFF/thinlto-emit-imports.ll
Peter Smith via llvm-dev
2019-Jul-16 17:41 UTC
[llvm-dev] Usage of chmod 400 in lld lit tests causes failures when run by root user
On Tue, 16 Jul 2019 at 18:23, Tom Stellard via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > Hi, > > There are 3 lld tests[1] that run the command `chmod 400` or `chmod u-w` > and then check that lld generates a permission denied error when trying to > write to the files. These tests fail when run as root, > because `chmod 400` is not enough to prevent root from writing to files. > Is there some other way we can tests this, or should we just not support > running tests as root? >A quick search on preventing root from overwriting files brings up chattr +i to set the immutable bit, however this only works when run as root so it isn't feasible. Personally I would be happy with not supporting the test suite running as root, or maybe documenting that chmod tests will fail.> A related question I have is how do these tests work on Windows since it doesn't > have chmod? >Could it be related to the sentence "If you would like to run the LLVM tests you will need Python. Version 2.7 and newer are known to work. You will need GnuWin32 tools, too." https://llvm.org/docs/GettingStartedVS.html It is likely that GnuWin32 tools contain chmod in some form. Unfortunately I don't have a Windows machine to hand to confirm. Peter> Thanks, > Tom > > [1] > > ELF/lto/thinlto-emit-imports.ll > ELF/lto/thinlto-cant-write-index.ll > COFF/thinlto-emit-imports.ll > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
James Henderson via llvm-dev
2019-Jul-17 16:13 UTC
[llvm-dev] Usage of chmod 400 in lld lit tests causes failures when run by root user
> > Could it be related to the sentence "If you would like to run the LLVM > tests you will need Python. Version 2.7 and newer are known to work. > You will need GnuWin32 tools, too." > https://llvm.org/docs/GettingStartedVS.html > It is likely that GnuWin32 tools contain chmod in some form. > Unfortunately I don't have a Windows machine to hand to confirm. >I can confirm that GnuWin32 contains a version of chmod. How it interacts with the Windows file permissions, I can't say, but it does work in this context at the very least. James On Tue, 16 Jul 2019 at 18:42, Peter Smith via llvm-dev < llvm-dev at lists.llvm.org> wrote:> On Tue, 16 Jul 2019 at 18:23, Tom Stellard via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > > > Hi, > > > > There are 3 lld tests[1] that run the command `chmod 400` or `chmod u-w` > > and then check that lld generates a permission denied error when trying > to > > write to the files. These tests fail when run as root, > > because `chmod 400` is not enough to prevent root from writing to files. > > Is there some other way we can tests this, or should we just not support > > running tests as root? > > > > A quick search on preventing root from overwriting files brings up > chattr +i to set the immutable bit, however this only works when run > as root so it isn't feasible. Personally I would be happy with not > supporting the test suite running as root, or maybe documenting that > chmod tests will fail. > > > A related question I have is how do these tests work on Windows since it > doesn't > > have chmod? > > > > Could it be related to the sentence "If you would like to run the LLVM > tests you will need Python. Version 2.7 and newer are known to work. > You will need GnuWin32 tools, too." > https://llvm.org/docs/GettingStartedVS.html > It is likely that GnuWin32 tools contain chmod in some form. > Unfortunately I don't have a Windows machine to hand to confirm. > > Peter > > > Thanks, > > Tom > > > > [1] > > > > ELF/lto/thinlto-emit-imports.ll > > ELF/lto/thinlto-cant-write-index.ll > > COFF/thinlto-emit-imports.ll > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190717/5e2ccf5b/attachment.html>