Skip to content
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

tests/net/socket/socketpair appears to mis-use work queue APIs #30072

Closed
pabigot opened this issue Nov 16, 2020 · 1 comment · Fixed by #30110
Closed

tests/net/socket/socketpair appears to mis-use work queue APIs #30072

pabigot opened this issue Nov 16, 2020 · 1 comment · Fixed by #30110
Assignees
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@pabigot
Copy link
Collaborator

pabigot commented Nov 16, 2020

The only in-tree use of k_work_submit_to_user_queue() outside of its own unit tests and a footprint test is in tests/net/socket/socketpair.

In that test the queue to which items are submitted is not a user queue: it was created with k_work_q_start() rather than k_work_q_user_start(). Certain permissions on queue internal fields were granted to make the test work.

Since the entire test uses user unit tests, it's not clear whether this was meant to be a non-user test that just verifies socketpair, or was truly intended to show that the socketpair API works from both privileged and user contexts.

In any case mixing the user-mode API to submit work items with the privileged mode API to define a work queue is confusing. The test should be reworked to use one or the other.

@pabigot pabigot added the bug The issue is a bug, or the PR is fixing a bug label Nov 16, 2020
@nashif nashif added the priority: medium Medium impact/importance bug label Nov 17, 2020
@pabigot pabigot self-assigned this Nov 18, 2020
@cfriedt
Copy link
Member

cfriedt commented Nov 20, 2020

Yeah, this one is tricky because it should work in both kernel and user space, but as you mentioned in #30110, there is currently no way to create a kernel object in a user thread but then grant permissions to another user thread to use that kernel object (afaik).

Normally, a set of file descriptors is given on a per-process / per-address-space context. Then, of course, the socket / file backend would need to map individual per-process file descriptors to the global file table.

Currently we use a global file table and global set of file descriptors in Zephyr. It's unclear as to whether any changes are planned for the socket / file backend (afaik).

Thanks for fixing the test @pabigot ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants