Subject: CVE-2022-48939: bpf: Add schedule points in batch ops

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

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

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

bpf: Add schedule points in batch ops

syzbot reported various soft lockups caused by bpf batch operations.

 INFO: task kworker/1:1:27 blocked for more than 140 seconds.
 INFO: task hung in rcu_barrier

Nothing prevents batch ops to process huge amount of data,
we need to add schedule points in them.

Note that maybe_wait_bpf_programs(map) calls from
generic_map_delete_batch() can be factorized by moving
the call after the loop.

This will be done later in -next tree once we get this fix merged,
unless there is strong opinion doing this optimization sooner.

The Linux kernel CVE team has assigned CVE-2022-48939 to this issue.

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

	Issue introduced in 5.6 with commit aa2e93b8e58e and fixed in 5.10.103 with commit 7ef94bfb08fb
	Issue introduced in 5.6 with commit aa2e93b8e58e and fixed in 5.15.26 with commit 8628f489b749
	Issue introduced in 5.6 with commit aa2e93b8e58e and fixed in 5.16.12 with commit 7e8099967d0e
	Issue introduced in 5.6 with commit aa2e93b8e58e and fixed in 5.17 with commit 75134f16e7dd

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-2022-48939
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:
	kernel/bpf/syscall.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/7ef94bfb08fb9e73defafbd5ddef6b5a0e2ee12b
	https://git.kernel.org/stable/c/8628f489b749a4f9767991631921dbe3fbcdc784
	https://git.kernel.org/stable/c/7e8099967d0e3ff9d1ae043e80b27fbe46c08417
	https://git.kernel.org/stable/c/75134f16e7dd0007aa474b281935c5f42e79f2c8