Files
linux-stable-mirror/include/linux
Hao Luo 2a77c58726 bpf: Add MEM_RDONLY for helper args that are pointers to rdonly mem.
commit 216e3cd2f2 upstream.

Some helper functions may modify its arguments, for example,
bpf_d_path, bpf_get_stack etc. Previously, their argument types
were marked as ARG_PTR_TO_MEM, which is compatible with read-only
mem types, such as PTR_TO_RDONLY_BUF. Therefore it's legitimate,
but technically incorrect, to modify a read-only memory by passing
it into one of such helper functions.

This patch tags the bpf_args compatible with immutable memory with
MEM_RDONLY flag. The arguments that don't have this flag will be
only compatible with mutable memory types, preventing the helper
from modifying a read-only memory. The bpf_args that have
MEM_RDONLY are compatible with both mutable memory and immutable
memory.

Signed-off-by: Hao Luo <haoluo@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211217003152.48334-9-haoluo@google.com
Cc: stable@vger.kernel.org # 5.15.x
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-01 17:22:26 +02:00
..
2021-09-20 12:43:34 +01:00
2021-12-14 10:57:11 +01:00
2021-11-25 09:48:41 +01:00
2021-11-25 09:49:08 +01:00
2022-04-13 20:59:03 +02:00
2021-11-18 19:15:51 +01:00
2021-09-17 13:52:17 +01:00
2021-10-07 16:51:57 +02:00
2021-11-21 13:44:12 +01:00
2021-09-15 09:22:35 -06:00
2021-12-14 10:57:15 +01:00