git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 5/8] unix-stream-server: add st_dev and st_mode to socket stolen checks

From
René Scharfe <l.s.r@web.de>
Date
Mar 6, 2021, 11:42 UTC
Message-ID
<05f4cb97-5d78-4698-795d-311197052e22@web.de>
In-Reply-To
<89100959528c6a3c16622cf86e6920273f5ed2d3.1614889047.git.gitgitgadget@gmail.com>
Am 04.03.21 um 21:17 schrieb Jeff Hostetler via GitGitGadget:
Show 26 quoted lines
> 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.)

Show 6 quoted lines
> +	if (!S_ISSOCK(st_now.st_mode))
> +		return 1;
>
>  	return 0;
>  }
>
Previous: Jeff Hostetler via GitGitGadgetNext: Jeff Hostetler
Message 9 of 15 in “Simple IPC Cleanups”
  1. 0/8 Simple IPC CleanupsJeff Hostetler via GitGitGadget, Mar 4, 2021
  2. 6/8 test-simple-ipc: refactor command line option processing in helperJeff Hostetler via GitGitGadget, Mar 4, 2021
  3. 7/8 test-simple-ipc: add --token=<token> string optionJeff Hostetler via GitGitGadget, Mar 4, 2021
  4. 4/8 simple-ipc: move error handling up a levelJeff Hostetler via GitGitGadget, Mar 4, 2021
  5. 2/8 unix-socket: simplify initialization of unix_stream_listen_optsJeff Hostetler via GitGitGadget, Mar 4, 2021
  6. Junio C HamanoMar 4, 2021
  7. 3/8 unix-stream-server: create unix-stream-server.cJeff Hostetler via GitGitGadget, Mar 4, 2021
  8. 5/8 unix-stream-server: add st_dev and st_mode to socket stolen checksJeff Hostetler via GitGitGadget, Mar 4, 2021
  9. René ScharfeMar 6, 2021
  10. Jeff HostetlerMar 8, 2021
  11. 1/8 pkt-line: remove buffer arg from write_packetized_from_fd_no_flush()Jeff Hostetler via GitGitGadget, Mar 4, 2021
  12. Junio C HamanoMar 4, 2021
  13. 8/8 simple-ipc: update design documentation with more detailsJeff Hostetler via GitGitGadget, Mar 4, 2021
  14. Junio C HamanoMar 5, 2021
  15. Jeff HostetlerMar 5, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.