From nobody Sat Feb 17 19:07:27 2024 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 4TcdbN49BXz53vWt for ; Sat, 17 Feb 2024 19:07:28 +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 4TcdbN0nFJz4D7p for ; Sat, 17 Feb 2024 19:07:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708196848; 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=3Eu5cTsteB0wOyamBb8y9oukRdI/ii3goAuaj4aABX8=; b=aH1xWAXFx9/Yp/uJQ7ZStaLLiKXZigDFfIVOfm280pW6DwhXVGQ1gFB0+G4ZY9GoN43jD5 /sIbNcYsn9RWsNy5WW5Bzcrmy4eokc7n9QbrxZRMffh6HbeFIESvzJg4DacvscW7FMxHqk Fa6KgyNXbH2umiHrjbv5oClb9xACYgnum9EoorAvVPw90ukV6FgfKesu0osyaFRNdiZbBp xqugqo3AfI+FjwHHJc9HG/Rw/p/je1akreZOcoDx+qUySaAeHD+/Aa55EWWkZ/EhqHyQpL c2Ce04h4/CsX8BzvSN9/eUX3zx12VEU/C67ATTvI8UkAM4m0/YNMnaBtXZmFXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708196848; a=rsa-sha256; cv=none; b=GAUIVFfY13IegqlIlLkX/QnJr01vrn2KJgu94dPHXRK8Ht1mdwvLgytmAnGtz4FGPpXf1x ySs1vbjOLwuQXCbe4GNfKzkuMoGUxOTVe9hF8XhSPE7pf7LrFp6Tx6FIYuXzzaoYin1oJ0 kOi0lnD3xIOzIy5IEDuJ4VwG3y7sr6HVEnqI5IycbLswPpDyDaHWzh9A6wLZdJLOAS3ipg HOlS8iwSoTnH44qwj5T87x6SCpMn4UtBb2OIlmckfpnPQehLAMv9l8plUQAmg2VZnVqFNY 6kShHxXQCWKpj/Qw8QGwvueqHz2XJLDasn2rkHraIi53lGYuwR0eA/SpIzGRbQ== 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 4TcdbM6qDTzK64 for ; Sat, 17 Feb 2024 19:07:27 +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 41HJ7RKF051118 for ; Sat, 17 Feb 2024 19:07:27 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 41HJ7ROx051117 for bugs@FreeBSD.org; Sat, 17 Feb 2024 19:07:27 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 277118] Linux Emulation (Linuxulator): accept(2) does not time out, SO_RCVTIMEO is ignored Date: Sat, 17 Feb 2024 19:07:27 +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: 14.0-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: christian@kohlschutter.com 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.mimetype 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 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D277118 Bug ID: 277118 Summary: Linux Emulation (Linuxulator): accept(2) does not time out, SO_RCVTIMEO is ignored Product: Base System Version: 14.0-STABLE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: christian@kohlschutter.com Attachment #248545 text/plain mime type: Created attachment 248545 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D248545&action= =3Dedit Code demonstrating the bug (compile with/for Linux, then test on Linux, and= use Linuxulator to test on FreeBSD) In Linux, setting SO_RCVTIMEO on a listening, blocking socket will cause accept(2) to return with -1 and errno=3DEAGAIN. Linuxulator unfortunately does not mimic this behavior, and instead exposes= BSD behavior (timeout is ignored). Therefore, any Linux code relying on the tim= eout may fail to work correctly with FreeBSD Linux emulation. This can be fixed in a way compatible with Linux proper and FreeBSD Linuxul= ator (if source code access is available) by calling poll(2) prior to accept(2). However, code that is optimized for Linux proper should not require the cal= l to poll(2) just to support the niche use case of supporting Linuxulator on FreeBSD, as that would increase the number of syscalls when running the bin= ary on Linux proper. A small test case is attached. --=20 You are receiving this mail because: You are the assignee for the bug.=