srg-imperial / SaBRe

Load-time selective binary rewriting
Other
152 stars 16 forks source link

Disable ARCH_SET_FS handling to the plugin #51

Closed andronat closed 4 years ago

andronat commented 4 years ago

We can't forward ARCH_SET_FS to the plugin. If the plugin uses locks through pthreads or malloc the plugin will segfault, this is because these libraries secretly use the TLS and the FS register. So when we switch the FS register above the plugin will be using the application's pthreads which might be uninitialized and thus segfault.

Remember! The plugin (for now) always needs to enter with the SaBRe FS.

Optional: To allow the plugin to be aware of this syscall as special hook needs to be introduced that notifies the plugin about the switch only after the switch is done.

ccadar commented 4 years ago

Thanks, @andronat -- I also liked the comment you added that justifies the decision.