From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751544AbaHOS4Q (ORCPT ); Fri, 15 Aug 2014 14:56:16 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:58034 "EHLO mail-wg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751116AbaHOS4O (ORCPT ); Fri, 15 Aug 2014 14:56:14 -0400 MIME-Version: 1.0 In-Reply-To: References: <1407916658-8731-1-git-send-email-ast@plumgrid.com> <1407916658-8731-18-git-send-email-ast@plumgrid.com> Date: Fri, 15 Aug 2014 11:56:12 -0700 Message-ID: Subject: Re: [PATCH RFC v4 net-next 17/26] tracing: allow eBPF programs to be attached to events From: Alexei Starovoitov To: Andy Lutomirski Cc: Daniel Borkmann , "H. Peter Anvin" , Andrew Morton , Linux API , Chema Gonzalez , Eric Dumazet , "David S. Miller" , Brendan Gregg , Linus Torvalds , Steven Rostedt , LKML , Peter Zijlstra , Kees Cook , Network Development , Ingo Molnar 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, Aug 15, 2014 at 11:50 AM, Andy Lutomirski wrote: > On Aug 15, 2014 10:36 AM, "Alexei Starovoitov" wrote: >> >> On Fri, Aug 15, 2014 at 10:20 AM, Andy Lutomirski wrote: >> > The downside of this approach is that compat support might be >> > difficult or impossible. >> >> Would do you mean by compat? 32-bit programs on 64-bit kernels? >> There is no such concept for eBPF. All eBPF programs are always >> operating on 64-bit registers. > > Doesn't the eBPF program need to know sizeof(long) to read these > fields correctly? Or am I misunderstanding what the code does? correct. eBPF program would be using 8-byte read on 64-bit kernel and 4-byte read on 32-bit kernel. Same with access to ptrace fields and pretty much all other fields in the kernel. The program will be different on different kernels. Say, this bpf_context struct doesn't exist at all. The programs would still need to be different to walk in-kernel data structures...