Netdev List
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Prashanth Swaminathan <prashanthsw@google.com>
Cc: netdev@vger.kernel.org, dsahern@kernel.org, maze@google.com,
	yuyanghuang@google.com
Subject: Re: [PATCH iproute2] ss: bound fscanf width when reading comm in user_ent_hash_build_task
Date: Tue, 20 Oct 2026 11:06:42 -0700	[thread overview]
Message-ID: <20261020110642.218231ce@phoenix.local> (raw)
In-Reply-To: <CAHdA9BwQPp9ciwB4RxUd79AOkcFo6gb2t52NTtWq_52=K15p=Q@mail.gmail.com>

On Tue, 20 Oct 2026 09:59:56 -0700
Prashanth Swaminathan <prashanthsw@google.com> wrote:

> user_ent_hash_build_task() reads the process comm name from
> /proc/<pid>/stat into a 16-byte stack buffer (char name[16]) using an
> unbounded fscanf("%*d (%[^)])", name).
> 
> Although the Linux kernel bounds the comm field to TASK_COMM_LEN - 1
> (15) bytes, bound the conversion specifier to %15[^)] so a malformed
> stat entry (e.g., via PROC_ROOT or non-standard procfs implementations)
> cannot overflow the stack buffer.
> 
> Signed-off-by: Prashanth Swaminathan <prashanthsw@google.com>
> ---

If you have a non-standard procfs, that is not our problem.

  reply	other threads:[~2026-10-20 18:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20 16:59 [PATCH iproute2] ss: bound fscanf width when reading comm in user_ent_hash_build_task Prashanth Swaminathan
2026-10-20 18:06 ` Stephen Hemminger [this message]
     [not found]   ` <CAHdA9ByY3mTg6JnwaQ2ACKSvkKLCq7VZTf6ay9BfpdmmJ4=Mfg@mail.gmail.com>
2026-10-21  2:46     ` Stephen Hemminger

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=20261020110642.218231ce@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=dsahern@kernel.org \
    --cc=maze@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=prashanthsw@google.com \
    --cc=yuyanghuang@google.com \
    /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