MPTCP Linux Development
 help / color / mirror / Atom feed
From: gang.yan@linux.dev
To: "Matthieu Baerts" <matttbe@kernel.org>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next 2/2] mptcp: use sockopt_lock(release)_sock in sockopt
Date: Tue, 28 Apr 2026 03:09:57 +0000	[thread overview]
Message-ID: <c773d6a165a1abeb963481ef76117a049952ae87@linux.dev> (raw)
In-Reply-To: <318c9ceb-b446-499f-9ee0-ccef871b5b21@kernel.org>

April 27, 2026 at 10:47 PM, "Matthieu Baerts" <matttbe@kernel.org mailto:matttbe@kernel.org?to=%22Matthieu%20Baerts%22%20%3Cmatttbe%40kernel.org%3E > wrote:


> 
> Hi Gang,
> 
> On 22/04/2026 11:19, Gang Yan wrote:
> 
> > 
> > From: Gang Yan <yangang@kylinos.cn>
> >  
> >  TCP and the core socket layer all use sockopt_lock_sock()
> >  sockopt_release_sock() in their setsockopt and getsockopt handlers. It
> >  is a BPF-aware wrapper that skips lock acquisition when invoked from a
> >  BPF program, where the socket lock is already held.
> >  
> >  Using lock_sock_fast() on subflows requires extra care: the fast path
> >  holds the socket spinlock with BH disabled, creating an atomic context
> >  where sleeping is not allowed. Switching to sockopt_lock_sock()
> >  avoids the risk of accidentally introducing sleeping operations inside
> >  the lock_sock_fast() critical section.
> > 
> Good catch, I guess we need this too. I think this patch can be seen as
> a fix as well, maybe with this tag?
> 
>  24426654ed3a ("bpf: net: Avoid sk_setsockopt() taking sk lock when
> called from bpf")
> 
> WDYT?
> 
> Also, from the same BPF series, we probably need this, no?
> 
>  e42c7beee71d ("bpf: net: Consider has_current_bpf_ctx() when testing
> capable() in sk_setsockopt()")

Great suggestions!

I'm a bit busy with ongoing work recently, but will check those two commits
carefully this week later. If these changes are necessary, I will send out a
new complete patch series. If not required separately, I will post relevant
updates in the mailing list thread accordingly.

Thanks
Gang
> 
> Cheers,
> Matt
> -- 
> Sponsored by the NGI0 Core fund.
>

  reply	other threads:[~2026-04-28  3:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-22  9:19 [PATCH mptcp-net 0/2] mptcp: replace lock_sock_fast with sleepable lock Gang Yan
2026-04-22  9:19 ` [PATCH mptcp-net 1/2] mptcp: fix scheduling with atomic in timestamp sockopt Gang Yan
2026-04-27 14:49   ` Matthieu Baerts
2026-04-22  9:19 ` [PATCH mptcp-next 2/2] mptcp: use sockopt_lock(release)_sock in sockopt Gang Yan
2026-04-27 14:47   ` Matthieu Baerts
2026-04-28  3:09     ` gang.yan [this message]
2026-04-23 16:45 ` [PATCH mptcp-net 0/2] mptcp: replace lock_sock_fast with sleepable lock MPTCP CI
2026-04-27 15:04 ` Matthieu Baerts
2026-04-28  2:56   ` gang.yan

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=c773d6a165a1abeb963481ef76117a049952ae87@linux.dev \
    --to=gang.yan@linux.dev \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    /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