python-greenlet / greenlet

Lightweight in-process concurrent programming
Other
1.65k stars 248 forks source link

Support running under address-sanitizer #367

Open dmbaggett opened 1 year ago

dmbaggett commented 1 year ago

In https://github.com/python-greenlet/greenlet/issues/113 and https://github.com/gevent/gevent/issues/1928 various approaches are discussed to get gevent-based programs running under address-sanitizer, either by using https://github.com/tbodt/greenstack or via an update to gevent to use a different concurrency mechanism.

Unfortunately the greenstack fork is quite old and no longer compiles under recent versions of Python, and the greenlet code itself has massively diverged since that fork.

Is anyone aware of any effort to get gevent/greenlet based code running under ASan? I can't even seem to figure out a set of -fno-sanitize compile options that will just disable all the stack checks.

If anybody is up for the challenge, I'd be willing to contribute monetarily to get ASan support as a greenlet compile-time option or similar. @tbodt maybe?

jamadden commented 1 year ago

Perhaps that's the wrong gevent issue? I didn't spot anything about address sanitizers there. The discussion of a different stack-switching algorithm was from a (theoretical) performance perspective.

I have done no work in this area and likely will not have time to in the forseeable future. I am not aware of any other work.

dmbaggett commented 1 year ago

@jamadden sorry, it's a bit confusing; the gevent issue isn't about sanitizers per se, but about another way to implement coroutines (in that case, via Python generators). Such an implementation would also allow for use with debugging tools that check for stack corruption.