All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Joel Granados <joel.granados@kernel.org>
Cc: Kees Cook <kees@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Jianlin Shi <shijianlin11@foxmail.com>,
	vbabka@kernel.org, hannes@cmpxchg.org, surenb@google.com,
	mhocko@suse.com, jackmanb@google.com, ziy@nvidia.com,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v2 0/4] sysctl: Disallow partial updates of miss-formatted sysctl vectors
Date: Fri, 14 Aug 2026 12:36:02 -0700	[thread overview]
Message-ID: <20260814123602.ec6889355580da96958b79d6@linux-foundation.org> (raw)
In-Reply-To: <20260814-lklm-partial_ctlvec-v2-0-9df50d26e477@kernel.org>

On Fri, 14 Aug 2026 12:41:11 +0200 Joel Granados <joel.granados@kernel.org> wrote:

> What?
> =====
> 
> Stage table->data when writing INT & ULONG ctl_tables. Commit staged
> data to kernel variable only when all the conversions have succeeded.
> This is applicable only to variables that represent a vector; paths
> pertaining to scalers are left unchanged. Notice that partial updates

"scalars"

> can still happen if less than the size of the vector are passed and
> correctly formatted.
> 
> This is the behavior we are protecting against:
> 
>   # echo "4 4 1 7" > /proc/sys/kernel/printk
>   # echo "1 x" > /proc/sys/kernel/printk
>   -bash: echo: write error: Invalid argument
>   # cat /proc/sys/kernel/printk
>   1 4 1 7    <- the write failed, the first element changed anyway

I like the change.

> Why?
> ====
> Allowing a partial change to a vector after returning from an erroneous
> proc_handler is just plain wrong. This should be handled within sysctl
> to avoid users having to do it for themselves [1]. 
> 
> Behavioral Changes
> ==================
> 1. A failed write will not update the vector
> 2. Vector writes can now fail with -ENOMEM

Yeah, this improves Linux.

> Testing
> =======
> This went through regular sysctl kunit and self test. Also is posted to
> 0-day.
> 
> I always find it difficult to know who wants to receive this. Please let
> me know if you want to be removed from the Cc/To.

Sashiko said one thing:
	https://sashiko.dev/#/patchset/20260814-lklm-partial_ctlvec-v2-0-9df50d26e477@kernel.org


      parent reply	other threads:[~2026-08-14 19:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 10:41 [PATCH v2 0/4] sysctl: Disallow partial updates of miss-formatted sysctl vectors Joel Granados
2026-08-14 10:41 ` [PATCH v2 1/4] sysctl: Split data conversion and file position handling Joel Granados
2026-08-14 10:41 ` [PATCH v2 2/4] sysctl: Reject uint arrays before calling the general proc_vec Joel Granados
2026-08-14 10:41 ` [PATCH v2 3/4] sysctl: Disallow partial updates for erroneous sysctl vectors Joel Granados
2026-08-14 10:41 ` [PATCH v2 4/4] sysctl: Add 0013 to test partially updated vectors Joel Granados
2026-08-14 19:36 ` Andrew Morton [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=20260814123602.ec6889355580da96958b79d6@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=joel.granados@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=shijianlin11@foxmail.com \
    --cc=shuah@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=ziy@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.