]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pidfs: add missing BUILD_BUG_ON() assert on struct pidfd_info
authorChristian Brauner <brauner@kernel.org>
Tue, 28 Oct 2025 08:45:49 +0000 (09:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:02:44 +0000 (14:02 +0100)
[ Upstream commit d8fc51d8fa3b9894713e7eebcf574bee488fa3e1 ]

Validate that the size of struct pidfd_info is correctly updated.

Link: https://patch.msgid.link/20251028-work-coredump-signal-v1-4-ca449b7b7aa0@kernel.org
Fixes: 1d8db6fd698d ("pidfs, coredump: add PIDFD_INFO_COREDUMP")
Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/pidfs.c

index 0ef5b47d796a267c15fb629817895af574e6954d..f4d7dac1b449492d4dc72ea26f4985c1be997de5 100644 (file)
@@ -306,6 +306,8 @@ static long pidfd_info(struct file *file, unsigned int cmd, unsigned long arg)
        const struct cred *c;
        __u64 mask;
 
+       BUILD_BUG_ON(sizeof(struct pidfd_info) != PIDFD_INFO_SIZE_VER1);
+
        if (!uinfo)
                return -EINVAL;
        if (usize < PIDFD_INFO_SIZE_VER0)