Re: [PATCH] [PATCH V5] mqueue: introduce new do_mq_timedreceive2() [ mq_peek syscall] for non-destructive receive and inspection,fix minor issue,prepared doc.
From: Arnd Bergmann
Date: Fri Mar 06 2026 - 05:32:00 EST
On Fri, Mar 6, 2026, at 10:38, Geert Uytterhoeven wrote:
> CC Arnd
Thanks!
> On Fri, 6 Mar 2026 at 08:50, Mathura_Kumar <academic1mathura@xxxxxxxxx> wrote:
>
>> +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 time (Y2038-safe)
>> + mq_timedreceive2_time32() - 32-bit time variant for legacy and compat
>
> What is the rationale behind adding a new syscall that is not Y2038-safe?
Indeed, that would need a very strong reason. New userspace already has to
support old kernels without the syscalls, and it would seem easy enough
to just not support it on time32 libc implementations.
>> 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
>
> PowerPC receives three variants?
> Oh, the first two are for 32-bit vs. 64-bit, so they should use the
> same syscall number.
Probably just a typo there (same on sparc), I assume the intention was
to use the same number as the generic scripts/syscall.tbl version.
> Furthermore, this breaks the "new syscalls use the same number on
> most architectures"-rule. Next free slot is now 472, 473, or 474,
> depending on architecture.
Right. I also noticed a few more mistakes with the numbers:
- parisc is missing the syscall entirely
- arm32 compat mode has the numbers reversed compared to native mode
- x86 only gets a version in the 'x32' range, but is missing the
native x86-64 version.
- The testcase hardcodes the x32 syscall number for all architectures
other than a couple of hardcoded ones
Also, I would point out few more general issues:
- compat handling is is busted for the normal syscalls, and only
seems to work by accident on the time32 one.
- the time32 syscall passes a kernel structure through a __user
pointer
- this is the first patch (or public email) ever sent by the "author"
- the changelog text and subject line make no sense whatsoever
- four submissions of the series in three days, with the latest
one labeled 'V5'.
I don't normally dismiss new submissions easily, but I think it's
safe to ignore this one.
Arnd