From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796183458; b=045GRzj04FLfEPf6LdieouuGXsKeA1WHwjf3WfptnIw0fP60X3fGf6wGVMFcHfJzEOPI LKl8wGnCiIZBBmkyOf3DGkEA3pFk4XwZaari5fu/vMONQi3i/xDuuvD8bn225kaud5fkU niCdpVBco/AmjMGpysZx+pr6IoY2qQ+qKovF1eph01mHRT3ario5q0wzb4vlxu4tizAB2 e/uxD0uY2jyQtEMkQtND9lXqbGJpK70MIPJjrOu2b53ANkcKLCOENtRlqXmP+aEMomxIL lgtHp5lnqaSnnx2Iv74qjOaQpmcxOvK/52qpQ2yI+yE2AWNe0pys6pxCJxUb2gFlDFA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796183458; h=Received:DKIM-Signature:Date:To:From:Subject:Message-Id; bh=zDcsmUzJc9xkTZNhOB2RvqafhAmHvol1cbfeiFA54HI=; b=bHK5Kj0Od1KL3iMONFuVl3Y/daaX+wrcg4pNVRkj4yCF5m7vfp+HR63XQxrfWtFDTxPP QztHuOoI13f7nalRcRx+w1rek6nr2hEJv8Zidrqbyq4ghF0HKPMWdQTtXHbKXgZPJk7vw hF6PDRNpk9pP5AJtlAl3n2lTEV9LBeixNVgqEdbwXEbZ4UwxEz7PAdTGEEtxf4Ky/Rsz+ oIV3/L8gdgRULsQxfmfsKmOt5lbxIItJSOQ9HOd0uV9t4TrTkx5xMJ4Lb3H77jUpB2VpE zdKRIJDwz6Utm3TANr0/2YwnYz9jkS8ha41pGTXid1x2/2MXu8ycPsEMYzH7Nr6xF2g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=2wVjAmSG; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7169606A322; Wed, 2 Dec 2026 03:50:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=2wVjAmSG Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71EB31F000C1; Wed, 2 Dec 2026 03:50:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796183458; bh=zDcsmUzJc9xkTZNhOB2RvqafhAmHvol1cbfeiFA54HI=; h=Date:To:From:Subject; b=2wVjAmSG2Cvm/35WOezm12r0PLLprFV07yF+qWccFfw1y55YndT8iL0r3BQz+oqOM gxErXn6gaQsVxZi5DMY3qpSxkrfIUI5PemvDn8q6ub0tFmcafaAzL10BfhipqSPWid XunlmMGsqjjHTH7Dw23/R4KbD1qgn//zj/5BYLlw= Date: Tue, 01 Dec 2026 19:50:58 -0800 To: mm-commits@vger.kernel.org,stable@vger.kernel.org, manfred@colorfullife.com,dave@stgolabs.net,akpm@linux-foundation.org, songhh06101@gmail.com From: Andrew Morton Subject: [merged mm-nonmm-hotfixes-stable] ipc-msg-keep-expelled-receivers-from-taking-new-messages.patch removed from -mm tree Message-Id: <20261202035058.71EB31F000C1@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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 Signed-off-by: Andrew Morton Reported-by: Hyunho Song Reviewed-by: Manfred Spraul Tested-by: Andrew Morton Cc: Davidlohr Bueso Cc: 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