public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] portage reliance on GNU objcopy ownership perseverance behavior in strip
@ 2021-02-05  0:09 Manoj Gupta
  2021-02-05  1:00 ` Michael Orlitzky
  2021-02-10  1:53 ` [gentoo-dev] " Fāng-ruì Sòng
  0 siblings, 2 replies; 9+ messages in thread
From: Manoj Gupta @ 2021-02-05  0:09 UTC (permalink / raw
  To: gentoo-dev, mgorny; +Cc: Fangrui Song, Jordan Rupprecht, Jian Cai

[-- Attachment #1: Type: text/plain, Size: 1299 bytes --]

Hi gentoo devs,

This question is regarding interaction of fowners [1] and estrip
functionality in portage.
fowners is used on various binaries and files to assign the ownership to
specific users or group.

GNU objcopy and strip do not change the file ownership when run as root.
However, llvm's versions do not preserve it and instead make root the owner
of the modified file.
e.g.
sudo strip <file> keeps the original ownership .
sudo llvm-strip <file> will change ownership to root.

We were trying to have llvm objcopy with a patch [3] to have the same
behavior as GNU but LLVM developers pointed out that GNU implementation is
thought to have a security issue:
https://sourceware.org/bugzilla/show_bug.cgi?id=26945
We have modified the LLVM patch to avoid chown on the final file and rather
doing it on the temporay file but I am not sure if that will be enough to
placate the llvm devs.

What does everyone think of modifying usages of calls to strip and objcopy
inside estrip so that file ownership is manually restored. e.g

owner=$(stat -U file)
group=$(stat -G file)
strip <file>
chown owner:group file

[1] https://devmanual.gentoo.org/function-reference/install-functions/
[2] https://gitweb.gentoo.org/proj/portage.git/tree/bin/estrip
[3] https://reviews.llvm.org/D93881

Thanks,
Manoj

[-- Attachment #2: Type: text/html, Size: 1899 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-02-10  4:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-05  0:09 [gentoo-dev] portage reliance on GNU objcopy ownership perseverance behavior in strip Manoj Gupta
2021-02-05  1:00 ` Michael Orlitzky
2021-02-10  1:53 ` [gentoo-dev] " Fāng-ruì Sòng
2021-02-10  2:02   ` Michael Orlitzky
2021-02-10  2:25     ` Manoj Gupta
2021-02-10  2:44       ` Michael Orlitzky
2021-02-10  4:44         ` Michael Orlitzky
2021-02-10  4:53           ` Manoj Gupta
2021-02-10  2:27     ` Fangrui Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox