mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yingjie Wang <x-professor@outlook.com>
To: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	Manfred Spraul <manfred@colorfullife.com>,
	Alexey Gladkov <legion@kernel.org>,
	"Eric W . Biederman" <ebiederm@xmission.com>
Cc: "Yingjie Wang" <x-professor@outlook.com>,
	"Vasily Averin" <vasily.averin@linux.dev>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Shakeel Butt" <shakeel.butt@linux.dev>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Michal Hocko" <mhocko@suse.com>,
	"Alejandro Colomar" <alx@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"cgroups@vger.kernel.org" <cgroups@vger.kernel.org>,
	"linux-api@vger.kernel.org" <linux-api@vger.kernel.org>,
	"linux-man@vger.kernel.org" <linux-man@vger.kernel.org>
Subject: [PATCH v3 0/3] ipc/sem: account enlarged sops arrays and validate SEMOPM
Date: Sat, 24 Oct 2026 12:21:40 +0000	[thread overview]
Message-ID: <cover.1792808260.git.x-professor@outlook.com> (raw)

Andrew, Manfred, thanks for the review.

This version separates the accounting threshold from the UAPI default.
SEMOPM can be changed when rebuilding the kernel, so it should not also
determine which operation arrays are accounted. The new internal
SEMOPM_NOACCOUNT threshold is fixed at 1000 operations. Allocations above
it use GFP_KERNEL_ACCOUNT; requests at or below it keep their existing
behavior.

The sysctl handler now parses writes into a temporary array while holding a
per-IPC-namespace mutex. The mutex covers the snapshot, validation, and
publication, so a failed write leaves the live settings unchanged and a
partial write cannot restore fields from an older snapshot. The snapshot and
publication use READ_ONCE() and WRITE_ONCE(), and reads continue through
proc_dointvec(). The unused sem_check_semmni() helper has also been removed.

The UAPI warning about physical fragmentation is obsolete now that the
operation array uses kvmalloc(). The header now describes SEMOPM as the
compiled-in default and retains the uniform <= INT_MAX range comment.

The series is based on 7be4bc52fd9e ("Merge tag 'driver-core-7.4-rc1' of
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core").

Validation completed:

- W=1 builds of the changed objects and a full x86-64 bzImage build;
- a W=1 i386 build of ipc/sem.o, ipc/ipc_sysctl.o, and ipc/namespace.o;
- initial and user-owned non-initial IPC namespaces rejected negative SEMOPM,
  invalid SEMMNI, and malformed writes without changing live settings;
- zero and positive SEMOPM values remained valid, with the configured
  operation-count boundary enforced;
- the operation-count boundary was checked at 1000 and 1001 operations;
- concurrent partial, full, rejected, and successful sysctl writes completed
  without stale-snapshot overwrites;
- successful, EAGAIN, EFAULT, signal-interruption, and IPC_RMID paths released
  operation-array allocations;
- a constrained memcg run with enlarged operation arrays entered the
  GFP_KERNEL_ACCOUNT limit path and returned allocation profiling to baseline;
- strict checkpatch (with the intentional CONST_STRUCT diagnostic ignored)
  and patch application checks passed.

Changes since v2:

- use a fixed internal SEMOPM_NOACCOUNT=1000 threshold instead of the
  rebuildable UAPI SEMOPM value for the accounting decision;
- remove sem_check_semmni() and inline the SEMMNI and SEMOPM range checks;
- restore the uniform <= INT_MAX SEMOPM comment form in the UAPI header;
- retain Manfred Spraul's Reviewed-by tags on the two patches revised
  according to his comments.

V2:
https://www.spinics.net/lists/kernel/msg6527052.html

Manfred's v2 review of 2/3:
https://www.spinics.net/lists/kernel/msg6528247.html

Manfred's v2 review of 3/3:
https://www.spinics.net/lists/kernel/msg6528679.html

An AI coding assistant assisted with implementation review, commit-message
drafting, and test planning.

Yingjie Wang (3):
  ipc/sem: account enlarged sops arrays to memcg
  ipc/sem: reject negative SEMOPM values
  ipc/sem: remove obsolete SEMOPM fragmentation warning

 include/linux/ipc_namespace.h |  3 +++
 include/uapi/linux/sem.h      |  7 +++----
 ipc/ipc_sysctl.c              | 35 ++++++++++++++++++++++++++---------
 ipc/sem.c                     |  7 ++++++-
 ipc/util.h                    |  9 ---------
 5 files changed, 38 insertions(+), 23 deletions(-)


base-commit: 7be4bc52fd9e0e55dc9a2e0232b89427d2c4b614
-- 
2.43.0


             reply	other threads:[~2026-10-24 12:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-24 12:21 Yingjie Wang [this message]
2026-10-24 12:21 ` [PATCH v3 1/3] ipc/sem: account enlarged sops arrays to memcg Yingjie Wang
2026-10-24 12:21 ` [PATCH v3 2/3] ipc/sem: reject negative SEMOPM values Yingjie Wang
2026-10-24 13:23   ` Alejandro Colomar
2026-10-24 12:21 ` [PATCH v3 3/3] ipc/sem: remove obsolete SEMOPM fragmentation warning Yingjie Wang

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=cover.1792808260.git.x-professor@outlook.com \
    --to=x-professor@outlook.com \
    --cc=akpm@linux-foundation.org \
    --cc=alx@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=hannes@cmpxchg.org \
    --cc=legion@kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=manfred@colorfullife.com \
    --cc=mhocko@suse.com \
    --cc=mkoutny@suse.com \
    --cc=shakeel.butt@linux.dev \
    --cc=vasily.averin@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

all inboxes | Powered by JetHome®