Netdev List
 help / color / mirror / Atom feed
From: Yingjie Wang <1075151112@qq.com>
To: Kuniyuki Iwashima <kuniyu@google.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH net] net: unix: reject negative max_dgram_qlen values
Date: Sat, 29 Aug 2026 13:32:10 +0800	[thread overview]
Message-ID: <tencent_762005AB7B4F04A2824BBD13EBFFB6CFC607@qq.com> (raw)
In-Reply-To: <CAAVpQUAYOo1hRXD_fFx9oa2bqTV_x17i7Y=vajcx1knYNLjdsQ@mail.gmail.com>

On Fri, Aug 28, 2026 at 10:49 AM Kuniyuki Iwashima <kuniyu@google.com> wrote:
> I'm not sure if this was intended, but passing -1 for sk_max_ack_backlog
> is known hacky config to get max, see __sys_listen_socket().

I checked this.  In __sys_listen_socket(), a negative backlog is cast to
unsigned and capped to somaxconn; there are also in-tree tests using
listen(..., -1).

I could not find the same convention for max_dgram_qlen.  It is not
documented or special-cased, and I found no in-tree user or test relying
on -1.  The sysctl value is copied directly to the u32 sk_max_ack_backlog,
so -1 becomes UINT_MAX without the somaxconn cap.

> At least, this effectively limits the upper bound to half,
> sk_buff_head.qlen is also u32.

Good point.  I'll change sysctl_max_dgram_qlen to unsigned int and use
proc_douintvec_minmax in v2, so negative writes are rejected while keeping
the full u32 range.

Thanks,
Yingjie


      reply	other threads:[~2026-08-29  5:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26  6:10 [PATCH net] net: unix: reject negative max_dgram_qlen values Yingjie Wang
2026-08-28 17:49 ` Kuniyuki Iwashima
2026-08-29  5:32   ` Yingjie Wang [this message]

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=tencent_762005AB7B4F04A2824BBD13EBFFB6CFC607@qq.com \
    --to=1075151112@qq.com \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@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