libpdx_uds: Handle EACCES error when connecting to PDX service
There is a race condition in the way init process creates socket files before it forks into a child (see system/core/init/util.cpp, function create_socket()). It first creates a socket, then calls bind() which creates a file entry, then calls chown/chmod to change ownership and access permissions of that file object. If a client process connects to the socket just after bind() was called but before chmod(), the socket file will have incorrect permissions and the connect call will be aborted with EACCESS (Permission denied) error. We should retry connection in case we get EACCESS. A proper fix would be is to find a way for init to create the file entry with the proper permissions to start with, and eliminate the race condition altogether. Bug: 37171113 Test: `lunch sailfish-eng && m -j32` succeeds Device boots correctly. Error recovery is handled correctly even after adding sleep(5) to init process just before calling chmod on the socket. Change-Id: If97c316daa0c0be5ff7b5aa302a69aa60e9fb237
Loading
Please register or sign in to comment