Do I correctly assume that pseudo_client_op() has to be fully reentrant?
No. It's never been even a tiny bit reentrant. We used to do the allocate and free thing, and it was incredibly expensive, and the nature of the thing requires confidence that we never, ever, have more than one thing writing and reading over the socket at a time, so it's just Not Reentrant. During one call to pseudo_client_op, there will never be another, and all the IPC stuff uses a single consistent local buffer that it returns the address of.
Declaring that as static without changing the initializer would indeed break everything -- we rely on the initializer working. Changing it to static means it only gets initialized once...
would probably be fine, because then it'd be initialized. Otherwise, we'd get failures when msg got overwritten and reused.
Or just changing `result = &msg` to something like `result = &xattrdb_data`, which would be nonsensical but it turns out not to matter, as the only caller that reaches this case is the caller that's just checking yes/no "is the return value not a null pointer".
If the caller only cares about yes/no then how about returning 1/0 instead of a pointer?