Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3723612yba; Mon, 29 Apr 2019 07:30:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVdz3sB2f7WC+/UeIr/n6rCqAm6YewECMEfodRbIKX/WwpRWkrqJTxq/MxFyOxnelCYQsF X-Received: by 2002:a63:fc43:: with SMTP id r3mr58232336pgk.44.1556548258330; Mon, 29 Apr 2019 07:30:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556548258; cv=none; d=google.com; s=arc-20160816; b=aXIU+jOJp/jl6lpycEZ8jHAB5ofhfHmua/S66oaQ62KSkdplWaAB1MvNhaGSJX6Cu5 AinKt4NV1Wge6IhnLFhomHtEgj7phe3RK8FEMPOgzW5ApBGplpj3Ehmgk84iRdhJ8o6N YodmxK/AxrIddqPvH4N0eK3sdhmFS5um59hHvycpSrzsuwFgtYX3KPjLYhfyS7/myPHt B6pOxoWB/XKJRyfCwdtWxcOLARvRDK755e0jvMiG7rX7GnbRA5XbYUDOYXNLVd8+U+ba Md3V46UiofoztKRef7+lQA+6v3i7jN0Qb14Bmh84BzJf8YXIWRUBwrCjnwl/unuV/kJp Wp5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=WcPAUupWuUJ9uw6w4LNzP0iB9AcsAU9AYb/3oXfMvwA=; b=EfGqMliPJjOJAT+bSNuayrcDCWdmkEm53+OdlWQsQQ8OvybmmD0/aEWND4oObjpKGn +uajIObKdGoRtVbGgf9K5Xyxk+TR2CQ4VL67euEYYzHXUMUxIFbz+VLl/nOb3Lu5A1of kZyYZ7UZDLRI61sXS5Be/yLfS/9icvZNGAhA/SYRDjaevTpyrijk5AAWBHmixLDVkhWV /BIZFokhJFuI42q1CuyM7E+KpACsvyoAJNB7Hfe5nmkS+jvhLITJcCpiMC9Af/nXV/ms aaenmI8TY0GvWv+yXhJnaoKdbWYUtgAQBG6Xi8wjk7RiOtPninWpVltGbifl/Q1DcwD5 MIqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=Q6PRyhoK; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k33si34042051pld.27.2019.04.29.07.30.42; Mon, 29 Apr 2019 07:30:58 -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=@joelfernandes.org header.s=google header.b=Q6PRyhoK; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728320AbfD2O3p (ORCPT + 99 others); Mon, 29 Apr 2019 10:29:45 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43405 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728240AbfD2O3p (ORCPT ); Mon, 29 Apr 2019 10:29:45 -0400 Received: by mail-pf1-f194.google.com with SMTP id e67so5388810pfe.10 for ; Mon, 29 Apr 2019 07:29:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=WcPAUupWuUJ9uw6w4LNzP0iB9AcsAU9AYb/3oXfMvwA=; b=Q6PRyhoKPf031uvtAuys2j2z3C8eSrpz0r0Zd2L9MC7r/78hpJEhnsaWELp08SNA72 kUtOse5O2XKfQR5CIIwBrm7hqqQk3dy1CcptRkegy7AN5DbP7lBBLOlus3qeilUIEtFI D1EYYwqPG3XqCm+DDCx1mCHjq/WteGdHagFNQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WcPAUupWuUJ9uw6w4LNzP0iB9AcsAU9AYb/3oXfMvwA=; b=uasa+ImAfotctirRS7oXweZbXyaiJ9TGhlIUZ+rE1K+j7Fq1UysxdFB1Vyonp/Opi8 OXI55k7aiit/sHleiY4i1cwu5Hd9J1KYCacZ6aeqiwZHVAiHQ3sES0WMUM6jvEr+z7T7 rotAjZhrw19+eS7W1GMWGwWyb/CMBe2AT5EZE6O7RSYgxNnxX3Ese0Gl58/sJLzQKItb IuQZOdtw0fTXmbUC2fu7IKnqV+f2dtb77jUrznnFoVxGNti3/f4ElaDAgBJHoLPOeIdz oTDk948E4Gr9RyIe2mZYAAgfB4x8oBXyd42cVvUK/HyAlLd725JuAruHCFrfcN2RHfGk FUfQ== X-Gm-Message-State: APjAAAUUrVqkFScdhiMURUs6uF+7EVqxD/bOwa6bJEbyY4Xai06e6CJd RI9c0nUTNJfarwhfrri7dJeCFw== X-Received: by 2002:a63:8149:: with SMTP id t70mr12045527pgd.134.1556548184065; Mon, 29 Apr 2019 07:29:44 -0700 (PDT) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id z16sm653529pfa.42.2019.04.29.07.29.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 07:29:43 -0700 (PDT) Date: Mon, 29 Apr 2019 10:29:41 -0400 From: Joel Fernandes To: Greg KH Cc: Masahiro Yamada , Linux Kernel Mailing List , Andrew Morton , Alexei Starovoitov , atish patra , Daniel Colascione , Dan Williams , Dietmar Eggemann , Guenter Roeck , Jonathan Corbet , Karim Yaghmour , Kees Cook , "Cc: Android Kernel" , "open list:DOCUMENTATION" , "open list:KERNEL SELFTEST FRAMEWORK" , linux-trace-devel@vger.kernel.org, Manoj Rao , Masami Hiramatsu , Qais Yousef , Randy Dunlap , Steven Rostedt , Shuah Khan , Yonghong Song , Olof Johansson Subject: Re: [PATCH v7 resend 1/2] Provide in-kernel headers to make extending kernel easier Message-ID: <20190429142941.GA178173@google.com> References: <20190426190430.172543-1-joel@joelfernandes.org> <20190427133844.GA29366@kroah.com> <20190429132602.GA165075@google.com> <20190429135455.GA2412@kroah.com> <20190429142425.GB29007@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190429142425.GB29007@kroah.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 29, 2019 at 04:24:25PM +0200, Greg KH wrote: > On Mon, Apr 29, 2019 at 11:14:30PM +0900, Masahiro Yamada wrote: > > On Mon, Apr 29, 2019 at 10:57 PM Greg KH wrote: > > > > > > On Mon, Apr 29, 2019 at 09:26:02AM -0400, Joel Fernandes wrote: > > > > On Sat, Apr 27, 2019 at 03:38:44PM +0200, Greg KH wrote: > > > > > On Fri, Apr 26, 2019 at 03:04:29PM -0400, Joel Fernandes (Google) wrote: > > > > > > Introduce in-kernel headers which are made available as an archive > > > > > > through proc (/proc/kheaders.tar.xz file). This archive makes it > > > > > > possible to run eBPF and other tracing programs that need to extend the > > > > > > kernel for tracing purposes without any dependency on the file system > > > > > > having headers. > > > > > > > > > > > > A github PR is sent for the corresponding BCC patch at: > > > > > > https://github.com/iovisor/bcc/pull/2312 > > > > > > > > > > > > On Android and embedded systems, it is common to switch kernels but not > > > > > > have kernel headers available on the file system. Further once a > > > > > > different kernel is booted, any headers stored on the file system will > > > > > > no longer be useful. This is an issue even well known to distros. > > > > > > By storing the headers as a compressed archive within the kernel, we can > > > > > > avoid these issues that have been a hindrance for a long time. > > > > > > > > > > > > The best way to use this feature is by building it in. Several users > > > > > > have a need for this, when they switch debug kernels, they do not want to > > > > > > update the filesystem or worry about it where to store the headers on > > > > > > it. However, the feature is also buildable as a module in case the user > > > > > > desires it not being part of the kernel image. This makes it possible to > > > > > > load and unload the headers from memory on demand. A tracing program can > > > > > > load the module, do its operations, and then unload the module to save > > > > > > kernel memory. The total memory needed is 3.3MB. > > > > > > > > > > > > By having the archive available at a fixed location independent of > > > > > > filesystem dependencies and conventions, all debugging tools can > > > > > > directly refer to the fixed location for the archive, without concerning > > > > > > with where the headers on a typical filesystem which significantly > > > > > > simplifies tooling that needs kernel headers. > > > > > > > > > > > > The code to read the headers is based on /proc/config.gz code and uses > > > > > > the same technique to embed the headers. > > > > > > > > > > > > Other approaches were discussed such as having an in-memory mountable > > > > > > filesystem, but that has drawbacks such as requiring an in-kernel xz > > > > > > decompressor which we don't have today, and requiring usage of 42 MB of > > > > > > kernel memory to host the decompressed headers at anytime. Also this > > > > > > approach is simpler than such approaches. > > > > > > > > > > > > Reviewed-by: Masahiro Yamada > > > > > > Signed-off-by: Joel Fernandes (Google) > > > > > > > > > > Reviewed-by: Greg Kroah-Hartman > > > > > > > > Thanks for the Reviewed-by tag. I believe there are still 2 logistical things > > > > to merge this. > > > > 1. Location of the header archive: > > > > Olof and Steve did not like it to be in /proc and instead /sys seemed a better > > > > choice they are Ok with. Me and Greg were Ok with it being in /sys/kernel/. > > > > Alexei, Greg and me are Ok with either proc or Sys. > > > > > > As you say, either is fine with me. > > > > > > > 2. Who is going to pull this patch: This seems a matter of where the header > > > > archive resides. If it is in /sys/kernel/ then I am assuming Greg will pull > > > > it. Masahiro has given his Reviewed-by tag, is he the one to pull it? > > > > > > I can take it, but it probably should just go through the kbuild tree, > > > as that makes more sense to me. > > > > > > I do not want to take responsibility for this. > > Hah, ok, I'll be glad to queue this up in my tree. I'll take it now, > and if people who really object to this being in /proc/ and want it in > /sys/, we can add a follow-on patch before 5.2-final is out to move the > file to that location. Sounds great to me. thanks! - Joel