Hi Yicong,

On 28 May 2015 at 17:09, Yicong Huang <hengha....@gmail.com> wrote:
> To achieve this purpose, here are my plans:
> 1. Write a builtin RPython module 'criticalsection', because I thought only
> builtin RPython module could be used for existed builtin RPython module
> 2. For the list of builtin functions that we might block, add the code in
> the begining of those functions, e.g.
>
> def epoll:
>     if criticalsection.isInCriticalSection() and
> criticalsection.block('select.epoll')
>          return None
>     ... the original code...

How about this pure Python solution, which would give the equivalent
level of security (i.e., okish against naive code, but no hard
security against a motivated attacker):

def just_returns_none(*args, **kwds):
    return None

def enter_critical_section():
    socket.epoll = just_returns_none

original_socket_epoll = socket.epoll

def leave_criticial_section():
    socket.epoll = original_socket_epoll


A bientôt,

Armin.
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to