Build libui and libgui with -std=c++1z
This works around an issue reported with address sanitizer involving std::shared_ptr<FenceTime> instances created by pre-C++17 compiled code, and destroyed by C++17 compiled SurfaceFlinger. The address sanitizer was complaining that there was a new/delete alignment mismatch, where the instances were allocated with default alignment, and destroyed with an 8-byte alignment requirement. Starting with C++17, new and delete now have versions that take an std::align_val_t argument that indicates the alignment of the allocation. The address sanitizer is verifying that the call to new matches the call to delete, and reports an error if it does not. The C++17 standard says that the compiler should behave in a way that is backwards compatible. In this case, FenceTime declares class-specific new and delete functions, and normally those would be used. Except that the current libc++ version of std::shared_ptr does not! It instead uses its own calls to allocate memory, and does a placement-new to actually create the FenceTime instance it shares. Unfortunately the version of new and delete called depends on whether it is compiled for C++17 or not. To make the address sanitizer happy, we can just build libui and libgui with -std=c++1z, which as a bonus allows the class-specific new to be removed. (Reproducing the failure requires a not-yet submitted CL which adds test coverage for composition calls, and another change to enable address sanitizer on the unit test) Bug: None Test: atest libsurfaceflinger_unittest Change-Id: I2321bbdbf64a8a068ba2b5ed73013ddd2fa6c32e
Loading
Please register or sign in to comment