Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4394014imu; Sat, 19 Jan 2019 08:28:59 -0800 (PST) X-Google-Smtp-Source: ALg8bN4MVkiHKA7R6MZLeH4/SFP0LGhBSlDd2Iu3xK128sQU3OaF7GibNbgAHgyknUQUV3LWw7QR X-Received: by 2002:a17:902:27a8:: with SMTP id d37mr23749321plb.182.1547915339304; Sat, 19 Jan 2019 08:28:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547915339; cv=none; d=google.com; s=arc-20160816; b=bxlmTROoRu8lZSKo0lk8dxzt4L42GQ7zieq2THWEiwgkJ6RGq0HuCVL4Z4VEnEg04y Zb3h6rDNyEYTY4rkERoxjXj6nv+2/7leqt7x6uepLyMvLKWatNIwhIopMUf33vMRLx88 /VX243Pq9ZOf612rNxcjfuKFc4ZYdOeDgtN7n3qy+BO37KL9Wst22pX52hXSgvH/KDzn RON7IJWObDycuAvZ/PoJIH0ckirwHCDYyqkqQRY/V8kkK2Fabm4kUjqsfVSNOuiSTIs9 w2NhWcIhyUXK/eH9/CuPfP5aXeeiCMpbgN83ixZIGf7FPJ/X8rxJp9BAl/PVofWkBM6q CUaA== 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=7OUnerQ4yTyTrQePDak9CT3pVNHgW0ADgz6GmAK0nY4=; b=nDMFQ/wlgy8Gngd6m+2QcXZr4FHCArJKSXq9UW9mDwI3vrSpCCw3DpGn26BXOPkZom Qg6ow4oAdLvaZWxOapx3nPw37VMJIE9CAcgaYWhbihyVGCl82a5SPRpM//JS2zZO+EjP zTk7BIdthLfDwj3K3NXJqkTRhD4cSOh96klu4pWY9S1Hv2ZmhrM3CRyp9y+csY59vklJ +E5TDnPCsZQUtj+zPNmNkZDmb7blI7i4uVTUzX+Ue8IeGJ6yxCepDwm2e2r9i367noJu BUdVT4P0HwAcpHpVr28XZrV/ouBsvz4DuHbN/HuKz/KiVbAQDVlOEcQYI67Q45dpp+FH AVug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=VlT9DB4T; 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 o27si8103325pgl.53.2019.01.19.08.28.41; Sat, 19 Jan 2019 08:28:59 -0800 (PST) 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=VlT9DB4T; 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 S1728586AbfASQ0s (ORCPT + 99 others); Sat, 19 Jan 2019 11:26:48 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:46105 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726756AbfASQ0r (ORCPT ); Sat, 19 Jan 2019 11:26:47 -0500 Received: by mail-qt1-f196.google.com with SMTP id y20so18583440qtm.13 for ; Sat, 19 Jan 2019 08:26:46 -0800 (PST) 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=7OUnerQ4yTyTrQePDak9CT3pVNHgW0ADgz6GmAK0nY4=; b=VlT9DB4TMtFUaZbyE8/yG1JgIO29NXxCr5Iu/BUl3VWMppZt8shMSTnCQ1qiPAQSsG JMSuYVFIhGigXgJGrrOT0oLnPB7Vzecgsla8xTPP2Yym5P4Zo9JWtuf+v6lZAGv+dOXP VH4RRctrV6OAvZPfJYQquA8viJggbwlWLnupo= 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=7OUnerQ4yTyTrQePDak9CT3pVNHgW0ADgz6GmAK0nY4=; b=GJ0hvpVQ7KYeu9x+45deWhG9DWJA7TNoWzZBLWpohR06H63cAk9p6Rccv9uyCe2LAG fndFIHUzuwjHZpXibDEj33bzXTuLuDKYUp2qceZh7wpyr3/gxzRwMTSlQRG7BwlIbWj+ wvGARAbXNtxRnagj1V/xKoh0vPHYepMLWqSgv/9xK2hUnMWNzjluSKYdnFLOsB50n1Lf RUmCqAvyLf92O/2mdPAVsdbdKwXMNvAcUc3r1fUlzvtaMRe7iKBZ+vztdGcqaoj7cthT 0AODFoiDG0R/SelcdYlHFM1Lhevs1n7MlOpm64ScEN0Ia5SecKWDl+NzQ4ClNRIUj6of fggQ== X-Gm-Message-State: AJcUukfsjZG5ICSFodWeAfztaAzv29JRiT9GwfM6WQj+oGhx1cI+/DLu 2KbBSrkTun6jeepAdv8aHh0qGw== X-Received: by 2002:ac8:19e2:: with SMTP id s31mr20921029qtk.215.1547915206309; Sat, 19 Jan 2019 08:26:46 -0800 (PST) Received: from localhost ([2620:0:1004:1100:cca9:fccc:8667:9bdc]) by smtp.gmail.com with ESMTPSA id 70sm15846448qkc.52.2019.01.19.08.26.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 19 Jan 2019 08:26:44 -0800 (PST) Date: Sat, 19 Jan 2019 11:26:44 -0500 From: Joel Fernandes To: Greg KH Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, Andrew Morton , ast@kernel.org, atishp04@gmail.com, Borislav Petkov , dancol@google.com, "H. Peter Anvin" , Ingo Molnar , Jan Kara , Jonathan Corbet , karim.yaghmour@opersys.com, Kees Cook , kernel-team@android.com, linux-doc@vger.kernel.org, Manoj Rao , Masahiro Yamada , paulmck@linux.vnet.ibm.com, "Peter Zijlstra (Intel)" , rdunlap@infradead.org, rostedt@goodmis.org, Thomas Gleixner , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , yhs@fb.com Subject: Re: [RFC] Provide in-kernel headers for making it easy to extend the kernel Message-ID: <20190119162644.GA231277@google.com> References: <20190118225543.86996-1-joel@joelfernandes.org> <20190119102800.GB17723@infradead.org> <20190119103606.GA17400@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190119103606.GA17400@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 Sat, Jan 19, 2019 at 11:36:06AM +0100, Greg KH wrote: > On Sat, Jan 19, 2019 at 02:28:00AM -0800, Christoph Hellwig wrote: > > This seems like a pretty horrible idea and waste of kernel memory. > > It's only a waste if you want it to be a waste, i.e. if you load the > kernel module. > > This really isn't any different from how /proc/config.gz works. Yes, that's right, it can be built as a module and loaded and unloaded on demand to free the kernel memory. Also such a module can be made a part of the initrd image itself (like other kernel modules that are built into an initrd), so this solution is already initrd-ready if anyone really wants it that way. > > Just add support to kbuild to store a compressed archive in initramfs > > and unpack it in the right place. > > I think the issue is that some devices do not use initramfs, or switch > away from it after init happens or something like that. Joel has all of > the looney details that he can provide. Initially I had written this as an image embedded into an init section, similar to the initramfs. On boot if a boot argument was passed, then the archive embedded was allocated additional non-init kernel memory to store it for retrieval through /proc. After that, the image that's embedded would be dropped entirely as its init memory. If no boot argument was passed, then no additional memory is used at all. Even though I got that working, I decided not to go with it because it was clunky because: 1. It required modification of the linker scripts in the kernel to embed the image into the init section, and also required a boot argument to be passed which makes the decision on whether to have headers as a boot-time decision than a post-boot decision. For these reasons, it is much cleaner to just have a loadable module and make it on-demand, as I am doing in this patch similar to what /proc/config.gz does. thanks! - Joel