Re: [PATCH 1/6] ipc: Move mqueue fs magic to uapi magic header

Günther Noack <[email protected]> Wed, 22 Jul 2026 14:43:32 +0200
Newsgroups dev.linux.lists.landlock,org.kernel.vger.linux-kernel,org.kernel.vger.linux-security-module
Message-ID <[email protected]>
Hello!

On Wed, Jul 22, 2026 at 01:29:37PM +0100, Oxana Kharitonova wrote:
> Move MQUEUE_MAGIC from ipc/mqueue.c to include/uapi/linux/magic.h so
> it can be shared by code outside of ipc/mqueue.c without duplicating
> the constant.
> 
> Signed-off-by: Oxana Kharitonova <[email protected]>
> ---
>  include/uapi/linux/magic.h | 2 ++
>  ipc/mqueue.c               | 2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h
> index 4f2da935a76c..8e5d33bb1453 100644
> --- a/include/uapi/linux/magic.h
> +++ b/include/uapi/linux/magic.h
> @@ -78,6 +78,8 @@
>  
>  #define V9FS_MAGIC		0x01021997
>  
> +#define MQUEUE_MAGIC		0x19800202
> +
>  #define BDEVFS_MAGIC            0x62646576
>  #define DAXFS_MAGIC             0x64646178
>  #define BINFMTFS_MAGIC          0x42494e4d
> diff --git a/ipc/mqueue.c b/ipc/mqueue.c
> index 4798b375972b..9515597d45ce 100644
> --- a/ipc/mqueue.c
> +++ b/ipc/mqueue.c
> @@ -22,6 +22,7 @@
>  #include <linux/sysctl.h>
>  #include <linux/poll.h>
>  #include <linux/mqueue.h>
> +#include <linux/magic.h>
>  #include <linux/msg.h>
>  #include <linux/skbuff.h>
>  #include <linux/vmalloc.h>
> @@ -47,7 +48,6 @@ struct mqueue_fs_context {
>  	bool			 newns;	/* Set if newly created ipc namespace */
>  };
>  
> -#define MQUEUE_MAGIC	0x19800202
>  #define DIRENT_SIZE	20
>  #define FILENT_SIZE	80
>  
> -- 
> 2.50.1 (Apple Git-155)
> 

The only reference to MQUEUE_MAGIC that I find in your patchset is from
Landlock's kernel code -- For a value that gets serialized to disk, like
for the other file systems, I think there is actually a legitimate use
case for userspace to use that value, when dealing with raw images?  But
that's not the case here, I think?

Should this live in include/linux/ipc_namespace.h instead?  Or even be
exposed as a helper function that lets you check whether an inode is
referring to an mqueue?

—Günther