Thread (62 messages) read the whole thread 62 messages, 8 authors, 2014-07-05

Re: [PATCH RFC net-next 13/14] samples: bpf: example of stateful socket filtering

From: Andy Lutomirski <luto@amacapital.net>
Date: 2014-06-28 00:21:30
Also in: linux-api, lkml

On Fri, Jun 27, 2014 at 5:06 PM, Alexei Starovoitov [off-list ref] wrote:
this socket filter example does:

- creates a hashtable in kernel with key 4 bytes and value 8 bytes

- populates map[6] = 0; map[17] = 0;  // 6 - tcp_proto, 17 - udp_proto

- loads eBPF program:
  r0 = skb[14 + 9]; // load one byte of ip->proto
  *(u32*)(fp - 4) = r0;
  value = bpf_map_lookup_elem(map_id, fp - 4);
  if (value)
       (*(u64*)value) += 1;
In the code below, this is XADD.  Is there anything that validates
that shared things like this can only be poked at by atomic
operations?

--Andy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help