From nobody Sun Mar 13 23:17:07 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id ACFE61A24FCD for ; Sun, 13 Mar 2022 23:17:07 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KGwYH2Qlpz3q1P for ; Sun, 13 Mar 2022 23:17:07 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F7262258D for ; Sun, 13 Mar 2022 23:17:07 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 22DNH7rW096762 for ; Sun, 13 Mar 2022 23:17:07 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 22DNH7ok096761 for bugs@FreeBSD.org; Sun, 13 Mar 2022 23:17:07 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 262535] Linuxulator sendfile does not support all file descriptors Date: Sun, 13 Mar 2022 23:17:07 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: james@mclgh.net X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647213427; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Pt4TBgJjpDtMd54PIw7uV3jfh6HK2UPwcHmvuC7S/b8=; b=GIgULdx+CMZCweCI3NK7QmHj1IeQEf3Wd19fxdQk7mavlHB7hKulSdKI55hkPQ9T1ZjUjw Sjr6v87SY7T9pi7e3ytcZzcXmocHl/m3KEz6eg3ssAjCcBZ+A/6Uf+qe3RLwBB2pzLFjAG 3FkfE0AajzimGENSr2sn0HwKQvBnKAJ/b5t+VGqJ1QQvP9y8iM0YMbw3QeGGg4mfvgw70m 34gcUDAIF5vIR90boTZgf10O0z7el7K9AnaEzv+hoz854NYQzRIioYIy7+MvQUryR/NNya CY2+/T+ao5tTp9vGn6JDYfylwHbcRJVbXtR8/Dr6XCtJKLCTfIFnUfJHGerkQg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647213427; a=rsa-sha256; cv=none; b=sHQ5IlPMvIh1HhjMwXDuaM3np6TmerLnehd/dOLbMdvsyMn8+p7is23gIjlKtHvCQ1t2Bx hP2rFgHwqSmkipeVlrMg+jq8iricHuFSAtRtjhUAW/wMF+Dqelr9WQ1NWypSvPODGg/950 GFwooBfpKrsj6KIe9gjBD28CBWtz/C17hYRWdFoUNmrjX4+Wl7OXso7Xp3liFOLu1cLIbK 1Ml8dNPIO+hZLL5w0Ys3ggCH7wdVvbRC3k9c4qVXwkUG9377Rad3t9Ld31uYkQbEXbd//H hs5bre4iZMbViGSD2p4p84SARDOJeTOBdlKPh9Dnun0t0yQUL4CVTf6OvnTxOw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D262535 Bug ID: 262535 Summary: Linuxulator sendfile does not support all file descriptors Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: james@mclgh.net Created attachment 232438 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D232438&action= =3Dedit Patch to add a fallback to Linuxulator sendfile to support any FDs In Linux < 2.6.33, sendfile could only be used to send from a file to a soc= ket. This is the behaviour implemented by the FreeBSD Linuxulator. However, since 2.6.33, sendfile can send from any FD to any other FD, which is not impleme= nted by FreeBSD sendfile or by the Linuxulator. I ran into this problem trying to run the game "Factorio" using the Linuxulator, which relies on sendfile to copy files on disk. Here is another thread on freebsd-emulation describing the same problem: https://www.mail-archive.com/freebsd-emulation@freebsd.org/msg11340.html Attached is a patch which changes the Linuxulator sendfile such that it will use FreeBSD sendfile where possible, but otherwise fallback on a simple read/write loop for compatibility. I would very much appreciate some feedback on the patch, as I have never contributed to the FreeBSD kernel before. In particular, any suggestion for= a better way to choose the buffer size than the arbitrary 8 KB I have hardcod= ed would be welcome. --=20 You are receiving this mail because: You are the assignee for the bug.=