Date: Sat, 17 Feb 2024 19:07:27 +0000 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 Message-ID: <bug-277118-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
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.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-277118-227>