Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754486AbaF1AVa (ORCPT ); Fri, 27 Jun 2014 20:21:30 -0400 Received: from mail-lb0-f173.google.com ([209.85.217.173]:56547 "EHLO mail-lb0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754330AbaF1AV3 (ORCPT ); Fri, 27 Jun 2014 20:21:29 -0400 MIME-Version: 1.0 In-Reply-To: <1403913966-4927-14-git-send-email-ast@plumgrid.com> References: <1403913966-4927-1-git-send-email-ast@plumgrid.com> <1403913966-4927-14-git-send-email-ast@plumgrid.com> From: Andy Lutomirski Date: Fri, 27 Jun 2014 17:21:07 -0700 Message-ID: Subject: Re: [PATCH RFC net-next 13/14] samples: bpf: example of stateful socket filtering To: Alexei Starovoitov Cc: "David S. Miller" , Ingo Molnar , Linus Torvalds , Steven Rostedt , Daniel Borkmann , Chema Gonzalez , Eric Dumazet , Peter Zijlstra , Arnaldo Carvalho de Melo , Jiri Olsa , Thomas Gleixner , "H. Peter Anvin" , Andrew Morton , Kees Cook , Linux API , Network Development , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 27, 2014 at 5:06 PM, Alexei Starovoitov 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/