When I moved these functions, I failed to move some of the symbol
versions.
Fixes: 29d079c96491 libsys: move __libsys_interposer consumers
Differential D44111
lib{c,sys}: expose __libsys_interposer consumers brooks on Feb 27 2024, 6:07 PM. Authored by Tags None Referenced Files
Subscribers
Details
When I moved these functions, I failed to move some of the symbol Fixes: 29d079c96491 libsys: move __libsys_interposer consumers
Diff Detail
Event TimelineComment Actions I think it is backward. I do not see a reason to have these live in libsys, esp. they 'fat' C implementation. Placing them in libc is more logical IMO, and it seems that the only reason they were attempted to be moved to libsys is use of the __libsys_interposed array. with __libsys_interposed_slot() you can place them in libc trivially, same as I handled sleep/usleep(3). Comment Actions Looking into it more, I'm less certain this is the right take. These are all thin wrappers that would now get a little more expensive due to an extra function call. More importantly, why should interposed system calls have their <sys>() interface provided by libc, when non-interposed ones come from libsys since they are the same as _<sys>() and __sys_<sys>()? Conceivably we could generate <sys>() for non-interposed ones if we really want to go that route, but I'm not excited by doing that. (Note that this review only fixes the ones where I messed up the move by not moving symbol map entries, there are another ~38 of them that were previously in lib/libc/sys and thus already handled.) Comment Actions One argument in favor of moving all the interposed functions back to libc is that this review stack effectively reverts rGbd6060a1c661b3. I find the log message for that commit frustrating as it doesn't describe the reported issue (correctness, performance, ???), only the change. Comment Actions The commit message is quite explicit explaining the breakage (libthr interposition of the signal handlers was overwritten, which makes libthr critical sections nonoperational and cancellation broken among other things). My take is ideally libsys.so should only export 'real' syscalls, and anything that is handled by intermediate code (e.g. interposed) should be left to upper layers e.g. libc. But this is too much for this stage, so we moved some interpositions into libsys. The sys_XXX symbol movement reflects that, and since both libsys and sys_XXX are implementation details, it is fine. After we fix and harden the current libsys extraction step, we could re-visit that. We must do something before we claim libsys is part of the ABI. Additional argument is that all the 'syscalls' like open/wait/etc are no longer syscalls, they forward the call to more generic openat/waitid. |