Skip to content

Cohabitation of two glibc

Paul-Antoine Arras edited this page Jan 10, 2019 · 1 revision

Once the client has been loaded, 2 libc copies are present in memory. This raises a couple of issues, the most pressing being the duplication of the TLS: each of the loader and the client has its own. However no two TLS can be used simultaneously in a single process.

Currently, SaBRe does the following:

  • during load time, it switches to its own TLS whenever a handler is invoked
  • during regular run time, only the client TLS is used even by the loader and the plugin
  • it uses a custom malloc implementation to allocate memory in a separate arena
  • it disables the stack protector in functions that switch TLS and allocate buffers larger than 8 bytes

Unfortunately, it is not safe for SaBRe to use the client TLS during normal run time. In some circumstances, it could overwrite data needed by the client. However systematically switching TLS (as we already do during load time), though generally cleaner, would break as soon as a clone syscall is issued because only one TLS would be set up by libc anyway.

Clone this wiki locally