Files
linux/kernel/bpf
Toke Høiland-Jørgensen 9d6b33d27c bpf: disallow attaching modify_return tracing functions to other BPF programs
[ Upstream commit 1af9270e90 ]

From the checks and commit messages for modify_return, it seems it was
never the intention that it should be possible to attach a tracing program
with expected_attach_type == BPF_MODIFY_RETURN to another BPF program.
However, check_attach_modify_return() will only look at the function name,
so if the target function starts with "security_", the attach will be
allowed even for bpf2bpf attachment.

Fix this oversight by also blocking the modification if a target program is
supplied.

Fixes: 18644cec71 ("bpf: Fix use-after-free in fmod_ret check")
Fixes: 6ba43b761c ("bpf: Attachment verification for BPF_MODIFY_RETURN")
Acked-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-29 10:11:30 +01:00
..
2020-08-07 18:57:24 +02:00
2020-03-13 12:49:52 -07:00
2020-07-25 20:16:32 -07:00
2020-05-15 17:29:41 +02:00