git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff Hostetler <git@jeffhostetler.com>
To: "René Scharfe" <l.s.r@web.de>,
	"Jeff Hostetler via GitGitGadget" <gitgitgadget@gmail.com>,
	git@vger.kernel.org
Cc: Jeff Hostetler <jeffhost@microsoft.com>
Subject: Re: [PATCH 5/8] unix-stream-server: add st_dev and st_mode to socket stolen checks
Date: Mon, 8 Mar 2021 09:14:48 -0500	[thread overview]
Message-ID: <f74c7b94-0378-edfc-6f34-18c896570a3e@jeffhostetler.com> (raw)
In-Reply-To: <05f4cb97-5d78-4698-795d-311197052e22@web.de>



On 3/6/21 6:42 AM, René Scharfe wrote:
> Am 04.03.21 um 21:17 schrieb Jeff Hostetler via GitGitGadget:
>> From: Jeff Hostetler <jeffhost@microsoft.com>
>>
>> When checking to see if our unix domain socket was stolen, also check
>> whether the st.st_dev and st.st_mode fields changed (in addition to
>> the st.st_ino field).
>>
>> The inode by itself is not unique; it is only unique on a given
>> device.
>>
>> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
>> ---
>>   unix-stream-server.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/unix-stream-server.c b/unix-stream-server.c
>> index f00298ca7ec3..366ece69306b 100644
>> --- a/unix-stream-server.c
>> +++ b/unix-stream-server.c
>> @@ -120,8 +120,11 @@ int unix_stream_server__was_stolen(
>>
>>   	if (st_now.st_ino != server_socket->st_socket.st_ino)
>>   		return 1;
>> +	if (st_now.st_dev != server_socket->st_socket.st_dev)
>> +		return 1;
>>
>> -	/* We might also consider the ctime on some platforms. */
> 
> Why remove that comment?  (This change is not mentioned in the commit
> message.)

I added it as a TODO to myself thinking that it might give us
additional assurances on some platforms while I was originally
getting things working.  In hindsight (and now that we have the
lockfile helping us), I didn't think it was actually needed, so
I removed it.

I didn't think it warranted a mention in the commit message.

> 
>> +	if (!S_ISSOCK(st_now.st_mode))
>> +		return 1;
>>
>>   	return 0;
>>   }
>>
> 

  reply	other threads:[~2021-03-08 14:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 20:17 [PATCH 0/8] Simple IPC Cleanups Jeff Hostetler via GitGitGadget
2021-03-04 20:17 ` [PATCH 1/8] pkt-line: remove buffer arg from write_packetized_from_fd_no_flush() Jeff Hostetler via GitGitGadget
2021-03-04 22:55   ` Junio C Hamano
2021-03-04 20:17 ` [PATCH 2/8] unix-socket: simplify initialization of unix_stream_listen_opts Jeff Hostetler via GitGitGadget
2021-03-04 23:12   ` Junio C Hamano
2021-03-04 20:17 ` [PATCH 3/8] unix-stream-server: create unix-stream-server.c Jeff Hostetler via GitGitGadget
2021-03-04 20:17 ` [PATCH 4/8] simple-ipc: move error handling up a level Jeff Hostetler via GitGitGadget
2021-03-04 20:17 ` [PATCH 5/8] unix-stream-server: add st_dev and st_mode to socket stolen checks Jeff Hostetler via GitGitGadget
2021-03-06 11:42   ` René Scharfe
2021-03-08 14:14     ` Jeff Hostetler [this message]
2021-03-04 20:17 ` [PATCH 6/8] test-simple-ipc: refactor command line option processing in helper Jeff Hostetler via GitGitGadget
2021-03-04 20:17 ` [PATCH 7/8] test-simple-ipc: add --token=<token> string option Jeff Hostetler via GitGitGadget
2021-03-04 20:17 ` [PATCH 8/8] simple-ipc: update design documentation with more details Jeff Hostetler via GitGitGadget
2021-03-05  0:24 ` [PATCH 0/8] Simple IPC Cleanups Junio C Hamano
2021-03-05 21:34   ` Jeff Hostetler

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=f74c7b94-0378-edfc-6f34-18c896570a3e@jeffhostetler.com \
    --to=git@jeffhostetler.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=jeffhost@microsoft.com \
    --cc=l.s.r@web.de \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).