Skip to content

Fix TCP_PSP_LISTENER EINVAL crash and PSP loopback deadlocks#101

Open
mejebak wants to merge 1 commit into
google:masterfrom
mejebak:master
Open

Fix TCP_PSP_LISTENER EINVAL crash and PSP loopback deadlocks#101
mejebak wants to merge 1 commit into
google:masterfrom
mejebak:master

Conversation

@mejebak

@mejebak mejebak commented Jun 4, 2026

Copy link
Copy Markdown

This PR addresses two issues with PSP listener sockets:

  1. TCP_PSP_LISTENER size mismatch on AnyIP bindings: Newer kernels expect a 40-byte psp_spi_addr_tuple when binding a listening socket to a wildcard address, causing getsockopt to fail with EINVAL when passing the legacy 24-byte psp_spi_tuple. This implements a fallback loop to dynamically handle both sizes.
  2. Timing race and deadlocks in PSP loopback: Resolves a data race in the PSP key receptionist thread by introducing a dedicated psp_listeners_lock to protect the listeners array (isolating it from psp_key_lock) and adding a 5-second wait in get_listen_fd() to ensure the client's requested port is registered before lookup."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant