Files
android_kernel_xiaomi_sm8450/include/uapi/linux
Alexei Starovoitov 9bac3d6d54 bpf: allow extended BPF programs access skb fields
introduce user accessible mirror of in-kernel 'struct sk_buff':
struct __sk_buff {
    __u32 len;
    __u32 pkt_type;
    __u32 mark;
    __u32 queue_mapping;
};

bpf programs can do:

int bpf_prog(struct __sk_buff *skb)
{
    __u32 var = skb->pkt_type;

which will be compiled to bpf assembler as:

dst_reg = *(u32 *)(src_reg + 4) // 4 == offsetof(struct __sk_buff, pkt_type)

bpf verifier will check validity of access and will convert it to:

dst_reg = *(u8 *)(src_reg + offsetof(struct sk_buff, __pkt_type_offset))
dst_reg &= 7

since skb->pkt_type is a bitfield.

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-03-15 22:02:28 -04:00
..
2014-10-20 10:30:15 +08:00
2014-09-23 23:15:46 -07:00
2015-02-02 18:09:42 +01:00
2014-10-14 13:08:29 +11:00
2013-04-26 16:08:16 +10:00
2014-07-01 10:48:05 -06:00
2014-03-20 14:55:18 +01:00
2015-03-06 21:50:02 -05:00
2014-11-19 14:48:02 -06:00
2014-12-08 12:55:57 +08:00
2012-10-16 18:49:15 -07:00
2014-08-08 15:57:31 -07:00
2014-05-14 10:04:34 +01:00
2013-12-11 12:57:55 -08:00
2013-08-13 15:10:22 -07:00
2014-12-16 11:19:42 -05:00
2014-12-22 16:12:36 -05:00
2015-01-05 22:44:46 -05:00
2015-02-09 16:59:03 +09:00
2014-12-02 13:52:53 -07:00
2015-02-17 14:34:51 -08:00
2014-08-08 15:57:31 -07:00
2013-11-27 11:03:38 -08:00
2014-03-04 13:51:06 -05:00
2015-01-20 13:51:06 +01:00
2014-12-13 12:42:52 -08:00
2013-02-27 19:10:22 -08:00
2015-02-02 18:46:51 -08:00
2013-04-19 14:57:57 -04:00
2012-11-16 10:15:35 -08:00
2014-03-21 14:21:13 -04:00
2015-01-21 19:21:30 +01:00
2015-02-07 18:43:16 +08:00
2014-12-10 17:41:10 -08:00
2014-12-09 14:10:41 +08:00
2013-03-22 16:19:59 -07:00
2015-03-05 22:08:42 -05:00
2014-04-26 12:13:24 -04:00
2015-02-10 12:38:14 -07:00
2013-05-02 13:40:15 +03:00
2014-12-09 12:06:31 +02:00
2014-12-09 12:05:24 +02:00
2013-12-11 09:25:20 -02:00