From owner-freebsd-emulation@freebsd.org Tue Dec 6 16:58:51 2016 Return-Path: Delivered-To: freebsd-emulation@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCAAAC6A9E4 for ; Tue, 6 Dec 2016 16:58:51 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 0AF912DF; Tue, 6 Dec 2016 16:58:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id SAA23308; Tue, 06 Dec 2016 18:50:31 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1cEIwo-000Gnf-RW; Tue, 06 Dec 2016 18:50:30 +0200 To: freebsd-emulation@FreeBSD.org Cc: Tijl Coosemans From: Andriy Gapon Subject: /compat/linux/dev and an odd program Message-ID: <1668707b-3f94-ccc4-068c-04869620b4f4@FreeBSD.org> Date: Tue, 6 Dec 2016 18:49:06 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2016 16:58:52 -0000 I have an old binary-only Linux program that, for whatever reason, opens /dev/null with O_CREAT flag (O_WRONLY | O_CREAT | O_TRUNC). That works fine when there is no /compat/linux/dev: the code in kern_alternate_path() sees that the directory does not exist, strips /compat/linux prefix and, so, the real /dev/null is found. But typically, if linux_base is installed, there is /compat/linux/dev directory, because of /compat/linux/dev/shm/. The code will see the directory and, thus, it will try to open /compat/linux/dev/null. But there is no such file, so it will try to create it. And fail with EPERM for a non-privileged user. I wonder if anyone has thoughts or suggestions on this situation. Either an administrative solution or a code change would be fine for me. Thanks! -- Andriy Gapon