Subject: CVE-2024-46684: binfmt_elf_fdpic: fix AUXV size calculation when ELF_HWCAP2 is defined

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

binfmt_elf_fdpic: fix AUXV size calculation when ELF_HWCAP2 is defined

create_elf_fdpic_tables() does not correctly account the space for the
AUX vector when an architecture has ELF_HWCAP2 defined. Prior to the
commit 10e29251be0e ("binfmt_elf_fdpic: fix /proc/<pid>/auxv") it
resulted in the last entry of the AUX vector being set to zero, but with
that change it results in a kernel BUG.

Fix that by adding one to the number of AUXV entries (nitems) when
ELF_HWCAP2 is defined.

The Linux kernel CVE team has assigned CVE-2024-46684 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.10 with commit 10e29251be0e and fixed in 6.10.8 with commit c507da85e4f8
	Issue introduced in 6.10 with commit 10e29251be0e and fixed in 6.11 with commit c6a09e342f8e

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-46684
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	fs/binfmt_elf_fdpic.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/c507da85e4f80c630deb9e98222ccf4118cbe6f8
	https://git.kernel.org/stable/c/c6a09e342f8e6d3cac7f7c5c14085236aca284b9