* [merged mm-nonmm-hotfixes-stable] ipc-msg-keep-expelled-receivers-from-taking-new-messages.patch removed from -mm tree
@ 2026-12-02 3:50 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-12-02 3:50 UTC (permalink / raw)
To: mm-commits, stable, manfred, dave, akpm, songhh06101
The quilt patch titled
Subject: ipc/msg: keep expelled receivers from taking new messages
has been removed from the -mm tree. Its filename was
ipc-msg-keep-expelled-receivers-from-taking-new-messages.patch
This patch was dropped because it was merged into the mm-nonmm-hotfixes-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Hyunho Song <songhh06101@gmail.com>
Subject: ipc/msg: keep expelled receivers from taking new messages
Date: Wed, 18 Nov 2026 12:28:21 +0900
Patch series "ipc/msg: prevent reads after queue permission revocation".
A process whose read access to a SysV message queue was revoked by IPC_SET
can receive a message sent afterward. A blocked receiver needs no
capability and can have a different UID from the queue owner. Patch 1
prevents delivery to a receiver awakened by IPC_SET. Patch 2 closes the
window between the read permission check and waiter insertion.
IPC_SET wakes all blocked receivers, including those whose read access is
unchanged. Each leaves q_receivers when it runs; a receiver that must
wait again rejoins at the tail, so IPC_SET can change their FIFO order.
Until they run, a sender queues a message instead of handing it to one of
them. An authorized receiver may then take it from the queue.
Waking only receivers whose access was revoked is not a small change.
IPC_SET runs in the setter's context, but ipcperms() checks current's
credentials and invokes the security hook. Deciding which waiters lost
access would need a way to check each receiver's credentials and security
policy, with appropriate audit behavior. Leave that separate from this
fix; IPC_SET is infrequent, and the existing wake-all behavior remains.
This patch (of 2):
IPC_SET sets a blocked receiver's result to -EAGAIN so it retries its read
permission check. expunge_all() leaves the receiver on q_receivers; a
sender can hand it a new message before it wakes. If IPC_SET revoked its
read access, it receives data that was sent after the revocation.
Mark every receiver that expunge_all() touched and skip it in
pipelined_send(). Keep it linked until it wakes so IPC_RMID can still
find it and change its result to -EIDRM. The sender queues the message
instead. On retry, a receiver with read access can take it from the
queue; a receiver whose read access was revoked gets -EACCES.
Signed-off-by: Hyunho Song <songhh06101@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reported-by: Hyunho Song <songhh06101@gmail.com>
Reviewed-by: Manfred Spraul <manfred@colorfullife.com>
Tested-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: <stable@vger.kernel.org>
ipc/msg.c | 7 +++++++
1 file changed, 7 insertions(+)
--- a/ipc/msg.c~ipc-msg-keep-expelled-receivers-from-taking-new-messages
+++ a/ipc/msg.c
@@ -82,6 +82,7 @@ struct msg_receiver {
long r_maxsize;
struct msg_msg *r_msg;
+ bool r_expunge;
};
/* one msg_sender for each sleeping sender */
@@ -255,6 +256,8 @@ static void expunge_all(struct msg_queue
struct task_struct *r_tsk;
r_tsk = get_task_struct(msr->r_tsk);
+ /* IPC_RMID must still find this waiter and set -EIDRM. */
+ msr->r_expunge = true;
/* see MSG_BARRIER for purpose/pairing */
smp_store_release(&msr->r_msg, ERR_PTR(res));
@@ -819,6 +822,9 @@ static inline int pipelined_send(struct
struct msg_receiver *msr, *t;
list_for_each_entry_safe(msr, t, &msq->q_receivers, r_list) {
+ /* IPC_SET needs the receiver to recheck its access. */
+ if (msr->r_expunge)
+ continue;
if (testmsg(msg, msr->r_msgtype, msr->r_mode) &&
!security_msg_queue_msgrcv(&msq->q_perm, msg, msr->r_tsk,
msr->r_msgtype, msr->r_mode)) {
@@ -1178,6 +1184,7 @@ static long do_msgrcv(int msqid, void __
goto out_unlock0;
}
+ msr_d.r_expunge = false;
list_add_tail(&msr_d.r_list, &msq->q_receivers);
msr_d.r_tsk = current;
msr_d.r_msgtype = msgtyp;
_
Patches currently in -mm which might be from songhh06101@gmail.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-02 3:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 3:50 [merged mm-nonmm-hotfixes-stable] ipc-msg-keep-expelled-receivers-from-taking-new-messages.patch removed from -mm tree Andrew Morton
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.