OSDN Git Service

Sanitize InputMessage before sending
authorSiarhei Vishniakou <svv@google.com>
Sat, 17 Nov 2018 06:18:53 +0000 (22:18 -0800)
committerandroid-build-team Robot <android-build-team-robot@google.com>
Wed, 16 Jan 2019 18:56:06 +0000 (18:56 +0000)
commit81973118791ebdfa5fd2be811e1bfdebfc9324ab
treebe8fcf9e5e79e023583b57cbc9cb09b444d04e23
parent0a91c46726431874f254b01645814485be1b8b18
Sanitize InputMessage before sending

The struct InputMessage has many fields, and is force-aligned to 8-byte
boundaries. There are also some padding fields that carry no
information.

This struct is typically allocated in the stack and populated with
various values before being sent across as a stream of bytes through the
socket.

Therefore, the "unused" data portions of the struct could contain
portions of the stack, since there aren't ever writes to those memory
locations.

To avoid this information leak, forcefully sanitize the struct. Create a
new struct that is explicitly set to zero. Next, only fill the
meaningful fields manually.

Bug: 115739809
Test: cts-tradefed run cts -m CtsSecurityBulletinHostTestCases -t android.security.cts.Poc18_12; adb shell monkey 100000
Change-Id: I7e44dacf1e8fa3156c8e4d2f7784ef0c53dab507
Merged-In: I7e44dacf1e8fa3156c8e4d2f7784ef0c53dab507
(cherry picked from commit e730f5aaa1c726ee9998a080e2d7f6284f4afec8)
include/input/InputTransport.h
libs/input/InputTransport.cpp
libs/input/tests/StructLayout_test.cpp