From nobody Fri Apr 3 01:26:02 2026 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B985934A3A5 for ; Wed, 25 Mar 2026 19:00:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774465258; cv=none; b=TrE9PbGc952s8cUYHhjTawxUdZG93F2wYrjVopGHTBn17Szgr9PN6gU3FFtSfiatEsq/cPvSGWF3INIrf8e/4GKaueMuQnwidduB2GQ+QAiJwn0UzY0KRrR9dpfer43YZNoPq+PYuNcEKK178LDQukbzWejoVLlSFTu8twX7IdY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774465258; c=relaxed/simple; bh=9UEMg/LUGz82KTZ4mXaCFHNFRy8OlbOJf3nyqzMuYP0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Y1u2gvDPkk5rllzOFjLSgpY6jGWRcvOihoyaH5mSyurcsJ3mXEHFASsNIIOzjdOdHDVIHx7wI1pewa26Y5lx30hAZu1mkg1pko6sjjka57SedBIxt/+tTLga6gVWvEmeRIWio4UV7/WMYR8OfSaeOda2q8UkIGyu94/aWnRxRlA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ee.vjti.ac.in; spf=none smtp.mailfrom=ee.vjti.ac.in; dkim=pass (1024-bit key) header.d=vjti.ac.in header.i=@vjti.ac.in header.b=TJLDN6/c; arc=none smtp.client-ip=209.85.216.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ee.vjti.ac.in Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ee.vjti.ac.in Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=vjti.ac.in header.i=@vjti.ac.in header.b="TJLDN6/c" Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-3567e2b4159so109227a91.0 for ; Wed, 25 Mar 2026 12:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vjti.ac.in; s=google; t=1774465254; x=1775070054; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qzCbch/KsCOdnnvj+/cBnu2Cwa08GiMJ/oPkFKD+RSg=; b=TJLDN6/c6gBMwovAfpfB/Ho/vlYJDHptgPDukKB5mfXjIh8yBVeyR1wnnbmzIxt3Er hg1B95OCnqRqo9dvUc3A7/tNBPmQMKOsNCLoaWtwclmTmMV9fr26LBcjWsfTOg84V9NP Bnwq8yB+qi4QGo2jDP2geTbVw1+nwxXRNlKgU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774465254; x=1775070054; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=qzCbch/KsCOdnnvj+/cBnu2Cwa08GiMJ/oPkFKD+RSg=; b=fdAGuhGEoBsrcPAvCJErXvYBVv22mEevie/Kfxxv6A311QXoekXY9jZ8E6OU4dBUUS 8ulSgitnaSDW3/tDe76lDx1QBUZ41mc0vA7Wvv+LFJX/2wQmQL1DW8+0nYSFpOV1kvpt 4scA3ycaimuHqz2z3DQulDCFZIP/t4pwdosiTWl9wGzke8ey2u4Cm7z8sqWxSUqEoa3T N2ebzNJuOOD8Ji6Js+Y43GU/a1850wHDhEw6hhMBCAnGQaHjZncJBtPttIYlykbMv6kA HafoX4cV1S7LFTnxri75/pBMFM9Vjt7VEQYvPg49vXbiv+2YpXEL7d6nyNufaWmILgq/ KyYQ== X-Gm-Message-State: AOJu0YxEQNIEPbqAov+cne1u3kjx5Yo8qQWjvngzyZ3v2NY0f6C4byqG l4u1Xas+ZE/5TKTlvb+xMiui3cf40kQrVqkngt2Dt1UrAtWyju6kL4QLOlBywQLyWHMUUluwqrG ZC+RmJkoTPg== X-Gm-Gg: ATEYQzxyE04CjEyrbD5NjbQcXaBJs5QjihJcExvokqoP+6/tD0NR6Wh2O88Aa7FkUYq GlVJMpXeddvYmzI1t3EyjFKbgEiMgl1vMjrRvYjmqrgHpr9pEhCGzlKx2u9ogSgluxo5JemNBwV tYp+QtHZya6HpAePbQOe+bcVCMrhbJxxnq20AjqxJV0ZLScs8bF60o8RUipQYhG/SjAEWjLR9ZE h+cV9NkZMOPsq3D7ttmv3Plc03I4YngbK5n84Lol5AGCTGo/QNChJa8WePeLwov+YaeeVIhORFQ 3yJDss9eBxaEavpI4kWhTJ0ZCkxVxe5AghFayliZ/ZtFlthEfwmFv/xoTbcKlAulwAtXcaDwjDq ypD4Ui+zT55smfEECuKkKStQbJ8EMNlt65H8ZdUCeNYlKKJ+Vi4Md4/PHoFlJRZMLZXgmG1/6nC LVkdFzS/ef5+2IEzLgk8ugRm3SCHNRjk0K3qCRixK4azt+OfXJ2qoZVd1zbZvUwwp8/wu76Xt7B H1AYdEOHsaf4LiONDWg1g== X-Received: by 2002:a17:903:908:b0:2b0:669d:3a68 with SMTP id d9443c01a7336-2b0b0a15b81mr51723535ad.19.1774465253887; Wed, 25 Mar 2026 12:00:53 -0700 (PDT) Received: from ranegod-HP-ENVY-x360-Convertible-13-bd0xxx.www.tendawifi.com ([14.139.108.62]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b0bc79f7dbsm6483485ad.25.2026.03.25.12.00.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2026 12:00:53 -0700 (PDT) From: Shaurya Rane To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: manfred@colorfullife.com, viro@zeniv.linux.org.uk, brauner@kernel.org, chuck.lever@oracle.com, jlayton@kernel.org, rstoyanov@fedoraproject.org, ptikhomirov@virtuozzo.com, Shaurya Rane Subject: [RFC PATCH 2/3] msg: move struct msg_msgseg and DATALEN_* to include/linux/msg.h Date: Thu, 26 Mar 2026 00:30:24 +0530 Message-Id: <20260325190025.40312-3-ssrane_b23@ee.vjti.ac.in> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260325190025.40312-1-ssrane_b23@ee.vjti.ac.in> References: <20260325190025.40312-1-ssrane_b23@ee.vjti.ac.in> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" struct msg_msgseg and the DATALEN_MSG / DATALEN_SEG macros are currently private to ipc/msgutil.c. struct msg_msg (already in the public kernel header include/linux/msg.h) carries a pointer to msg_msgseg, making it an incomplete type for all callers outside msgutil.c. Move the definition of struct msg_msgseg and the two DATALEN macros to include/linux/msg.h so that other IPC code can safely copy multi-segment message payloads into a kernel buffer under a spinlock, without calling store_msg() which performs copy_to_user() and therefore cannot be used under a spinlock. ipc/msgutil.c already includes , so it picks up the definitions from the header with no functional change. Signed-off-by: Shaurya Rane --- include/linux/msg.h | 13 +++++++++++++ ipc/msgutil.c | 7 ------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/include/linux/msg.h b/include/linux/msg.h index 9a972a296b95..2d5353bace9a 100644 --- a/include/linux/msg.h +++ b/include/linux/msg.h @@ -5,6 +5,19 @@ #include #include =20 +/* + * Each message is stored in one or more page-sized segments. + * The first segment is embedded in struct msg_msg; overflow goes into + * chained struct msg_msgseg blocks. + */ +struct msg_msgseg { + struct msg_msgseg *next; + /* message data follows immediately */ +}; + +#define DATALEN_MSG ((size_t)PAGE_SIZE - sizeof(struct msg_msg)) +#define DATALEN_SEG ((size_t)PAGE_SIZE - sizeof(struct msg_msgseg)) + /* one msg_msg structure for each message */ struct msg_msg { struct list_head m_list; diff --git a/ipc/msgutil.c b/ipc/msgutil.c index e28f0cecb2ec..9cd4b078d55c 100644 --- a/ipc/msgutil.c +++ b/ipc/msgutil.c @@ -31,13 +31,6 @@ struct ipc_namespace init_ipc_ns =3D { .user_ns =3D &init_user_ns, }; =20 -struct msg_msgseg { - struct msg_msgseg *next; - /* the next part of the message follows immediately */ -}; - -#define DATALEN_MSG ((size_t)PAGE_SIZE-sizeof(struct msg_msg)) -#define DATALEN_SEG ((size_t)PAGE_SIZE-sizeof(struct msg_msgseg)) =20 static kmem_buckets *msg_buckets __ro_after_init; =20 --=20 2.34.1