Skip to content

net: socketpair: fcntl non-functional with socketpair-provided sockets on posix arch #54996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tracked by #51211
cfriedt opened this issue Feb 20, 2023 · 0 comments · Fixed by #55760
Closed
Tracked by #51211

net: socketpair: fcntl non-functional with socketpair-provided sockets on posix arch #54996

cfriedt opened this issue Feb 20, 2023 · 0 comments · Fixed by #55760
Assignees
Labels
area: native port Host native arch port (native_sim) area: Networking area: POSIX POSIX API Library bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@cfriedt
Copy link
Member

cfriedt commented Feb 20, 2023

Describe the bug
Encountered in #54747, fcntl() does not seem to be working on socketpair()-provided sockets with CONFIG_ARCH_POSIX.

The result is that non-blocking I/O on socketpair()-provided sockets are non-functional (but only on native_posix and related ARCH_POSIX boards).

Please also mention any information which could help others to understand
the problem you're facing:

  • What target platform are you using?: native_posix, native_posix_64, nrf52_bsim.
  • What have you tried to diagnose or workaround this issue?: skipped tests with the known bad configuration in tests: net: socketpair: clean up tests and provide coverage for all libcs #54747
  • Is this a regression? Who knows at this point. It's likely that socketpair worked on native_posix originally because we were linking it in from the native libc. If there was a regression, then it was caused by the massive workaround for splitting networking off to run under native_posix and making CONFIG_ARCH_POSIX and CONFIG_POSIX_API mutually exclusive. But that in itself was just fixing issues with which code paths were actually linked-in (i.e. not mixing native posix and zephyr system calls).
  • ...

To Reproduce
Steps to reproduce the behavior:

  1. Remove blocks containing ztest_test_skip() added in tests: net: socketpair: clean up tests and provide coverage for all libcs #54747
  2. west build -p auto -b native_posix tests/net/sockets/socketpair
  3. See error

Expected behavior
Test cases should pass and non-blocking I/O on socketpair sockets under native_posix should be supported.

Impact
Non-blocking I/O on socketpair sockets under native_posix are not supported until this is fixed.

In the larger scope, this is just one of many issues that need to be fixed to support CONFIG_POSIX_API under CONFIG_ARCH_POSIX.

Logs and console output

*** Booting Zephyr OS build zephyr-v3.3.0-196-g4c70a99d0a0f ***
Running TESTSUITE net_socketpair
===================================================================
START - AF_LOCAL__SOCK_STREAM__0
 PASS - AF_LOCAL__SOCK_STREAM__0 in 0.000 seconds
===================================================================
START - AF_UNIX__SOCK_STREAM__0
 PASS - AF_UNIX__SOCK_STREAM__0 in 0.000 seconds
===================================================================
START - close_one_end_and_read_from_the_other
 PASS - close_one_end_and_read_from_the_other in 0.000 seconds
===================================================================
START - close_one_end_and_write_to_the_other
 PASS - close_one_end_and_write_to_the_other in 0.000 seconds
===================================================================
START - expected_failures
 PASS - expected_failures in 0.000 seconds
===================================================================
START - poll_close_remote_end_POLLIN
 PASS - poll_close_remote_end_POLLIN in 1.010 seconds
===================================================================
START - poll_close_remote_end_POLLOUT
 PASS - poll_close_remote_end_POLLOUT in 1.010 seconds
===================================================================
START - poll_delayed_data
 PASS - poll_delayed_data in 0.220 seconds
===================================================================
START - poll_immediate_data
 PASS - poll_immediate_data in 0.000 seconds
===================================================================
START - poll_signalling_POLLIN
 PASS - poll_signalling_POLLIN in 0.000 seconds
===================================================================
START - poll_signalling_POLLOUT
 PASS - poll_signalling_POLLOUT in 0.000 seconds
===================================================================
START - poll_timeout
 PASS - poll_timeout in 0.040 seconds
===================================================================
START - poll_timeout_nonblocking
 PASS - poll_timeout_nonblocking in 0.040 seconds
===================================================================
START - read_block
 PASS - read_block in 0.220 seconds
===================================================================
START - read_nonblock
non-blocking socketpair I/O is unsupported with CONFIG_ARCH_POSIX
 SKIP - read_nonblock in 0.000 seconds
===================================================================
START - unsupported_calls
 PASS - unsupported_calls in 0.000 seconds
===================================================================
START - write_block
 PASS - write_block in 0.000 seconds
===================================================================
START - write_nonblock
non-blocking socketpair I/O is unsupported with CONFIG_ARCH_POSIX
 SKIP - write_nonblock in 0.000 seconds
===================================================================
START - zsock_fcntl_wrapper
non-blocking socketpair I/O is unsupported with CONFIG_ARCH_POSIX

    Assertion failed at WEST_TOPDIR/zephyr/tests/net/socket/socketpair/src/fcntl.c:38: net_socketpair_zsock_fcntl_wrapper: (res ^ flags not equal to O_NONBLOCK)
expected O_NONBLOCK set
 FAIL - zsock_fcntl_wrapper in 0.000 seconds
===================================================================
TESTSUITE net_socketpair failed.

------ TESTSUITE SUMMARY START ------

SUITE FAIL -  94.12% [net_socketpair]: pass = 16, fail = 1, skip = 2, total = 19 duration = 2.540 seconds
 - PASS - [net_socketpair.AF_LOCAL__SOCK_STREAM__0] duration = 0.000 seconds
 - PASS - [net_socketpair.AF_UNIX__SOCK_STREAM__0] duration = 0.000 seconds
 - PASS - [net_socketpair.close_one_end_and_read_from_the_other] duration = 0.000 seconds
 - PASS - [net_socketpair.close_one_end_and_write_to_the_other] duration = 0.000 seconds
 - PASS - [net_socketpair.expected_failures] duration = 0.000 seconds
 - PASS - [net_socketpair.poll_close_remote_end_POLLIN] duration = 1.010 seconds
 - PASS - [net_socketpair.poll_close_remote_end_POLLOUT] duration = 1.010 seconds
 - PASS - [net_socketpair.poll_delayed_data] duration = 0.220 seconds
 - PASS - [net_socketpair.poll_immediate_data] duration = 0.000 seconds
 - PASS - [net_socketpair.poll_signalling_POLLIN] duration = 0.000 seconds
 - PASS - [net_socketpair.poll_signalling_POLLOUT] duration = 0.000 seconds
 - PASS - [net_socketpair.poll_timeout] duration = 0.040 seconds
 - PASS - [net_socketpair.poll_timeout_nonblocking] duration = 0.040 seconds
 - PASS - [net_socketpair.read_block] duration = 0.220 seconds
 - SKIP - [net_socketpair.read_nonblock] duration = 0.000 seconds
 - PASS - [net_socketpair.unsupported_calls] duration = 0.000 seconds
 - PASS - [net_socketpair.write_block] duration = 0.000 seconds
 - SKIP - [net_socketpair.write_nonblock] duration = 0.000 seconds
 - FAIL - [net_socketpair.zsock_fcntl_wrapper] duration = 0.000 seconds

------ TESTSUITE SUMMARY END ------

===================================================================
PROJECT EXECUTION FAILED

Environment (please complete the following information):

  • OS: (e.g. Linux, MacOS, Windows): Linux
  • Toolchain (e.g Zephyr SDK, ...): Zephyr SDK v0.15.2
  • Commit SHA or Version used: 4c70a99

Additional context
This is one of many other conflicts that exist between CONFIG_ARCH_POSIX and CONFIG_POSIX_API and should be addressed along with LTSv3 RoadMap.

Also, socketpair() will be continue to be marked as experimental until it is stable on native_posix.

@cfriedt cfriedt added the bug The issue is a bug, or the PR is fixing a bug label Feb 20, 2023
@cfriedt cfriedt self-assigned this Feb 20, 2023
@cfriedt cfriedt added area: POSIX POSIX API Library area: native port Host native arch port (native_sim) area: Networking priority: low Low impact/importance bug labels Feb 20, 2023
This was referenced Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: native port Host native arch port (native_sim) area: Networking area: POSIX POSIX API Library bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant