Subject: CVE-2024-42067: bpf: Take return from set_memory_rox() into account with bpf_jit_binary_lock_ro()

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

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

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

bpf: Take return from set_memory_rox() into account with bpf_jit_binary_lock_ro()

set_memory_rox() can fail, leaving memory unprotected.

Check return and bail out when bpf_jit_binary_lock_ro() returns
an error.

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

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

	Fixed in 6.6.37 with commit 08f6c05feb1d
	Fixed in 6.6.38 with commit 9fef36cad60d
	Fixed in 6.9.8 with commit 044da7ae7afd
	Fixed in 6.10 with commit e60adf513275

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-42067
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:
	arch/arm/net/bpf_jit_32.c
	arch/loongarch/net/bpf_jit.c
	arch/mips/net/bpf_jit_comp.c
	arch/parisc/net/bpf_jit_core.c
	arch/s390/net/bpf_jit_comp.c
	arch/sparc/net/bpf_jit_comp_64.c
	arch/x86/net/bpf_jit_comp32.c
	include/linux/filter.h

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/08f6c05feb1db21653e98ca84ea04ca032d014c7
	https://git.kernel.org/stable/c/9fef36cad60d4226f9d06953cd56d1d2f9119730
	https://git.kernel.org/stable/c/044da7ae7afd4ef60806d73654a2e6a79aa4ed7a
	https://git.kernel.org/stable/c/e60adf513275c3a38e5cb67f7fd12387e43a3ff5