From owner-freebsd-amd64@freebsd.org Wed Mar 21 12:37:31 2018 Return-Path: Delivered-To: freebsd-amd64@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49F1EF649DA for ; Wed, 21 Mar 2018 12:37:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F59C6D282; Wed, 21 Mar 2018 12:37:30 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w2LCbFQD013960 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 21 Mar 2018 14:37:18 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w2LCbFQD013960 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w2LCbFrk013959; Wed, 21 Mar 2018 14:37:15 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 21 Mar 2018 14:37:15 +0200 From: Konstantin Belousov To: Andriy Gapon Cc: Stefan Esser , freebsd-amd64@freebsd.org Subject: Re: Linux compat / changing compat path Message-ID: <20180321123715.GK76926@kib.kiev.ua> References: <20180321090911.4d1059c2@ernst.home> <75bf1e70-b43a-5642-f69a-cc085c50225a@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <75bf1e70-b43a-5642-f69a-cc085c50225a@FreeBSD.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 12:37:31 -0000 On Wed, Mar 21, 2018 at 01:57:37PM +0200, Andriy Gapon wrote: > On 21/03/2018 10:39, Stefan Esser wrote: > > And you want to change occurances of /compat/linux in the kernel (and possibly > > some libraries and user programs), e.g. in /sys/amd64/linux/linux_sysvec.c ... > > > > There is some magic that makes an exec of /bin/sh look up /compat/linux/bin/sh > > first, if performed from within a program running under Linux emulation, and > > if you need that behavior, you have to adjust at least the kernel sources. > > > > Maybe the hard-coded "/compat/linux" should be replaced by a macro, to allow > > easy modification without loss of functionality ... > > I am not sure what would actually happen in the following case. > Create a jail and make it "pure Linux". That is, install only Linux binaries > there, no FreeBSD at all. And install them under the root of the jail, that is, > no /compat/linux within the jail. > Would that work? > Would I be able to start such a jail (processes in it) ? > Would they be able to correctly find their libraries and other executables they > might want to exec? > > If this works or could be made to work, then I am sure that some people would it > useful. > This already works. /compat/linux prefix is first try, and if not found, code falls back to normal lookup. People did used 'native linux' jails, in particular, to do builds.