[issue29335] subprocess module does not check WIFSTOPPED on SIGCHLD

2017-01-23 Thread Zach Riggle
Zach Riggle added the comment: Neat, though that's not in the standard library. The current logic for getting a handle to libc could also be simplified via ctypes.util.find_library (https://docs.python.org/3/library/ctypes.html#finding-shared-libraries). Darwin: >>> import ct

[issue29335] subprocess module does not check WIFSTOPPED on SIGCHLD

2017-01-23 Thread Zach Riggle
Zach Riggle added the comment: Of note, there's no need to actually cause a SIGSEGV to generate the signal. The tests might be more clear to replace: libc.printf(ctypes.c_char_p(0xdeadbeef)) with os.kill(os.getpid(), signal.SIGSEGV

[issue29335] Python 2.7 subprocess module does not check WIFSTOPPED on SIGCHLD

2017-01-21 Thread Zach Riggle
Zach Riggle added the comment: To further clarify the report: When the attached proof-of-concept is executed, a RuntimeException is raised, which has a comment "Should never happen". The issue isn't due to SIGCHLD, but rather following a waitpid() call. The code attempts to sus

[issue29335] Python 2.7 subprocess module does not check WIFSTOPPED on SIGCHLD

2017-01-20 Thread Zach Riggle
New submission from Zach Riggle: The attached script hits some "This should never happen" code in the subprocess module. These lines here: https://github.com/python/cpython/blob/2.7/Lib/subprocess.py#L1036-L1038 The root cause is a lack of checking WIFSTOPPED and WSTOPSIG in t