Files
android_kernel_xiaomi_sm8450/include/linux
Yonghong Song 31fd85816d bpf: permits narrower load from bpf program context fields
Currently, verifier will reject a program if it contains an
narrower load from the bpf context structure. For example,
        __u8 h = __sk_buff->hash, or
        __u16 p = __sk_buff->protocol
        __u32 sample_period = bpf_perf_event_data->sample_period
which are narrower loads of 4-byte or 8-byte field.

This patch solves the issue by:
  . Introduce a new parameter ctx_field_size to carry the
    field size of narrower load from prog type
    specific *__is_valid_access validator back to verifier.
  . The non-zero ctx_field_size for a memory access indicates
    (1). underlying prog type specific convert_ctx_accesses
         supporting non-whole-field access
    (2). the current insn is a narrower or whole field access.
  . In verifier, for such loads where load memory size is
    less than ctx_field_size, verifier transforms it
    to a full field load followed by proper masking.
  . Currently, __sk_buff and bpf_perf_event_data->sample_period
    are supporting narrowing loads.
  . Narrower stores are still not allowed as typical ctx stores
    are just normal stores.

Because of this change, some tests in verifier will fail and
these tests are removed. As a bonus, rename some out of bound
__sk_buff->cb access to proper field name and remove two
redundant "skb cb oob" tests.

Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-14 14:56:25 -04:00
..
2017-04-21 10:45:01 -04:00
2017-06-09 15:49:02 -04:00
2016-12-22 22:58:37 -05:00
2017-04-28 18:09:59 -04:00
2017-05-01 14:09:21 -07:00
2017-02-10 15:52:24 -05:00
2017-01-25 13:17:47 -05:00
2017-04-26 23:54:06 -04:00
2017-03-30 09:37:20 +02:00
2017-05-24 12:43:30 -04:00
2017-04-18 20:41:12 +02:00
2016-12-05 19:01:16 -05:00
2017-04-10 17:15:02 +02:00
2017-04-27 05:13:04 -04:00
2016-12-05 19:01:16 -05:00
2017-06-06 15:41:24 -04:00
2017-05-12 15:57:15 -07:00
2016-12-25 17:21:22 +01:00
2017-03-21 10:15:47 +02:00
2017-04-05 18:11:48 +02:00
2017-05-18 10:07:41 -04:00
2017-05-18 10:07:40 -04:00
2017-05-08 17:15:12 -07:00
2017-01-05 15:01:55 -06:00
2017-04-04 14:10:12 -07:00
2017-05-03 15:52:10 -07:00
2016-12-12 18:55:06 -08:00
2016-12-25 17:21:23 +01:00
2017-02-24 17:46:57 -08:00
2016-12-06 11:05:46 +01:00
2017-04-24 14:30:46 -04:00
2017-01-12 16:48:26 -05:00
2017-04-26 13:03:04 -04:00
2016-12-06 10:17:03 +02:00
2017-03-07 14:01:02 -08:00
2017-05-18 10:07:40 -04:00
2017-04-19 14:21:23 +02:00
2017-02-13 21:44:09 -05:00
2017-03-28 08:54:48 +02:00
2017-05-03 15:52:10 -07:00
2017-05-08 17:15:12 -07:00
2017-03-26 15:09:45 +02:00
2017-01-09 16:07:38 -05:00
2016-12-26 23:53:46 -05:00
2017-06-01 14:53:04 -04:00
2017-03-09 15:42:33 +01:00
2017-01-10 18:31:55 -08:00
2017-02-10 16:34:17 +00:00
2017-05-09 16:43:22 +03:00