mqueue: introduce new do_mq_timedreceive2() [ mq_peek syscall] for non-destructive receive and inspection,fix minor issue,prepared doc.
Subsystems (17)
PATCH 1/1 mqueue: introduce new do_mq_timedreceive2() [ mq_peek syscall] for non-destructive receive and inspection,fix minor issue,prepared doc.
First of all Thanks for constructive response,I am new to kernel development so in earlier patch has some style issue
what changed now:-
1)As per my estimate all style issue fixed
2)Doc was prepared in Documentation/userspace-api/syscall.rst, for better
consistency, i was not making inline comment for doc in source code
3)I am squashing previous three commit in this latest one for convenience in applying
and merging
Required Attention:-As per mail from bot
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]
As per my guess bot failed to apply all earlier patch in order,now As Squashed, it should not come but if it then required manual intervention, I tested Successfully on x86-64 bit arch and all test.
Short Description:
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: ALL
Testing:
- 15+ functional test cases
- Multi-threaded producer/consumer scenarios
- concurrent pop and peek
- Edge cases: empty queue, FIFO invalid flags, signal interruption etc.
--- Documentation/userspace-api/syscall.rst | 246 ++++++ 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/x86/entry/syscalls/syscall_32.tbl | 2 + arch/x86/entry/syscalls/syscall_64.tbl | 2 + arch/xtensa/kernel/syscalls/syscall.tbl | 2 + include/linux/syscalls.h | 10 + include/uapi/asm-generic/unistd.h | 8 +- ipc/mqueue.c | 184 +++++ ipc/msg.c | 2 +- ipc/msgutil.c | 49 +- ipc/util.h | 3 +- scripts/checksyscalls.sh | 1 + scripts/syscall.tbl | 3 + tools/testing/selftests/ipc/.gitignore | 1 + tools/testing/selftests/ipc/Makefile | 5 +- tools/testing/selftests/ipc/mq_peek.c | 794 ++++++++++++++++++++ 27 files changed, 1304 insertions(+), 33 deletions(-) create mode 100644 Documentation/userspace-api/syscall.rst create mode 100644 tools/testing/selftests/ipc/mq_peek.c
Documentation/userspace-api/syscall.rst new file +246 -0
@@ -0,0 +1,246 @@ +mq_timedreceive2 system call +============================= + +This document describes the mq_timedreceive2() system call. It provides +an overview of the feature, its motivation, interface specification, +design, and test specification. + +Contents +-------- + 1) Overview + 2) Motivation + 3) Functional Specification + 4) Design + 5) Implementation Notes + 6) Test Specification + +1) Overview +----------- + +POSIX message queues on Linux provide mq_receive() and mq_timedreceive() +for consuming messages from a queue. Both interfaces require the caller +to pass the message buffer, length, and priority pointer as individual +arguments to the system call. This imposes a fixed calling convention +that cannot be extended without breaking the ABI. + +mq_timedreceive2() introduces a new system call entry point that accepts +message buffer parameters via a struct argument rather than as individual +syscall arguments. This frees the remaining syscall argument slots for +new functionality flags and a message index, enabling non-destructive +peek and indexed access semantics that are not possible with the +original interface. + +Two variants are provided: + + mq_timedreceive2() - primary variant, 64-bit + mq_timedreceive2_time32() - 32-bit time variant for legacy and compat + +2) Motivation +------------- + +The original mq_timedreceive() interface exhausts all usable syscall +argument slots with mqdes, msg_ptr, msg_len, msg_prio, and abs_timeout. +Adding new behavior such as peek-without-consume or indexed message +access would require either a new syscall with a completely different +signature, or overloading existing arguments in ways that harm clarity +and correctness. + +By consolidating the message buffer parameters into a struct, this +syscall recovers argument slots for: + + flags - controls peek vs consume and other future behavior + index - selects a specific message position in the priority queue + +This design follows the precedent of other Linux syscalls that use +struct arguments to allow forward-compatible extensibility, such as +clone3() and openat2(). + +2.1 Non-destructive peek +~~~~~~~~~~~~~~~~~~~~~~~~ + +When the appropriate flag is set, mq_timedreceive2() copies the +message into the caller's buffer without removing it from the queue. +The queue state and priority ordering are fully preserved. This allows +applications to inspect a message before deciding whether to consume +it, eliminating the need to re-queue messages and the race conditions +that re-queuing introduces in multi-consumer scenarios. + +2.2 Indexed access +~~~~~~~~~~~~~~~~~~ + +The index argument allows the caller to address a specific position +within the priority-ordered queue rather than always receiving the +highest priority message. This is useful for queue inspection, +debugging, and monitoring tools that need visibility into queue +contents without disturbing normal consumers. + +3) Functional Specification +--------------------------- + +NAME + mq_timedreceive2 - receive or peek at a message from a + POSIX message queue + +SYNOPSIS + #include <mqueue.c> + + struct mq_timedreceive2_args { + size_t msg_len; + unsigned int *msg_prio; + char *msg_ptr; + }; + + ssize_t mq_timedreceive2(mqd_t mqdes, + struct mq_timedreceive2_args *uargs, + unsigned int flags, + unsigned long index, + const struct timespec *abs_timeout); + + Note: As of now,no glibc wrapper exists for this syscall. Callers must + invoke it directly using syscall(). + +DESCRIPTION + mq_timedreceive2() receives or peeks at a message from the + message queue referred to by the descriptor mqdes. + + The uargs structure provides the message buffer parameters: + + msg_ptr userspace buffer to receive the message body + msg_len size of msg_ptr in bytes, must be >= mq_msgsize + of the queue + msg_prio if not NULL, the priority of the received message + is stored here + + The flags argument controls receive behavior. The following + flags are defined: + + MQ_PEEK + Copy the message into msg_ptr without removing it + from the queue. The queue is not modified. If this + flag is not set, behavior is identical to + mq_timedreceive() and the message is consumed. + + The index argument selects which message to operate on within + the priority-ordered queue. index 0 refers to the highest + priority message. When MQ_PEEK is not set, index will be ignored but must be 0. + + The abs_timeout argument specifies an absolute timeout. If + MQ_PEEK is set,this take control to peek path and so timeout + will be ignored otherwise it will behave as mq_timedreceive(). + + +RETURN VALUE + On success, returns the number of bytes copied into msg_ptr. + On failure, returns -1 and sets errno. + +ERRORS + EAGAIN Queue is empty and Operation Peek (O_NONBLOCK + equivalent behavior). + + EBADF mqdes is not a valid message queue descriptor open + for reading. + + EFAULT uargs, msg_ptr, msg_prio, or abs_timeout points to + an invalid address. + EINVAL Error to copy msg to temp buffer in kernel space + + EMSGSIZE msg_len is less than the mq_msgsize attribute of + the queue. + +4) Design +--------- + +4.1 Struct-based argument passing +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The message buffer parameters (msg_ptr, msg_len, msg_prio) are +consolidated into struct mq_timedreceive2_args rather than passed +as individual syscall arguments. Linux syscalls are limited to six +arguments. The original mq_timedreceive() consumes all six slots, +leaving no room for extension. Consolidating the buffer parameters +into a struct recovers two argument slots for flags and index while +keeping the interface clean and forward-compatible. + +Future extensions can be made by adding new flag bits without +requiring a new syscall number, following the same extensibility +model as openat2() and clone3(). + +4.2 Compat handling +~~~~~~~~~~~~~~~~~~~~ + +32-bit userspace on 64-bit kernels requires a separate compat +variant because pointer sizes and alignment differ between ABIs. +mq_timedreceive2_time32() accepts struct compat_mq_timedreceive2_args +which uses compat_uptr_t and compat_size_t in place of native pointer +and size_t types, and struct old_timespec32 for the timeout. + + struct compat_mq_timedreceive2_args { + compat_size_t msg_len; + compat_uptr_t msg_prio; + compat_uptr_t msg_ptr; + }; + +The compat entry point performs the necessary conversions before +calling the shared do_mq_timedreceive2() implementation. + +4.3 Peek implementation +~~~~~~~~~~~~~~~~~~~~~~~~ + +When MQ_PEEK is set, the implementation locates the target +message in the priority tree but does not remove it. Two locks are +taken: the first confirms a message exists before any allocation is +attempted, avoiding atomic allocation on empty queues. The second +protects the kernel temporary buffer copy operation. + +4.4 Index argument +~~~~~~~~~~~~~~~~~~~ + +The priority tree is walked to the node at position index within +the priority ordering. index 0 is always the highest priority +message. + +5) Implementation Notes +----------------------- + +The implementation lives in ipc/mqueue.c. The two syscall entry +points mq_timedreceive2 and mq_timedreceive2_time32 are thin wrappers +that validate and convert arguments before calling the shared internal +function do_mq_timedreceive2(). This mirrors the existing pattern used +by mq_timedreceive and mq_timedreceive_time32. + +Syscall numbers are assigned for all supported architectures. Refer +to the respective syscall table files under arch/ for per-architecture +numbers. + +6) Test Specification +--------------------- + +Tests for mq_timedreceive2() should cover the following: + + 1) Basic receive: verify that without MQ_PEEK the message is + consumed and queue depth decreases by one. Verify message body + and priority are correct. + + 2) Peek semantics: verify that with MQ_PEEK the message body + and priority are returned correctly and the queue depth is + unchanged after the call. + + 3) Repeated peek: verify that calling mq_timedreceive2() with + MQ_PEEK multiple times on the same queue returns the same + message each time without modifying the queue. + + 4) Index argument: verify that index 0 returns the highest priority + message. Verify that out-of-range index returns ENOENT. + + 5) Empty queue : verify that on an peek with empty queue return EAGAIN + + 6) Memory behavior:Verify tiny and big message copy works as expected. + + 7) Invalid arguments: verify EBADF for invalid mqdes, EFAULT for + bad pointers in uargs, EINVAL for unknown flags, EMSGSIZE for + msg_len smaller than queue mq_msgsize. + + 9) Concurrent access: verify that simultaneous peek from multiple + threads returns consistent results and does not corrupt queue + state. Verify that a concurrent mq_receive() and peek() do + not race or oops.
arch/alpha/kernel/syscalls/syscall.tbl +1 -0
@@ -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
arch/arm/tools/syscall.tbl +2 -0
@@ -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
arch/arm64/tools/syscall_32.tbl +2 -0
@@ -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
arch/m68k/kernel/syscalls/syscall.tbl +3 -0
@@ -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 +
arch/microblaze/kernel/syscalls/syscall.tbl +3 -0
@@ -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 +
arch/mips/kernel/syscalls/syscall_n32.tbl +2 -0
@@ -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
arch/mips/kernel/syscalls/syscall_n64.tbl +1 -0
@@ -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
arch/mips/kernel/syscalls/syscall_o32.tbl +2 -0
@@ -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
arch/powerpc/kernel/syscalls/syscall.tbl +3 -0
@@ -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
arch/s390/kernel/syscalls/syscall.tbl +1 -0
@@ -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
arch/sh/kernel/syscalls/syscall.tbl +2 -0
@@ -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
arch/sparc/kernel/syscalls/syscall.tbl +3 -0
@@ -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
arch/x86/entry/syscalls/syscall_32.tbl +2 -0
@@ -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
arch/x86/entry/syscalls/syscall_64.tbl +2 -0
@@ -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
arch/xtensa/kernel/syscalls/syscall.tbl +2 -0
@@ -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
include/linux/syscalls.h +10 -0
@@ -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 /*
@@ -746,6 +747,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);
include/uapi/asm-generic/unistd.h +6 -2
@@ -863,9 +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 472 +__SC_3264(__NR_mq_timedreceive2, sys_mq_timedreceive2_time32, sys_mq_timedreceive2) +#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
ipc/mqueue.c +184 -0
232 lines not on this page · raw message
ipc/msg.c +1 -1
@@ -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; }
ipc/msgutil.c +21 -28
67 lines not on this page · raw message
ipc/util.h +2 -1
@@ -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) {
scripts/checksyscalls.sh +1 -0
@@ -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
scripts/syscall.tbl +3 -0
@@ -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
tools/testing/selftests/ipc/.gitignore +1 -0
@@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only msgque_test msgque +mq_peek
tools/testing/selftests/ipc/Makefile +4 -1
@@ -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
tools/testing/selftests/ipc/mq_peek.c new file +794 -0
794 lines not on this page · raw message
Signature · 1 line
2.43.0
kernel test robot
build botkernel test robot noticed the following build warnings:
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 brauner-vfs/vfs.all linus/master v7.0-rc2 next-20260304] [cannot apply to 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-fix-minor-issue-prep/20260305-145412 base: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next patch link: https://lore.kernel.org/r/20260305065212.83213-1-academic1mathura%40gmail.com patch subject: [PATCH] mqueue: introduce new do_mq_timedreceive2() [ mq_peek syscall] for non-destructive receive and inspection,fix minor issue,prepared doc. compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) docutils: docutils (Docutils 0.21.2, Python 3.13.5, on linux) reproduce: (https://download.01.org/0day-ci/archive/20260305/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
Documentation/userspace-api/landlock:526: ./include/uapi/linux/landlock.h:45: ERROR: Unknown target name: "network flags". [docutils] Documentation/userspace-api/landlock:526: ./include/uapi/linux/landlock.h:50: ERROR: Unknown target name: "scope flags". [docutils] Documentation/userspace-api/landlock:526: ./include/uapi/linux/landlock.h:24: ERROR: Unknown target name: "filesystem flags". [docutils] Documentation/userspace-api/landlock:535: ./include/uapi/linux/landlock.h:166: ERROR: Unknown target name: "filesystem flags". [docutils] Documentation/userspace-api/landlock:535: ./include/uapi/linux/landlock.h:189: ERROR: Unknown target name: "network flags". [docutils]
>> Documentation/userspace-api/syscall.rst:88: WARNING: Inline emphasis start-string without end-string. [docutils] >> Documentation/userspace-api/syscall.rst:88: WARNING: Inline emphasis start-string without end-string. [docutils] >> Documentation/userspace-api/syscall.rst:91: WARNING: Definition list ends without a blank line; unexpected unindent. [docutils] Documentation/userspace-api/syscall.rst:94: WARNING: Inline emphasis start-string without end-string. [docutils] Documentation/userspace-api/syscall.rst:94: WARNING: Inline emphasis start-string without end-string. [docutils] Documentation/userspace-api/syscall.rst:110: ERROR: Unexpected indentation. [docutils] >> Documentation/userspace-api/syscall.rst:111: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] Documentation/userspace-api/syscall.rst:145: WARNING: Definition list ends without a blank line; unexpected unindent. [docutils] Documentation/userspace-api/syscall.rst:181: WARNING: Definition list ends without a blank line; unexpected unindent. [docutils] >> Documentation/userspace-api/syscall.rst: WARNING: document isn't included in any toctree [toc.not_included]
Documentation/networking/skbuff:36: ./include/linux/skbuff.h:181: WARNING: Failed to create a cross reference. A title or caption not found: 'crc' [ref.ref]
vim +88 Documentation/userspace-api/syscall.rst
79
80 NAME
81 mq_timedreceive2 - receive or peek at a message from a
82 POSIX message queue
83
84 SYNOPSIS
85 #include <mqueue.c>
86
87 struct mq_timedreceive2_args {
> 88 size_t msg_len;
89 unsigned int *msg_prio;
90 char *msg_ptr;
> 91 };
92
93 ssize_t mq_timedreceive2(mqd_t mqdes,
94 struct mq_timedreceive2_args *uargs,
95 unsigned int flags,
96 unsigned long index,
97 const struct timespec *abs_timeout);
98
99 Note: As of now,no glibc wrapper exists for this syscall. Callers must
100 invoke it directly using syscall().
101
102 DESCRIPTION
103 mq_timedreceive2() receives or peeks at a message from the
104 message queue referred to by the descriptor mqdes.
105
106 The uargs structure provides the message buffer parameters:
107
108 msg_ptr userspace buffer to receive the message body
109 msg_len size of msg_ptr in bytes, must be >= mq_msgsize
110 of the queue
> 111 msg_prio if not NULL, the priority of the received message
112 is stored here
113
114 The flags argument controls receive behavior. The following
115 flags are defined:
116
117 MQ_PEEK
118 Copy the message into msg_ptr without removing it
119 from the queue. The queue is not modified. If this
120 flag is not set, behavior is identical to
121 mq_timedreceive() and the message is consumed.
122
123 The index argument selects which message to operate on within
124 the priority-ordered queue. index 0 refers to the highest
125 priority message. When MQ_PEEK is not set, index will be ignored but must be 0.
126
127 The abs_timeout argument specifies an absolute timeout. If
128 MQ_PEEK is set,this take control to peek path and so timeout
129 will be ignored otherwise it will behave as mq_timedreceive(). 130
131
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build errors:
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 brauner-vfs/vfs.all next-20260304] [cannot apply to 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-fix-minor-issue-prep/20260305-145412 base: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next patch link: https://lore.kernel.org/r/20260305065212.83213-1-academic1mathura%40gmail.com patch subject: [PATCH] mqueue: introduce new do_mq_timedreceive2() [ mq_peek syscall] for non-destructive receive and inspection,fix minor issue,prepared doc. config: x86_64-rhel-9.4-ltp (https://download.01.org/0day-ci/archive/20260305/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260305/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from <command-line>:
ipc/mqueue.c:1749:24: warning: 'struct compat_mq_timedreceive2_args' declared inside parameter list will not be visible outside of this definition or declaration
1749 | struct compat_mq_timedreceive2_args __user *, uargs,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:617:63: note: in definition of macro '__same_type'
617 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
| ^
include/linux/syscalls.h:131:26: note: in expansion of macro '__TYPE_AS'
131 | #define __TYPE_IS_LL(t) (__TYPE_AS(t, 0LL) || __TYPE_AS(t, 0ULL))
| ^~~~~~~~~
include/linux/syscalls.h:132:56: note: in expansion of macro '__TYPE_IS_LL'
132 | #define __SC_LONG(t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a
| ^~~~~~~~~~~~
include/linux/syscalls.h:122:27: note: in expansion of macro '__SC_LONG'
122 | #define __MAP4(m,t,a,...) m(t,a), __MAP3(m,__VA_ARGS__)
| ^
include/linux/syscalls.h:123:35: note: in expansion of macro '__MAP4'
123 | #define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__)
| ^~~~~~
include/linux/syscalls.h:125:22: note: in expansion of macro '__MAP5'
125 | #define __MAP(n,...) __MAP##n(__VA_ARGS__)
| ^~~~~
arch/x86/include/asm/syscall_wrapper.h:224:36: note: in expansion of macro '__MAP'
224 | static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
| ^~~~~
include/linux/syscalls.h:237:9: note: in expansion of macro '__SYSCALL_DEFINEx'
237 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/syscalls.h:230:36: note: in expansion of macro 'SYSCALL_DEFINEx'
230 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
ipc/mqueue.c:1748:1: note: in expansion of macro 'SYSCALL_DEFINE5'
1748 | SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
| ^~~~~~~~~~~~~~~
In file included from ipc/mqueue.c:29:
ipc/mqueue.c:1749:24: warning: 'struct compat_mq_timedreceive2_args' declared inside parameter list will not be visible outside of this definition or declaration
1749 | struct compat_mq_timedreceive2_args __user *, uargs,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/syscalls.h:127:25: note: in definition of macro '__SC_DECL'
127 | #define __SC_DECL(t, a) t a
| ^
include/linux/syscalls.h:123:35: note: in expansion of macro '__MAP4'
123 | #define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__)
| ^~~~~~
include/linux/syscalls.h:125:22: note: in expansion of macro '__MAP5'
125 | #define __MAP(n,...) __MAP##n(__VA_ARGS__)
| ^~~~~
arch/x86/include/asm/syscall_wrapper.h:225:43: note: in expansion of macro '__MAP'
225 | static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
| ^~~~~
include/linux/syscalls.h:237:9: note: in expansion of macro '__SYSCALL_DEFINEx'
237 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/syscalls.h:230:36: note: in expansion of macro 'SYSCALL_DEFINEx'
230 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
ipc/mqueue.c:1748:1: note: in expansion of macro 'SYSCALL_DEFINE5'
1748 | SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
| ^~~~~~~~~~~~~~~
ipc/mqueue.c:1749:24: warning: 'struct compat_mq_timedreceive2_args' declared inside parameter list will not be visible outside of this definition or declaration
1749 | struct compat_mq_timedreceive2_args __user *, uargs,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:617:63: note: in definition of macro '__same_type'
617 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
| ^
include/linux/syscalls.h:131:26: note: in expansion of macro '__TYPE_AS'
131 | #define __TYPE_IS_LL(t) (__TYPE_AS(t, 0LL) || __TYPE_AS(t, 0ULL))
| ^~~~~~~~~
include/linux/syscalls.h:132:56: note: in expansion of macro '__TYPE_IS_LL'
132 | #define __SC_LONG(t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a
| ^~~~~~~~~~~~
include/linux/syscalls.h:122:27: note: in expansion of macro '__SC_LONG'
122 | #define __MAP4(m,t,a,...) m(t,a), __MAP3(m,__VA_ARGS__)
| ^
include/linux/syscalls.h:123:35: note: in expansion of macro '__MAP4'
123 | #define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__)
| ^~~~~~
include/linux/syscalls.h:125:22: note: in expansion of macro '__MAP5'
125 | #define __MAP(n,...) __MAP##n(__VA_ARGS__)
| ^~~~~
arch/x86/include/asm/syscall_wrapper.h:228:36: note: in expansion of macro '__MAP'
228 | static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
| ^~~~~
include/linux/syscalls.h:237:9: note: in expansion of macro '__SYSCALL_DEFINEx'
237 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/syscalls.h:230:36: note: in expansion of macro 'SYSCALL_DEFINEx'
230 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
ipc/mqueue.c:1748:1: note: in expansion of macro 'SYSCALL_DEFINE5'
1748 | SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
| ^~~~~~~~~~~~~~~
ipc/mqueue.c: In function '__se_sys_mq_timedreceive2_time32':
>> include/linux/syscalls.h:133:25: error: passing argument 2 of '__do_sys_mq_timedreceive2_time32' from incompatible pointer type [-Wincompatible-pointer-types]
133 | #define __SC_CAST(t, a) (__force t) a
include/linux/syscalls.h:122:27: note: in expansion of macro '__SC_CAST'
122 | #define __MAP4(m,t,a,...) m(t,a), __MAP3(m,__VA_ARGS__)
| ^
include/linux/syscalls.h:123:35: note: in expansion of macro '__MAP4'
123 | #define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__)
| ^~~~~~
include/linux/syscalls.h:125:22: note: in expansion of macro '__MAP5'
125 | #define __MAP(n,...) __MAP##n(__VA_ARGS__)
| ^~~~~
arch/x86/include/asm/syscall_wrapper.h:230:43: note: in expansion of macro '__MAP'
230 | long ret = __do_sys##name(__MAP(x,__SC_CAST,__VA_ARGS__));\
| ^~~~~
include/linux/syscalls.h:237:9: note: in expansion of macro '__SYSCALL_DEFINEx'
237 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/syscalls.h:230:36: note: in expansion of macro 'SYSCALL_DEFINEx'
230 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
ipc/mqueue.c:1748:1: note: in expansion of macro 'SYSCALL_DEFINE5'
1748 | SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
| ^~~~~~~~~~~~~~~
ipc/mqueue.c:1749:63: note: expected 'struct compat_mq_timedreceive2_args *' but argument is of type 'struct compat_mq_timedreceive2_args *'
1749 | struct compat_mq_timedreceive2_args __user *, uargs,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
include/linux/syscalls.h:127:27: note: in definition of macro '__SC_DECL'
127 | #define __SC_DECL(t, a) t a
| ^
include/linux/syscalls.h:123:35: note: in expansion of macro '__MAP4'
123 | #define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__)
| ^~~~~~
include/linux/syscalls.h:125:22: note: in expansion of macro '__MAP5'
125 | #define __MAP(n,...) __MAP##n(__VA_ARGS__)
| ^~~~~
arch/x86/include/asm/syscall_wrapper.h:225:43: note: in expansion of macro '__MAP'
225 | static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
| ^~~~~
include/linux/syscalls.h:237:9: note: in expansion of macro '__SYSCALL_DEFINEx'
237 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/syscalls.h:230:36: note: in expansion of macro 'SYSCALL_DEFINEx'
230 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
ipc/mqueue.c:1748:1: note: in expansion of macro 'SYSCALL_DEFINE5'
1748 | SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
| ^~~~~~~~~~~~~~~
ipc/mqueue.c: At top level:
ipc/mqueue.c:1749:24: warning: 'struct compat_mq_timedreceive2_args' declared inside parameter list will not be visible outside of this definition or declaration
1749 | struct compat_mq_timedreceive2_args __user *, uargs,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/syscalls.h:127:25: note: in definition of macro '__SC_DECL'
127 | #define __SC_DECL(t, a) t a
| ^
include/linux/syscalls.h:123:35: note: in expansion of macro '__MAP4'
123 | #define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__)
| ^~~~~~
include/linux/syscalls.h:125:22: note: in expansion of macro '__MAP5'
125 | #define __MAP(n,...) __MAP##n(__VA_ARGS__)
| ^~~~~
arch/x86/include/asm/syscall_wrapper.h:235:43: note: in expansion of macro '__MAP'
235 | static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
| ^~~~~
include/linux/syscalls.h:237:9: note: in expansion of macro '__SYSCALL_DEFINEx'
237 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/syscalls.h:230:36: note: in expansion of macro 'SYSCALL_DEFINEx'
230 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
ipc/mqueue.c:1748:1: note: in expansion of macro 'SYSCALL_DEFINE5'
1748 | SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
| ^~~~~~~~~~~~~~~
In file included from include/linux/compat.h:34,
from include/net/compat.h:8,
from include/net/scm.h:13,
from include/linux/netlink.h:9,
from ipc/mqueue.c:28:
>> arch/x86/include/asm/syscall_wrapper.h:235: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 *)'}
235 | static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
| ^~~~~~~~
include/linux/syscalls.h:237:9: note: in expansion of macro '__SYSCALL_DEFINEx'
237 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/syscalls.h:230:36: note: in expansion of macro 'SYSCALL_DEFINEx'
230 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
ipc/mqueue.c:1748:1: note: in expansion of macro 'SYSCALL_DEFINE5'
1748 | SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
| ^~~~~~~~~~~~~~~
arch/x86/include/asm/syscall_wrapper.h:225: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 *)'}
225 | static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
| ^~~~~~~~
include/linux/syscalls.h:237:9: note: in expansion of macro '__SYSCALL_DEFINEx'
237 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/syscalls.h:230:36: note: in expansion of macro 'SYSCALL_DEFINEx'
230 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
ipc/mqueue.c:1748:1: note: in expansion of macro 'SYSCALL_DEFINE5'
1748 | SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
| ^~~~~~~~~~~~~~~
ipc/mqueue.c: In function '__do_sys_mq_timedreceive2_time32':
>> ipc/mqueue.c:1757:13: error: implicit declaration of function 'get_compat_mq_args'; did you mean 'get_compat_msghdr'? [-Wimplicit-function-declaration]
1757 | if (get_compat_mq_args(pargs, uargs))
| ^~~~~~~~~~~~~~~~~~
| get_compat_msghdr
ipc/mqueue.c: At top level:
arch/x86/include/asm/syscall_wrapper.h:225:28: warning: '__do_sys_mq_timedreceive2_time32' used but never defined
225 | static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
| ^~~~~~~~
include/linux/syscalls.h:237:9: note: in expansion of macro '__SYSCALL_DEFINEx'
237 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
include/linux/syscalls.h:230:36: note: in expansion of macro 'SYSCALL_DEFINEx'
230 | #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
| ^~~~~~~~~~~~~~~
ipc/mqueue.c:1748:1: note: in expansion of macro 'SYSCALL_DEFINE5'
1748 | SYSCALL_DEFINE5(mq_timedreceive2_time32, mqd_t, mqdes,
| ^~~~~~~~~~~~~~~vim +/__do_sys_mq_timedreceive2_time32 +133 include/linux/syscalls.h
07fe6e00f6cca6 Al Viro 2013-01-21 126 07fe6e00f6cca6 Al Viro 2013-01-21 127 #define __SC_DECL(t, a) t a 4f59c718521a0f Al Viro 2017-07-08 128 #define __TYPE_AS(t, v) __same_type((__force t)0, v) 4f59c718521a0f Al Viro 2017-07-08 129 #define __TYPE_IS_L(t) (__TYPE_AS(t, 0L)) 4f59c718521a0f Al Viro 2017-07-08 130 #define __TYPE_IS_UL(t) (__TYPE_AS(t, 0UL)) 4f59c718521a0f Al Viro 2017-07-08 131 #define __TYPE_IS_LL(t) (__TYPE_AS(t, 0LL) || __TYPE_AS(t, 0ULL)) 4a0fd5bf0fd079 Al Viro 2013-01-21 132 #define __SC_LONG(t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a 4f59c718521a0f Al Viro 2017-07-08 @133 #define __SC_CAST(t, a) (__force t) a 56062d60f117dc Richard Palethorpe 2024-01-10 134 #define __SC_TYPE(t, a) t 2cf0966683430b Al Viro 2013-01-21 135 #define __SC_ARGS(t, a) a 4a0fd5bf0fd079 Al Viro 2013-01-21 136 #define __SC_TEST(t, a) (void)BUILD_BUG_ON_ZERO(!__TYPE_IS_LL(t) && sizeof(t) > sizeof(long)) 1a94bc34768e46 Heiko Carstens 2009-01-14 137
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki