1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/tools/llvm-objcopy
Fangrui Song 3afa7d901e [llvm-objcopy] Don't change permissions of non-regular output files
There is currently an EPERM error when a regular user executes `llvm-objcopy a.o /dev/null`.
Worse, root can even change the mode bits of /dev/null.

Fix it by checking if the output file is special.

A new overload of llvm::sys::fs::setPermissions with FD as the parameter
is added. Users should provide `perm & ~umask` as the parameter if they
intend to respect umask.

The existing overload of llvm::sys::fs::setPermissions may be deleted if
we can find an implementation of fchmod() on Windows. fchmod() is
usually better than chmod() because it saves syscalls and can avoid race
condition.

Reviewed By: jakehehrlich, jhenderson

Differential Revision: https://reviews.llvm.org/D64236

llvm-svn: 365753
2019-07-11 10:17:59 +00:00
..
COFF [llvm-objcopy] Tidy up error messages 2019-05-22 13:23:26 +00:00
ELF Revert [llvm-objcopy] Allow strip symtab from executables and DSOs 2019-07-10 23:32:44 +00:00
MachO [llvm-objcopy][MachO] Fix strict-aliasing warning. NFCI 2019-06-24 23:39:01 +00:00
Buffer.cpp [llvm-objcopy][NFC] Remove unnecessary llvm-objcopy.h #includes 2019-03-13 23:40:16 +00:00
Buffer.h [llvm-objcopy] Fix crash when writing empty binary output 2019-01-28 15:02:40 +00:00
CMakeLists.txt [llvm-objcopy][MachO] Rebuild the symbol/string table in the writer 2019-06-21 00:21:50 +00:00
CopyConfig.cpp [llvm-objcopy][NFC] Refactor output target parsing v2 2019-07-05 05:28:38 +00:00
CopyConfig.h [llvm-objcopy][NFC] Refactor output target parsing v2 2019-07-05 05:28:38 +00:00
llvm-objcopy.cpp [llvm-objcopy] Don't change permissions of non-regular output files 2019-07-11 10:17:59 +00:00
llvm-objcopy.h Small refactoring of FileError. NFC. 2019-02-11 09:49:37 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ObjcopyOpts.td [llvm-objcopy][llvm-strip] Fix help text typo for --allow-broken-links 2019-06-25 13:14:18 +00:00
StripOpts.td [llvm-objcopy][llvm-strip] Fix help text typo for --allow-broken-links 2019-06-25 13:14:18 +00:00