public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Shengzhuo Wei <me@cherr.cc>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	John Stultz <johnstul@us.ibm.com>, Yao Zi <me@ziyao.cc>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] proc: fix comm_write return value when truncated or error
Date: Fri, 24 Apr 2026 21:52:12 +0300	[thread overview]
Message-ID: <5587b10e-91a4-458b-a95b-025be31e1a84@p183> (raw)
In-Reply-To: <aeuwfe6xy74R2qm4@pve.cherr>

On Sat, Apr 25, 2026 at 02:03:41AM +0800, Shengzhuo Wei wrote:
> On 2026-04-24 16:28, Alexey Dobriyan wrote:
> > > > Fixes: 4614a696bd1c ("procfs: allow threads to rename siblings via /proc/pid/tasks/tid/comm")
> > > 
> > > December 2009.
> > > 
> > > Hopefully no userspace is depending on the broken return value of a
> > > write to /proc/pid/comm.
> > > 
> > > Arguably we should leave the code as-is and add an apologetic comment
> > > explaining the situation.
> > 
> 
> First, there's a plain bug regardless: assigning -EINVAL to a size_t count and
> returning it as ssize_t produces a bogus positive value on the error path.

There is no bug, write() will return -EINVAL as it should.

> Introducing a dedicated ssize_t ret fixes this without changing any
> success-path behavior, the change is on a permission failure path, so it's hard 
> to imagine anyone depending on the broken behavior, but worth mentioning

  reply	other threads:[~2026-04-24 18:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23 20:06 [PATCH] proc: fix comm_write return value when truncated or error Shengzhuo Wei
2026-04-24 10:50 ` Andrew Morton
2026-04-24 13:28   ` Alexey Dobriyan
2026-04-24 18:03     ` Shengzhuo Wei
2026-04-24 18:52       ` Alexey Dobriyan [this message]
2026-04-24 13:35 ` Andrew Morton

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=5587b10e-91a4-458b-a95b-025be31e1a84@p183 \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=johnstul@us.ibm.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@cherr.cc \
    --cc=me@ziyao.cc \
    /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