History log of /system/bt/btif/src/btif_mce.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
3f06e14fddc0e674347ae28ea4a25218d4ce1d2a 10-Nov-2015 Pavlin Radoslavov <pavlin@google.com> Fix SIGBUS crash when copying data

We have the following memory alignment-related issue, that seems
to be architecture/compiler/memcpy(3) specific.

Within struct tBTIF_CONTEXT_SWITCH_CBACK, the beginning of the
zero-length array "char p_param[]" is not aligned (because of the
struct internals).
However, this p_param pointer is casted within function
btif_gattc_deep_copy() to the struct pointer (btif_adv_data_t *).
By definition, the memory pointed to by such pointer is suppose
to be aligned:

btif_adv_data_t *dst = (btif_adv_data_t*) p_dest;

It seems that on some architectures/compilers the executed memcpy()
instructions are optimized for such memory alignment.
If the memory was not aligned, we get SIGBUS.

Apparently, just using (void *) casting for the memcpy() destination,
avoids using the optimized memory aligned instructions:
memcpy((void *)dst, src, ...);

The solutions are twofold:
* Make sure that "char p_param[]" within struct
tBTIF_CONTEXT_SWITCH_CBACK is aligned. Otherwise, the casting
to "(btif_adv_data_t*)" can be problematic.
* Add (void *) casting to all memcpy() calls which might be
referring to such mis-aligned memory.
This is done by using the new macro maybe_non_aligned_memcpy()
in all places that such casting might be needed.

Either solution is sufficient to prevent the crash as identified in
this particular case. We need to apply both solutions, to reduce the
chance of running again into a similar issue.

Bug: 25601669
Change-Id: I6c49645c00f10c594a5d1e53a9fac202c506657c
/system/bt/btif/src/btif_mce.c
49a86709488e5cfd5e23759da18bf9613e15b04d 08-Jul-2015 Marie Janssen <jamuraa@google.com> build: LOG_TAG consistency, include order, build fixes

Fix the order of includes across a bunch of files, and declare LOG_TAG
at the top of every file in which it is used.

Consistently use bt_ as a LOG_TAG prefix.
Fix issues with LOG macro usage.
Remove unused includes and double-includes (when in related .h)

Add includes as necessary to compile cleanly (problems surfaced by
reordering includes)

Change-Id: Ic55520c8302b06bbc1942c10c448b20844669da6
/system/bt/btif/src/btif_mce.c
e1a9e52ff59d36bd1bb5b7b3a02fafba6394edfe 31-Mar-2015 Etan Cohen <etancohen@google.com> Merge commit 'f7f839985b3931682363d2ef3b7c5cae55a842ee' into merge

Change-Id: Iaaec1ea0bf3009b7e32a9a60f697631a3f56e889
f8027005333c88a2f097cfd70d15c3d54c7764ae 12-Mar-2015 Chris Manton <cmanton@google.com> Demote, cleanup and extend observed logging
/system/bt/btif/src/btif_mce.c
95b74f252f534ec757aab1fc08e086e02b2cfe8d 12-Mar-2015 Sharvil Nanavati <sharvil@google.com> Use fully qualified path for btcore includes.
/system/bt/btif/src/btif_mce.c
794f3b5f126fffc3dd1129a710187591348bbf23 01-Oct-2014 Chris Manton <cmanton@google.com> Removal of bd.[c|h]

Consolidate legacy types into bt_types.h
/system/bt/btif/src/btif_mce.c
8a6a89faa942aed4f176b0c98402d01c8bdd6aa6 20-Aug-2014 Sharvil Nanavati <sharvil@google.com> Introduce btcore, a low-level library to manipulate Bluetooth data types.

This change adds a single module to btcore: bdaddr. The bdaddr module
is reponsible for manipulating and working with Bluetooth addresses.
/system/bt/btif/src/btif_mce.c
c7503db23f91676b2df732becb9579d5ccdcc7a7 24-Jan-2015 Ian Coolidge <icoolidge@google.com> Fix omitted libc includes.

Change-Id: I72c08984aeef60e4833e600b4351759b9687a014
/system/bt/btif/src/btif_mce.c
2dc999935d4c69ae31ea93d9014165965dd373d6 17-Apr-2014 Hemant Gupta <hemantg@codeaurora.org> Bluetooth: Support MAP Client role on Bluedroid.

Implementation changes from BTA and BTIF layer to support
MCE role on Bluedroid stack.

Change-Id: I8547b0f28338e83edabae969121872ca23fdcb36
/system/bt/btif/src/btif_mce.c