[all-commits] [llvm/llvm-project] 17b4e6: [llvm-objcopy] If input=output, preserve umask bit...

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Feb 24 11:10:27 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 17b4e695ce0ef89eac4a37df2df49d4c0e700766
      https://github.com/llvm/llvm-project/commit/17b4e695ce0ef89eac4a37df2df49d4c0e700766
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-02-24 (Wed, 24 Feb 2021)

  Changed paths:
    M llvm/test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test
    M llvm/tools/llvm-objcopy/llvm-objcopy.cpp

  Log Message:
  -----------
  [llvm-objcopy] If input=output, preserve umask bits, otherwise drop S_ISUID/S_ISGID bits

This makes the behavior similar to cp

```
chmod u+s,g+s,o+x a
sudo llvm-strip a -o b
// With this patch, b drops set-user-ID and set-group-ID bits.
// sudo cp a b => b does not have set-user-ID or set-group-ID bits.
```

This also changes the behavior for the following case:

```
chmod u+s,g+s,o+x a
llvm-strip a
// a preserves set-user-ID and set-group-ID bits.
// This matches binutils<2.36 and probably >=2.37.  2.36 and 2.36.1 have some compatibility issues.
```

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




More information about the All-commits mailing list