OSDN Git Service

Preserve x18 while calling aptX encoder libraries.
authorPeter Collingbourne <pcc@google.com>
Mon, 19 Nov 2018 20:58:18 +0000 (12:58 -0800)
committerPeter Collingbourne <pcc@google.com>
Thu, 6 Dec 2018 22:14:40 +0000 (22:14 +0000)
commit8a25a1756b5600ea65134fe8f7729228ad8c535f
treed70b8c894b68a1b26d5bc8f7a2bea4530120da3d
parente72c597aa7b936a163d0fe027d33339a5603d9be
Preserve x18 while calling aptX encoder libraries.

Shadow call stack (SCS) is a security mitigation that uses a
separate stack (the SCS) for return addresses. In versions of
Android newer than P, the compiler normally cooperates with the
system to ensure that the SCS address is always stored in register
x18. This requires that everything in a process that uses SCS is
built with -ffixed-x18. However, two libraries (libaptX_encoder.so
and libaptXHD_encoder.so) are supplied in binary format and were
not compiled with -ffixed-x18. We are working with the vendor to get
these libraries rebuilt with -ffixed-x18, but until then, we need to
prevent this library from clobbering x18 so that we can turn on SCS
in the Bluetooth process.

Bug: 112907825
Bug: 120621517
Change-Id: Id27829ed5696903c42b4aeb75c3b3880c97a3a36
common/scoped_scs_exit.h [new file with mode: 0644]
stack/a2dp/a2dp_vendor_aptx_encoder.cc
stack/a2dp/a2dp_vendor_aptx_hd_encoder.cc