Florin Papa added the comment:

Hi all,

Our latest effort on enabling MPX in CPython has concentrated around 
eliminating all INIT_BOUNDS and BND_LEGACY attributes that are used to bypass 
bounds checking for certain pointers. In order to avoid using these attributes, 
we needed to find and fix the root cause of the problems. The main issue was 
represented by the small object allocator (Objects/obmalloc.c), which was 
performing some operations that MPX considered unsafe (pointer jumping). A 
similar problem was found in the allocator used by the garbage collection 
module (Modules/gcmodule.c). These issues, as well as other minor operations 
considered unsafe by MPX (Objects/listobject.c, Objects/dictobject.c) have been 
addressed so far.

As a result, we were able to eliminate all INIT_BOUNDS and BND_LEGACY 
attributes from the code. Also, we identified the optimization flag that caused 
crashes when compiling with –O3, which is –fipa-icf. Compiling with “-O3 
–fno-ipa-icf” now works fine. The entire regrtest suite passes, except 
test_capi and test_faulthandler. Test_capi fails because of a “\n” outputted by 
the MPX runtime at stdout instead of stderr (fixed in the GCC 6 trunk). 
Test_faulthandler fails because we have disabled the faulthandler module when 
MPX is active, as it produced crashes since both the faulthandler and the MPX 
runtime overwrite the default SIGSEGV handler and the new handlers would 
interfere with each other.

The current patch works on GCC 5.3.0, which solves a linking problem with 
libmpx, present in GCC 5.2.1. We still have some problems, such as bounds 
warnings that only appear once in 10 runs for a few of the tests, but do not 
cause crashes or failed tests. The biggest problem we face is the presence of 
pointers that do not have bounds. These could be the result of some bugs we 
found in MPX:

    1. Calling strlen and memset (possibly others) for the first time in a 
program will not be subject to MPX checks
    2.Copying an array of pointers to a new location will reset the first 
pointer’s bounds (deep copy of the pointer bounds fails)
The first problem was solved by upgrading ldd to version 2.22, while the second 
issue will be solved by the GCC 6 release (around April 2016), which will offer 
more stable support for MPX.

Therefore, we have decided to wait until the GCC 6 release to provide a final 
version of the MPX patch for CPython. Meanwhile, you can see the latest 
modifications we have made in the patch attached.

Thank you,
Florin Papa

----------
Added file: http://bugs.python.org/file41781/mpx_enable_3_6_v7.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25300>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to