[llvm-dev] Usage of chmod 400 in lld lit tests causes failures when run by root user

James Henderson via llvm-dev llvm-dev at lists.llvm.org
Wed Jul 17 09:13:56 PDT 2019


>
> 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>


More information about the llvm-dev mailing list