Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1548968imc; Mon, 11 Mar 2019 16:59:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxv/yYDlXV+exrP2F1ADR7ESywqTTia21bB341JqwmMzIWPRBPj2hrpYCILnsU/Du63XKM7 X-Received: by 2002:a63:2224:: with SMTP id i36mr32176336pgi.169.1552348761214; Mon, 11 Mar 2019 16:59:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552348761; cv=none; d=google.com; s=arc-20160816; b=wqwFLP195bG7yHcGGyVowxX3zIEonwIkGEybs1daYr8XcN9ZQmePCxIG7YSDVhqvAs RuMk0JgWE4S28foQF67Ku5ifXhV7RQVH4skwDxDqFe72WEDZMN/OYUePCHoxqrSAbXPr BW/nFAbpMzMim/1YMrESlMNuQcrT9BA8fSDpkft3xjjOWQZ1nDCAj3DfFSiQt2BZvPQa QrSvpfttyd3Mb4VtWWxLKANRTtviEEPaplQ25RwhVYXh1opW4FVJwHs025+imGdVGzY2 E7SGF8ifBHtKmHeQMBB4EvDdIZRBU7/skEeZqxygxdOCVI1/k6XZuG3dbwnafsVD5to5 XB1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=N20KT5RcXIKPLrLophveDXK6Y0mLDSNidvB525qrrR4=; b=eaUyFjRQYtE8VmsAPLOh+n8EvGsCEz1zMRDN8vf7JwRB9jjSQ78796XJ33Jfp5FYD1 k1YYzOJjg5o2IWvdvZ2taFznlMs/HqO+q8nhhqo6afUXprfEfXMkWiK1/Z/dkLQ9Fmje f7qqjYEAh0LExv3AvPbKyRqg4hajlssl5ItA9ZHdfNmECgvKzfOBhy3NYRHfpcaoPUC0 77x6xtHhc3+HOiiQfaz6QBhfYNz71qajoeDgJOik2tXRUrHfsc/uCb/GY5EVbb65DbUQ aD4W2BNcD8H0HLVZWkxzhOiteUv2qc9115B2skwT0PMZ1yL3GZhlNUYndj4liD/SJ6XW lASg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Uq5DG41h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i65si6890130pfb.118.2019.03.11.16.59.02; Mon, 11 Mar 2019 16:59:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Uq5DG41h; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726187AbfCKX6n (ORCPT + 99 others); Mon, 11 Mar 2019 19:58:43 -0400 Received: from mail-ua1-f65.google.com ([209.85.222.65]:36597 "EHLO mail-ua1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725850AbfCKX6m (ORCPT ); Mon, 11 Mar 2019 19:58:42 -0400 Received: by mail-ua1-f65.google.com with SMTP id e15so204322uam.3 for ; Mon, 11 Mar 2019 16:58:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=N20KT5RcXIKPLrLophveDXK6Y0mLDSNidvB525qrrR4=; b=Uq5DG41hDYZnL4k0WSqLJZ+5EwzG2Ir9JXnjcdwhafRkUqyfhN2HeeX90hvLnK7xzA q43QEN82NFlw6uwcRCPRQDzVINJhOCRHd0TBwJV6WjA2VWLKMP9BE7FwG4z3nIMHwhTW 6n1aHf8JlxocAOkkfWxkMSWccPOu2qRVcFVcZwNf8wdqzuctk7boRAZokzqZU5diIwV+ L53I7/zvvb7OWkI6PyOIEA0WvGZ0qUSgleYnPXmIlIY/Ew2AYYKmNwbt1ttVXC6THTJh DFBYbxz6pPBhNfCFs7AIyHQkMDieigJZ5xCeZtvZf0/rPCp/8uy8vPJbF1l4P0Hbp26j jw1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=N20KT5RcXIKPLrLophveDXK6Y0mLDSNidvB525qrrR4=; b=hRx1mXj7v0uFLyhxjgAtGIuvgtZRCkcprq8AKN5vHwkpLHYFfcydLJf//LagvFSg8v YlwG82Mr2DraCr/6iX7qrSIXBJUd4aypKY62LJy74SROBHRxFZx/3Y7Y3UWvgxoeqdJQ kxRwEL0s8P/ItWXo0oAgcO6TRx8BdKoY8OEJwiQE/xuImPYz3nKZweHXjZeQy91qWprk VjAXpt0p3cq2Hc2NlMSvBzNNJwZKSOFCT/1LadXl83F852XNF/Cyd8NKcitXhbtdVmfB znXoZie3UjAKk2ofpZV4TVh+n61a0xGpwsXIJdDwctvb1KnUtPQsleqVCir/NE5/TWqq Ta4Q== X-Gm-Message-State: APjAAAWX4M9Si2N5pzfCUnSwx/q0NiEBfu1dvZoQadg8lOaLOwEGgGKz YjFhcWVZsjbRq/GVatzCgnb4oI0JxItVVbZ6oE1kFQ== X-Received: by 2002:ab0:2789:: with SMTP id t9mr18483371uap.100.1552348720797; Mon, 11 Mar 2019 16:58:40 -0700 (PDT) MIME-Version: 1.0 References: <20190301160856.129678-1-joel@joelfernandes.org> <20190307150343.GB258852@google.com> <20190308140251.GC25768@kroah.com> <20190309071648.GE3882@kroah.com> <20190309121141.GA30173@kroah.com> <3e84e1ef-e266-e983-5874-6c26ac7f38b8@opersys.com> <20190311193612.4f09bf11@oasis.local.home> In-Reply-To: <20190311193612.4f09bf11@oasis.local.home> From: Daniel Colascione Date: Mon, 11 Mar 2019 16:58:28 -0700 Message-ID: Subject: Re: [PATCH v4 1/2] Provide in-kernel headers for making it easy to extend the kernel To: Steven Rostedt Cc: Karim Yaghmour , Geert Uytterhoeven , Greg KH , Joel Fernandes , LKML , Andrew Morton , Alexei Starovoitov , atish patra , Dan Williams , Dietmar Eggemann , Guenter Roeck , Jonathan Corbet , Kees Cook , Android Kernel Team , "open list:DOCUMENTATION" , "open list:KERNEL SELFTEST FRAMEWORK" , linux-trace-devel@vger.kernel.org, Manoj Rao , Masahiro Yamada , Masami Hiramatsu , Qais Yousef , Randy Dunlap , Shuah Khan , Yonghong Song Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 11, 2019 at 4:37 PM Steven Rostedt wrote: > > On Sat, 9 Mar 2019 16:44:31 -0500 > Karim Yaghmour wrote: > > > > Sorry, I should've been clearer. I'm including eBPF/BCC into the > > "user-space tools" here. That was in fact my prime motivation in > > encouraging Joel at the last LPC to look at this. I've been integrating > > the teaching of eBPF into my AOSP debugging and performance analysis > > class (see CC courseware here: > > http://www.opersys.com/training/android-debug-and-performance), and it > > was pretty messy trying to show people how to benefit from such tools > > under Android. Joel's present set of patches would obviate this problem. > > I've been reading this thread and staying out for the most part. But I > was thinking about how I could use kernel headers for things like > kprobes, and I want to mention the pony that I would like to have :-) > > Are headers really needed, and more importantly, are they enough? What > if userspace is 32bit and the kernel is 64bit. Can ebpf scripts handle > that? Why would eBPF care about the bit width of userspace? I've thought a lot about inspecting user state from the kernel and have some weird ideas in that area (e.g., why not register eBPF programs to unwind user stacks?) --- but I think that Joel's work is independent of all that. I'm curious what you think we can do about userspace. I wish we could just compile the world with frame pointers, but we can't. > What I would love, is a table that has all structures and their fields > with information about their types, size and signed types. Like the > format fields in the events directory. This way ebpf (and kprobes, > internally in the kernel) could access this table and be able to know > what the data structures of the kernel is). Think of the headers as encoding this information and more and the C compiler as a magical decoder ring. :-) I totally get the desire for a metadata format a little less messy than C code, but as a practical matter, a rich C-compilation pipeline already exists, and the debuginfo you're proposing doesn't, except in the form of DWARF, which I think would be even more controversial to embed in the kernel memory image than headers are. A header blob provides a strict superset of the information your scheme provides.