[PATCH] D93881: [llvm-objcopy] preserve file ownership when overwritten

Manoj Gupta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 19:16:03 PST 2021


manojgupta added a comment.

>>> Could you just update the build instructions for these few packages?
>>
>> I see over 600 uses of of fowners in Gentoo and over 55 in Chrome OS (public). Not all uses are related to binary files but asking to fix the build system instead of fixing the incompatibility is a non-trivial and a no-go.
>>
>> [1] https://github.com/gentoo/gentoo/search?q=fowners&type=code
>> [2] https://source.chromium.org/search?q=fowners&sq=&ss=chromiumos
>
> OK. If that is the case, I am happy that llvm-objcopy adopts the GNU objcopy behavior.
>
> But I think we should do better: instead of: (1) create a temp file (2) open it by name again (3) check it is a regular file with one hard link & it is writable (S_IWUSR) (4) fstat (5) fchown,
> we should just modify the destination in place (for `objcopy file` and `strip file`). If the file has been mapped readonly, on many platforms it may be unwritable. We have to accept this.
>
> The various security checks is to prevent vulnerability.

Thanks, we will work on an improved patch with the added checks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93881/new/

https://reviews.llvm.org/D93881



More information about the llvm-commits mailing list