Linux filesystem development
 help / color / mirror / Atom feed
From: Laura Brehm <laurajfbrehm@gmail.com>
To: brauner@kernel.org
Cc: laurabrehm@hey.com, laurajfbrehm@gmail.com,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] coredump: fix race condition between connect and
Date: Fri,  4 Jul 2025 12:40:42 +0200	[thread overview]
Message-ID: <20250704104042.86223-1-laurabrehm@hey.com> (raw)
In-Reply-To: <20250704-ernten-fehlschlag-05a175183e12@brauner>

> kernel_connect()
> -> sock->ops->connect::unix_stream_connect()
>   -> prepare_peercred()
>      -> pidfs_register_pid()

Ah, thank you! I initially ran into this while working from an older
tree that had had the coredump-socket series cherry-picked into it,
but it was missing Commit fd0a109a0f6b7524543d17520da92a44a9f5343c
("net, pidfs: prepare for handing out pidfds for reaped 
sk->sk_peer_pid").

My tree instead had:
    static void init_peercred(struct sock *sk)
    {
	    sk->sk_peer_pid = get_pid(task_tgid(current));
	    sk->sk_peer_cred = get_current_cred();
    }

I switched over to the main tree when preparing patches, but missed
that the issue was not present there. 

> Honestly curious: is that something you actually observed or that you
> think may happen or that an some coding assistant thinks might happen?

No coding assistants (not a fan), but I understand the question. I
maintain some other large projects and we get a few inane patches
too. I usually try my best to avoid making patches such as these
without some amount of double checking if I'm addressing a real issue,
but I did run into the issue I described (about half the time,
depending on how fast the coredump server ran) in my tree, and I
forgot to repro after switching trees.

Apologies for the inconvenience, and for the understanding/quick
replies!


  reply	other threads:[~2025-07-04 10:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250703120244.96908-1-laurabrehm@hey.com>
2025-07-03 12:02 ` [PATCH 1/2] coredump: fix race condition between connect and putting pidfs dentry Laura Brehm
2025-07-04  8:51   ` Christian Brauner
2025-07-04 10:40     ` Laura Brehm [this message]
2025-07-03 12:02 ` [PATCH 2/2] coredump: fix PIDFD_INFO_COREDUMP ioctl check Laura Brehm
2025-07-04  8:57   ` (subset) " Christian Brauner
2025-07-04  8:57   ` Christian Brauner

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=20250704104042.86223-1-laurabrehm@hey.com \
    --to=laurajfbrehm@gmail.com \
    --cc=brauner@kernel.org \
    --cc=laurabrehm@hey.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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