Subject: CVE-2022-48714: bpf: Use VM_MAP instead of VM_ALLOC for ringbuf

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

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

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

bpf: Use VM_MAP instead of VM_ALLOC for ringbuf

After commit 2fd3fb0be1d1 ("kasan, vmalloc: unpoison VM_ALLOC pages
after mapping"), non-VM_ALLOC mappings will be marked as accessible
in __get_vm_area_node() when KASAN is enabled. But now the flag for
ringbuf area is VM_ALLOC, so KASAN will complain out-of-bound access
after vmap() returns. Because the ringbuf area is created by mapping
allocated pages, so use VM_MAP instead.

After the change, info in /proc/vmallocinfo also changes from
  [start]-[end]   24576 ringbuf_map_alloc+0x171/0x290 vmalloc user
to
  [start]-[end]   24576 ringbuf_map_alloc+0x171/0x290 vmap user

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

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

	Issue introduced in 5.8 with commit 457f44363a88 and fixed in 5.10.99 with commit 6304a613a97d
	Issue introduced in 5.8 with commit 457f44363a88 and fixed in 5.15.22 with commit 5e457aeab52a
	Issue introduced in 5.8 with commit 457f44363a88 and fixed in 5.16.8 with commit d578933f6226
	Issue introduced in 5.8 with commit 457f44363a88 and fixed in 5.17 with commit b293dcc473d2

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-48714
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/ringbuf.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/6304a613a97d6dcd49b93fbad31e9f39d1e138d6
	https://git.kernel.org/stable/c/5e457aeab52a5947619e1f18047f4d2f3212b3eb
	https://git.kernel.org/stable/c/d578933f6226d5419af9306746efa1c693cbaf9c
	https://git.kernel.org/stable/c/b293dcc473d22a62dc6d78de2b15e4f49515db56