public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] mqueue: introduce new  do_mq_timedreceive2() [ mq_peek  syscall] for non-destructive receive             and inspection
@ 2026-03-04 13:51 Mathura_Kumar
  2026-03-04 13:51 ` [PATCH 2/3] [PATCH-V2] " Mathura_Kumar
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Mathura_Kumar @ 2026-03-04 13:51 UTC (permalink / raw)
  To: brauner; +Cc: academic1mathura, linux-arch, linux-kernel, viro

    POSIX message queues currently lack a mechanism to read
    a message without removing it from the queue. This is a
    long-standing limitation,when we require inspection of queue state
    without altering it.

    Modifying existing mq_receive() semantics via additional
    flags was considered. However, altering behavior of an
    existing syscall risks breaking backward compatibility
    for applications relying on current semantics. Since
    mq_receive() guarantees message removal, changing this
    contract is not safe.

    To preserve ABI stability, this patch introduces a new
    system call that performs a non-destructive receive
    operation (peek). The existing behavior remains unchanged.

    Design considerations:

    Two approaches for copying message data to userspace
    were evaluated:

    1) Refcount-based message lifecycle handling
       - This can help us  Avoids intermediate temp kernel copy
       - Extends message lifetime
       -But this may increase writer starvation under heavy load and
        add unneassery complication on priority  management and
        delay more time to free space in inode due refcount may prevent

    2) Temporary kernel buffer copy
       - Copies message into a bounded kernel buffer
       - Reduces time message remains locked
       - Improves fairness under write-heavy workloads
       - Simpler lifetime management

    My implementation adopts the temporary buffer approach
    to minimize starvation and reduce locking complexity.
    The design allows future transition if refcounting is
    deemed preferable.

    Architecture support: Entry was made in relevant system call table
      - x86
      - ARM

    Testing:
      - 15+ functional test cases
      - Multi-threaded producer/consumer scenarios
      - concurrent pop and peek
      - Edge cases: empty queue, FIFO
        invalid flags, signal interruption etc.

Signed-off-by: Mathura_Kumar <academic1mathura@gmail.com>
---
 arch/x86/entry/syscalls/syscall_32.tbl |   2 +
 arch/x86/entry/syscalls/syscall_64.tbl |   2 +
 include/linux/syscalls.h               |   9 +
 include/uapi/asm-generic/unistd.h      |   5 +-
 ipc/mqueue.c                           | 180 ++++++
 ipc/msg.c                              |   2 +-
 ipc/msgutil.c                          |  51 +-
 ipc/util.h                             |   3 +-
 tools/testing/selftests/ipc/.gitignore |   1 +
 tools/testing/selftests/ipc/Makefile   |   5 +-
 tools/testing/selftests/ipc/mq_peek.c  | 794 +++++++++++++++++++++++++
 11 files changed, 1022 insertions(+), 32 deletions(-)
 create mode 100644 tools/testing/selftests/ipc/mq_peek.c

diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl
index f832ebd2d79b..d6701f763203 100644
--- a/arch/x86/entry/syscalls/syscall_32.tbl
+++ b/arch/x86/entry/syscalls/syscall_32.tbl
@@ -477,3 +477,5 @@
 469	i386	file_setattr		sys_file_setattr
 470	i386	listns			sys_listns
 471	i386	rseq_slice_yield	sys_rseq_slice_yield
+472	i386	mq_timedreceive2	sys_mq_timedreceive2_time32
+473	i386	mq_timedreceive2_time64	sys_mq_timedreceive2
diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl
index 524155d655da..539654953280 100644
--- a/arch/x86/entry/syscalls/syscall_64.tbl
+++ b/arch/x86/entry/syscalls/syscall_64.tbl
@@ -441,3 +441,5 @@
 547	x32	pwritev2		compat_sys_pwritev64v2
 # This is the end of the legacy x32 range.  Numbers 548 and above are
 # not special and are not to be used for x32-specific syscalls.
+# Adding new syscalls from here to keep marginal gap intact in 472 to 511 for future expansion
+548	common	mq_timedreceive2		sys_mq_timedreceive2
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 02bd6ddb6278..4db405159a8b 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -746,6 +746,15 @@ asmlinkage long sys_mq_timedsend_time32(mqd_t mqdes,
 			const char __user *u_msg_ptr,
 			unsigned int msg_len, unsigned int msg_prio,
 			const struct old_timespec32 __user *u_abs_timeout);
+asmlinkage long
+sys_mq_timedreceive2(mqd_t mqdes, struct mq_timedreceive2_args __user *uargs,
+		     unsigned int flags, unsigned long index,
+		     struct __kernel_timespec __user *abs_timeout);
+asmlinkage long
+sys_mq_timedreceive2_time32(mqd_t mqdes,
+			    struct mq_timedreceive2_args __user *uargs,
+			    unsigned int flags, unsigned long index,
+			    struct old_timespec32 __user *abs_timeout);
 asmlinkage long sys_msgget(key_t key, int msgflg);
 asmlinkage long sys_old_msgctl(int msqid, int cmd, struct msqid_ds __user *buf);
 asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf);
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index a627acc8fb5f..1d27fd3e118e 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -865,7 +865,10 @@ __SYSCALL(__NR_rseq_slice_yield, sys_rseq_slice_yield)
 
 #undef __NR_syscalls
 #define __NR_syscalls 472
-
+#define __NR_mq_timedreceive2 473
+__SC_3264(__NR_mq_timedreceive2, sys_mq_timedreceive2_time32, sys_mq_timedreceive2)
+#define __NR_mq_timedreceive2_time64 474
+__SYSCALL(__NR_mq_timedreceive2_time64, sys_mq_timedreceive2)
 /*
  * 32 bit systems traditionally used different
  * syscalls for off_t and loff_t arguments, while
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 4798b375972b..f6c7462b818f 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -53,6 +53,7 @@ struct mqueue_fs_context {
 
 #define SEND		0
 #define RECV		1
+#define MQ_PEEK     2
 
 #define STATE_NONE	0
 #define STATE_READY	1
@@ -63,6 +64,12 @@ struct posix_msg_tree_node {
 	int			priority;
 };
 
+struct mq_timedreceive2_args {
+	size_t msg_len;
+	unsigned int  *msg_prio;
+    char  *msg_ptr;
+};
+
 /*
  * Locking:
  *
@@ -1230,6 +1237,116 @@ static int do_mq_timedreceive(mqd_t mqdes, char __user *u_msg_ptr,
 	return ret;
 }
 
+static struct msg_msg *mq_peek_index(struct mqueue_inode_info *info, int index)
+{
+	struct rb_node *node;
+	struct posix_msg_tree_node *leaf;
+	struct msg_msg *msg;
+	int count = 0;
+	/* Start from highest priority */
+	node = rb_last(&info->msg_tree);
+	while (node) {
+		leaf = rb_entry(node, struct posix_msg_tree_node, rb_node);
+		list_for_each_entry(msg, &leaf->msg_list, m_list) {
+			if (count == index)
+				return msg;
+			count++;
+		}
+
+		node = rb_prev(node);
+	}
+
+	return NULL;
+}
+
+static int do_mq_timedreceive2(mqd_t mqdes,
+			       struct mq_timedreceive2_args __user *uargs,
+			       unsigned int flags, unsigned long index,
+			       struct timespec64 *ts)
+{
+	struct mq_timedreceive2_args args;
+	ssize_t ret;
+	struct msg_msg *msg_ptr, *k_msg_buffer;
+	long k_m_type;
+	size_t k_m_ts;
+	struct inode *inode;
+	struct mqueue_inode_info *info;
+
+	if (copy_from_user(&args, uargs, sizeof(args)))
+		return -EFAULT;
+
+	if (!(flags & MQ_PEEK)) {
+		return do_mq_timedreceive(mqdes, args.msg_ptr, args.msg_len,
+					  args.msg_prio, ts);
+	}
+	audit_mq_sendrecv(mqdes, args.msg_len, 0, ts);
+	CLASS(fd, f)(mqdes);
+	if (fd_empty(f))
+		return -EBADF;
+
+	inode = file_inode(fd_file(f));
+	if (unlikely(fd_file(f)->f_op != &mqueue_file_operations))
+		return -EBADF;
+	info = MQUEUE_I(inode);
+	audit_file(fd_file(f));
+
+	if (unlikely(!(fd_file(f)->f_mode & FMODE_READ)))
+		return -EBADF;
+
+	if (unlikely(args.msg_len < info->attr.mq_msgsize))
+		return -EMSGSIZE;
+	if (index >= (unsigned long)info->attr.mq_maxmsg)
+		return -ENOENT;
+
+	spin_lock(&info->lock);
+	if (info->attr.mq_curmsgs == 0) {
+		spin_unlock(&info->lock);
+		return -EAGAIN;
+	}
+	msg_ptr = mq_peek_index(info, index);
+	if (!msg_ptr) {
+		spin_unlock(&info->lock);
+		return -ENOENT;
+	}
+	k_m_type = msg_ptr->m_type;
+	k_m_ts = msg_ptr->m_ts;
+	spin_unlock(&info->lock);
+
+	k_msg_buffer = alloc_msg(k_m_ts);
+	if (!k_msg_buffer)
+		return -ENOMEM;
+
+	/*Two spin lock is necessary we are avoiding atomic memory allocation
+    *and to early allocation without confirming that , is even msg exists to peek
+    */
+	spin_lock(&info->lock);
+	msg_ptr = mq_peek_index(info, index);
+	if (!msg_ptr || msg_ptr->m_type != k_m_type ||
+	    msg_ptr->m_ts != k_m_ts) {
+		spin_unlock(&info->lock);
+		free_msg(k_msg_buffer);
+		return -EAGAIN;
+	}
+	if (IS_ERR(copy_msg(msg_ptr, k_msg_buffer, k_m_ts))) {
+		spin_unlock(&info->lock);
+		free_msg(k_msg_buffer);
+		return -EINVAL;
+	}
+	spin_unlock(&info->lock);
+
+	ret = k_msg_buffer->m_ts;
+	if (args.msg_prio && put_user(k_m_type, args.msg_prio)) {
+		free_msg(k_msg_buffer);
+		return -EFAULT;
+	}
+	if (store_msg(args.msg_ptr, k_msg_buffer, k_m_ts)) {
+		free_msg(k_msg_buffer);
+		return -EFAULT;
+	}
+	free_msg(k_msg_buffer);
+	return ret;
+}
+
 SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr,
 		size_t, msg_len, unsigned int, msg_prio,
 		const struct __kernel_timespec __user *, u_abs_timeout)
@@ -1258,6 +1375,23 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr,
 	return do_mq_timedreceive(mqdes, u_msg_ptr, msg_len, u_msg_prio, p);
 }
 
+SYSCALL_DEFINE5(mq_timedreceive2, mqd_t, mqdes,
+		struct mq_timedreceive2_args __user *, uargs, unsigned int,
+		flags, const unsigned long, index,
+		const struct __kernel_timespec __user *, u_abs_timeout)
+{
+	struct timespec64 ts, *p = NULL;
+
+	if (u_abs_timeout) {
+		int res = prepare_timeout(u_abs_timeout, &ts);
+
+		if (res)
+			return res;
+		p = &ts;
+	}
+	return do_mq_timedreceive2(mqdes, uargs, flags, index, p);
+}
+
 /*
  * Notes: the case when user wants us to deregister (with NULL as pointer)
  * and he isn't currently owner of notification, will be silently discarded.
@@ -1450,6 +1584,7 @@ SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes,
 }
 
 #ifdef CONFIG_COMPAT
+#include "asm-generic/compat.h"
 
 struct compat_mq_attr {
 	compat_long_t mq_flags;      /* message queue flags		     */
@@ -1459,6 +1594,12 @@ struct compat_mq_attr {
 	compat_long_t __reserved[4]; /* ignored for input, zeroed for output */
 };
 
+struct compat_mq_timedreceive2_args {
+	compat_size_t msg_len;
+	compat_uptr_t msg_prio;
+	compat_uptr_t msg_ptr;
+};
+
 static inline int get_compat_mq_attr(struct mq_attr *attr,
 			const struct compat_mq_attr __user *uattr)
 {
@@ -1490,6 +1631,22 @@ static inline int put_compat_mq_attr(const struct mq_attr *attr,
 	return 0;
 }
 
+static inline int get_compat_mq_args(struct mq_timedreceive2_args *args,
+					struct compat_mq_timedreceive2_args __user *uargs)
+{
+	struct compat_mq_timedreceive2_args v;
+
+	if (copy_from_user(&v, uargs, sizeof(*uargs)))
+		return -EFAULT;
+
+	memset(args, 0, sizeof(*args));
+	args->msg_len = (size_t)compat_ptr(v.msg_len);
+	args->msg_prio = (unsigned int *)compat_ptr(v.msg_prio);
+	args->msg_ptr = (char *)compat_ptr(v.msg_ptr);
+
+	return 0;
+}
+
 COMPAT_SYSCALL_DEFINE4(mq_open, const char __user *, u_name,
 		       int, oflag, compat_mode_t, mode,
 		       struct compat_mq_attr __user *, u_attr)
@@ -1583,6 +1740,29 @@ SYSCALL_DEFINE5(mq_timedreceive_time32, mqd_t, mqdes,
 	}
 	return do_mq_timedreceive(mqdes, u_msg_ptr, msg_len, u_msg_prio, p);
 }
+
+SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
+		struct compat_mq_timedreceive2_args __user *, uargs,
+		unsigned int, flags, const unsigned long, index,
+		const struct old_timespec32 __user *, u_abs_timeout)
+{
+	struct mq_timedreceive2_args args, *pargs = NULL;
+
+	pargs = &args;
+
+	if (get_compat_mq_args(pargs, uargs))
+		return -EFAULT;
+
+	struct timespec64 ts, *p = NULL;
+
+	if (u_abs_timeout) {
+		int res = compat_prepare_timeout(u_abs_timeout, &ts);
+		if (res)
+			return res;
+		p = &ts;
+	}
+	return do_mq_timedreceive2(mqdes, pargs, flags, index, p);
+}
 #endif
 
 static const struct inode_operations mqueue_dir_inode_operations = {
diff --git a/ipc/msg.c b/ipc/msg.c
index 62996b97f0ac..6392b11dd7f7 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -1156,7 +1156,7 @@ static long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, in
 			 * not update queue parameters.
 			 */
 			if (msgflg & MSG_COPY) {
-				msg = copy_msg(msg, copy);
+				msg = copy_msg(msg, copy, msg->m_ts);
 				goto out_unlock0;
 			}
 
diff --git a/ipc/msgutil.c b/ipc/msgutil.c
index e28f0cecb2ec..8c8622b78f12 100644
--- a/ipc/msgutil.c
+++ b/ipc/msgutil.c
@@ -51,7 +51,7 @@ static int __init init_msg_buckets(void)
 }
 subsys_initcall(init_msg_buckets);
 
-static struct msg_msg *alloc_msg(size_t len)
+struct msg_msg *alloc_msg(size_t len)
 {
 	struct msg_msg *msg;
 	struct msg_msgseg **pseg;
@@ -122,39 +122,34 @@ struct msg_msg *load_msg(const void __user *src, size_t len)
 	free_msg(msg);
 	return ERR_PTR(err);
 }
-#ifdef CONFIG_CHECKPOINT_RESTORE
-struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst)
+
+struct msg_msg *copy_msg(struct msg_msg *src,
+							struct msg_msg *dst,
+						size_t len)
 {
-	struct msg_msgseg *dst_pseg, *src_pseg;
-	size_t len = src->m_ts;
-	size_t alen;
+	struct msg_msgseg *src_seg, *dst_seg;
+	size_t remaining, chunk;
 
-	if (src->m_ts > dst->m_ts)
+	if (len > src->m_ts)
 		return ERR_PTR(-EINVAL);
-
-	alen = min(len, DATALEN_MSG);
-	memcpy(dst + 1, src + 1, alen);
-
-	for (dst_pseg = dst->next, src_pseg = src->next;
-	     src_pseg != NULL;
-	     dst_pseg = dst_pseg->next, src_pseg = src_pseg->next) {
-
-		len -= alen;
-		alen = min(len, DATALEN_SEG);
-		memcpy(dst_pseg + 1, src_pseg + 1, alen);
+	chunk = min(len, DATALEN_MSG);
+	memcpy(dst + 1, src + 1, chunk);
+	remaining = len - chunk;
+	src_seg = src->next;
+	dst_seg = dst->next;
+	while (remaining > 0 && src_seg && dst_seg) {
+		chunk = min(remaining, DATALEN_SEG);
+		memcpy(dst_seg + 1, src_seg + 1, chunk);
+		remaining -= chunk;
+		src_seg = src_seg->next;
+		dst_seg = dst_seg->next;
 	}
-
+	if (remaining != 0)
+		return ERR_PTR(-EINVAL);
 	dst->m_type = src->m_type;
-	dst->m_ts = src->m_ts;
-
+	dst->m_ts   = src->m_ts;
 	return dst;
-}
-#else
-struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst)
-{
-	return ERR_PTR(-ENOSYS);
-}
-#endif
+ }
 int store_msg(void __user *dest, struct msg_msg *msg, size_t len)
 {
 	size_t alen;
diff --git a/ipc/util.h b/ipc/util.h
index a55d6cebe6d3..374abeee79b3 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -197,8 +197,9 @@ int ipc_parse_version(int *cmd);
 
 extern void free_msg(struct msg_msg *msg);
 extern struct msg_msg *load_msg(const void __user *src, size_t len);
-extern struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst);
+extern struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst, size_t len);
 extern int store_msg(void __user *dest, struct msg_msg *msg, size_t len);
+extern struct msg_msg *alloc_msg(size_t len);
 
 static inline int ipc_checkid(struct kern_ipc_perm *ipcp, int id)
 {
diff --git a/tools/testing/selftests/ipc/.gitignore b/tools/testing/selftests/ipc/.gitignore
index 9ed280e4c704..fe609d98ecb2 100644
--- a/tools/testing/selftests/ipc/.gitignore
+++ b/tools/testing/selftests/ipc/.gitignore
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 msgque_test
 msgque
+mq_peek
diff --git a/tools/testing/selftests/ipc/Makefile b/tools/testing/selftests/ipc/Makefile
index 50e9c299fc4a..fa9d4f500783 100644
--- a/tools/testing/selftests/ipc/Makefile
+++ b/tools/testing/selftests/ipc/Makefile
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 uname_M := $(shell uname -m 2>/dev/null || echo not)
 ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
+CC = gcc
+CFLAGS = -static -O2
 ifeq ($(ARCH),i386)
         ARCH := x86
 	CFLAGS := -DCONFIG_X86_32 -D__i386__
@@ -12,7 +14,8 @@ endif
 
 CFLAGS += $(KHDR_INCLUDES)
 
-TEST_GEN_PROGS := msgque
+TEST_GEN_PROGS := msgque mq_peek
+LDLIBS += -lrt -lpthread
 
 include ../lib.mk
 
diff --git a/tools/testing/selftests/ipc/mq_peek.c b/tools/testing/selftests/ipc/mq_peek.c
new file mode 100644
index 000000000000..77fcb50fdbcd
--- /dev/null
+++ b/tools/testing/selftests/ipc/mq_peek.c
@@ -0,0 +1,794 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * mq_peek.c - Selftest for mq_timedreceive2(MQ_PEEK)
+ *
+ * Tests the peek-without-dequeue extension to POSIX message queues:
+ *   - Correct priority-rank indexed access (index 0 = highest priority)
+ *   - FIFO ordering within same priority level
+ *   - Non-destructive semantics (queue is never modified on peek)
+ *   - All error paths (-EBADF, -EMSGSIZE, -EFAULT, -EAGAIN, -ENOENT)
+ *   - Large (multi-segment) message payload copy
+ *   - Concurrent peek + receive / peek + send races
+ */
+
+#include "linux/array_size.h"
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <errno.h>
+#include <pthread.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <mqueue.h>
+#include <time.h>
+
+#include "kselftest.h"
+
+#ifndef __NR_mq_timedreceive2
+#if defined(__x86_64__)
+#define __NR_mq_timedreceive2 548
+#elif defined(__aarch64__)
+#define __NR_mq_timedreceive2 548
+#elif defined(__riscv)
+#define __NR_mq_timedreceive2 548
+#else
+#define __NR_mq_timedreceive2 548
+#endif
+#endif
+
+#define MQ_PEEK 2U
+
+struct mq_timedreceive2_args {
+	size_t msg_len;
+	unsigned int *msg_prio;
+	char *msg_ptr;
+};
+
+static long mq_timedreceive2(mqd_t mqdes, struct mq_timedreceive2_args *uargs,
+			     unsigned int flags, unsigned long index,
+			     const struct timespec *timeout)
+{
+	return syscall(__NR_mq_timedreceive2, (long)mqdes, uargs, (long)flags,
+		       index, timeout);
+}
+
+#define MQ_NAME_PREFIX "/mq_peek_test_"
+#define MAX_MSG_SIZE 128
+#define LARGE_MSG_SIZE 4064
+#define MQ_MAXMSG 16
+
+#define PRIO_HIGH 9
+#define PRIO_MED 5
+#define PRIO_LOW 1
+
+static mqd_t open_queue(const char *suffix, long msgsize)
+{
+	char name[64];
+	struct mq_attr attr = {
+		.mq_flags = 0,
+		.mq_maxmsg = MQ_MAXMSG,
+		.mq_msgsize = msgsize,
+		.mq_curmsgs = 0,
+	};
+	mqd_t mqd;
+
+	snprintf(name, sizeof(name), "%s%s", MQ_NAME_PREFIX, suffix);
+	mq_unlink(name);
+
+	mqd = mq_open(name, O_NONBLOCK | O_RDWR | O_CREAT | O_EXCL, 0600, &attr);
+	if (mqd == (mqd_t)-1) {
+		ksft_test_result_fail("mq_open(%s): %m\n", name);
+		ksft_exit_fail();
+	}
+
+	mq_unlink(name);
+	return mqd;
+}
+
+static void send_msg(mqd_t mqd, unsigned int prio, const char *text, size_t len)
+{
+	if (mq_send(mqd, text, len, prio) != 0) {
+		ksft_test_result_fail("mq_send(prio=%u): %m\n", prio);
+		ksft_exit_fail();
+	}
+}
+
+static long peek(mqd_t mqd, unsigned long index, char *buf, size_t bufsz,
+		 unsigned int *prio)
+{
+	struct mq_timedreceive2_args args = {
+		.msg_len = bufsz,
+		.msg_prio = prio,
+		.msg_ptr = buf,
+	};
+	return mq_timedreceive2(mqd, &args, MQ_PEEK, index, NULL);
+}
+
+static long queue_depth(mqd_t mqd)
+{
+	struct mq_attr attr;
+
+	if (mq_getattr(mqd, &attr) != 0)
+		return -1;
+	return attr.mq_curmsgs;
+}
+
+static void test_peek_empty_queue(void)
+{
+	mqd_t mqd = open_queue("empty", MAX_MSG_SIZE);
+	char buf[MAX_MSG_SIZE];
+	unsigned int prio;
+	long ret;
+
+	ret = peek(mqd, 0, buf, sizeof(buf), &prio);
+	if (ret == -1 && errno == EAGAIN)
+		ksft_test_result_pass("peek on empty queue [EAGAIN]\n");
+	else
+		ksft_test_result_fail("peek on empty queue: expected EAGAIN, got ret=%ld errno=%d (%m)\n",
+							ret, errno);
+
+	mq_close(mqd);
+}
+
+static void test_peek_invalid_fd(void)
+{
+	char buf[MAX_MSG_SIZE];
+	unsigned int prio;
+	long ret;
+
+	ret = peek((mqd_t)-1, 0, buf, sizeof(buf), &prio);
+	if (ret == -1 && errno == EBADF)
+		ksft_test_result_pass("peek invalid fd [ EBADF]\n");
+	else
+		ksft_test_result_fail("peek invalid fd: expected EBADF, got ret=%ld errno=%d\n",
+							   ret, errno);
+}
+
+
+static void test_peek_non_mqueue_fd(void)
+{
+	int pipefd[2];
+	char buf[MAX_MSG_SIZE];
+	unsigned int prio;
+	long ret;
+
+	if (pipe(pipefd) != 0) {
+		ksft_test_result_skip("pipe() failed, skipping non-mqueue-fd test\n");
+		return;
+	}
+
+	ret = peek((mqd_t)pipefd[0], 0, buf, sizeof(buf), &prio);
+	if (ret == -1 && errno == EBADF)
+		ksft_test_result_pass("peek on pipe fd [EBADF]\n");
+	else
+		ksft_test_result_fail("peek non-mqueue fd: expected EBADF, got ret=%ld errno=%d\n",
+								ret, errno);
+
+	close(pipefd[0]);
+	close(pipefd[1]);
+}
+
+
+static void test_peek_writeonly_fd(void)
+{
+	char name[] = "/ksft_mq_peek_wo";
+	struct mq_attr attr = { .mq_maxmsg = 4, .mq_msgsize = MAX_MSG_SIZE };
+	mqd_t rw, wo;
+	char buf[MAX_MSG_SIZE];
+	unsigned int prio;
+	long ret;
+
+	mq_unlink(name);
+	rw = mq_open(name, O_RDWR | O_CREAT, 0600, &attr);
+	if (rw == (mqd_t)-1) {
+		ksft_test_result_skip("mq_open RW failed: %m\n");
+		return;
+	}
+	wo = mq_open(name, O_WRONLY);
+	mq_unlink(name);
+
+	if (wo == (mqd_t)-1) {
+		ksft_test_result_skip("mq_open WO failed: %m\n");
+		mq_close(rw);
+		return;
+	}
+
+	send_msg(rw, PRIO_HIGH, "x", 1);
+
+	ret = peek(wo, 0, buf, sizeof(buf), &prio);
+	if (ret == -1 && errno == EBADF)
+		ksft_test_result_pass("peek on O_WRONLY fd [EBADF]\n");
+	else
+		ksft_test_result_fail("peek WO fd: expected EBADF, got ret=%ld errno=%d\n",
+								ret, errno);
+
+	mq_close(wo);
+	mq_close(rw);
+}
+
+
+static void test_peek_buffer_too_small(void)
+{
+	mqd_t mqd = open_queue("small", MAX_MSG_SIZE);
+	char tiny[1]; /* deliberately too small */
+	unsigned int prio;
+	struct mq_timedreceive2_args args = {
+		.msg_len = sizeof(tiny),
+		.msg_prio = &prio,
+		.msg_ptr = tiny,
+	};
+	long ret;
+
+	send_msg(mqd, PRIO_HIGH, "hello", 5);
+
+	ret = mq_timedreceive2(mqd, &args, MQ_PEEK, 0, NULL);
+	if (ret == -1 && errno == EMSGSIZE)
+		ksft_test_result_pass("peek with small buf [EMSGSIZE]\n");
+	else
+		ksft_test_result_fail("peek small buf: expected EMSGSIZE, got ret=%ld errno=%d\n",
+							ret, errno);
+
+	mq_close(mqd);
+}
+
+
+
+
+static void test_peek_bad_msg_ptr(void)
+{
+	mqd_t mqd = open_queue("bad_ptr", MAX_MSG_SIZE);
+	unsigned int prio;
+
+	struct mq_timedreceive2_args args = {
+		.msg_len = MAX_MSG_SIZE,
+		.msg_prio = &prio,
+		.msg_ptr = (char *)0x1,
+	};
+	long ret;
+	send_msg(mqd, PRIO_HIGH, "payload", 7);
+	ret = mq_timedreceive2(mqd, &args, MQ_PEEK, 0, NULL);
+	if (ret == -1 && errno == EFAULT)
+		ksft_test_result_pass("peek bad msg_ptr [EFAULT]\n");
+	else
+		ksft_test_result_fail("peek bad msg_ptr: expected EFAULT, got ret=%ld errno=%d\n",
+								ret, errno);
+
+	mq_close(mqd);
+}
+
+
+static void test_peek_index_out_of_range(void)
+{
+	mqd_t mqd = open_queue("oob", MAX_MSG_SIZE);
+	char buf[MAX_MSG_SIZE];
+	unsigned int prio;
+	long ret;
+	send_msg(mqd, PRIO_MED, "one", 3);
+	ret = peek(mqd, 1, buf, sizeof(buf), &prio);
+	if (ret == -1 && errno == ENOENT)
+		ksft_test_result_pass("peek OOB index [ENOENT]\n");
+	else
+		ksft_test_result_fail("peek OOB: expected ENOENT, got ret=%ld errno=%d\n",
+								ret, errno);
+
+	mq_close(mqd);
+}
+
+
+static void test_peek_basic_data(void)
+{
+	mqd_t mqd = open_queue("basic", MAX_MSG_SIZE);
+	const char *payload = "peek-test-payload";
+	char buf[MAX_MSG_SIZE];
+	unsigned int prio = 0;
+	long ret;
+
+	send_msg(mqd, PRIO_HIGH, payload, strlen(payload));
+
+	memset(buf, 0, sizeof(buf));
+	ret = peek(mqd, 0, buf, sizeof(buf), &prio);
+
+	if (ret < 0) {
+		ksft_test_result_fail("basic peek failed: ret=%ld errno=%d (%m)\n", ret, errno);
+		goto out;
+	}
+	if ((size_t)ret != strlen(payload)) {
+		ksft_test_result_fail("basic peek: wrong size %ld (expected %zu)\n", ret, strlen(payload));
+		goto out;
+	}
+	if (memcmp(buf, payload, strlen(payload)) != 0) {
+		ksft_test_result_fail("basic peek: payload mismatch\n");
+		goto out;
+	}
+	if (prio != PRIO_HIGH) {
+		ksft_test_result_fail("basic peek: wrong prio %u (expected %d)\n", prio, PRIO_HIGH);
+		goto out;
+	}
+	ksft_test_result_pass("basic peek: correct data and priority\n");
+out:
+	mq_close(mqd);
+}
+
+
+static void test_peek_nondestructive(void)
+{
+	mqd_t mqd = open_queue("nodestr", MAX_MSG_SIZE);
+	char buf[MAX_MSG_SIZE];
+	unsigned int prio;
+	int i;
+
+	send_msg(mqd, PRIO_HIGH, "A", 1);
+	send_msg(mqd, PRIO_MED, "B", 1);
+	send_msg(mqd, PRIO_LOW, "C", 1);
+
+	if (queue_depth(mqd) != 3) {
+		ksft_test_result_fail("initial depth != 3\n");
+		mq_close(mqd);
+		return;
+	}
+
+	for (i = 0; i < 10; i++) {
+		peek(mqd, 0, buf, sizeof(buf), &prio);
+		peek(mqd, 1, buf, sizeof(buf), &prio);
+		peek(mqd, 2, buf, sizeof(buf), &prio);
+	}
+
+	if (queue_depth(mqd) == 3)
+		ksft_test_result_pass(
+			"peek is non-destructive (depth stays 3)\n");
+	else
+		ksft_test_result_fail("peek modified queue: depth=%ld (expected 3)\n", queue_depth(mqd));
+
+	mq_close(mqd);
+}
+
+
+static void test_peek_priority_order(void)
+{
+	mqd_t mqd = open_queue("prio_order", MAX_MSG_SIZE);
+	char buf[MAX_MSG_SIZE];
+	unsigned int prio;
+	long ret;
+	int pass = 1;
+
+	send_msg(mqd, PRIO_LOW, "low", 3);
+	send_msg(mqd, PRIO_HIGH, "high", 4);
+	send_msg(mqd, PRIO_MED, "med", 3);
+
+	/* index 0 must return highest priority */
+	ret = peek(mqd, 0, buf, sizeof(buf), &prio);
+	if (ret < 0 || prio != PRIO_HIGH) {
+		ksft_test_result_fail(
+			"prio_order index0: prio=%u ret=%ld errno=%d\n", prio,
+			ret, errno);
+		pass = 0;
+	}
+	if (pass && memcmp(buf, "high", 4) != 0) {
+		ksft_test_result_fail("prio_order index0: wrong payload\n");
+		pass = 0;
+	}
+
+	/* index 1 must return medium priority */
+	ret = peek(mqd, 1, buf, sizeof(buf), &prio);
+	if (pass && (ret < 0 || prio != PRIO_MED)) {
+		ksft_test_result_fail("prio_order index1: prio=%u ret=%ld\n",
+				      prio, ret);
+		pass = 0;
+	}
+	if (pass && memcmp(buf, "med", 3) != 0) {
+		ksft_test_result_fail("prio_order index1: wrong payload\n");
+		pass = 0;
+	}
+
+	/* index 2 must return lowest priority */
+	ret = peek(mqd, 2, buf, sizeof(buf), &prio);
+	if (pass && (ret < 0 || prio != PRIO_LOW)) {
+		ksft_test_result_fail("prio_order index2: prio=%u ret=%ld\n",
+				      prio, ret);
+		pass = 0;
+	}
+	if (pass && memcmp(buf, "low", 3) != 0) {
+		ksft_test_result_fail("prio_order index2: wrong payload\n");
+		pass = 0;
+	}
+
+	if (pass)
+		ksft_test_result_pass(
+			"priority ordering: index0=HIGH, index1=MED, index2=LOW\n");
+
+	mq_close(mqd);
+}
+
+
+static void test_peek_fifo_within_priority(void)
+{
+	mqd_t mqd = open_queue("fifo", MAX_MSG_SIZE);
+	char buf[MAX_MSG_SIZE];
+	unsigned int prio;
+	long ret;
+	int pass = 1;
+
+	send_msg(mqd, PRIO_HIGH, "first", 5);
+	send_msg(mqd, PRIO_HIGH, "second", 6);
+	send_msg(mqd, PRIO_HIGH, "third", 5);
+
+	memset(buf, 0, sizeof(buf));
+	ret = peek(mqd, 0, buf, sizeof(buf), &prio);
+	if (ret < 0 || memcmp(buf, "first", 5) != 0) {
+		ksft_test_result_fail(
+			"FIFO peek[0]: expected 'first', got '%.*s' ret=%ld\n",
+			(int)ret, buf, ret);
+		pass = 0;
+	}
+
+	if (pass) {
+		char rbuf[MAX_MSG_SIZE];
+		unsigned int rprio;
+		ssize_t r = mq_receive(mqd, rbuf, sizeof(rbuf), &rprio);
+		if (r < 0 || memcmp(rbuf, "first", 5) != 0) {
+			ksft_test_result_fail("mq_receive 'first' failed\n");
+			pass = 0;
+		}
+	}
+
+	if (pass) {
+		memset(buf, 0, sizeof(buf));
+		ret = peek(mqd, 0, buf, sizeof(buf), &prio);
+		if (ret < 0 || memcmp(buf, "second", 6) != 0) {
+			ksft_test_result_fail("FIFO peek after receive: expected 'second', got '%.*s'\n",
+				(int)ret, buf);
+			pass = 0;
+		}
+}
+
+	if (pass)
+		ksft_test_result_pass("FIFO within same priority is correct\n");
+
+	mq_close(mqd);
+}
+
+
+static void test_peek_all_indices(void)
+{
+	const unsigned int prios[] = { 2, 7, 4, 9, 1, 6 };
+	const int N = (int)(sizeof(prios) / sizeof(prios[0]));
+	mqd_t mqd = open_queue("all_idx", MAX_MSG_SIZE);
+	char buf[MAX_MSG_SIZE];
+	char expected_payload[MAX_MSG_SIZE];
+	unsigned int prio;
+	long ret;
+	int i, pass = 1;
+	unsigned int sorted[6];
+
+	for (i = 0; i < N; i++) {
+		snprintf(expected_payload, sizeof(expected_payload),
+			 "msg_prio_%u", prios[i]);
+		send_msg(mqd, prios[i], expected_payload,
+			 strlen(expected_payload));
+		sorted[i] = prios[i];
+	}
+
+	for (i = 0; i < N - 1; i++) {
+		int j;
+		for (j = i + 1; j < N; j++) {
+			if (sorted[j] > sorted[i]) {
+				unsigned int tmp = sorted[i];
+				sorted[i] = sorted[j];
+				sorted[j] = tmp;
+			}
+		}
+	}
+
+	for (i = 0; i < N && pass; i++) {
+		memset(buf, 0, sizeof(buf));
+		ret = peek(mqd, (unsigned long)i, buf, sizeof(buf), &prio);
+		if (ret < 0) {
+			ksft_test_result_fail("all_indices peek[%d] failed: ret=%ld errno=%d\n",
+									i, ret, errno);
+			pass = 0;
+			break;
+		}
+		if (prio != sorted[i]) {
+			ksft_test_result_fail("all_indices peek[%d]: prio=%u expected=%u\n",
+									i, prio, sorted[i]);
+			pass = 0;
+		}
+
+		snprintf(expected_payload, sizeof(expected_payload),
+			 "msg_prio_%u", sorted[i]);
+		if (memcmp(buf, expected_payload, strlen(expected_payload))) {
+			ksft_test_result_fail("all_indices peek[%d]: payload mismatch\n", i);
+			pass = 0;
+		}
+	}
+
+	if (pass && queue_depth(mqd) != N) {
+		ksft_test_result_fail("all_indices: depth=%ld expected=%d after peek\n",
+			queue_depth(mqd), N);
+		pass = 0;
+	}
+
+	if (pass) {
+		ret = peek(mqd, (unsigned long)N, buf, sizeof(buf), &prio);
+		if (!(ret == -1 && errno == ENOENT)) {
+			ksft_test_result_fail("all_indices OOB[%d]: expected ENOENT, got ret=%ld errno=%d\n",
+									N, ret, errno);
+			pass = 0;
+		}
+	}
+
+	if (pass)
+		ksft_test_result_pass("all-indices: correct prio order + OOB ENOENT\n");
+
+	mq_close(mqd);
+}
+
+static void test_peek_large_message(void)
+{
+	mqd_t mqd = open_queue("large", LARGE_MSG_SIZE);
+	char *send_buf, *recv_buf;
+	unsigned int prio = 0;
+	long ret;
+	int pass = 1;
+
+	send_buf = malloc(LARGE_MSG_SIZE);
+	recv_buf = calloc(1, LARGE_MSG_SIZE);
+	if (!send_buf || !recv_buf) {
+		ksft_test_result_skip("OOM allocating large message buffers\n");
+		goto out;
+	}
+
+	for (int i = 0; i < LARGE_MSG_SIZE; i++)
+		send_buf[i] = (char)(i & 0xFF);
+
+	send_msg(mqd, PRIO_HIGH, send_buf, LARGE_MSG_SIZE);
+
+	ret = peek(mqd, 0, recv_buf, LARGE_MSG_SIZE, &prio);
+	if (ret != LARGE_MSG_SIZE) {
+		ksft_test_result_fail("large msg peek: ret=%ld expected=%d\n",
+				      ret, LARGE_MSG_SIZE);
+		pass = 0;
+	}
+	if (pass && memcmp(send_buf, recv_buf, LARGE_MSG_SIZE) != 0) {
+		ksft_test_result_fail("large msg peek: payload mismatch\n");
+		pass = 0;
+	}
+	if (pass && prio != PRIO_HIGH) {
+		ksft_test_result_fail("large msg peek: prio=%u expected=%d\n",
+				      prio, PRIO_HIGH);
+		pass = 0;
+	}
+	if (pass && queue_depth(mqd) != 1) {
+		ksft_test_result_fail(
+			"large msg peek: queue modified (depth=%ld)\n",
+			queue_depth(mqd));
+		pass = 0;
+	}
+	if (pass)
+		ksft_test_result_pass(
+			"large (%d B) 	multi-segment peek: correct\n",
+			LARGE_MSG_SIZE);
+out:
+	free(send_buf);
+	free(recv_buf);
+	mq_close(mqd);
+}
+
+static void test_no_peek_flag_is_receive(void)
+{
+	mqd_t mqd = open_queue("nopeek", MAX_MSG_SIZE);
+	char buf[MAX_MSG_SIZE];
+	unsigned int prio = 0;
+	struct mq_timedreceive2_args args = {
+		.msg_len = sizeof(buf),
+		.msg_prio = &prio,
+		.msg_ptr = buf,
+	};
+	long ret;
+
+	send_msg(mqd, PRIO_HIGH, "consume-me", 10);
+
+    ret = mq_timedreceive2(mqd, &args, 0, 0, NULL);
+	if (ret < 0) {
+		ksft_test_result_fail("no-peek receive failed: ret=%ld errno=%d\n", ret, errno);
+		mq_close(mqd);
+		return;
+	}
+	if (queue_depth(mqd) != 0)
+		ksft_test_result_fail("no-peek: queue still has messages (depth=%ld)\n", queue_depth(mqd));
+	else
+		ksft_test_result_pass("without MQ_PEEK the message is consumed normally\n");
+
+	mq_close(mqd);
+}
+
+
+struct race_ctx {
+	mqd_t mqd;
+	int errors;
+};
+
+static void *receiver_thread(void *arg)
+{
+	struct race_ctx *ctx = arg;
+	char buf[MAX_MSG_SIZE];
+	unsigned int prio;
+	ssize_t r;
+
+	while ((r = mq_receive(ctx->mqd, buf, sizeof(buf), &prio)) > 0)
+		;
+
+	return NULL;
+}
+
+static void test_peek_concurrent_receive(void)
+{
+	struct race_ctx ctx;
+	pthread_t tid;
+	char buf[MAX_MSG_SIZE];
+	unsigned int prio;
+	long ret;
+	int i;
+
+	ctx.mqd = open_queue("concurrent", MAX_MSG_SIZE);
+	ctx.errors = 0;
+
+
+	for (i = 0; i < MQ_MAXMSG; i++) {
+		char payload[32];
+		snprintf(payload, sizeof(payload), "msg%d", i);
+		send_msg(ctx.mqd, (unsigned int)(i % 5) + 1, payload,
+			 strlen(payload));
+	}
+
+	if (pthread_create(&tid, NULL, receiver_thread, &ctx) != 0) {
+		ksft_test_result_skip("pthread_create failed\n");
+		mq_close(ctx.mqd);
+		return;
+	}
+
+	/*
+     Peek repeatedly.The queue is being drained concurrently.
+	 */
+	for (i = 0; i < 200; i++) {
+		ret = peek(ctx.mqd, (unsigned long)(i % 4), buf, sizeof(buf),
+			   &prio);
+		if (ret < 0 && errno != EAGAIN && errno != ENOENT) {
+			ctx.errors++;
+		}
+	}
+
+	pthread_join(tid, NULL);
+
+	if (ctx.errors == 0)
+		ksft_test_result_pass("concurrent peek+receive: no unexpected errors\n");
+	else
+		ksft_test_result_fail("concurrent peek+receive: %d unexpected errors\n", ctx.errors);
+
+	mq_close(ctx.mqd);
+}
+
+static void test_peek_null_prio_ptr(void)
+{
+	mqd_t mqd = open_queue("null_prio", MAX_MSG_SIZE);
+	char buf[MAX_MSG_SIZE];
+	struct mq_timedreceive2_args args = {
+		.msg_len = sizeof(buf),
+		.msg_prio = NULL,
+		.msg_ptr = buf,
+	};
+	long ret;
+
+	send_msg(mqd, PRIO_MED, "no-prio-needed", 14);
+
+	ret = mq_timedreceive2(mqd, &args, MQ_PEEK, 0, NULL);
+	if (ret >= 0)
+		ksft_test_result_pass("peek with NULL msg_prio ptr: OK\n");
+	else
+		ksft_test_result_fail("peek NULL msg_prio: ret=%ld errno=%d (%m)\n", ret, errno);
+
+	mq_close(mqd);
+}
+
+
+static void test_peek_priority_matches_receive(void)
+{
+	mqd_t mqd = open_queue("prio_match", MAX_MSG_SIZE);
+	char peek_buf[MAX_MSG_SIZE], recv_buf[MAX_MSG_SIZE];
+	unsigned int peek_prio = 0, recv_prio = 0;
+	long peek_ret;
+	ssize_t recv_ret;
+	int pass = 1;
+
+	send_msg(mqd, PRIO_MED, "consistent-prio", 15);
+
+	peek_ret = peek(mqd, 0, peek_buf, sizeof(peek_buf), &peek_prio);
+	if (peek_ret < 0) {
+		ksft_test_result_fail("peek failed: %m\n");
+		mq_close(mqd);
+		return;
+	}
+
+	recv_ret = mq_receive(mqd, recv_buf, sizeof(recv_buf), &recv_prio);
+	if (recv_ret < 0) {
+		ksft_test_result_fail("mq_receive failed: %m\n");
+		mq_close(mqd);
+		return;
+	}
+
+	if (peek_prio != recv_prio) {
+		ksft_test_result_fail("prio mismatch: peek=%u receive=%u\n",
+								peek_prio, recv_prio);
+		pass = 0;
+	}
+	if (pass && peek_ret != recv_ret) {
+		ksft_test_result_fail("size mismatch: peek=%ld receive=%zd\n",
+				      peek_ret, recv_ret);
+		pass = 0;
+	}
+	if (pass && memcmp(peek_buf, recv_buf, (size_t)recv_ret) != 0) {
+		ksft_test_result_fail("payload mismatch between peek and receive\n");
+		pass = 0;
+	}
+	if (pass)
+		ksft_test_result_pass("peeked priority/payload matches mq_receive output\n");
+
+	mq_close(mqd);
+}
+
+
+
+static const struct {
+	const char *name;
+	void (*fn)(void);
+} tests[] = {
+	{ "empty queue → EAGAIN", test_peek_empty_queue },
+	{ "invalid fd → EBADF", test_peek_invalid_fd },
+	{ "non-mqueue fd → EBADF", test_peek_non_mqueue_fd },
+	{ "O_WRONLY fd → EBADF", test_peek_writeonly_fd },
+	{ "buffer too small → EMSGSIZE", test_peek_buffer_too_small },
+	{ "bad msg_ptr → EFAULT", test_peek_bad_msg_ptr },
+	{ "OOB index → ENOENT", test_peek_index_out_of_range },
+	{ "basic data+prio correctness", test_peek_basic_data },
+	{ "non-destructive semantics", test_peek_nondestructive },
+	{ "priority ordering across indices", test_peek_priority_order },
+	{ "FIFO within same priority", test_peek_fifo_within_priority },
+	{ "all distinct priority indices", test_peek_all_indices },
+	{ "large multi-segment message", test_peek_large_message },
+	{ "no MQ_PEEK → normal receive", test_no_peek_flag_is_receive },
+	{ "concurrent peek + receive", test_peek_concurrent_receive },
+	{ "NULL msg_prio ptr", test_peek_null_prio_ptr },
+	{ "peeked prio matches mq_receive",
+	  test_peek_priority_matches_receive },
+};
+
+int main(void)
+{
+	unsigned int i;
+	long sc_ret;
+
+	ksft_print_header();
+	ksft_set_plan(sizeof(tests) / sizeof(tests[0]));
+
+
+	{
+		struct mq_timedreceive2_args probe_args = { 0 };
+		sc_ret = mq_timedreceive2((mqd_t)-1, &probe_args, MQ_PEEK, 0,
+					  NULL);
+		if (sc_ret == -1 && errno == ENOSYS)
+			ksft_exit_skip("mq_timedreceive2 syscall not available "
+				"(NR=%d ENOSYS) — is the kernel too old?\n",
+				__NR_mq_timedreceive2);
+	}
+
+	for (i = 0; i < ARRAY_SIZE(tests); i++) {
+		ksft_print_msg("--- [%02u] %s ---\n", i + 1, tests[i].name);
+		tests[i].fn();
+	}
+
+	return ksft_get_fail_cnt() ? 1 : 0;
+}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] [PATCH-V2] mqueue: introduce new do_mq_timedreceive2() [ mq_peek syscall] for non-destructive       receive and inspection
  2026-03-04 13:51 [PATCH 1/3] mqueue: introduce new do_mq_timedreceive2() [ mq_peek syscall] for non-destructive receive and inspection Mathura_Kumar
@ 2026-03-04 13:51 ` Mathura_Kumar
  2026-03-04 13:51 ` [PATCH 3/3] [PATCH]-This patch series completes the implementation of do_mq_timedreceive2 new system calls that provide non-destructive peek functionality on POSIX message queues Mathura_Kumar
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Mathura_Kumar @ 2026-03-04 13:51 UTC (permalink / raw)
  To: brauner; +Cc: academic1mathura, linux-arch, linux-kernel, viro,
	kernel test robot

Following Two warning issue by build and test on V1:

1) include/linux/syscalls.h:750:42: warning: declaration of 'struct mq_timedreceive2_args'
   will not be visible outside of this function [-Wvisibility]
fix-included the missing header for global visibility

2)  warning: syscall mq_timedreceive2_time64 not implemented [-W#warnings]

fix- This seem false postive warning, script not able to correctly map syscall table
 with handler
in file - ~/linux/arch/x86/entry/syscalls/syscall_32.tbl
473 causing warning due to now explicit handler for name "mq_timedrecive2_time64",because
it also handle by same normal SYS_DEFINE for  64 bit arch  because logically both are
same if 32bit machine call 64 bit, if we add named defined then it create unnessary
 redudancy and duplicacy, so even at this time i am not changing this, if required kindlly
once test in runtime and guide me.

472	i386	mq_timedreceive2	sys_mq_timedreceive2_time32
473	i386	mq_timedreceive2_time64	sys_mq_timedreceive2

Reported-by: kernel test robot <lkp@intel.com>
 Closes: https://lore.kernel.org/oe-kbuild-all/202602270443.k6N6t2u4-lkp@intel.com

Signed-off-by: Mathura_Kumar <academic1mathura@gmail.com>
---
 include/linux/syscalls.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 4db405159a8b..307cfd6f154c 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -93,6 +93,7 @@ struct file_attr;
 #include <linux/key.h>
 #include <linux/personality.h>
 #include <trace/syscall.h>
+#include <linux/mqueue.h>
 
 #ifdef CONFIG_ARCH_HAS_SYSCALL_WRAPPER
 /*
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] [PATCH]-This patch series completes the implementation of do_mq_timedreceive2 new        system calls that provide non-destructive peek functionality        on POSIX message queues
  2026-03-04 13:51 [PATCH 1/3] mqueue: introduce new do_mq_timedreceive2() [ mq_peek syscall] for non-destructive receive and inspection Mathura_Kumar
  2026-03-04 13:51 ` [PATCH 2/3] [PATCH-V2] " Mathura_Kumar
@ 2026-03-04 13:51 ` Mathura_Kumar
  2026-03-05  5:49   ` kernel test robot
                     ` (2 more replies)
  2026-03-04 18:24 ` [PATCH 1/3] mqueue: introduce new do_mq_timedreceive2() [ mq_peek syscall] for non-destructive receive and inspection Randy Dunlap
  2026-03-05  5:09 ` kernel test robot
  3 siblings, 3 replies; 8+ messages in thread
From: Mathura_Kumar @ 2026-03-04 13:51 UTC (permalink / raw)
  To: brauner; +Cc: academic1mathura, linux-arch, linux-kernel, viro

v1 of this series  was incomplete — syscall table entries for several
architectures were missing, and false postive warning. This addresses all of that
and has been tested on x86-64 with all tests passing.

 Patch 1/3 — core implementation
 Patch 2/3 — RFC about false postive build error
 Patch 3/3 — remaining per-arch syscall table entries

All older patch was still seem unseen/unmerged so for convenience i am including
all required commit of previous patch with this.

Architecture support: ALL Ready

Signed-off-by: Mathura_Kumar <academic1mathura@gmail.com>
---
 arch/alpha/kernel/syscalls/syscall.tbl      | 1 +
 arch/arm/tools/syscall.tbl                  | 2 ++
 arch/arm64/tools/syscall_32.tbl             | 2 ++
 arch/m68k/kernel/syscalls/syscall.tbl       | 3 +++
 arch/microblaze/kernel/syscalls/syscall.tbl | 3 +++
 arch/mips/kernel/syscalls/syscall_n32.tbl   | 2 ++
 arch/mips/kernel/syscalls/syscall_n64.tbl   | 1 +
 arch/mips/kernel/syscalls/syscall_o32.tbl   | 2 ++
 arch/powerpc/kernel/syscalls/syscall.tbl    | 3 +++
 arch/s390/kernel/syscalls/syscall.tbl       | 1 +
 arch/sh/kernel/syscalls/syscall.tbl         | 2 ++
 arch/sparc/kernel/syscalls/syscall.tbl      | 3 +++
 arch/xtensa/kernel/syscalls/syscall.tbl     | 2 ++
 include/uapi/asm-generic/unistd.h           | 9 +++++----
 scripts/checksyscalls.sh                    | 1 +
 scripts/syscall.tbl                         | 3 +++
 16 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/arch/alpha/kernel/syscalls/syscall.tbl b/arch/alpha/kernel/syscalls/syscall.tbl
index f31b7afffc34..0ff42d241419 100644
--- a/arch/alpha/kernel/syscalls/syscall.tbl
+++ b/arch/alpha/kernel/syscalls/syscall.tbl
@@ -511,3 +511,4 @@
 579	common	file_setattr			sys_file_setattr
 580	common	listns				sys_listns
 581	common	rseq_slice_yield		sys_rseq_slice_yield
+582	common	mq_timedreceive2		sys_mq_timedreceive2
diff --git a/arch/arm/tools/syscall.tbl b/arch/arm/tools/syscall.tbl
index 94351e22bfcf..bcec28be852c 100644
--- a/arch/arm/tools/syscall.tbl
+++ b/arch/arm/tools/syscall.tbl
@@ -486,3 +486,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_timedreceive2		sys_mq_timedreceive2_time32
+473	common	mq_timedreceive2_time64	sys_mq_timedreceive2
diff --git a/arch/arm64/tools/syscall_32.tbl b/arch/arm64/tools/syscall_32.tbl
index 62d93d88e0fe..02603704231e 100644
--- a/arch/arm64/tools/syscall_32.tbl
+++ b/arch/arm64/tools/syscall_32.tbl
@@ -483,3 +483,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_timedreceive2_time64	sys_mq_timedreceive2
+473	common	mq_timedreceive2		sys_mq_timedreceive2_time32
diff --git a/arch/m68k/kernel/syscalls/syscall.tbl b/arch/m68k/kernel/syscalls/syscall.tbl
index 248934257101..b67f23edda11 100644
--- a/arch/m68k/kernel/syscalls/syscall.tbl
+++ b/arch/m68k/kernel/syscalls/syscall.tbl
@@ -471,3 +471,6 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_timedreceive2		sys_mq_timedreceive2_time32
+473	common	mq_timedreceive2_time64	sys_mq_timedreceive2
+
diff --git a/arch/microblaze/kernel/syscalls/syscall.tbl b/arch/microblaze/kernel/syscalls/syscall.tbl
index 223d26303627..89fb60006a99 100644
--- a/arch/microblaze/kernel/syscalls/syscall.tbl
+++ b/arch/microblaze/kernel/syscalls/syscall.tbl
@@ -477,3 +477,6 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_timedreceive2		sys_mq_timedreceive2_time32
+473	common	mq_timedreceive2_time64	sys_mq_timedreceive2
+
diff --git a/arch/mips/kernel/syscalls/syscall_n32.tbl b/arch/mips/kernel/syscalls/syscall_n32.tbl
index 7430714e2b8f..fee830be67a6 100644
--- a/arch/mips/kernel/syscalls/syscall_n32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_n32.tbl
@@ -410,3 +410,5 @@
 469	n32	file_setattr			sys_file_setattr
 470	n32	listns				sys_listns
 471	n32	rseq_slice_yield		sys_rseq_slice_yield
+472	n32	mq_timedreceive2	    sys_mq_timedreceive2_time32
+473	n32	mq_timedreceive2_time64	sys_mq_timedreceive2
diff --git a/arch/mips/kernel/syscalls/syscall_n64.tbl b/arch/mips/kernel/syscalls/syscall_n64.tbl
index 630aab9e5425..75de6ee2df94 100644
--- a/arch/mips/kernel/syscalls/syscall_n64.tbl
+++ b/arch/mips/kernel/syscalls/syscall_n64.tbl
@@ -386,3 +386,4 @@
 469	n64	file_setattr			sys_file_setattr
 470	n64	listns				sys_listns
 471	n64	rseq_slice_yield		sys_rseq_slice_yield
+472	n64	mq_timedreceive2		sys_mq_timedreceive2
diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl
index 128653112284..8694a2d2f084 100644
--- a/arch/mips/kernel/syscalls/syscall_o32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_o32.tbl
@@ -459,3 +459,5 @@
 469	o32	file_setattr			sys_file_setattr
 470	o32	listns				sys_listns
 471	o32	rseq_slice_yield		sys_rseq_slice_yield
+472	o32	mq_timedreceive2	    sys_mq_timedreceive2_time32
+473	o32	mq_timedreceive2_time64	sys_mq_timedreceive2
diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
index 4fcc7c58a105..fd90a2f500b6 100644
--- a/arch/powerpc/kernel/syscalls/syscall.tbl
+++ b/arch/powerpc/kernel/syscalls/syscall.tbl
@@ -562,3 +562,6 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	nospu	rseq_slice_yield		sys_rseq_slice_yield
+472	32	mq_timedreceive2	        sys_mq_timedreceive2_time32
+473	64	mq_timedreceive2    		sys_mq_timedreceive2
+474	32	mq_timedreceive2_time64	    sys_mq_timedreceive2          sys_mq_timedreceive2
diff --git a/arch/s390/kernel/syscalls/syscall.tbl b/arch/s390/kernel/syscalls/syscall.tbl
index 09a7ef04d979..34df682061d9 100644
--- a/arch/s390/kernel/syscalls/syscall.tbl
+++ b/arch/s390/kernel/syscalls/syscall.tbl
@@ -398,3 +398,4 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_timedreceive2		sys_mq_timedreceive2
diff --git a/arch/sh/kernel/syscalls/syscall.tbl b/arch/sh/kernel/syscalls/syscall.tbl
index 70b315cbe710..1796ccd23d10 100644
--- a/arch/sh/kernel/syscalls/syscall.tbl
+++ b/arch/sh/kernel/syscalls/syscall.tbl
@@ -475,3 +475,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_timedreceive2		sys_mq_timedreceive2_time32
+473	common	mq_timedreceive2_time64		sys_mq_timedreceive2
diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl
index 7e71bf7fcd14..5cfde6e0e6ba 100644
--- a/arch/sparc/kernel/syscalls/syscall.tbl
+++ b/arch/sparc/kernel/syscalls/syscall.tbl
@@ -517,3 +517,6 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	32	mq_timedreceive2			sys_mq_timedreceive2_time32
+473	64	mq_timedreceive2			sys_mq_timedreceive2
+474	32	mq_timedreceive2_time64		sys_mq_timedreceive2		sys_mq_timedreceive2
diff --git a/arch/xtensa/kernel/syscalls/syscall.tbl b/arch/xtensa/kernel/syscalls/syscall.tbl
index a9bca4e484de..9f69ef99e617 100644
--- a/arch/xtensa/kernel/syscalls/syscall.tbl
+++ b/arch/xtensa/kernel/syscalls/syscall.tbl
@@ -442,3 +442,5 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	common	mq_timedreceive2		sys_mq_timedreceive2_time32
+473	common	mq_timedreceive2_time64		sys_mq_timedreceive2
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index 1d27fd3e118e..ecfad24055b3 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -863,12 +863,13 @@ __SYSCALL(__NR_listns, sys_listns)
 #define __NR_rseq_slice_yield 471
 __SYSCALL(__NR_rseq_slice_yield, sys_rseq_slice_yield)
 
-#undef __NR_syscalls
-#define __NR_syscalls 472
-#define __NR_mq_timedreceive2 473
+
+#define __NR_mq_timedreceive2 472
 __SC_3264(__NR_mq_timedreceive2, sys_mq_timedreceive2_time32, sys_mq_timedreceive2)
-#define __NR_mq_timedreceive2_time64 474
+#define __NR_mq_timedreceive2_time64 473
 __SYSCALL(__NR_mq_timedreceive2_time64, sys_mq_timedreceive2)
+#undef __NR_syscalls
+#define __NR_syscalls 474
 /*
  * 32 bit systems traditionally used different
  * syscalls for off_t and loff_t arguments, while
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index 1e5d2eeb726d..605a65cfa144 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -104,6 +104,7 @@ cat << EOF
 #define __IGNORE_recvmmsg_time64
 #define __IGNORE_mq_timedsend_time64
 #define __IGNORE_mq_timedreceive_time64
+#define __IGNORE_mq_timedreceive2_time64
 #define __IGNORE_semtimedop_time64
 #define __IGNORE_rt_sigtimedwait_time64
 #define __IGNORE_futex_time64
diff --git a/scripts/syscall.tbl b/scripts/syscall.tbl
index 7a42b32b6577..7a09cd65cd8d 100644
--- a/scripts/syscall.tbl
+++ b/scripts/syscall.tbl
@@ -412,3 +412,6 @@
 469	common	file_setattr			sys_file_setattr
 470	common	listns				sys_listns
 471	common	rseq_slice_yield		sys_rseq_slice_yield
+472	time32	mq_timedreceive2		sys_mq_timedreceive2_time32
+473	64	mq_timedreceive2			sys_mq_timedreceive2
+474	32	mq_timedreceive_time64		sys_mq_timedreceive2
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] mqueue: introduce new do_mq_timedreceive2() [ mq_peek syscall] for non-destructive receive and inspection
  2026-03-04 13:51 [PATCH 1/3] mqueue: introduce new do_mq_timedreceive2() [ mq_peek syscall] for non-destructive receive and inspection Mathura_Kumar
  2026-03-04 13:51 ` [PATCH 2/3] [PATCH-V2] " Mathura_Kumar
  2026-03-04 13:51 ` [PATCH 3/3] [PATCH]-This patch series completes the implementation of do_mq_timedreceive2 new system calls that provide non-destructive peek functionality on POSIX message queues Mathura_Kumar
@ 2026-03-04 18:24 ` Randy Dunlap
  2026-03-05  5:09 ` kernel test robot
  3 siblings, 0 replies; 8+ messages in thread
From: Randy Dunlap @ 2026-03-04 18:24 UTC (permalink / raw)
  To: Mathura_Kumar, brauner; +Cc: linux-arch, linux-kernel, viro

Hi--

On 3/4/26 5:51 AM, Mathura_Kumar wrote:
>     POSIX message queues currently lack a mechanism to read
>     a message without removing it from the queue. This is a
>     long-standing limitation,when we require inspection of queue state
>     without altering it.
> 
>     Modifying existing mq_receive() semantics via additional
>     flags was considered. However, altering behavior of an
>     existing syscall risks breaking backward compatibility
>     for applications relying on current semantics. Since
>     mq_receive() guarantees message removal, changing this
>     contract is not safe.
> 
>     To preserve ABI stability, this patch introduces a new
>     system call that performs a non-destructive receive
>     operation (peek). The existing behavior remains unchanged.
> 
>     Design considerations:
> 
>     Two approaches for copying message data to userspace
>     were evaluated:
> 
>     1) Refcount-based message lifecycle handling
>        - This can help us  Avoids intermediate temp kernel copy
>        - Extends message lifetime
>        -But this may increase writer starvation under heavy load and
>         add unneassery complication on priority  management and
>         delay more time to free space in inode due refcount may prevent
> 
>     2) Temporary kernel buffer copy
>        - Copies message into a bounded kernel buffer
>        - Reduces time message remains locked
>        - Improves fairness under write-heavy workloads
>        - Simpler lifetime management
> 
>     My implementation adopts the temporary buffer approach
>     to minimize starvation and reduce locking complexity.
>     The design allows future transition if refcounting is
>     deemed preferable.
> 
>     Architecture support: Entry was made in relevant system call table
>       - x86
>       - ARM

I don't see any ARM changes in this patch.

>     Testing:
>       - 15+ functional test cases
>       - Multi-threaded producer/consumer scenarios
>       - concurrent pop and peek
>       - Edge cases: empty queue, FIFO
>         invalid flags, signal interruption etc.
> 
> Signed-off-by: Mathura_Kumar <academic1mathura@gmail.com>
> ---
>  arch/x86/entry/syscalls/syscall_32.tbl |   2 +
>  arch/x86/entry/syscalls/syscall_64.tbl |   2 +
>  include/linux/syscalls.h               |   9 +
>  include/uapi/asm-generic/unistd.h      |   5 +-
>  ipc/mqueue.c                           | 180 ++++++
>  ipc/msg.c                              |   2 +-
>  ipc/msgutil.c                          |  51 +-
>  ipc/util.h                             |   3 +-
>  tools/testing/selftests/ipc/.gitignore |   1 +
>  tools/testing/selftests/ipc/Makefile   |   5 +-
>  tools/testing/selftests/ipc/mq_peek.c  | 794 +++++++++++++++++++++++++
>  11 files changed, 1022 insertions(+), 32 deletions(-)
>  create mode 100644 tools/testing/selftests/ipc/mq_peek.c
> 



> diff --git a/ipc/mqueue.c b/ipc/mqueue.c
> index 4798b375972b..f6c7462b818f 100644
> --- a/ipc/mqueue.c
> +++ b/ipc/mqueue.c
> @@ -53,6 +53,7 @@ struct mqueue_fs_context {
>  
>  #define SEND		0
>  #define RECV		1
> +#define MQ_PEEK     2
>  
>  #define STATE_NONE	0
>  #define STATE_READY	1
> @@ -63,6 +64,12 @@ struct posix_msg_tree_node {
>  	int			priority;
>  };
>  
> +struct mq_timedreceive2_args {
> +	size_t msg_len;
> +	unsigned int  *msg_prio;
> +    char  *msg_ptr;

Indent above with tab, not spaces.

> +};
> +
>  /*
>   * Locking:
>   *
> @@ -1230,6 +1237,116 @@ static int do_mq_timedreceive(mqd_t mqdes, char __user *u_msg_ptr,
>  	return ret;
>  }
>  
> +static struct msg_msg *mq_peek_index(struct mqueue_inode_info *info, int index)
> +{
> +	struct rb_node *node;
> +	struct posix_msg_tree_node *leaf;
> +	struct msg_msg *msg;
> +	int count = 0;

Insert a blank line between data and code.

> +	/* Start from highest priority */
> +	node = rb_last(&info->msg_tree);
> +	while (node) {
> +		leaf = rb_entry(node, struct posix_msg_tree_node, rb_node);
> +		list_for_each_entry(msg, &leaf->msg_list, m_list) {
> +			if (count == index)
> +				return msg;
> +			count++;
> +		}
> +
> +		node = rb_prev(node);
> +	}
> +
> +	return NULL;
> +}
> +
> +static int do_mq_timedreceive2(mqd_t mqdes,
> +			       struct mq_timedreceive2_args __user *uargs,
> +			       unsigned int flags, unsigned long index,
> +			       struct timespec64 *ts)
> +{
> +	struct mq_timedreceive2_args args;
> +	ssize_t ret;
> +	struct msg_msg *msg_ptr, *k_msg_buffer;
> +	long k_m_type;
> +	size_t k_m_ts;
> +	struct inode *inode;
> +	struct mqueue_inode_info *info;
> +
> +	if (copy_from_user(&args, uargs, sizeof(args)))
> +		return -EFAULT;
> +
> +	if (!(flags & MQ_PEEK)) {
> +		return do_mq_timedreceive(mqdes, args.msg_ptr, args.msg_len,
> +					  args.msg_prio, ts);
> +	}
> +	audit_mq_sendrecv(mqdes, args.msg_len, 0, ts);
> +	CLASS(fd, f)(mqdes);
> +	if (fd_empty(f))
> +		return -EBADF;
> +
> +	inode = file_inode(fd_file(f));
> +	if (unlikely(fd_file(f)->f_op != &mqueue_file_operations))
> +		return -EBADF;
> +	info = MQUEUE_I(inode);
> +	audit_file(fd_file(f));
> +
> +	if (unlikely(!(fd_file(f)->f_mode & FMODE_READ)))
> +		return -EBADF;
> +
> +	if (unlikely(args.msg_len < info->attr.mq_msgsize))
> +		return -EMSGSIZE;
> +	if (index >= (unsigned long)info->attr.mq_maxmsg)
> +		return -ENOENT;
> +
> +	spin_lock(&info->lock);
> +	if (info->attr.mq_curmsgs == 0) {
> +		spin_unlock(&info->lock);
> +		return -EAGAIN;
> +	}
> +	msg_ptr = mq_peek_index(info, index);
> +	if (!msg_ptr) {
> +		spin_unlock(&info->lock);
> +		return -ENOENT;
> +	}
> +	k_m_type = msg_ptr->m_type;
> +	k_m_ts = msg_ptr->m_ts;
> +	spin_unlock(&info->lock);
> +
> +	k_msg_buffer = alloc_msg(k_m_ts);
> +	if (!k_msg_buffer)
> +		return -ENOMEM;
> +
> +	/*Two spin lock is necessary we are avoiding atomic memory allocation
> +    *and to early allocation without confirming that , is even msg exists to peek
> +    */

Bad comment format and indentation.

> +	spin_lock(&info->lock);
> +	msg_ptr = mq_peek_index(info, index);
> +	if (!msg_ptr || msg_ptr->m_type != k_m_type ||
> +	    msg_ptr->m_ts != k_m_ts) {
> +		spin_unlock(&info->lock);
> +		free_msg(k_msg_buffer);
> +		return -EAGAIN;
> +	}
> +	if (IS_ERR(copy_msg(msg_ptr, k_msg_buffer, k_m_ts))) {
> +		spin_unlock(&info->lock);
> +		free_msg(k_msg_buffer);
> +		return -EINVAL;
> +	}
> +	spin_unlock(&info->lock);
> +
> +	ret = k_msg_buffer->m_ts;
> +	if (args.msg_prio && put_user(k_m_type, args.msg_prio)) {
> +		free_msg(k_msg_buffer);
> +		return -EFAULT;
> +	}
> +	if (store_msg(args.msg_ptr, k_msg_buffer, k_m_ts)) {
> +		free_msg(k_msg_buffer);
> +		return -EFAULT;
> +	}
> +	free_msg(k_msg_buffer);
> +	return ret;
> +}
> +
>  SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr,
>  		size_t, msg_len, unsigned int, msg_prio,
>  		const struct __kernel_timespec __user *, u_abs_timeout)
> @@ -1258,6 +1375,23 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr,
>  	return do_mq_timedreceive(mqdes, u_msg_ptr, msg_len, u_msg_prio, p);
>  }
>  

Please add kernel-doc comments to describe the function and its arguments.
Or if not kernel-doc comments, then some kind of API documentation.

> +SYSCALL_DEFINE5(mq_timedreceive2, mqd_t, mqdes,
> +		struct mq_timedreceive2_args __user *, uargs, unsigned int,
> +		flags, const unsigned long, index,
> +		const struct __kernel_timespec __user *, u_abs_timeout)
> +{
> +	struct timespec64 ts, *p = NULL;
> +
> +	if (u_abs_timeout) {
> +		int res = prepare_timeout(u_abs_timeout, &ts);
> +
> +		if (res)
> +			return res;
> +		p = &ts;
> +	}
> +	return do_mq_timedreceive2(mqdes, uargs, flags, index, p);
> +}
> +
>  /*
>   * Notes: the case when user wants us to deregister (with NULL as pointer)
>   * and he isn't currently owner of notification, will be silently discarded.
> @@ -1450,6 +1584,7 @@ SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes,
>  }
>  
>  #ifdef CONFIG_COMPAT
> +#include "asm-generic/compat.h"
>  
>  struct compat_mq_attr {
>  	compat_long_t mq_flags;      /* message queue flags		     */
> @@ -1459,6 +1594,12 @@ struct compat_mq_attr {
>  	compat_long_t __reserved[4]; /* ignored for input, zeroed for output */
>  };
>  
> +struct compat_mq_timedreceive2_args {
> +	compat_size_t msg_len;
> +	compat_uptr_t msg_prio;
> +	compat_uptr_t msg_ptr;
> +};
> +
>  static inline int get_compat_mq_attr(struct mq_attr *attr,
>  			const struct compat_mq_attr __user *uattr)
>  {
> @@ -1490,6 +1631,22 @@ static inline int put_compat_mq_attr(const struct mq_attr *attr,
>  	return 0;
>  }
>  
> +static inline int get_compat_mq_args(struct mq_timedreceive2_args *args,
> +					struct compat_mq_timedreceive2_args __user *uargs)
> +{
> +	struct compat_mq_timedreceive2_args v;
> +
> +	if (copy_from_user(&v, uargs, sizeof(*uargs)))
> +		return -EFAULT;
> +
> +	memset(args, 0, sizeof(*args));
> +	args->msg_len = (size_t)compat_ptr(v.msg_len);
> +	args->msg_prio = (unsigned int *)compat_ptr(v.msg_prio);
> +	args->msg_ptr = (char *)compat_ptr(v.msg_ptr);
> +
> +	return 0;
> +}
> +
>  COMPAT_SYSCALL_DEFINE4(mq_open, const char __user *, u_name,
>  		       int, oflag, compat_mode_t, mode,
>  		       struct compat_mq_attr __user *, u_attr)
> @@ -1583,6 +1740,29 @@ SYSCALL_DEFINE5(mq_timedreceive_time32, mqd_t, mqdes,
>  	}
>  	return do_mq_timedreceive(mqdes, u_msg_ptr, msg_len, u_msg_prio, p);
>  }
> +

Add kernel-doc comments here also.

> +SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
> +		struct compat_mq_timedreceive2_args __user *, uargs,
> +		unsigned int, flags, const unsigned long, index,
> +		const struct old_timespec32 __user *, u_abs_timeout)
> +{


> diff --git a/ipc/msgutil.c b/ipc/msgutil.c
> index e28f0cecb2ec..8c8622b78f12 100644
> --- a/ipc/msgutil.c
> +++ b/ipc/msgutil.c
> @@ -51,7 +51,7 @@ static int __init init_msg_buckets(void)
>  }
>  subsys_initcall(init_msg_buckets);
>  
> -static struct msg_msg *alloc_msg(size_t len)
> +struct msg_msg *alloc_msg(size_t len)
>  {
>  	struct msg_msg *msg;
>  	struct msg_msgseg **pseg;
> @@ -122,39 +122,34 @@ struct msg_msg *load_msg(const void __user *src, size_t len)
>  	free_msg(msg);
>  	return ERR_PTR(err);
>  }
> -#ifdef CONFIG_CHECKPOINT_RESTORE
> -struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst)
> +
> +struct msg_msg *copy_msg(struct msg_msg *src,
> +							struct msg_msg *dst,
> +						size_t len)

Strange indentation.

>  {

-- 
~Randy


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] mqueue: introduce new  do_mq_timedreceive2() [ mq_peek  syscall] for non-destructive receive             and inspection
  2026-03-04 13:51 [PATCH 1/3] mqueue: introduce new do_mq_timedreceive2() [ mq_peek syscall] for non-destructive receive and inspection Mathura_Kumar
                   ` (2 preceding siblings ...)
  2026-03-04 18:24 ` [PATCH 1/3] mqueue: introduce new do_mq_timedreceive2() [ mq_peek syscall] for non-destructive receive and inspection Randy Dunlap
@ 2026-03-05  5:09 ` kernel test robot
  3 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2026-03-05  5:09 UTC (permalink / raw)
  To: Mathura_Kumar, brauner
  Cc: oe-kbuild-all, academic1mathura, linux-arch, linux-kernel, viro

Hi Mathura_Kumar,

kernel test robot noticed the following build errors:

[auto build test ERROR on shuah-kselftest/next]
[also build test ERROR on shuah-kselftest/fixes next-20260304]
[cannot apply to arnd-asm-generic/master linus/master tip/x86/asm v6.16-rc1]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mathura_Kumar/mqueue-introduce-new-do_mq_timedreceive2-mq_peek-syscall-for-non-destructive-receive-and-inspection/20260305-020107
base:   https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next
patch link:    https://lore.kernel.org/r/20260304135126.77270-1-academic1mathura%40gmail.com
patch subject: [PATCH 1/3] mqueue: introduce new  do_mq_timedreceive2() [ mq_peek  syscall] for non-destructive receive             and inspection
config: arm64-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260305/202603050617.WQwaYhvS-lkp@intel.com/config)
compiler: aarch64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260305/202603050617.WQwaYhvS-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603050617.WQwaYhvS-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

     122 | #define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__)
         |                                   ^~~~~~
   ./include/linux/syscalls.h:124:22: note: in expansion of macro '__MAP5'
     124 | #define __MAP(n,...) __MAP##n(__VA_ARGS__)
         |                      ^~~~~
   ./arch/arm64/include/asm/syscall_wrapper.h:58:36: note: in expansion of macro '__MAP'
      58 |         static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__))              \
         |                                    ^~~~~
   ./include/linux/syscalls.h:236:9: note: in expansion of macro '__SYSCALL_DEFINEx'
     236 |         __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~
   ./include/linux/syscalls.h:229:36: note: in expansion of macro 'SYSCALL_DEFINEx'
     229 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
         |                                    ^~~~~~~~~~~~~~~
   ipc/mqueue.c:1744:1: note: in expansion of macro 'SYSCALL_DEFINE5'
    1744 | SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
         | ^~~~~~~~~~~~~~~
   ipc/mqueue.c: In function '__se_sys_mq_timedreceive2_time32':
   ./include/linux/syscalls.h:132:25: error: passing argument 2 of '__do_sys_mq_timedreceive2_time32' from incompatible pointer type [-Wincompatible-pointer-types]
     132 | #define __SC_CAST(t, a) (__force t) a
   ./include/linux/syscalls.h:121:27: note: in expansion of macro '__SC_CAST'
     121 | #define __MAP4(m,t,a,...) m(t,a), __MAP3(m,__VA_ARGS__)
         |                           ^
   ./include/linux/syscalls.h:122:35: note: in expansion of macro '__MAP4'
     122 | #define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__)
         |                                   ^~~~~~
   ./include/linux/syscalls.h:124:22: note: in expansion of macro '__MAP5'
     124 | #define __MAP(n,...) __MAP##n(__VA_ARGS__)
         |                      ^~~~~
   ./arch/arm64/include/asm/syscall_wrapper.h:60:43: note: in expansion of macro '__MAP'
      60 |                 long ret = __do_sys##name(__MAP(x,__SC_CAST,__VA_ARGS__));      \
         |                                           ^~~~~
   ./include/linux/syscalls.h:236:9: note: in expansion of macro '__SYSCALL_DEFINEx'
     236 |         __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~
   ./include/linux/syscalls.h:229:36: note: in expansion of macro 'SYSCALL_DEFINEx'
     229 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
         |                                    ^~~~~~~~~~~~~~~
   ipc/mqueue.c:1744:1: note: in expansion of macro 'SYSCALL_DEFINE5'
    1744 | SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
         | ^~~~~~~~~~~~~~~
   ipc/mqueue.c:1745:63: note: expected 'struct compat_mq_timedreceive2_args *' but argument is of type 'struct compat_mq_timedreceive2_args *'
    1745 |                 struct compat_mq_timedreceive2_args __user *, uargs,
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
   ./include/linux/syscalls.h:126:27: note: in definition of macro '__SC_DECL'
     126 | #define __SC_DECL(t, a) t a
         |                           ^
   ./include/linux/syscalls.h:122:35: note: in expansion of macro '__MAP4'
     122 | #define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__)
         |                                   ^~~~~~
   ./include/linux/syscalls.h:124:22: note: in expansion of macro '__MAP5'
     124 | #define __MAP(n,...) __MAP##n(__VA_ARGS__)
         |                      ^~~~~
   ./arch/arm64/include/asm/syscall_wrapper.h:53:43: note: in expansion of macro '__MAP'
      53 |         static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));      \
         |                                           ^~~~~
   ./include/linux/syscalls.h:236:9: note: in expansion of macro '__SYSCALL_DEFINEx'
     236 |         __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~
   ./include/linux/syscalls.h:229:36: note: in expansion of macro 'SYSCALL_DEFINEx'
     229 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
         |                                    ^~~~~~~~~~~~~~~
   ipc/mqueue.c:1744:1: note: in expansion of macro 'SYSCALL_DEFINE5'
    1744 | SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
         | ^~~~~~~~~~~~~~~
   ipc/mqueue.c: At top level:
   ipc/mqueue.c:1745:24: warning: 'struct compat_mq_timedreceive2_args' declared inside parameter list will not be visible outside of this definition or declaration
    1745 |                 struct compat_mq_timedreceive2_args __user *, uargs,
         |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ./include/linux/syscalls.h:126:25: note: in definition of macro '__SC_DECL'
     126 | #define __SC_DECL(t, a) t a
         |                         ^
   ./include/linux/syscalls.h:122:35: note: in expansion of macro '__MAP4'
     122 | #define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__)
         |                                   ^~~~~~
   ./include/linux/syscalls.h:124:22: note: in expansion of macro '__MAP5'
     124 | #define __MAP(n,...) __MAP##n(__VA_ARGS__)
         |                      ^~~~~
   ./arch/arm64/include/asm/syscall_wrapper.h:65:43: note: in expansion of macro '__MAP'
      65 |         static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
         |                                           ^~~~~
   ./include/linux/syscalls.h:236:9: note: in expansion of macro '__SYSCALL_DEFINEx'
     236 |         __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~
   ./include/linux/syscalls.h:229:36: note: in expansion of macro 'SYSCALL_DEFINEx'
     229 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
         |                                    ^~~~~~~~~~~~~~~
   ipc/mqueue.c:1744:1: note: in expansion of macro 'SYSCALL_DEFINE5'
    1744 | SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
         | ^~~~~~~~~~~~~~~
   In file included from ./include/linux/compat.h:34,
                    from ./arch/arm64/include/asm/ftrace.h:41,
                    from ./include/linux/ftrace.h:23,
                    from ./include/linux/kprobes.h:28,
                    from ./include/linux/kgdb.h:17,
                    from ./arch/arm64/include/asm/cacheflush.h:11,
                    from ./include/linux/cacheflush.h:5,
                    from ./include/linux/highmem.h:8,
                    from ./include/linux/pagemap.h:11,
                    from ipc/mqueue.c:17:
>> ./arch/arm64/include/asm/syscall_wrapper.h:65:28: error: conflicting types for '__do_sys_mq_timedreceive2_time32'; have 'long int(mqd_t,  struct compat_mq_timedreceive2_args *, unsigned int,  const long unsigned int,  const struct old_timespec32 *)' {aka 'long int(int,  struct compat_mq_timedreceive2_args *, unsigned int,  const long unsigned int,  const struct old_timespec32 *)'}
      65 |         static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
         |                            ^~~~~~~~
   ./include/linux/syscalls.h:236:9: note: in expansion of macro '__SYSCALL_DEFINEx'
     236 |         __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~
   ./include/linux/syscalls.h:229:36: note: in expansion of macro 'SYSCALL_DEFINEx'
     229 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
         |                                    ^~~~~~~~~~~~~~~
   ipc/mqueue.c:1744:1: note: in expansion of macro 'SYSCALL_DEFINE5'
    1744 | SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
         | ^~~~~~~~~~~~~~~
   ./arch/arm64/include/asm/syscall_wrapper.h:53:28: note: previous declaration of '__do_sys_mq_timedreceive2_time32' with type 'long int(mqd_t,  struct compat_mq_timedreceive2_args *, unsigned int,  const long unsigned int,  const struct old_timespec32 *)' {aka 'long int(int,  struct compat_mq_timedreceive2_args *, unsigned int,  const long unsigned int,  const struct old_timespec32 *)'}
      53 |         static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));      \
         |                            ^~~~~~~~
   ./include/linux/syscalls.h:236:9: note: in expansion of macro '__SYSCALL_DEFINEx'
     236 |         __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~
   ./include/linux/syscalls.h:229:36: note: in expansion of macro 'SYSCALL_DEFINEx'
     229 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
         |                                    ^~~~~~~~~~~~~~~
   ipc/mqueue.c:1744:1: note: in expansion of macro 'SYSCALL_DEFINE5'
    1744 | SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
         | ^~~~~~~~~~~~~~~
   ipc/mqueue.c: In function '__do_sys_mq_timedreceive2_time32':
   ipc/mqueue.c:1753:13: error: implicit declaration of function 'get_compat_mq_args'; did you mean 'get_compat_msghdr'? [-Wimplicit-function-declaration]
    1753 |         if (get_compat_mq_args(pargs, uargs))
         |             ^~~~~~~~~~~~~~~~~~
         |             get_compat_msghdr
   ipc/mqueue.c: At top level:
>> ./arch/arm64/include/asm/syscall_wrapper.h:53:28: warning: '__do_sys_mq_timedreceive2_time32' used but never defined
      53 |         static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));      \
         |                            ^~~~~~~~
   ./include/linux/syscalls.h:236:9: note: in expansion of macro '__SYSCALL_DEFINEx'
     236 |         __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~
   ./include/linux/syscalls.h:229:36: note: in expansion of macro 'SYSCALL_DEFINEx'
     229 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
         |                                    ^~~~~~~~~~~~~~~
   ipc/mqueue.c:1744:1: note: in expansion of macro 'SYSCALL_DEFINE5'
    1744 | SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
         | ^~~~~~~~~~~~~~~


vim +65 ./arch/arm64/include/asm/syscall_wrapper.h

4378a7d4be30ec Mark Rutland 2018-07-11  48  
4378a7d4be30ec Mark Rutland 2018-07-11  49  #define __SYSCALL_DEFINEx(x, name, ...)						\
4378a7d4be30ec Mark Rutland 2018-07-11  50  	asmlinkage long __arm64_sys##name(const struct pt_regs *regs);		\
4378a7d4be30ec Mark Rutland 2018-07-11  51  	ALLOW_ERROR_INJECTION(__arm64_sys##name, ERRNO);			\
4378a7d4be30ec Mark Rutland 2018-07-11  52  	static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__));		\
4378a7d4be30ec Mark Rutland 2018-07-11 @53  	static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));	\
4378a7d4be30ec Mark Rutland 2018-07-11  54  	asmlinkage long __arm64_sys##name(const struct pt_regs *regs)		\
4378a7d4be30ec Mark Rutland 2018-07-11  55  	{									\
4378a7d4be30ec Mark Rutland 2018-07-11  56  		return __se_sys##name(SC_ARM64_REGS_TO_ARGS(x,__VA_ARGS__));	\
4378a7d4be30ec Mark Rutland 2018-07-11  57  	}									\
4378a7d4be30ec Mark Rutland 2018-07-11  58  	static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__))		\
4378a7d4be30ec Mark Rutland 2018-07-11  59  	{									\
4378a7d4be30ec Mark Rutland 2018-07-11  60  		long ret = __do_sys##name(__MAP(x,__SC_CAST,__VA_ARGS__));	\
4378a7d4be30ec Mark Rutland 2018-07-11  61  		__MAP(x,__SC_TEST,__VA_ARGS__);					\
4378a7d4be30ec Mark Rutland 2018-07-11  62  		__PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__));		\
4378a7d4be30ec Mark Rutland 2018-07-11  63  		return ret;							\
4378a7d4be30ec Mark Rutland 2018-07-11  64  	}									\
4378a7d4be30ec Mark Rutland 2018-07-11 @65  	static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
4378a7d4be30ec Mark Rutland 2018-07-11  66  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] [PATCH]-This patch series completes the implementation of do_mq_timedreceive2 new        system calls that provide non-destructive peek functionality        on POSIX message queues
  2026-03-04 13:51 ` [PATCH 3/3] [PATCH]-This patch series completes the implementation of do_mq_timedreceive2 new system calls that provide non-destructive peek functionality on POSIX message queues Mathura_Kumar
@ 2026-03-05  5:49   ` kernel test robot
  2026-03-05  5:51   ` kernel test robot
  2026-03-05  8:10   ` kernel test robot
  2 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2026-03-05  5:49 UTC (permalink / raw)
  To: Mathura_Kumar, brauner
  Cc: oe-kbuild-all, academic1mathura, linux-arch, linux-kernel, viro

Hi Mathura_Kumar,

kernel test robot noticed the following build warnings:

[auto build test WARNING on shuah-kselftest/next]
[also build test WARNING on shuah-kselftest/fixes linus/master v7.0-rc2 next-20260304]
[cannot apply to arnd-asm-generic/master tip/x86/asm]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mathura_Kumar/mqueue-introduce-new-do_mq_timedreceive2-mq_peek-syscall-for-non-destructive-receive-and-inspection/20260305-020107
base:   https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next
patch link:    https://lore.kernel.org/r/20260304135126.77270-3-academic1mathura%40gmail.com
patch subject: [PATCH 3/3] [PATCH]-This patch series completes the implementation of do_mq_timedreceive2 new        system calls that provide non-destructive peek functionality        on POSIX message queues
config: csky-allnoconfig (https://download.01.org/0day-ci/archive/20260305/202603051306.xpnYl8Oz-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260305/202603051306.xpnYl8Oz-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603051306.xpnYl8Oz-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from arch/csky/include/uapi/asm/unistd.h:3,
                    from arch/csky/include/asm/unistd.h:3,
                    from <stdin>:2:
>> ./arch/csky/include/generated/uapi/asm/unistd_32.h:352:9: warning: '__NR_mq_timedreceive_time64' redefined
     352 | #define __NR_mq_timedreceive_time64 474
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   ./arch/csky/include/generated/uapi/asm/unistd_32.h:299:9: note: this is the location of the previous definition
     299 | #define __NR_mq_timedreceive_time64 419
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   <stdin>:1634:2: warning: #warning syscall mq_timedreceive2_time64 not implemented [-Wcpp]
--
   In file included from arch/csky/include/uapi/asm/unistd.h:3,
                    from arch/csky/include/asm/unistd.h:3,
                    from include/uapi/linux/unistd.h:8,
                    from include/uapi/linux/lsm.h:14,
                    from include/linux/security.h:36,
                    from include/net/scm.h:9,
                    from include/linux/netlink.h:9,
                    from include/uapi/linux/neighbour.h:6,
                    from include/linux/netdevice.h:44,
                    from drivers/base/core.c:24:
>> ./arch/csky/include/generated/uapi/asm/unistd_32.h:352:9: warning: '__NR_mq_timedreceive_time64' redefined
     352 | #define __NR_mq_timedreceive_time64 474
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   ./arch/csky/include/generated/uapi/asm/unistd_32.h:299:9: note: this is the location of the previous definition
     299 | #define __NR_mq_timedreceive_time64 419
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from arch/csky/include/uapi/asm/unistd.h:3,
                    from arch/csky/include/asm/unistd.h:3,
                    from include/uapi/linux/unistd.h:8,
                    from include/linux/syscalls.h:91,
                    from include/linux/syscalls_api.h:1,
                    from kernel/sched/sched.h:64,
                    from kernel/sched/rq-offsets.c:5:
>> ./arch/csky/include/generated/uapi/asm/unistd_32.h:352:9: warning: '__NR_mq_timedreceive_time64' redefined
     352 | #define __NR_mq_timedreceive_time64 474
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   ./arch/csky/include/generated/uapi/asm/unistd_32.h:299:9: note: this is the location of the previous definition
     299 | #define __NR_mq_timedreceive_time64 419
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/syscalls.h:751:42: warning: 'struct mq_timedreceive2_args' declared inside parameter list will not be visible outside of this definition or declaration
     751 | sys_mq_timedreceive2(mqd_t mqdes, struct mq_timedreceive2_args __user *uargs,
         |                                          ^~~~~~~~~~~~~~~~~~~~~
   include/linux/syscalls.h:756:36: warning: 'struct mq_timedreceive2_args' declared inside parameter list will not be visible outside of this definition or declaration
     756 |                             struct mq_timedreceive2_args __user *uargs,
         |                                    ^~~~~~~~~~~~~~~~~~~~~
   In file included from arch/csky/include/uapi/asm/unistd.h:3,
                    from arch/csky/include/asm/unistd.h:3,
                    from <stdin>:2:
>> ./arch/csky/include/generated/uapi/asm/unistd_32.h:352:9: warning: '__NR_mq_timedreceive_time64' redefined
     352 | #define __NR_mq_timedreceive_time64 474
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   ./arch/csky/include/generated/uapi/asm/unistd_32.h:299:9: note: this is the location of the previous definition
     299 | #define __NR_mq_timedreceive_time64 419
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   <stdin>:1634:2: warning: #warning syscall mq_timedreceive2_time64 not implemented [-Wcpp]

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] [PATCH]-This patch series completes the implementation of do_mq_timedreceive2 new        system calls that provide non-destructive peek functionality        on POSIX message queues
  2026-03-04 13:51 ` [PATCH 3/3] [PATCH]-This patch series completes the implementation of do_mq_timedreceive2 new system calls that provide non-destructive peek functionality on POSIX message queues Mathura_Kumar
  2026-03-05  5:49   ` kernel test robot
@ 2026-03-05  5:51   ` kernel test robot
  2026-03-05  8:10   ` kernel test robot
  2 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2026-03-05  5:51 UTC (permalink / raw)
  To: Mathura_Kumar, brauner
  Cc: oe-kbuild-all, academic1mathura, linux-arch, linux-kernel, viro

Hi Mathura_Kumar,

kernel test robot noticed the following build warnings:

[auto build test WARNING on shuah-kselftest/next]
[also build test WARNING on shuah-kselftest/fixes linus/master v7.0-rc2 next-20260303]
[cannot apply to arnd-asm-generic/master tip/x86/asm]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mathura_Kumar/mqueue-introduce-new-do_mq_timedreceive2-mq_peek-syscall-for-non-destructive-receive-and-inspection/20260305-020107
base:   https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next
patch link:    https://lore.kernel.org/r/20260304135126.77270-3-academic1mathura%40gmail.com
patch subject: [PATCH 3/3] [PATCH]-This patch series completes the implementation of do_mq_timedreceive2 new        system calls that provide non-destructive peek functionality        on POSIX message queues
config: arc-allnoconfig (https://download.01.org/0day-ci/archive/20260305/202603051353.0aNGnszx-lkp@intel.com/config)
compiler: arc-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260305/202603051353.0aNGnszx-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603051353.0aNGnszx-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from arch/arc/include/uapi/asm/unistd.h:10,
                    from arch/arc/include/asm/unistd.h:5,
                    from <stdin>:2:
>> ./arch/arc/include/generated/uapi/asm/unistd_32.h:356:9: warning: '__NR_mq_timedreceive_time64' redefined
     356 | #define __NR_mq_timedreceive_time64 474
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   ./arch/arc/include/generated/uapi/asm/unistd_32.h:303:9: note: this is the location of the previous definition
     303 | #define __NR_mq_timedreceive_time64 419
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   <stdin>:1634:2: warning: #warning syscall mq_timedreceive2_time64 not implemented [-Wcpp]
--
   In file included from arch/arc/include/uapi/asm/unistd.h:10,
                    from arch/arc/include/asm/unistd.h:5,
                    from arch/arc/include/asm/entry.h:10,
                    from arch/arc/kernel/head.S:14:
>> ./arch/arc/include/generated/uapi/asm/unistd_32.h:356:9: warning: '__NR_mq_timedreceive_time64' redefined
     356 | #define __NR_mq_timedreceive_time64 474
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   ./arch/arc/include/generated/uapi/asm/unistd_32.h:303:9: note: this is the location of the previous definition
     303 | #define __NR_mq_timedreceive_time64 419
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from arch/arc/include/uapi/asm/unistd.h:10,
                    from arch/arc/include/asm/unistd.h:5,
                    from include/uapi/linux/unistd.h:8,
                    from arch/arc/kernel/process.c:16:
>> ./arch/arc/include/generated/uapi/asm/unistd_32.h:356:9: warning: '__NR_mq_timedreceive_time64' redefined
     356 | #define __NR_mq_timedreceive_time64 474
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   ./arch/arc/include/generated/uapi/asm/unistd_32.h:303:9: note: this is the location of the previous definition
     303 | #define __NR_mq_timedreceive_time64 419
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from arch/arc/kernel/process.c:19:
   include/linux/syscalls.h:751:42: warning: 'struct mq_timedreceive2_args' declared inside parameter list will not be visible outside of this definition or declaration
     751 | sys_mq_timedreceive2(mqd_t mqdes, struct mq_timedreceive2_args __user *uargs,
         |                                          ^~~~~~~~~~~~~~~~~~~~~
   include/linux/syscalls.h:756:36: warning: 'struct mq_timedreceive2_args' declared inside parameter list will not be visible outside of this definition or declaration
     756 |                             struct mq_timedreceive2_args __user *uargs,
         |                                    ^~~~~~~~~~~~~~~~~~~~~
--
   In file included from arch/arc/include/uapi/asm/unistd.h:10,
                    from arch/arc/include/asm/unistd.h:5,
                    from include/uapi/linux/unistd.h:8,
                    from include/linux/syscalls.h:91,
                    from arch/arc/kernel/sys.c:3:
>> ./arch/arc/include/generated/uapi/asm/unistd_32.h:356:9: warning: '__NR_mq_timedreceive_time64' redefined
     356 | #define __NR_mq_timedreceive_time64 474
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   ./arch/arc/include/generated/uapi/asm/unistd_32.h:303:9: note: this is the location of the previous definition
     303 | #define __NR_mq_timedreceive_time64 419
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/syscalls.h:751:42: warning: 'struct mq_timedreceive2_args' declared inside parameter list will not be visible outside of this definition or declaration
     751 | sys_mq_timedreceive2(mqd_t mqdes, struct mq_timedreceive2_args __user *uargs,
         |                                          ^~~~~~~~~~~~~~~~~~~~~
   include/linux/syscalls.h:756:36: warning: 'struct mq_timedreceive2_args' declared inside parameter list will not be visible outside of this definition or declaration
     756 |                             struct mq_timedreceive2_args __user *uargs,
         |                                    ^~~~~~~~~~~~~~~~~~~~~
   arch/arc/kernel/sys.c:13:36: warning: initialized field overwritten [-Woverride-init]
      13 | #define __SYSCALL(nr, call) [nr] = (call),
         |                                    ^
   arch/arc/kernel/sys.c:14:52: note: in expansion of macro '__SYSCALL'
      14 | #define __SYSCALL_WITH_COMPAT(nr, native, compat)  __SYSCALL(nr, native)
         |                                                    ^~~~~~~~~
   ./arch/arc/include/generated/asm/syscall_table_32.h:1:1: note: in expansion of macro '__SYSCALL_WITH_COMPAT'
       1 | __SYSCALL_WITH_COMPAT(0, sys_io_setup, compat_sys_io_setup)
         | ^~~~~~~~~~~~~~~~~~~~~
   arch/arc/kernel/sys.c:13:36: note: (near initialization for 'sys_call_table[0]')
      13 | #define __SYSCALL(nr, call) [nr] = (call),
         |                                    ^
   arch/arc/kernel/sys.c:14:52: note: in expansion of macro '__SYSCALL'
      14 | #define __SYSCALL_WITH_COMPAT(nr, native, compat)  __SYSCALL(nr, native)
         |                                                    ^~~~~~~~~
   ./arch/arc/include/generated/asm/syscall_table_32.h:1:1: note: in expansion of macro '__SYSCALL_WITH_COMPAT'
       1 | __SYSCALL_WITH_COMPAT(0, sys_io_setup, compat_sys_io_setup)
         | ^~~~~~~~~~~~~~~~~~~~~
   arch/arc/kernel/sys.c:13:36: warning: initialized field overwritten [-Woverride-init]
      13 | #define __SYSCALL(nr, call) [nr] = (call),
         |                                    ^
   ./arch/arc/include/generated/asm/syscall_table_32.h:2:1: note: in expansion of macro '__SYSCALL'
       2 | __SYSCALL(1, sys_io_destroy)
         | ^~~~~~~~~
   arch/arc/kernel/sys.c:13:36: note: (near initialization for 'sys_call_table[1]')
      13 | #define __SYSCALL(nr, call) [nr] = (call),
         |                                    ^
   ./arch/arc/include/generated/asm/syscall_table_32.h:2:1: note: in expansion of macro '__SYSCALL'
       2 | __SYSCALL(1, sys_io_destroy)
         | ^~~~~~~~~
   arch/arc/kernel/sys.c:13:36: warning: initialized field overwritten [-Woverride-init]
      13 | #define __SYSCALL(nr, call) [nr] = (call),
         |                                    ^
   arch/arc/kernel/sys.c:14:52: note: in expansion of macro '__SYSCALL'
      14 | #define __SYSCALL_WITH_COMPAT(nr, native, compat)  __SYSCALL(nr, native)
         |                                                    ^~~~~~~~~
   ./arch/arc/include/generated/asm/syscall_table_32.h:3:1: note: in expansion of macro '__SYSCALL_WITH_COMPAT'
       3 | __SYSCALL_WITH_COMPAT(2, sys_io_submit, compat_sys_io_submit)
         | ^~~~~~~~~~~~~~~~~~~~~
   arch/arc/kernel/sys.c:13:36: note: (near initialization for 'sys_call_table[2]')
      13 | #define __SYSCALL(nr, call) [nr] = (call),
         |                                    ^
   arch/arc/kernel/sys.c:14:52: note: in expansion of macro '__SYSCALL'
      14 | #define __SYSCALL_WITH_COMPAT(nr, native, compat)  __SYSCALL(nr, native)
         |                                                    ^~~~~~~~~
   ./arch/arc/include/generated/asm/syscall_table_32.h:3:1: note: in expansion of macro '__SYSCALL_WITH_COMPAT'
       3 | __SYSCALL_WITH_COMPAT(2, sys_io_submit, compat_sys_io_submit)
         | ^~~~~~~~~~~~~~~~~~~~~
   arch/arc/kernel/sys.c:13:36: warning: initialized field overwritten [-Woverride-init]
      13 | #define __SYSCALL(nr, call) [nr] = (call),
         |                                    ^
   ./arch/arc/include/generated/asm/syscall_table_32.h:4:1: note: in expansion of macro '__SYSCALL'
       4 | __SYSCALL(3, sys_io_cancel)
         | ^~~~~~~~~
   arch/arc/kernel/sys.c:13:36: note: (near initialization for 'sys_call_table[3]')
      13 | #define __SYSCALL(nr, call) [nr] = (call),
         |                                    ^
   ./arch/arc/include/generated/asm/syscall_table_32.h:4:1: note: in expansion of macro '__SYSCALL'
       4 | __SYSCALL(3, sys_io_cancel)
         | ^~~~~~~~~
   arch/arc/kernel/sys.c:13:36: warning: initialized field overwritten [-Woverride-init]
      13 | #define __SYSCALL(nr, call) [nr] = (call),
         |                                    ^
   ./arch/arc/include/generated/asm/syscall_table_32.h:5:1: note: in expansion of macro '__SYSCALL'
       5 | __SYSCALL(4, sys_io_getevents_time32)
         | ^~~~~~~~~
   arch/arc/kernel/sys.c:13:36: note: (near initialization for 'sys_call_table[4]')
      13 | #define __SYSCALL(nr, call) [nr] = (call),
         |                                    ^
   ./arch/arc/include/generated/asm/syscall_table_32.h:5:1: note: in expansion of macro '__SYSCALL'
       5 | __SYSCALL(4, sys_io_getevents_time32)
         | ^~~~~~~~~
   arch/arc/kernel/sys.c:13:36: warning: initialized field overwritten [-Woverride-init]
      13 | #define __SYSCALL(nr, call) [nr] = (call),
         |                                    ^
   ./arch/arc/include/generated/asm/syscall_table_32.h:6:1: note: in expansion of macro '__SYSCALL'
       6 | __SYSCALL(5, sys_setxattr)
         | ^~~~~~~~~
   arch/arc/kernel/sys.c:13:36: note: (near initialization for 'sys_call_table[5]')
      13 | #define __SYSCALL(nr, call) [nr] = (call),
         |                                    ^
   ./arch/arc/include/generated/asm/syscall_table_32.h:6:1: note: in expansion of macro '__SYSCALL'
       6 | __SYSCALL(5, sys_setxattr)
         | ^~~~~~~~~
   arch/arc/kernel/sys.c:13:36: warning: initialized field overwritten [-Woverride-init]
      13 | #define __SYSCALL(nr, call) [nr] = (call),
         |                                    ^
   ./arch/arc/include/generated/asm/syscall_table_32.h:7:1: note: in expansion of macro '__SYSCALL'
       7 | __SYSCALL(6, sys_lsetxattr)
--
   In file included from arch/arc/include/uapi/asm/unistd.h:10,
                    from arch/arc/include/asm/unistd.h:5,
                    from include/uapi/linux/unistd.h:8,
                    from include/linux/syscalls.h:91,
                    from include/linux/syscalls_api.h:1,
                    from kernel/sched/sched.h:64,
                    from kernel/sched/rq-offsets.c:5:
>> ./arch/arc/include/generated/uapi/asm/unistd_32.h:356:9: warning: '__NR_mq_timedreceive_time64' redefined
     356 | #define __NR_mq_timedreceive_time64 474
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   ./arch/arc/include/generated/uapi/asm/unistd_32.h:303:9: note: this is the location of the previous definition
     303 | #define __NR_mq_timedreceive_time64 419
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/syscalls.h:751:42: warning: 'struct mq_timedreceive2_args' declared inside parameter list will not be visible outside of this definition or declaration
     751 | sys_mq_timedreceive2(mqd_t mqdes, struct mq_timedreceive2_args __user *uargs,
         |                                          ^~~~~~~~~~~~~~~~~~~~~
   include/linux/syscalls.h:756:36: warning: 'struct mq_timedreceive2_args' declared inside parameter list will not be visible outside of this definition or declaration
     756 |                             struct mq_timedreceive2_args __user *uargs,
         |                                    ^~~~~~~~~~~~~~~~~~~~~
   In file included from arch/arc/include/uapi/asm/unistd.h:10,
                    from arch/arc/include/asm/unistd.h:5,
                    from <stdin>:2:
>> ./arch/arc/include/generated/uapi/asm/unistd_32.h:356:9: warning: '__NR_mq_timedreceive_time64' redefined
     356 | #define __NR_mq_timedreceive_time64 474
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   ./arch/arc/include/generated/uapi/asm/unistd_32.h:303:9: note: this is the location of the previous definition
     303 | #define __NR_mq_timedreceive_time64 419
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   <stdin>:1634:2: warning: #warning syscall mq_timedreceive2_time64 not implemented [-Wcpp]

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] [PATCH]-This patch series completes the implementation of do_mq_timedreceive2 new        system calls that provide non-destructive peek functionality        on POSIX message queues
  2026-03-04 13:51 ` [PATCH 3/3] [PATCH]-This patch series completes the implementation of do_mq_timedreceive2 new system calls that provide non-destructive peek functionality on POSIX message queues Mathura_Kumar
  2026-03-05  5:49   ` kernel test robot
  2026-03-05  5:51   ` kernel test robot
@ 2026-03-05  8:10   ` kernel test robot
  2 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2026-03-05  8:10 UTC (permalink / raw)
  To: Mathura_Kumar, brauner
  Cc: oe-kbuild-all, academic1mathura, linux-arch, linux-kernel, viro

Hi Mathura_Kumar,

kernel test robot noticed the following build errors:

[auto build test ERROR on shuah-kselftest/next]
[also build test ERROR on shuah-kselftest/fixes linus/master v7.0-rc2 next-20260304]
[cannot apply to arnd-asm-generic/master tip/x86/asm]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mathura_Kumar/mqueue-introduce-new-do_mq_timedreceive2-mq_peek-syscall-for-non-destructive-receive-and-inspection/20260305-020107
base:   https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next
patch link:    https://lore.kernel.org/r/20260304135126.77270-3-academic1mathura%40gmail.com
patch subject: [PATCH 3/3] [PATCH]-This patch series completes the implementation of do_mq_timedreceive2 new        system calls that provide non-destructive peek functionality        on POSIX message queues
config: riscv-randconfig-r072-20260305 (https://download.01.org/0day-ci/archive/20260305/202603051551.UzHTmDax-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 15.2.0
smatch: v0.5.0-9004-gb810ac53
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260305/202603051551.UzHTmDax-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603051551.UzHTmDax-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

>> ./arch/riscv/include/generated/asm/syscall_table_32.h:475:11: error: array index in initializer exceeds array bounds
     475 | __SYSCALL(474, sys_mq_timedreceive2)
         |           ^~~
   arch/riscv/kernel/compat_syscall_table.c:18:35: note: in definition of macro '__SYSCALL'
      18 | #define __SYSCALL(nr, call)      [nr] = __riscv_##call,
         |                                   ^~
   ./arch/riscv/include/generated/asm/syscall_table_32.h:475:11: note: (near initialization for 'compat_sys_call_table')
     475 | __SYSCALL(474, sys_mq_timedreceive2)
         |           ^~~
   arch/riscv/kernel/compat_syscall_table.c:18:35: note: in definition of macro '__SYSCALL'
      18 | #define __SYSCALL(nr, call)      [nr] = __riscv_##call,
         |                                   ^~
>> arch/riscv/kernel/compat_syscall_table.c:18:41: warning: excess elements in array initializer
      18 | #define __SYSCALL(nr, call)      [nr] = __riscv_##call,
         |                                         ^~~~~~~~
   ./arch/riscv/include/generated/asm/syscall_table_32.h:475:1: note: in expansion of macro '__SYSCALL'
     475 | __SYSCALL(474, sys_mq_timedreceive2)
         | ^~~~~~~~~
   arch/riscv/kernel/compat_syscall_table.c:18:41: note: (near initialization for 'compat_sys_call_table')
      18 | #define __SYSCALL(nr, call)      [nr] = __riscv_##call,
         |                                         ^~~~~~~~
   ./arch/riscv/include/generated/asm/syscall_table_32.h:475:1: note: in expansion of macro '__SYSCALL'
     475 | __SYSCALL(474, sys_mq_timedreceive2)
         | ^~~~~~~~~
--
   In file included from arch/riscv/include/uapi/asm/unistd.h:22,
                    from arch/riscv/include/asm/unistd.h:27,
                    from arch/riscv/kernel/compat_vdso/../vdso/flush_icache.S:7,
                    from arch/riscv/kernel/compat_vdso/flush_icache.S:3:
>> ./arch/riscv/include/generated/uapi/asm/unistd_32.h:322:9: warning: '__NR_mq_timedreceive_time64' redefined
     322 | #define __NR_mq_timedreceive_time64 474
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   ./arch/riscv/include/generated/uapi/asm/unistd_32.h:269:9: note: this is the location of the previous definition
     269 | #define __NR_mq_timedreceive_time64 419
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from arch/riscv/include/uapi/asm/unistd.h:22,
                    from arch/riscv/include/asm/unistd.h:27,
                    from arch/riscv/kernel/compat_vdso/../vdso/getcpu.S:7,
                    from arch/riscv/kernel/compat_vdso/getcpu.S:3:
>> ./arch/riscv/include/generated/uapi/asm/unistd_32.h:322:9: warning: '__NR_mq_timedreceive_time64' redefined
     322 | #define __NR_mq_timedreceive_time64 474
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   ./arch/riscv/include/generated/uapi/asm/unistd_32.h:269:9: note: this is the location of the previous definition
     269 | #define __NR_mq_timedreceive_time64 419
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from arch/riscv/include/uapi/asm/unistd.h:22,
                    from arch/riscv/include/asm/unistd.h:27,
                    from arch/riscv/kernel/compat_vdso/../vdso/rt_sigreturn.S:7,
                    from arch/riscv/kernel/compat_vdso/rt_sigreturn.S:3:
>> ./arch/riscv/include/generated/uapi/asm/unistd_32.h:322:9: warning: '__NR_mq_timedreceive_time64' redefined
     322 | #define __NR_mq_timedreceive_time64 474
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   ./arch/riscv/include/generated/uapi/asm/unistd_32.h:269:9: note: this is the location of the previous definition
     269 | #define __NR_mq_timedreceive_time64 419
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-03-05  8:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 13:51 [PATCH 1/3] mqueue: introduce new do_mq_timedreceive2() [ mq_peek syscall] for non-destructive receive and inspection Mathura_Kumar
2026-03-04 13:51 ` [PATCH 2/3] [PATCH-V2] " Mathura_Kumar
2026-03-04 13:51 ` [PATCH 3/3] [PATCH]-This patch series completes the implementation of do_mq_timedreceive2 new system calls that provide non-destructive peek functionality on POSIX message queues Mathura_Kumar
2026-03-05  5:49   ` kernel test robot
2026-03-05  5:51   ` kernel test robot
2026-03-05  8:10   ` kernel test robot
2026-03-04 18:24 ` [PATCH 1/3] mqueue: introduce new do_mq_timedreceive2() [ mq_peek syscall] for non-destructive receive and inspection Randy Dunlap
2026-03-05  5:09 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox