Daniel Borkmann f531fbb06a bpf: reject stores into ctx via st and xadd
[ upstream commit f37a8cb84cce18762e8f86a70bd6a49a66ab964c ]

Alexei found that verifier does not reject stores into context
via BPF_ST instead of BPF_STX. And while looking at it, we
also should not allow XADD variant of BPF_STX.

The context rewriter is only assuming either BPF_LDX_MEM- or
BPF_STX_MEM-type operations, thus reject anything other than
that so that assumptions in the rewriter properly hold. Add
test cases as well for BPF selftests.

Fixes: d691f9e8d440 ("bpf: allow programs to write to certain skb fields")
Reported-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-31 12:55:57 +01:00
..
2017-09-02 07:07:53 +02:00
2016-01-22 18:04:28 -05:00
2016-04-04 09:46:47 -04:00
2016-02-16 13:04:58 -05:00
2017-05-20 14:28:40 +02:00
2017-07-05 14:40:24 +02:00
2017-08-24 17:12:21 -07:00
2016-03-01 20:36:56 +01:00
2016-09-22 20:00:36 -05:00