[lld] r267497 - [ELF] Introduce --reproduce flag.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 12:02:30 PDT 2016


On 26 April 2016 at 14:59, Rui Ueyama via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> On Tue, Apr 26, 2016 at 11:53 AM, Davide Italiano <davide at freebsd.org>
> wrote:
>>
>> On Tue, Apr 26, 2016 at 11:39 AM, Rui Ueyama <ruiu at google.com> wrote:
>> > Noticed that the current implementation is even dangerous. If input
>> > files
>> > are specified with relative path which contains (possibly multiple) ".."
>> > directories, then files may escape from the specified directory and
>> > clobber
>> > whatever there is. Think about "lld --reproduce /home/ruiu/repro
>> > ../../../etc/passwd".
>> >
>>
>> Hmm, we can make that case to work but that's tricky if we want to
>> keep relative paths in the invocation.
>> Maybe we should transform every relative path in an absolute one
>> before we do the copy?
>
>
> What I'm trying to do is to remove all ".." and "." from path components
> using sys::path::remove_dots and then append it to the base directory. I
> think it should suffice.
>
> If we really want to preserve pathnames, we probably need to create a zip or
> tar archive file so that we can set any pathnames without polluting the real
> filesystem namespace. But I'd think it is probably too much.

Given the objective (reproducing the link run) we can probably rename
the files in any way that is convenient.

Cheers,
Rafael


More information about the llvm-commits mailing list