[PATCH] D62718: [llvm-objcopy] Change handling of output file permissions

Alex Brachet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 00:36:06 PDT 2019


abrachet added a comment.

> If it is a block/character special file, you probably don't want to change its permission (think: root does llvm-objcopy something /dev/null).

I think we have 3 ways of addressing this:

1. Add flags to various file handling routines in sys::fs to be weary to not change permissions of a special file.
2. Ignore this because it is very unlikely.
3. Not changing permissions of the output file if it is being written over.

I had actually started on 1, but think that it was not worth it, it just clutters their parameters for very little reason. Ultimately I think the problem here is very unlikely for this and other llvm tools. I don't remember the last time I ran anything as su, nor do I think any setuid program would have any reason run llvm-objcopy or any other llvm tools. I think 3 is the obvious compromise, checking if we are writing to a special file is too niche to worry about in my opinion, but not changing permission bits of an existing file would solve the concern raised in a straight forward manner. Personally I am the biggest fan of 2 for the reasons above, I'm not sure that the benefits of 3 outweigh the cost of adding what would be confusing behavior in my opinion.


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

https://reviews.llvm.org/D62718





More information about the llvm-commits mailing list