MPTCP Linux Development
 help / color / mirror / Atom feed
From: Mat Martineau <martineau@kernel.org>
To: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-net 0/9] net: sysctl: avoid using current->nsproxy
Date: Tue, 7 Jan 2025 17:49:18 -0800 (PST)	[thread overview]
Message-ID: <d79d6baa-7215-a7f3-df35-c802fafb073e@kernel.org> (raw)
In-Reply-To: <20250107-mptcp-sysfs-netns-v1-0-2fa7075d9970@kernel.org>

On Tue, 7 Jan 2025, Matthieu Baerts (NGI0) wrote:

> As pointed out by Al Viro and Eric Dumazet in [1], using the 'net'
> structure via 'current' is not recommended for different reasons:
>
> - Inconsistency: getting info from the reader's/writer's netns vs only
>  from the opener's netns.
>
> - current->nsproxy can be NULL in some cases, resulting in an 'Oops'
>  (null-ptr-deref), e.g. when the current task is exiting, as spotted by
>  syzbot [1] using acct(2).
>
> The 'net' or 'pernet' structure can be obtained from the table->data
> using container_of().
>
> Note that table->data could also be used directly in more places, but
> that would increase the size of this fix to replace all accesses via
> 'net'.
>
> Patches 2-9 remove access of net via current->nsproxy in sysfs handlers
> in MPTCP, SCTP and RDS. There are multiple patches to ease the
> backports.
>
> Patch 1 is not directly linked to this, but it is a small fix for MPTCP
> available_schedulers sysctl knob to explicitly mark it as read-only.
>
> Please note that this series does not address Al's comment [2]. In SCTP,
> some sysctl knobs set other sysfs-exposed variables for the min/max: two
> processes could then write two linked values at the same time, resulting
> in new values being outside the new boundaries.


Thanks Matthieu,

The mptcp patches (1-3) LGTM:

Reviewed-by: Mat Martineau <martineau@kernel.org>


The sctp and rds patches look fine as well.


- Mat


>
> Link: https://lore.kernel.org/67769ecb.050a0220.3a8527.003f.GAE@google.com [1]
> Link: https://lore.kernel.org/netdev/20250105211158.GL1977892@ZenIV/ [2]
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> ---
> Matthieu Baerts (NGI0) (9):
>      mptcp: sysctl: avail sched: remove write access
>      mptcp: sysctl: sched: avoid using current->nsproxy
>      mptcp: sysctl: blackhole timeout: avoid using current->nsproxy
>      sctp: sysctl: cookie_hmac_alg: avoid using current->nsproxy
>      sctp: sysctl: rto_min/max: avoid using current->nsproxy
>      sctp: sysctl: auth_enable: avoid using current->nsproxy
>      sctp: sysctl: udp_port: avoid using current->nsproxy
>      sctp: sysctl: plpmtud_probe_interval: avoid using current->nsproxy
>      rds: sysctl: rds_tcp_{rcv,snd}buf: avoid using current->nsproxy
>
> net/mptcp/ctrl.c  | 17 +++++++++--------
> net/rds/tcp.c     | 39 ++++++++++++++++++++++++++++++++-------
> net/sctp/sysctl.c | 14 ++++++++------
> 3 files changed, 49 insertions(+), 21 deletions(-)
> ---
> base-commit: 474ab61b2b3a9a0c31267efe807c4fed12d66d28
> change-id: 20250105-mptcp-sysfs-netns-23723ba85401
>
> Best regards,
> -- 
> Matthieu Baerts (NGI0) <matttbe@kernel.org>
>
>
>

  parent reply	other threads:[~2025-01-08  1:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 17:09 [PATCH mptcp-net 0/9] net: sysctl: avoid using current->nsproxy Matthieu Baerts (NGI0)
2025-01-07 17:09 ` [PATCH mptcp-net 1/9] mptcp: sysctl: avail sched: remove write access Matthieu Baerts (NGI0)
2025-01-07 17:09 ` [PATCH mptcp-net 2/9] mptcp: sysctl: sched: avoid using current->nsproxy Matthieu Baerts (NGI0)
2025-01-07 17:09 ` [PATCH mptcp-net 3/9] mptcp: sysctl: blackhole timeout: " Matthieu Baerts (NGI0)
2025-01-07 17:09 ` [PATCH mptcp-net 4/9] sctp: sysctl: cookie_hmac_alg: " Matthieu Baerts (NGI0)
2025-01-07 17:09 ` [PATCH mptcp-net 5/9] sctp: sysctl: rto_min/max: " Matthieu Baerts (NGI0)
2025-01-07 17:09 ` [PATCH mptcp-net 6/9] sctp: sysctl: auth_enable: " Matthieu Baerts (NGI0)
2025-01-07 17:09 ` [PATCH mptcp-net 7/9] sctp: sysctl: udp_port: " Matthieu Baerts (NGI0)
2025-01-07 17:09 ` [PATCH mptcp-net 8/9] sctp: sysctl: plpmtud_probe_interval: " Matthieu Baerts (NGI0)
2025-01-07 17:09 ` [PATCH mptcp-net 9/9] rds: sysctl: rds_tcp_{rcv,snd}buf: " Matthieu Baerts (NGI0)
2025-01-07 18:23 ` [PATCH mptcp-net 0/9] net: sysctl: " MPTCP CI
2025-01-08  1:49 ` Mat Martineau [this message]
2025-01-08 11:57   ` Matthieu Baerts

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=d79d6baa-7215-a7f3-df35-c802fafb073e@kernel.org \
    --to=martineau@kernel.org \
    --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