-
-
Notifications
You must be signed in to change notification settings - Fork 605
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
page_fault on lockfree::mutex::lock() #936
Comments
does there have bug in SOCK_UNLOCK(so) and sodealloc?
|
For future reference, please run in gdb "osv syms" to have the symbols in your own code (frames 16-18) also decoded, so you'll know what called "dup3" in your code. Refer to https://github.com/cloudius-systems/osv/wiki/Debugging-OSv which explains "osv syms" and other issues of debugging in OSv. Anyway, this definitely looks like an OSv bug: In frame 15, dup3() is closing an old file descriptor 189 which it found to be open. This ends up calling soclose() (frame 12) because the old file descriptor was a socket. soclose() notices (in frame 12) that this is a listening socket (listen() was called for it), and finds in so_comp a new connection which the kernel already established, but the application hasn't accept()ed yet, and wants to abort this connection (since after closing the listening socket, the application can never accept it). By calling (see bsd/sys/kern/uipc_socket.cc:655) soabort() on the new connection. soabort(sp) starts by trying to lock new socket, using the socket's "mutex* so_mtx" filed. Here is where I stopped investigating, maybe you can help me continue - when is the inpcb supposed to be created, only later when the connection is accept()ed? Maybe we changed this order as part of the Van-Jacobson reorganization of the code, and forgot to fix this case? In any case, I think as a quick workaround, you can modify soabort() in bsd/sys/kern/uipc_socket.cc:705, instead of SOCK_LOCK(so), do something like if (SOCK_MTX(so))
SOCK_LOCK(so) You'll also need to change sofree(), same file, from SOCK_LOCK_ASSERT(so) to if (SOCK_MTX(so))
SOCK_LOCK_ASSERT(so) and potentially in additional places in sofree() which locks and unlocks so. Even if this works, the question becomes whether it is ok that the connected by un-accepted connection has a nullptr lock. This needs to be further investigated. I'm assuming that a connection that has never been accept()ed doesn't need any locking. Obviously, the application cannot be using it because it never accepted it. But could the kernel be using it internally at this point? It is really ok that we don't have a lock for it? |
Maybe this discussion, of a double free in soabort(), is related? https://groups.google.com/d/msg/osv-dev/uOv1057u5Q0/xTBFvyucCQAJ |
i try to porting shop center to osv, but it failed
The text was updated successfully, but these errors were encountered: