public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@gotplt.org>
To: Alan Modra <amodra@gmail.com>
Cc: binutils@sourceware.org, i@maskray.me, nickc@redhat.com
Subject: Re: [PATCH] binutils: Attempt to retain permissions on copying file
Date: Wed, 24 Feb 2021 15:57:10 +0530	[thread overview]
Message-ID: <ea419cd3-bc52-fce3-a3a9-ce8ac41232ed@gotplt.org> (raw)
In-Reply-To: <20210223115644.GI6042@bubble.grove.modra.org>

On 2/23/21 5:26 PM, Alan Modra wrote:
> On Tue, Feb 23, 2021 at 12:22:59PM +0530, Siddhesh Poyarekar wrote:
>> Writing into an existing file clears its S_ISUID and S_ISGID bits.
>> Attempt to restore those permission bits but don't fail if it doesn't
>> work.
>>
>> Also, since the output file always exists (all callers create an empty
>> file before calling smart_rename), open the file without any
>> permission hints or O_CREAT.
>>
>> binutils/
>>
>> 	* rename.c (simple_copy): Don't use O_CREAT.
>> 	(simple_copy)[!defined (_WIN32) || defined (__CYGWIN32__)]:
>> 	Attempt to retain permission bits.
> 
> Thanks, I'll fold this into a followup patch of mine that makes use of
> the temp file descriptor in smart_rename rather than reopening the
> file.  I don't believe there is a security issue in reopening the
> file, but this way there is one less directory operation.  I'm also
> going to make use of the target_stat we already have rather than
> calling stat again.

I just tested tip and it looks in good shape.  I suppose this ought to 
go into 2.36 too since the simple_copy patch went in there too.

Thanks,
Siddhesh

  reply	other threads:[~2021-02-24 10:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 19:17 [PATCH] binutils: Avoid renaming over existing files Siddhesh Poyarekar
2021-02-09  3:33 ` Fangrui Song
2021-02-15  5:17 ` [PING][PATCH] " Siddhesh Poyarekar
2021-02-15 15:59   ` Michael Matz
2021-02-15 16:11     ` Siddhesh Poyarekar
2021-02-18 19:20   ` Nick Clifton
2021-02-19  2:37     ` Siddhesh Poyarekar
2021-02-19  7:44       ` Matthias Klose
2021-02-19  8:02         ` Siddhesh Poyarekar
2021-02-19 16:45           ` Nick Clifton
2021-02-22 15:30             ` Siddhesh Poyarekar
2021-02-23  0:00               ` Alan Modra
2021-02-23  2:23                 ` Siddhesh Poyarekar
2021-02-23  4:44                   ` Fangrui Song
2021-02-23  5:10                     ` Siddhesh Poyarekar
2021-02-23  6:52                       ` [PATCH] binutils: Attempt to retain permissions on copying file Siddhesh Poyarekar
2021-02-23 11:56                         ` Alan Modra
2021-02-24 10:27                           ` Siddhesh Poyarekar [this message]
2021-02-24 23:47                             ` Alan Modra
2021-02-25  2:28                               ` Siddhesh Poyarekar
2021-02-26  7:33                                 ` Alan Modra
2021-02-23 18:49                         ` Marco Atzeri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea419cd3-bc52-fce3-a3a9-ce8ac41232ed@gotplt.org \
    --to=siddhesh@gotplt.org \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=i@maskray.me \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).