Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1764742yba; Sat, 27 Apr 2019 06:39:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqxb4sLZgnaasVXAiJmeVyyXbIYGrQ1z14r8/f7qQFxS7PAdu9CgfLgFoCwO+ZyZlvqvFsN5 X-Received: by 2002:a63:e110:: with SMTP id z16mr31990591pgh.165.1556372396111; Sat, 27 Apr 2019 06:39:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556372396; cv=none; d=google.com; s=arc-20160816; b=g3GN4JsrlNDDKliCdr1RsxDZ7cOR+MSD+zKbRBBOnkSj0Fdvg3VebEVfSlK3kl+zJo KvTLCbAeh96ddkSSCGzhTdVXsgLNkAG6Ab4LsXvVXVJbdfeZN/6Ys0WYqB0qaGzxiGig xQuIB9BT/+NCLDm7F9u6da07tOcxW6K7OcjWFWDAutkfQN8A146bipVnndRPEcGcwWuG DOm8A+9uRyZg+6nPgzffXruiqCKUC/rqanFjbRT0Ser2fQQMJdnQgjyS9TdXzC7FpU1s k9H1ySXdbCJvW2QlvixnG86c6HYVRelUkUMeOltAHN5wgD+MKysqEv4sNgZC+aObN6Bw TUrg== 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=g1d/0wvr2bR9SahnByDOk0HKNjOb/vdfd8yoUVmGTkU=; b=XXwo7AO0J7N3In3sI9I0HARmir5Jo5kxIiGEYXe1gfLJ1+as7RAKfNwYZmUCFPtNIz r7TCZyLWb8WSTvukJ0UMviX4yOVlurWjeWbqt2cCy/A1myNjeZiz7QJExE45q98Ji9LQ Szhj/QNsJL7OmcQoNv9ZAJ4P/HckxsYSSbk+zTAaG2H8CcyEedY8wOKiu3lykOaNjTH7 7TgprLaAf4+ysJrla22JZrBzGODJNJI3vW6J5uIXwtV4F6pYIz5RVqyM+31tm6C2ANL0 oWE316tU3yO4Nw89q4eL5IWzfGRLDoyjD5Hi2JUgkC1Fhexd0T4qi/JiMNZbDk+3bVjL 9L6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VrSZOaxD; 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 v10si2280363pff.199.2019.04.27.06.39.39; Sat, 27 Apr 2019 06:39:56 -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=@kernel.org header.s=default header.b=VrSZOaxD; 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 S1726308AbfD0Nis (ORCPT + 99 others); Sat, 27 Apr 2019 09:38:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:37754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725902AbfD0Nir (ORCPT ); Sat, 27 Apr 2019 09:38:47 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 690622087C; Sat, 27 Apr 2019 13:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556372326; bh=CQcLLq5g0BGJbtU32SVU6f5FrjJ1oFNOfzb5TjWhoQw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VrSZOaxD3J8Y9bd0i/Ao20cxuGAUkc5xtteQQaQTLR0SqpT+eBj9scMUlWJ7z30Fd Cr6LcQyukHusNdWX794WdFdVxxZ/ehgIxOqu8Qt63U4KpulEeRq6zOSISMhciNF/g6 kJScp46Ejq962tIRsV7hJzVQJWveers8pjTvNflI= Date: Sat, 27 Apr 2019 15:38:44 +0200 From: Greg KH To: "Joel Fernandes (Google)" Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Andrew Morton , ast@kernel.org, atishp04@gmail.com, dancol@google.com, Dan Williams , dietmar.eggemann@arm.com, Guenter Roeck , Jonathan Corbet , karim.yaghmour@opersys.com, Kees Cook , kernel-team@android.com, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-trace-devel@vger.kernel.org, Manoj Rao , mhiramat@kernel.org, qais.yousef@arm.com, rdunlap@infradead.org, rostedt@goodmis.org, Shuah Khan , yhs@fb.com Subject: Re: [PATCH v7 resend 1/2] Provide in-kernel headers to make extending kernel easier Message-ID: <20190427133844.GA29366@kroah.com> References: <20190426190430.172543-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190426190430.172543-1-joel@joelfernandes.org> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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