Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp904800imb; Fri, 1 Mar 2019 18:40:18 -0800 (PST) X-Google-Smtp-Source: APXvYqw87B9C1WeE5BHL9qOQK74es4ndRXO49pDrdyNoCpTDYHxxrr+gXHJ9Q1wIxrtmAAh7fCy4 X-Received: by 2002:a63:9dc3:: with SMTP id i186mr8000952pgd.305.1551494418486; Fri, 01 Mar 2019 18:40:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551494418; cv=none; d=google.com; s=arc-20160816; b=hehXZds56TyI99tH1ZMg9AnRLapQiPAgngqYqMmA1WU6BzwVYl+oQQ/7c2i4Tyz4Pw mYKur7NQvNFNd9rKCgCeLMPQZidjRdkefbxyOS6upS5U1Ll7u3PwK6RXe8WuYcB5q1nc M3BIwb/m0EnQ2VqaDxXJoqm/WnhkRl8UFCfYyKtqAzX+18naSE8OOyzOCR/UIFkIA42Q NFft2qAcXi/IzKVrT4sg2LSKhot6VhVEaRKmXOAB4CBtH7teQ2FpCZQ+3eWJd74pokvy 3qepdzlSvZrujADmOZyVLE6iiN69OfXQze2B6nAtRLIR74NOd+S1iCRNv1qakknxUEIC AljQ== 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=5Temr26glEFV5oBvptkrenNBwbSVXvaTPHPZBdA7hho=; b=vAgTJz6I8nHZZ1tRmxxVT0+E5F9RCgmpA31MGWYOT9Ufox+PNo2EZoUKIscqqCqgsl qICQUDYNDIYp8il3Twu0PZ+Fl7X4zmIImFXWeVVNJ0o/8bh1uj6GgukJd10s98EY+9ro IZ102fHlRiaSuZBS24wqDpVGlL76FT4zuZMbN6E/yfuzfugiBKtAZLWnpMcDEU99BZOY zbiqp2DB4CNI0097gr2GUWzHiENcyRMlUU17LbdJZ6mbka2er83tB+JfB79qhxUNWBbz 4KYSP02xFRLaQzPf39QcJAPlpBvV0V1f3Gt6gZRAucma+ItX15mYT11yjK3uHX4uVU6v b/BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=fevPHetG; 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 5si13038668plx.421.2019.03.01.18.40.02; Fri, 01 Mar 2019 18:40:18 -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=fevPHetG; 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 S1727541AbfCBCjo (ORCPT + 99 others); Fri, 1 Mar 2019 21:39:44 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:43818 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726835AbfCBCjn (ORCPT ); Fri, 1 Mar 2019 21:39:43 -0500 Received: by mail-qk1-f195.google.com with SMTP id f196so15529176qke.10 for ; Fri, 01 Mar 2019 18:39:42 -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=5Temr26glEFV5oBvptkrenNBwbSVXvaTPHPZBdA7hho=; b=fevPHetGuRxApcOMs7+xRchWUctf+oj1jQqEq46J109zotdV7Y2+0pdX4q79SgjvX5 UVzx1FJ/2GGQCg4V9qIjmPNHu8BA5s6eZJtubMrLUEIeyc/al1fnL48cn4TibRFZT0ym bNUWQQUM1tpWtBk2SDHB1B8LQPEAHQm/OHd+Y= 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=5Temr26glEFV5oBvptkrenNBwbSVXvaTPHPZBdA7hho=; b=LrVE6N4cgAo06yrwKyK7T3GjIXXcRaUpMTunFNlvlc7q6fiWPEZbSjUGT8eFwdxW60 PUApnue72FcwjiUdWH9e7mL1uPoPXYvDH0hw++Eh56FPy8Tuy2d4Qt0D7ud5PbDeUX+E ernBrpkS0vSR251HsoYbo0IwQvEn2lOqZRMGsvYxGMpAxYevW0Tizi52tm8bNyb1wTxQ 62CE7aon0ZcDbxUuoJ4XDLZKxCFuAZ6Lc4rrANTUDZkmdw72WUuhnyNImqDfHdglKyi0 uzPzrw+hnfLIJD4MvAzQvORLt1KLtMpj2VOyLeNK0q1ljgaSxF/zenT1syXk4NijFKuo 2aew== X-Gm-Message-State: APjAAAX2sUsgjxzfP4MaBzLxQ9kcCNZMzq44R6calBqjIG6lkwxI7iHC Lny2bZve+s0JqWEEJtzVeYPo/g== X-Received: by 2002:a37:f506:: with SMTP id l6mr6466129qkk.110.1551494382200; Fri, 01 Mar 2019 18:39:42 -0800 (PST) Received: from localhost ([2620:0:1004:1100:cca9:fccc:8667:9bdc]) by smtp.gmail.com with ESMTPSA id h10sm24209069qta.3.2019.03.01.18.39.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Mar 2019 18:39:41 -0800 (PST) Date: Fri, 1 Mar 2019 21:39:40 -0500 From: Joel Fernandes To: Masahiro Yamada Cc: Linux Kernel Mailing List , Andrew Morton , Alexei Starovoitov , atish patra , Daniel Colascione , Dan Williams , Greg Kroah-Hartman , Guenter Roeck , Jonathan Corbet , Karim Yaghmour , Kees Cook , kernel-team@android.com, "open list:DOCUMENTATION" , "open list:KERNEL SELFTEST FRAMEWORK" , linux-trace-devel@vger.kernel.org, Manoj Rao , Masami Hiramatsu , Paul McKenney , "Peter Zijlstra (Intel)" , qais.yousef@arm.com, Randy Dunlap , Steven Rostedt , Shuah Khan , Thomas Gleixner , Yonghong Song Subject: Re: [PATCH v3 1/2] Provide in-kernel headers for making it easy to extend the kernel Message-ID: <20190302023940.GA55262@google.com> References: <20190227193748.132301-1-joel@joelfernandes.org> <20190228144306.GA138215@google.com> <20190301171954.GA217990@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Mar 02, 2019 at 11:13:07AM +0900, Masahiro Yamada wrote: > On Sat, Mar 2, 2019 at 3:03 AM Joel Fernandes wrote: > > > > On Fri, Mar 01, 2019 at 03:25:05PM +0900, Masahiro Yamada wrote: > > [...] > > > > > I am guessing the user will run these commands > > > > > on the target system. > > > > > In other words, external modules are native-compiled. > > > > > So, > > > > > > > > > > target-arch: arm64 > > > > > host-arch: arm64 > > > > > > > > > > > > > > > Is this correct? > > > > > > > > > > > > > > > If I understood the assumed use-case correctly, > > > > > kheaders.tar.xw will contain host-programs compiled for x86, > > > > > which will not work on the target system. > > > > > > > > > > > > > You are right, the above commands in the commit message work only if the > > > > host/target are same arch due to scripts. > > > > > > > > However we can build with arm64 device connected to a host, like this (which > > > > I tested): > > > > > > > > adb shell modprobe kheaders; adb pull /proc/kheaders.tar.xz > > > > rm -rf $HOME/headers; mkdir -p $HOME/headers > > > > tar -xvf /proc/kheaders.tar.xz -C $HOME/headers >/dev/null > > > > cd my-kernel-module > > > > make -C $HOME/headers M=$(pwd) ARCH=arm64 CROSS_COMPILE=aarch64- modules > > > > adb push test.ko /data/; adb shell rmmod kheaders > > > > > > > > The other way we can make this work is using x86 usermode emulation inside a > > > > chroot on the Android device which will make the earlier commands work. One > > > > thing to note is that Android also runs on x86 hardware so the commands in > > > > the commit message will work even for x86 Android targets already. > > > > > > > > Also note that this the "module building" part is really only one of the > > > > usecases. eBPF is another which needs the headers - and the headers are vast > > > > majority of the archive. Headers take 3.1MB out of 3.6MB of the archive on > > > > arm64 builds. > > > > > > > > How do you want to proceed here, should I mention these points in the commit > > > > message? > > > > > > > > > > > > I do not request a re-spin just for a matter of commit log, > > > but this version produces an empty tarball. > > > So, you will have a chance to update the patch anyway. > > > > > > In the next version, it would be nice to note that > > > "external modules must be built on the same host arch > > > as built vmlinux". > > > > Ok, I respun it with 1 more minor nit for arm64 building. Please take a look. > > > I have not checked code-diff in v3 yet. > > Anyway, I will add comments to v4 > if I notice something. Ok. Since all your comments from previous series were addressed, it would be nice to get your Acked-by tag for v4 unless you have further comments or concerns. > > > Let me ask one more question. > > > > > > I guess this patch is motivated by > > > how difficult to convey kernel headers > > > from vendors to users. > > > > > > In that situation, how will the user find > > > the right compiler to use for building external modules? > > > > > > > > > > > > > > > Greg KH said: > > > > > > We don't ever support the system of loading a module built with anything > > > other than the _exact_ same compiler than the kernel was. > > > > > > > > > For the full context, see this: > > > https://lore.kernel.org/patchwork/patch/836247/#1031547 > > > > IMO this issue is not related to this patch but is just an issue with > > building external modules in general. > > > I do not think it is an issue of the build system, at least. > > As far as I understood Greg's comment, it is troublesome > without the assumption that vmlinux and modules are built > by the same compiler. > It is related to this patch since this patch assumes use-cases > where external modules are built in a completely different environment, > where a different compiler is probably installed. Yes, but what I'm trying to say is the same issue exists with all other solutions today that do this. Such as debian you have linux-headers package. A user could totally use the build artifacts obtained from somewhere to build a kernel module with a completely different compiler. That issue has just to do with the reality, and isn't an issue caused by any one solution such as this one. I agree care must be taken whenever user is building external kernel modules independent of kernel sources. Did I miss something else? thanks a lot, - Joel