From owner-freebsd-emulation@freebsd.org Tue Dec 6 18:56:37 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 27897C6AD94 for ; Tue, 6 Dec 2016 18:56:37 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay114.isp.belgacom.be (mailrelay114.isp.belgacom.be [195.238.20.141]) (using TLSv1.2 with cipher RC4-SHA (128/128 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign Organization Validation CA - SHA256 - G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6334ADE6; Tue, 6 Dec 2016 18:56:35 +0000 (UTC) (envelope-from tijl@freebsd.org) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2ClBgDACEdY//s+sVteGgEBAQECAQEBA?= =?us-ascii?q?QgBAQEBgzkBAQEBAR9MgQQQpFQmAZZehiICgiNDEQECAQEBAQEBAWIohGkBBTo?= =?us-ascii?q?cIxALDgoJJQ8qHgYTG4hYq3uLQwEBAQEBAQQBAQEBI4sZiikFmmaRC3SPWI4Dh?= =?us-ascii?q?A41IYEZhVY9NIkOAQEB?= X-IPAS-Result: =?us-ascii?q?A2ClBgDACEdY//s+sVteGgEBAQECAQEBAQgBAQEBgzkBAQE?= =?us-ascii?q?BAR9MgQQQpFQmAZZehiICgiNDEQECAQEBAQEBAWIohGkBBTocIxALDgoJJQ8qH?= =?us-ascii?q?gYTG4hYq3uLQwEBAQEBAQQBAQEBI4sZiikFmmaRC3SPWI4DhA41IYEZhVY9NIk?= =?us-ascii?q?OAQEB?= Received: from 251.62-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.62.251]) by relay.skynet.be with ESMTP; 06 Dec 2016 19:55:23 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.15.2/8.15.2) with ESMTP id uB6ItLbF024819; Tue, 6 Dec 2016 19:55:21 +0100 (CET) (envelope-from tijl@FreeBSD.org) Date: Tue, 6 Dec 2016 19:55:20 +0100 From: Tijl Coosemans To: Andriy Gapon Cc: freebsd-emulation@FreeBSD.org Subject: Re: /compat/linux/dev and an odd program Message-ID: <20161206195520.367929e9@kalimero.tijl.coosemans.org> In-Reply-To: <1668707b-3f94-ccc4-068c-04869620b4f4@FreeBSD.org> References: <1668707b-3f94-ccc4-068c-04869620b4f4@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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 18:56:37 -0000 On Tue, 6 Dec 2016 18:49:06 +0200 Andriy Gapon wrote: > 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! Try creating this symlink: ln -s /dev/null /compat/linux/dev/null