You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thunking libc itself has the potential to make thunking other libraries significantly more robust by making various workarounds unnecessary (see #1208). Here's an (incomplete) list of nontrivial things that need to be tackled:
errno is a data symbol exported by libc.so, written to by many (but not all) libc functions on error (and written to by guest application to "reset" errors). When thunking libc, the problem that arises is that the errno symbol exposed by thunked libc to guest applications is a different symbol than the native errno symbol that host libc functions write to. Unless we find magic to allow for sharing the same data symbol, some mechanism to synchronize the value between the two data symbols is needed.
A lot of functions set errno, so a scalable approach is needed for synchronizing the native/thunk errno values. Here are some potential options to handle this:
Brute-force synchronize errno before/after every libc function
Add a thunkgen annotation to mark functions that potentially set errno and autogenerate synchronization code for annotated functions, only
memprotect the errno symbol to catch reads/writes by the guest applications in a SIGSEV handler and synchronize on-demand
Use a custom dynamic loader that relocates matching data symbols where possible given ABI compatibility constraints
Thunking libc itself has the potential to make thunking other libraries significantly more robust by making various workarounds unnecessary (see #1208). Here's an (incomplete) list of nontrivial things that need to be tackled:
__libc_start_main
)printf
-like functions (including fprintf, sprintf, snprintf, vprintf, ...)qsort
)errno
optarg
/optind
/opterr
/optopt
stat
)__lxstat
/__fxstat
/...: Data layout of parameter struct is determined by a version fieldThe text was updated successfully, but these errors were encountered: