History log of /frameworks/native/libs/binder/Parcel.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
1967749cdcbec29a6058206104e232480253fa7d 19-May-2017 Michael Wachenschwanz <mwachens@google.com> Merge "DO NOT MERGE Revert "Logging for catching memory issue in Parcel"" into oc-dev
a6541637a8a5bf55899564df79b7a14e8029fed3 19-May-2017 Michael Wachenschwanz <mwachens@google.com> DO NOT MERGE Revert "Logging for catching memory issue in Parcel"

This reverts commit c65de59762cfc284bd203d97281f5a8f86aba877.

Bug: 37298089
Change-Id: Ib42d27f91bf1408d633a98e6ac7f316175f1e289
/frameworks/native/libs/binder/Parcel.cpp
c8ddb0171f85a26fcd7e7dec43317c301b452076 11-May-2017 Michael Wachenschwanz <mwachens@google.com> Merge "Logging for catching memory issue in Parcel" into oc-dev
c65de59762cfc284bd203d97281f5a8f86aba877 08-May-2017 Michael Wachenschwanz <mwachens@google.com> Logging for catching memory issue in Parcel

Added a check to catch a bug that is suspected to lead to a segfault
during GC. Actual fix for the bug is commented and will be checked in
once the flow that is hitting the bug is uncoverered

Bug: 37298089
Test: manual

Change-Id: I68dea02566a9e9375e3a09d4cc19e39379d84747
Signed-off-by: Michael Wachenschwanz <mwachens@google.com>
/frameworks/native/libs/binder/Parcel.cpp
2b6317436d2035ce98331906aaaca87e6026c9c8 05-May-2017 Martijn Coenen <maco@google.com> Correctly set minimum priority on nodes.

It looks like libbinder has always set the minimum priority
for a node to 0x7f (127). This is an invalid value as far
as the kernel is concerned, since the current driver only
accepts positive nice values (0..19). The effect of using
0xf7 is that the nice value was clamped to MAX_NICE (19) -
so effectively the kernel never raised the priority
based on the min_priority setting of a node. Correct this
by just using MAX_NICE directly.

Additionally, a recent change removed the use of the
gDisableBackgroundScheduling flag, which system_server
used to make sure that incoming transactions were not
executed at a lower priority. That behavior is actually
still desired, so this change sets the min_priorirty
value to 0 for processes that have requested background
scheduling to be disabled. The effect of that is that
all transactions into those nodes will be executed with
a priority of at least nice 0 (and potentially higher,
depending on the priority of the caller).

Bug: 37677242
Test: verified /d/binder output
Change-Id: I7cbfd309d04cbd052f868fbfe0930529ff21a48a
/frameworks/native/libs/binder/Parcel.cpp
15feb9b55a0ea1d4a4e21a6425965b1004fdbc8b 11-Apr-2017 Dianne Hackborn <hackbod@google.com> Add private helpers needed for job queue.

We need to compare the data in parcels. Bleah.

Test: not relevant here.

Change-Id: I7b694ec89793449bf7ac342f663dc534feedf9b6
/frameworks/native/libs/binder/Parcel.cpp
6316f5b8df30422b247c2bfd1a805dcd4069b54e 04-Jan-2017 Robert Quattlebaum <rquattle@google.com> libbinder: Add support for Value, Map, and IpPrefix types

Change-Id: I4cd06c7c65f69e6b787111573b29c4ff22f57981
/frameworks/native/libs/binder/Parcel.cpp
ec9ec7d55c63f791ab3ed9221e68d6215f7b928a 18-Dec-2016 Nick Kralevich <nnk@google.com> libbinder: replace dup() with fcntl(F_DUPFD_CLOEXEC)

Replace calls to dup() with fcntl(F_DUPFD_CLOEXEC). The only difference
between the two is that O_CLOEXEC is set on the newly duped file
descriptor. This helps address file descriptor leaks crossing an exec()
boundary in multi-threaded processes, and potentially fixes the following
non-reproducible SELinux denials which may be occurring because of FD
leakage from netd to clatd/dnsmasq.

avc: denied { use } for comm="clatd" path="socket:[860297]" dev="sockfs"
ino=860297 scontext=u:r:clatd:s0 tcontext=u:r:untrusted_app:s0:c512,c768
tclass=fd permissive=0

avc: denied { read write } for comm="clatd" path="socket:[1414454]"
dev="sockfs" ino=1414454 scontext=u:r:clatd:s0
tcontext=u:r:system_server:s0 tclass=tcp_socket permissive=0

avc: denied { use } for comm="clatd" path="socket:[681600]" dev="sockfs"
ino=681600 scontext=u:r:clatd:s0 tcontext=u:r:priv_app:s0:c512,c768
tclass=fd permissive=0

Test: Device boots and no obvious problems
Change-Id: I9dcd9911a093f329c6f12e39d2c49ef3df651ae5
/frameworks/native/libs/binder/Parcel.cpp
442351128906471310730663613013ce7051dd18 03-Nov-2016 Christopher Tate <ctate@google.com> Correct overflow check in Parcel resize code

Bug 31929765

Change-Id: Ie27b9945f1de056624668869bdf9a5578abff467
/frameworks/native/libs/binder/Parcel.cpp
d84ff3143605f73b5fedb83d7db4224c6d4f1feb 21-Oct-2016 Fabien Sanglard <sanglardf@google.com> Fix fd leak in Binder

Bug: 29982873
Test: Ran poc executable provided with bug report. After this
patch, the device is able to use the Camera after the DoS attemp.

Change-Id: I5990a25c76e9d78616caec4fc98fb5547f37a0de
/frameworks/native/libs/binder/Parcel.cpp
1941a404d642b3dfaac365ba494f1e9912876f00 29-Aug-2016 Dianne Hackborn <hackbod@google.com> Introduce new command callback to shell.

This introduces a new feature of the IBinder command protocol
to allow the shell command implementation to call back into
its caller to ask it to open files in the calling context. This
is needed so that commands that have arguments specifying files
can open those files as the calling shell, not the system (or
whatever) process.

Test: Manual

Change-Id: Idd5b49ea21057864cc9cef816b3e4afbf01948fc
/frameworks/native/libs/binder/Parcel.cpp
433e87b221b871727c3bde70c600014b43776dcf 16-Sep-2016 Paul Lietar <lietar@google.com> binder: Replace use of resize()/memcpy() with reserve()/insert()

resize() zero initializes the vector even though data is about to be
copied to it. Moreover it does so with a loop rather than a memset.

Using reserve() and insert() is significantly faster with large
payloads, as it only has to allocate and memcpy.

Benchmarked using system/libhwbinder/tests/benchmarks

Before:
Benchmark Time CPU Iterations
-------------------------------------------------------------
BM_sendVec_binder/4k 89872 ns 45885 ns 15328
BM_sendVec_binder/8k 122753 ns 57713 ns 11667
BM_sendVec_binder/16k 163825 ns 88444 ns 7500
BM_sendVec_binder/32k 261942 ns 153561 ns 4667
BM_sendVec_binder/64k 558372 ns 318525 ns 2386

After:
Benchmark Time CPU Iterations
-------------------------------------------------------------
BM_sendVec_binder/4k 69052 ns 23111 ns 30000
BM_sendVec_binder/8k 71891 ns 25092 ns 27632
BM_sendVec_binder/16k 85439 ns 32822 ns 21429
BM_sendVec_binder/32k 115223 ns 43912 ns 15789
BM_sendVec_binder/64k 203960 ns 82667 ns 8750

Change-Id: Ie83c1d0a9da6f175ffd1a3fc9e0ecc6d542a909a
/frameworks/native/libs/binder/Parcel.cpp
57a58d9198640b138e8cc442eb1702dea5f2c829 25-Aug-2016 Mark Salyzyn <salyzyn@google.com> Merge "binder: use ashmem_valid()" am: b5ac868729 am: d7f671406c am: 9a057a99df
am: 10e15ecfb2

Change-Id: I3a280d4bfba4f2d8d5d5a909eda43ffa9e0d94bd
9a057a99dfbeaaa3160929049debdc5df8731021 25-Aug-2016 Mark Salyzyn <salyzyn@google.com> Merge "binder: use ashmem_valid()" am: b5ac868729
am: d7f671406c

Change-Id: I6567609d364e53628e174f3a3c91a6c9edd5ed20
8058936f866a16001f1894c0688f87bf5a6c76d9 24-Aug-2016 Mark Salyzyn <salyzyn@google.com> binder: use ashmem_valid()

Bug: 30310689
Change-Id: I38e2720843f1eebec39ce6c7d957ee9a1dafac59
/frameworks/native/libs/binder/Parcel.cpp
206c2b804ac67ed2f97df5646210608fdef6bf41 02-Aug-2016 Sergio Giro <sgiro@google.com> Merge "Unicode: specify destination length in utf8_to_utf16 methods"
f4607438f2df5f33c77d86e1b84db92af4f60f62 21-Jul-2016 Sergio Giro <sgiro@google.com> Unicode: specify destination length in utf8_to_utf16 methods

Change-Id: I5223caa7d42f4582a982609a898a02043265c6d3
/frameworks/native/libs/binder/Parcel.cpp
5064822c0131f8b252b18a3cfbedd82e8643854c 21-Jul-2016 Roshan Pius <rpius@google.com> Merge \\"Add |readString8| method which returns failure\\" am: 115e6ec7e9
am: 83b9ea5d1f

Change-Id: Ib43e53e377a4315c141d9e3bcd16d287d4175cf3
83b9ea5d1f31eedfe2a2e6cb5ec86dd99213c86e 21-Jul-2016 Roshan Pius <rpius@google.com> Merge \"Add |readString8| method which returns failure\"
am: 115e6ec7e9

Change-Id: Iaf1ea3b66ed242dcd82a88ebc0556c08a5fdf85e
87b64d2a0e6aa35f39d612ecbd688f36f1046d5a 18-Jul-2016 Roshan Pius <rpius@google.com> Add |readString8| method which returns failure

Add a new method to return |String8| read failures from Parcels.

BUG: 30189542
Change-Id: I65b59887dd9a15068abe95d24d390aa577bc49a6
/frameworks/native/libs/binder/Parcel.cpp
05cd88ab69b008a88b682b8de2dc1d614f31e2ae 14-Jul-2016 Sergio Giro <sgiro@google.com> Add bound checks to utf16_to_utf8
am: 9b39ebe132

Change-Id: I1b3aa4ab0c3f6f4b577d10dda8ce9604d0fc4e9c
9b39ebe132a18f530a5e5885a9faca514257902a 28-Jun-2016 Sergio Giro <sgiro@google.com> Add bound checks to utf16_to_utf8

Bug: 29250543
Change-Id: I518e7b2fe10aaa3f1c1987586a09b1110aff7e1a
(cherry picked from commit 7e93b2ddcb49b5365fbe1dab134ffb38e6f1c719)
/frameworks/native/libs/binder/Parcel.cpp
bd95c7088bd5cd128a92c59246fe7b697f73d59a 11-Jul-2016 Sergio Giro <sgiro@google.com> Merge \"Add bound checks to utf16_to_utf8\" into nyc-mr1-dev
am: 9e3a43e817

Change-Id: Idc968c4efd11de8f3d45499cc8ba094ace605d2f
7e93b2ddcb49b5365fbe1dab134ffb38e6f1c719 28-Jun-2016 Sergio Giro <sgiro@google.com> Add bound checks to utf16_to_utf8

Bug: 29250543
Change-Id: I518e7b2fe10aaa3f1c1987586a09b1110aff7e1a
/frameworks/native/libs/binder/Parcel.cpp
c55b4b69d49c67cb9602e6ced2c1facb9580e3a1 09-May-2016 Marco Nelissen <marcone@google.com> Correctly handle dup() failure in Parcel::readNativeHandle am: 1de7966c72 am: 275c9f60f9 am: 853702ce3d am: 775f2e6dbf am: 82afbe2258 am: c2c470c700 am: 56dea28189 am: bca20d8376 am: a8244873a8 am: 93bf31f54d am: f91c66a9a8
am: fb6342d2bb

* commit 'fb6342d2bbf0f5e324ea1685a0b3cfc4af648ee7':
Correctly handle dup() failure in Parcel::readNativeHandle

Change-Id: Ib7680b30823e6bf41d7591fdb48c244565f323d0
fb6342d2bbf0f5e324ea1685a0b3cfc4af648ee7 09-May-2016 Marco Nelissen <marcone@google.com> Correctly handle dup() failure in Parcel::readNativeHandle am: 1de7966c72 am: 275c9f60f9 am: 853702ce3d am: 775f2e6dbf am: 82afbe2258 am: c2c470c700 am: 56dea28189 am: bca20d8376 am: a8244873a8 am: 93bf31f54d
am: f91c66a9a8

* commit 'f91c66a9a889f0ed851953dd0c1b2ff70e622dda':
Correctly handle dup() failure in Parcel::readNativeHandle

Change-Id: Ib4a4fe7d4ca8291fb82fcbbd91c3a0803a1e1b30
93bf31f54d56617baf0192a451f2269ad78e6c49 09-May-2016 Marco Nelissen <marcone@google.com> Correctly handle dup() failure in Parcel::readNativeHandle am: 1de7966c72 am: 275c9f60f9 am: 853702ce3d am: 775f2e6dbf am: 82afbe2258 am: c2c470c700 am: 56dea28189 am: bca20d8376
am: a8244873a8

* commit 'a8244873a881f18cf5cea22dc5f566dbe6394f48':
Correctly handle dup() failure in Parcel::readNativeHandle

Change-Id: I351dad18e1f3b1903553a8cdfacde18c64f3b6d4
a8244873a881f18cf5cea22dc5f566dbe6394f48 09-May-2016 Marco Nelissen <marcone@google.com> Correctly handle dup() failure in Parcel::readNativeHandle am: 1de7966c72 am: 275c9f60f9 am: 853702ce3d am: 775f2e6dbf am: 82afbe2258 am: c2c470c700 am: 56dea28189
am: bca20d8376

* commit 'bca20d8376708da7ed835e71442ab52197d1e9c0':
Correctly handle dup() failure in Parcel::readNativeHandle

Change-Id: Ia0845cc9f58fcb2cca204118cbaff6e251ed0b8e
bca20d8376708da7ed835e71442ab52197d1e9c0 09-May-2016 Marco Nelissen <marcone@google.com> Correctly handle dup() failure in Parcel::readNativeHandle am: 1de7966c72 am: 275c9f60f9 am: 853702ce3d am: 775f2e6dbf am: 82afbe2258 am: c2c470c700
am: 56dea28189

* commit '56dea28189ff0894d24ebb63650ad5159031549c':
Correctly handle dup() failure in Parcel::readNativeHandle

Change-Id: I283fd9ad78ddb434d831adaef58db22a57b335f6
56dea28189ff0894d24ebb63650ad5159031549c 09-May-2016 Marco Nelissen <marcone@google.com> Correctly handle dup() failure in Parcel::readNativeHandle am: 1de7966c72 am: 275c9f60f9 am: 853702ce3d am: 775f2e6dbf am: 82afbe2258
am: c2c470c700

* commit 'c2c470c700a4e0fbbcd5b99da144f02cee7b9b3e':
Correctly handle dup() failure in Parcel::readNativeHandle

Change-Id: I68084d5f6bfd4b209c738b94a0f31fe9db113d9f
82afbe2258c5c5e18ea6e9496d590cff177e67d4 09-May-2016 Marco Nelissen <marcone@google.com> Correctly handle dup() failure in Parcel::readNativeHandle am: 1de7966c72 am: 275c9f60f9 am: 853702ce3d
am: 775f2e6dbf

* commit '775f2e6dbf757d1b1853337c19bf15f15a127e31':
Correctly handle dup() failure in Parcel::readNativeHandle

Change-Id: Ibfc37203a33c603df365ed9cbb85632d34acafbd
775f2e6dbf757d1b1853337c19bf15f15a127e31 09-May-2016 Marco Nelissen <marcone@google.com> Correctly handle dup() failure in Parcel::readNativeHandle am: 1de7966c72 am: 275c9f60f9
am: 853702ce3d

* commit '853702ce3d1ba5e45ce58f332ed1d40008a44375':
Correctly handle dup() failure in Parcel::readNativeHandle

Change-Id: I2b8f6070ecc873d67be5a4c72ca870606af93a3d
1de7966c72981aebc3c7f9978ab129678ac89258 26-Apr-2016 Marco Nelissen <marcone@google.com> Correctly handle dup() failure in Parcel::readNativeHandle

bail out if dup() fails, instead of creating an invalid native_handle_t

Bug: 28395952

Change-Id: Ia1a6198c0f45165b9c6a55a803e5f64d8afa0572
/frameworks/native/libs/binder/Parcel.cpp
d760b810722e11bef285c812c13eef4dc7950ea2 26-Apr-2016 Christopher Wiley <wiley@google.com> Merge "libbinder: Replace ScopedFd with base::unique_fd" am: 758973c
am: 512926e

* commit '512926e2d7d9d9ac9e2487c38579c73998e14243':
libbinder: Replace ScopedFd with base::unique_fd

Change-Id: Ie07321addb7a5f2ae49f276e31b80054d1154bd4
2cf1995d3d1cdca8e0ba2d8fab9a322c4096f809 11-Apr-2016 Christopher Wiley <wiley@google.com> libbinder: Replace ScopedFd with base::unique_fd

unique_fd is a more canonical construct going forward.

Bug: 27804373
Test: checkbuilds pass on aosp x86_64-eng

Change-Id: I53eca34c0f4fd00be770a6898ff06ec2e98b9c8e
/frameworks/native/libs/binder/Parcel.cpp
0cbee9f0f87841e77f6c4b2449cdd1a472da2982 18-Apr-2016 Christopher Wiley <wiley@google.com> Merge "Revert "libbinder: Replace ScopedFd with base::unique_fd"" am: dcc5575
am: 1c58569

* commit '1c585692a37eef2d28e01db451879f7f53dc97a1':
Revert "libbinder: Replace ScopedFd with base::unique_fd"

Change-Id: Iae20ab4fac161b0785b011b42353ebf46de1c59a
46ef1a7f578d20423961e6b989dad0524bcad13a 18-Apr-2016 Christopher Wiley <wiley@google.com> Revert "libbinder: Replace ScopedFd with base::unique_fd"

This reverts commit b12c5a67f9cf5a55f67c08bef898c48cefa9d03d.

Change-Id: I13ab8151376bc3bda7f96b92db7934720dc62215
/frameworks/native/libs/binder/Parcel.cpp
7f38c4b9d84c0aa84017b8e211de416d7467cbb6 18-Apr-2016 Treehugger Robot <treehugger-gerrit@google.com> Merge "libbinder: Replace ScopedFd with base::unique_fd" am: 747c0bb
am: 7a07e39

* commit '7a07e39801a6bf1d4c1e35017da80a44ee4a343f':
libbinder: Replace ScopedFd with base::unique_fd

Change-Id: I88b06c3e6d86278024e135697a1a024d56ba86ee
b12c5a67f9cf5a55f67c08bef898c48cefa9d03d 11-Apr-2016 Christopher Wiley <wiley@google.com> libbinder: Replace ScopedFd with base::unique_fd

unique_fd is a more canonical construct going forward.

Bug: 27804373
Test: checkbuilds pass on aosp x86_64-eng

Change-Id: I8c1f202f1a6d646b5468f8c08fdcab7ea7f3178b
/frameworks/native/libs/binder/Parcel.cpp
ffc5a84a6f84627b001c151197ab00f4f4b49d63 25-Mar-2016 Christopher Tate <ctate@google.com> Merge "Remove spurious log" into nyc-dev
am: 7ff357a

* commit '7ff357ab080d0f3330a5642124a352f745d816bb':
Remove spurious log
bf14e94722a57a545b04396e06e9c5d65e241068 25-Mar-2016 Christopher Tate <ctate@google.com> Remove spurious log

Bug 26696080

Change-Id: I60ce2c1fac653d33a033c1e22f0df87466287fba
/frameworks/native/libs/binder/Parcel.cpp
fc7e369cc2d222602215fb2e03f5fe9a70cdc0c6 25-Mar-2016 Christopher Tate <ctate@google.com> Merge "Guard against failed array allocation" into nyc-dev
am: 834fde8

* commit '834fde83f9a924f23e920306d9f7590fb6fd0e0b':
Guard against failed array allocation
e4e0ae8abc7f612960fc381a792d0bef4c3eb6f9 25-Mar-2016 Christopher Tate <ctate@google.com> Guard against failed array allocation

Also sanity check the fd count of incoming Parcels. Anything
exceeding our actual rlimit is inherently not legit.

Bug 26696080

Change-Id: Ib983dce8e8977d7e33195a4ee471115cdaf1c56b
/frameworks/native/libs/binder/Parcel.cpp
b5f08e43d89081ed48307f8a2e883c6c78d37fa1 11-Mar-2016 Christopher Wiley <wiley@google.com> Merge "libbinder: Make null handling explicit for strong binders"
35d77caf8e7e34fa6ac8f4bbc75a52631adc0272 08-Mar-2016 Christopher Wiley <wiley@google.com> libbinder: Make null handling explicit for strong binders

Bug: 27156495
Test: Compiles

Change-Id: I62cade1761377a9ec2921a758307582552e4c2ac
/frameworks/native/libs/binder/Parcel.cpp
0b1cf331d281d28eb67b3aa2be01026c2ceda4d9 09-Feb-2016 Casey Dahlin <sadmac@google.com> libbinder: Allow readByteVector to take uint8_t

Change-Id: I2f0d1f3b4c04f04e7a866e9a4cf76c899b4b4980
Test: AIDL integration tests pass
Bug: 27078230
/frameworks/native/libs/binder/Parcel.cpp
0e93732cf1b32fb001d4e99e6f49b97aab91a247 17-Feb-2016 Bill Yi <byi@google.com> Merge commit 'db5c5bb0259fa024517d9a151726785facba4f02' into HEAD
185d3447d8a62d4d93d19125b82dbc3f9e12dda2 09-Feb-2016 Casey Dahlin <sadmac@google.com> libbinder: Allow readByteVector to take uint8_t

Change-Id: I2f0d1f3b4c04f04e7a866e9a4cf76c899b4b4980
Test: AIDL integration tests pass
Bug: 27078230
/frameworks/native/libs/binder/Parcel.cpp
6ff4920cb12fa4776d27b54e2e4daa27bb78fc10 05-Feb-2016 Mark Salyzyn <salyzyn@google.com> Merge "system_server BINDER_TYPE_FD driver ashmem accessors" am: b23a388c64
am: 3196c839af

* commit '3196c839af9ea74c59f5860c0d1f6e7e20b7a65e':
system_server BINDER_TYPE_FD driver ashmem accessors
70f3665f8272b2f6d05e77ff0c17683b4b7f82b7 02-Feb-2016 Mark Salyzyn <salyzyn@google.com> system_server BINDER_TYPE_FD driver ashmem accessors

check if device matches the ashmem rdev, before calling
ashmem_get_size_region. This eliminates making this call
when associated with other driver file descriptors.

Bug: 26374183
Bug: 26918423
Bug: 26871259
Change-Id: I1f88c2c93ea35a73c8e14125f3d1a6c67fa4f15b
/frameworks/native/libs/binder/Parcel.cpp
4ab1dbe5594b672532db5996dce3b77dbedd7580 01-Feb-2016 Christopher Wiley <wiley@google.com> Merge "Add support for decoding UTF16 to UTF8" am: ac4728f8ba
am: 7b0c8479ae

* commit '7b0c8479ae68c6596df21879c6470ff21560ea03':
Add support for decoding UTF16 to UTF8
ac4728f8ba54e5f25466efeaf65a1dbda179ca97 01-Feb-2016 Christopher Wiley <wiley@google.com> Merge "Add support for decoding UTF16 to UTF8"
9a5e32f141fdb43edc1bb31ceacec781b35281b3 29-Jan-2016 Christopher Wiley <wiley@google.com> Add support for decoding UTF16 to UTF8

This is helpful because many native service developers use std::string
internally, and String16 doesn't work very well with many C++
primitives.

Bug: 26729450
Test: Integration test appears to show this is correct.

Change-Id: Ib75068881da28fd8515685bcbcbe864ba3b7ec23
/frameworks/native/libs/binder/Parcel.cpp
393aa435964aa24413235a34dda686bd0f693e45 27-Jan-2016 Mark Salyzyn <salyzyn@google.com> system_server BINDER_TYPE_FD sockets using ashmem accessors

check if device is a character device, before calling
ashmem_get_size_region. We do not check if the st_rdev
matches /dev/ashmem. So this at least eliminates making
this call when associated with a socket.

Bug: 26374183
Change-Id: I68ed9d1c2cd4c47228ed065e3e18eb4151f038f4
(cherry picked from AOSP commit eab2afc7ac5183750a23693ecee89dad7f7abf5f)
/frameworks/native/libs/binder/Parcel.cpp
9cc62e8713aa3c53127e676ec084f1c01dcd769a 27-Jan-2016 Mark Salyzyn <salyzyn@google.com> Parcel: file descriptor leak

Resolve a file descriptor leak when a request for
ashmem size adjustment is not filed.

Change-Id: I4ebccfd096ec5313725fd99dc3e025f9561d061f
(cherry picked from AOSP commit b454d8ffa928e33dd54c979a747994acbd117397)
/frameworks/native/libs/binder/Parcel.cpp
8bb1a530ccf02aa7c6cea6a3bcbcdcc59200f0e6 27-Jan-2016 Mark Salyzyn <salyzyn@google.com> Parcel: include Android coding standard

Change-Id: I3507bdfd04a06db85b46539338c787395ec652ff
(cherry picked from AOSP commit abed7f7aebdbdd20fdb37d0d6e79e50905c7f5d5)
/frameworks/native/libs/binder/Parcel.cpp
4d64cf9e09bebd1d7d6851aa00c021f8d2d4e91e 27-Jan-2016 Mark Salyzyn <salyzyn@google.com> Parcel: LOG_TAG cleanup

NB: several ALOG messages behind comments, recommend removal

Change-Id: Iaf02f55cbf7ef0ee7c4a6ee67c7f8b57cf97cd26
(cherry picked from AOSP commit e93390b0bd336cd1b69abebf6eeffd18881f531b)
/frameworks/native/libs/binder/Parcel.cpp
becad77245e5549600e996b287ad47e8c0edcd46 27-Jan-2016 Mark Salyzyn <salyzyn@google.com> Merge "system_server BINDER_TYPE_FD sockets using ashmem accessors"
am: cf9944684f

* commit 'cf9944684f438a1c3a47ab16c3efa4fa5d57f921':
system_server BINDER_TYPE_FD sockets using ashmem accessors
f6ec7d5e3a55ee7eca4203dc386b6d0837b8e660 27-Jan-2016 Mark Salyzyn <salyzyn@google.com> Merge changes I4ebccfd0,I3507bdfd,Iaf02f55c
am: acca0abaf1

* commit 'acca0abaf15318a6a260addd78566383bd4110a5':
Parcel: file descriptor leak
Parcel: include Android coding standard
Parcel: LOG_TAG cleanup
eab2afc7ac5183750a23693ecee89dad7f7abf5f 27-Jan-2016 Mark Salyzyn <salyzyn@google.com> system_server BINDER_TYPE_FD sockets using ashmem accessors

check if device is a character device, before calling
ashmem_get_size_region. We do not check if the st_rdev
matches /dev/ashmem. So this at least eliminates making
this call when associated with a socket.

Bug: 26374183
Change-Id: I68ed9d1c2cd4c47228ed065e3e18eb4151f038f4
/frameworks/native/libs/binder/Parcel.cpp
b454d8ffa928e33dd54c979a747994acbd117397 27-Jan-2016 Mark Salyzyn <salyzyn@google.com> Parcel: file descriptor leak

Resolve a file descriptor leak when a request for
ashmem size adjustment is not filed.

Change-Id: I4ebccfd096ec5313725fd99dc3e025f9561d061f
/frameworks/native/libs/binder/Parcel.cpp
abed7f7aebdbdd20fdb37d0d6e79e50905c7f5d5 27-Jan-2016 Mark Salyzyn <salyzyn@google.com> Parcel: include Android coding standard

Change-Id: I3507bdfd04a06db85b46539338c787395ec652ff
/frameworks/native/libs/binder/Parcel.cpp
e93390b0bd336cd1b69abebf6eeffd18881f531b 27-Jan-2016 Mark Salyzyn <salyzyn@google.com> Parcel: LOG_TAG cleanup

NB: several ALOG messages behind comments, recommend removal

Change-Id: Iaf02f55cbf7ef0ee7c4a6ee67c7f8b57cf97cd26
/frameworks/native/libs/binder/Parcel.cpp
f15194ae49b77b030a4062d2a083803dce410467 16-Dec-2015 Casey Dahlin <sadmac@google.com> Merge "Allow null values for Parcel readers and writers"
am: 4df4842186

* commit '4df484218624081ee5de68798fe8bbf26efdc069':
Allow null values for Parcel readers and writers
b9872623ca0f2366c348d6d40a8ba45ee0e87710 26-Nov-2015 Casey Dahlin <sadmac@google.com> Allow null values for Parcel readers and writers

Test: AIDL integration tests pass
Bug: 25969194
Change-Id: Ib7023c8e02af49e08c9921f1d097e5967c1d378e
Signed-off-by: Casey Dahlin <sadmac@google.com>
/frameworks/native/libs/binder/Parcel.cpp
4b5d182fd5055a4052237785164f543fe49b8f1d 10-Dec-2015 Colin Cross <ccross@android.com> Merge "Fix allocation count"
am: b25116f735

* commit 'b25116f735e00467057085c18a984aca0cc93a84':
Fix allocation count
b25116f735e00467057085c18a984aca0cc93a84 10-Dec-2015 Colin Cross <ccross@android.com> Merge "Fix allocation count"
83ec65e19a8b5e1ae11e789b3d79d08543b09193 09-Dec-2015 Colin Cross <ccross@android.com> Fix allocation count

The realloc case in continueWrite should not increment the counter,
the pointer passed to realloc is guaranteed to be non-NULL so the total
number of allocations will not have changed.

When realloc is called in restartWrite mData has not been checked
against NULL, increment the counter if it was NULL.

Bug: 26086286
Change-Id: I4c8af450cca1868b91793c0c5f0d8c4b4b5badbe
/frameworks/native/libs/binder/Parcel.cpp
8c0dbf91213ce1ac25df68b6efdc13fa7f89ca80 23-Nov-2015 Casey Dahlin <sadmac@google.com> Merge "Add support for file descriptors and vectors thereof" am: 8f237272e0
am: 0ebbd1ef19

* commit '0ebbd1ef19a4a4f6b0dfcc8d8d7c625ab5211f9d':
Add support for file descriptors and vectors thereof
0ebbd1ef19a4a4f6b0dfcc8d8d7c625ab5211f9d 23-Nov-2015 Casey Dahlin <sadmac@google.com> Merge "Add support for file descriptors and vectors thereof"
am: 8f237272e0

* commit '8f237272e0630b8f279db7f90aebfff73a1a9c00':
Add support for file descriptors and vectors thereof
06673e38983baad380e818c5493b7faccf3b2393 23-Nov-2015 Casey Dahlin <sadmac@google.com> Add support for file descriptors and vectors thereof

We use ScopedFd from nativehelper to manage the lifetime.

Test: Passes AIDL unit and integration tests. Full build completes and
runs.
Bug: 25242023
Signed-off-by: Casey Dahlin <sadmac@google.com>

Change-Id: I22c87ed1cb3bd4bf667b372ea4a2e9fcd4dd986a
/frameworks/native/libs/binder/Parcel.cpp
cf6d7d1925531b4a327294757fb8595387c170e7 23-Nov-2015 Christopher Wiley <wiley@google.com> Merge "libbinder: Add support for C++ Parcelable" am: 49b5443a49
am: 6c31acd969

* commit '6c31acd969ffc754e514885fa7f4d0c25403f580':
libbinder: Add support for C++ Parcelable
6c31acd969ffc754e514885fa7f4d0c25403f580 23-Nov-2015 Christopher Wiley <wiley@google.com> Merge "libbinder: Add support for C++ Parcelable"
am: 49b5443a49

* commit '49b5443a49d737d13c8d05dfd9b827b2c4198edc':
libbinder: Add support for C++ Parcelable
14b02baadaa7143c5e059ab0e58c48c1a39de14b 20-Nov-2015 Christopher Wiley <wiley@google.com> Merge "libbinder: Move vector writing templates to header" am: e1aa1c7e13
am: 709ae9a0a5

* commit '709ae9a0a5775c75b81d011ae9624f28787e5b15':
libbinder: Move vector writing templates to header
709ae9a0a5775c75b81d011ae9624f28787e5b15 20-Nov-2015 Christopher Wiley <wiley@google.com> Merge "libbinder: Move vector writing templates to header"
am: e1aa1c7e13

* commit 'e1aa1c7e136e7372c17b8db7a6d8b307ba4cd571':
libbinder: Move vector writing templates to header
dfefb3c7c87063783b0baeee9c6b534526f51658 20-Nov-2015 Nick Kralevich <nnk@google.com> handle size_t > java max int size
am: cfe27deac7

* commit 'cfe27deac7e0ede89a78b9f03fb4a4159d68be8e':
handle size_t > java max int size
97f048d19e51da4ea6ff98d8a9daf38f2577f182 19-Nov-2015 Christopher Wiley <wiley@google.com> libbinder: Add support for C++ Parcelable

Bug: 23600712
Test: compiles, integration tests for Java/C++ compatibility pass

Change-Id: I0919571919a3633350169ed5668bbb000da9691c
/frameworks/native/libs/binder/Parcel.cpp
03d1eb6bf90bcd0a04b176988478d2e939d3fba0 19-Nov-2015 Christopher Wiley <wiley@google.com> libbinder: Move vector writing templates to header

This allows us to reuse them to read and write vectors of parcelables.

Bug: 23600712
Test: Compiles, aidl integration tests pass

Change-Id: Ibbfc2f158b6b3000b13f35f3c09a0cd3741e8128
/frameworks/native/libs/binder/Parcel.cpp
fb92cfcd3e8977a6cac0147de80bf2a0fb6a2d87 18-Nov-2015 Casey Dahlin <sadmac@google.com> Merge "Revert "Add support for unique_fds and vectors of file descriptors""
am: 5cd09786eb

* commit '5cd09786eb4ff6e99351e8a317205a5efd12ac74':
Revert "Add support for unique_fds and vectors of file descriptors"
5cd09786eb4ff6e99351e8a317205a5efd12ac74 18-Nov-2015 Casey Dahlin <sadmac@google.com> Merge "Revert "Add support for unique_fds and vectors of file descriptors""
25a365623c4d703872d8faa4f0674d9514910c45 18-Nov-2015 Casey Dahlin <sadmac@google.com> Revert "Add support for unique_fds and vectors of file descriptors"

This reverts commit 9626d88882972d45576dcceedc037d2e9843196b.

Change-Id: I6121f388d17c6f2d0cf6f31bc42f0804dd72aba2
/frameworks/native/libs/binder/Parcel.cpp
0dd1a5d2f4e69c5df233fa9468191c03dc9b639f 18-Nov-2015 Casey Dahlin <sadmac@google.com> Merge "Add support for unique_fds and vectors of file descriptors"
am: b1819fc295

* commit 'b1819fc295811ca3a005042a80149c8d0655211f':
Add support for unique_fds and vectors of file descriptors
b1819fc295811ca3a005042a80149c8d0655211f 18-Nov-2015 Casey Dahlin <sadmac@google.com> Merge "Add support for unique_fds and vectors of file descriptors"
9626d88882972d45576dcceedc037d2e9843196b 05-Nov-2015 Casey Dahlin <sadmac@google.com> Add support for unique_fds and vectors of file descriptors

Change-Id: Ic61e69d9db438b4686032459c896aed2a482c9a5
Test: Unit tests pass
Bug: 25242023
Signed-off-by: Casey Dahlin <sadmac@google.com>
/frameworks/native/libs/binder/Parcel.cpp
d3521982942874f4149ebc686be581d0ff857734 18-Nov-2015 Christopher Wiley <wiley@google.com> Merge "libbinder: Add binder::Status type"
am: babed3ea52

* commit 'babed3ea523822f4f5084c3e8a951f2cdf924695':
libbinder: Add binder::Status type
cfe27deac7e0ede89a78b9f03fb4a4159d68be8e 16-Sep-2015 Nick Kralevich <nnk@google.com> handle size_t > java max int size

Cleanly abort if we would have returned a value which can't be safely
handled by the java APIs. I'm not sure this code is reachable, but
adding the check just in case.

Bug: 16676699

(cherry picked from commit 3f6b702b5834330ef061f4ed97677ae90a541f23)

Change-Id: Iddc16f32cb5d46219a4dcb3548bcfeaade0f9c9e
/frameworks/native/libs/binder/Parcel.cpp
f28b295df90da3b9610cc5d6100039e54d95f49a 10-Sep-2015 Dan Austin <danielaustin@google.com> Benign unsigned integer overflow in Parcel

The realloc case in continueWrite did not update the
gParcelGlobalAllocCount value when an allocation occurred.

In addition, there are conditions that could cause the
gParcelGlobalAllocCount value to be decremented below 0, resulting
in a benign unsigned integer overflow that can cause corrupted values
to be returned through system profiling mechanisms.

BUG: 23972600

(cherry picked from commit 48fd7b457bb0657253d6012e787f50498b32ae42)

Change-Id: I1ad2ac02ab370402481550f6ab8f21fce42455e4
/frameworks/native/libs/binder/Parcel.cpp
09eb749704afd9e226e1347cb20c90be2016cd21 10-Nov-2015 Christopher Wiley <wiley@google.com> libbinder: Add binder::Status type

This object implements equivalent functionality to the Java logic which
serializes and re-throws exceptions from services.

Bug: 25615695
Test: Integration test for generated AIDL code reveals this to work
correctly.

Change-Id: Ic80c9def0dd232582ea9c49717ec50894af6bfc2
/frameworks/native/libs/binder/Parcel.cpp
d6bb937114a945dd1ebe4299ab2dab1bd6ff795e 13-Nov-2015 Casey Dahlin <sadmac@google.com> Merge "Use templates for write*Vector methods"
am: 81960facb6

* commit '81960facb673740acd41b72d21febea16ba4986c':
Use templates for write*Vector methods
5f0625695ce6999ec70f5699f70a8a0fa84a1bf6 13-Nov-2015 Casey Dahlin <sadmac@google.com> Use templates for write*Vector methods

Change-Id: I86223bd54940ebe3e8f090b7786ddfa3ee57195e
Test: AIDL integration tests still pass
Bug: None
Signed-off-by: Casey Dahlin <sadmac@google.com>
/frameworks/native/libs/binder/Parcel.cpp
fb1f4cf4d481f1614bae977b187cdb888c8af09a 12-Nov-2015 Christopher Wiley <wiley@google.com> Merge "libbinder: Return UNEXPECTED_NULL when appropriate"
am: 41e50f99bc

* commit '41e50f99bc3b832df2b7249ce1d3fc92e718c98d':
libbinder: Return UNEXPECTED_NULL when appropriate
4db672ddccb02b2bd70ddb4812c00a5060174c93 10-Nov-2015 Christopher Wiley <wiley@google.com> libbinder: Return UNEXPECTED_NULL when appropriate

Return a meaningful and consistent error code when libbinder encounters
a null reference that it didn't expect. This allows us to detect these
situations and cause a corresponding NullPointerException to be thrown
on the remote callsite.

While here, consolidate places we read vector<T> from a parcel into a
single templated version. This dramatically reduces code duplication.

Bug: 25617251
Test: Integration tests asserting that vectors serialize correctly
passes. Integration test asserting that we throw
NullPointerException on seeing a null reference also passes.

Change-Id: Ia59c264884ec89539c1b99cd7bd28ac201b5b7ac
/frameworks/native/libs/binder/Parcel.cpp
4ed5d8c98ea74c953b767a84ebfedf9d038dba3b 05-Nov-2015 Casey Dahlin <sadmac@google.com> Merge "Add support for reading/writing a vector of binders"
am: fd6843236f

* commit 'fd6843236fe9094fc8868f1a58e6ba4364a485a7':
Add support for reading/writing a vector of binders
14f8cf12e2764ff554dd0e3b72cc8711b14adffe 03-Nov-2015 Bill Yi <byi@google.com> Merge commit '75c5de42b759bdcfa7c0e6103fb959c28d686116' into HEAD
eb8e15f9bb29f8794f8be819530631c358fd6a15 03-Nov-2015 Casey Dahlin <sadmac@google.com> Add support for reading/writing a vector of binders

Change-Id: Iaa8da704b2ae3c1ca5456177441a335991b40e8a
Test: unit tests pass
Bug: 24470786
Signed-off-by: Casey Dahlin <sadmac@google.com>
/frameworks/native/libs/binder/Parcel.cpp
f0fc52b59be0bf39912f7b698d9bde26415a6096 31-Oct-2015 Christopher Wiley <wiley@google.com> Fix bug in byte vector serialization

Byte vectors are used by the generated C++ code as the representation
of Java byte[]. This type is serialized as a packed byte array on
the java side.

Bug: 25012838
Test: integration tests for byte[] show this type crossing language
boundaries correctly.

Change-Id: I8bb1b8ffcb77ced44f99f6b370226a32694f7df1
/frameworks/native/libs/binder/Parcel.cpp
75c5de42b759bdcfa7c0e6103fb959c28d686116 29-Oct-2015 Casey Dahlin <sadmac@google.com> Merge "Add readStrongBinder that takes an interface" am: 71b70a244c
am: 6319281c24

* commit '6319281c24284a83f8bab090c6048d864635f0dd':
Add readStrongBinder that takes an interface
f0c13772d95486d98f034361883b2415bb26a614 28-Oct-2015 Casey Dahlin <sadmac@google.com> Add readStrongBinder that takes an interface

We use a template function to let us pass arbitrary interfaces, all of which
can be cast to IBinder.

Change-Id: Iadf21c495cde43e8a5adb85a49e6592196f401ff
Test: unit tests
Bug: 23600713
Signed-off-by: Casey Dahlin <sadmac@google.com>
/frameworks/native/libs/binder/Parcel.cpp
23cd9ff6d80cfb33873728369211e014fd0351a2 28-Oct-2015 Christopher Wiley <wiley@google.com> Merge "libbinder: Fix out of bounds in readBoolVector" am: 1f76049c95
am: 87a30d930a

* commit '87a30d930a76a9e73643bbac8737781d72fed33f':
libbinder: Fix out of bounds in readBoolVector
97887989495318803643c91b196b6bcabf2a7a03 28-Oct-2015 Christopher Wiley <wiley@google.com> libbinder: Fix out of bounds in readBoolVector

Bug: 25012838
Test: This code now works at runtime.

Change-Id: I3d6b2677f11276e6be4c51451ca36572a4ee573d
/frameworks/native/libs/binder/Parcel.cpp
0d2a22ece851b5ee358ac18214ccbfa28c3eb121 23-Oct-2015 Adrian Roos <roosa@google.com> Merge changes from topic \'parcel-v2\' into mnc-dr-dev am: cf33d50d25 am: 0c11f9918c
am: bcc709b94d

* commit 'bcc709b94d72e7f2d03d952dbf8a21b6980fd3a9':
Maintain Parcel ABI
Revert "Revert "Track ashmem memory usage in Parcel""
6bb3114246f6f6aa406e65452dbaa12b135029ea 23-Oct-2015 Adrian Roos <roosa@google.com> Maintain Parcel ABI

Makes sure we don't change the memory layout of the Parcel class
to maintain binary compatibility with prebuilts linking against
libbinder.

Bug: 25004154
Change-Id: I656687497f08bb85cefda796aafa2341e601e30a
/frameworks/native/libs/binder/Parcel.cpp
cbf3726357966539c2a685f46e61c3fc8937f19e 23-Oct-2015 Adrian Roos <roosa@google.com> Revert "Revert "Track ashmem memory usage in Parcel""

This reverts commit 6880307e8e35a6c484942443fb4ddd6173126152.

Bug: 25004154
Change-Id: I9b432d1ebc39f3bbcd7afdefc403f0fb6ced8158
/frameworks/native/libs/binder/Parcel.cpp
f4ccbf8103dadabfc8e2eb01b582d9711f7d2931 23-Oct-2015 Ian Pedowitz <ijpedowitz@google.com> Revert "Track ashmem memory usage in Parcel" am: 6880307e8e am: 159a5c3372
am: 7a2643cd77

* commit '7a2643cd77f1836844032f8a14f3c03a40c4e581':
Revert "Track ashmem memory usage in Parcel"
6880307e8e35a6c484942443fb4ddd6173126152 23-Oct-2015 Ian Pedowitz <ijpedowitz@google.com> Revert "Track ashmem memory usage in Parcel"

This reverts commit e2f499fb734bc30a1e1c947112caa0727349b6ed.

Bug: 25169267
Bug: 25191602
Bug: 25004154
Change-Id: I24bb0da4e8739ee5a0c251e4adac9904827144e0
/frameworks/native/libs/binder/Parcel.cpp
b73f66ec1a31c5910c63fea199b222afb7c5a417 22-Oct-2015 Adrian Roos <roosa@google.com> Track ashmem memory usage in Parcel am: e2f499fb73 am: a0c1be2617
am: cb09f2c82f

* commit 'cb09f2c82fa202b3e4069b74ca103d8ba502c4c3':
Track ashmem memory usage in Parcel
e2f499fb734bc30a1e1c947112caa0727349b6ed 21-Oct-2015 Adrian Roos <roosa@google.com> Track ashmem memory usage in Parcel

Bug: 25004154
Change-Id: Id9d5656dd0605f1b50525596b75601309f67ebdc
/frameworks/native/libs/binder/Parcel.cpp
1515ea103e00f6672afad4d27f2e0dec5648d7b6 21-Oct-2015 Casey Dahlin <sadmac@google.com> Fix build breakage due to extraneous dereference

Change-Id: If84d8b68a6af1e04a6085351655e588ebef65664
/frameworks/native/libs/binder/Parcel.cpp
451ff582d730e27f4e22d9f158f8ee24d1bc2729 20-Oct-2015 Casey Dahlin <sadmac@google.com> Add read/write methods for vectors

Also a readString16 with the expected semantics.

Change-Id: Idbeaff1b4337089b2a5a7124f77226a693b2be4f
Test: Unit tests pass
Bug: 25012838
Signed-off-by: Casey Dahlin <sadmac@google.com>
/frameworks/native/libs/binder/Parcel.cpp
d6848f52e60be17b7f0992be7827dcae4ea2efb1 16-Oct-2015 Casey Dahlin <sadmac@google.com> Add methods to Parcel for bool and char and byte

We lift these to int, but handling the details of that here will be better
than having AIDL generate casting code all the time.

Test: unit tests pass
Bug: 24981507
Change-Id: If6aa33ab5fe365dd237136a95c5d9a702af41d15
Signed-off-by: Casey Dahlin <sadmac@google.com>
/frameworks/native/libs/binder/Parcel.cpp
f0f131f36b5ce2a25992576aa75e7c08654e5a8d 11-Sep-2015 Dan Austin <danielaustin@google.com> am 6c8c8138: Merge "Benign unsigned integer overflow in Parcel"

* commit '6c8c8138434d2381a78407e9876121d3bcef55a7':
Benign unsigned integer overflow in Parcel
48fd7b457bb0657253d6012e787f50498b32ae42 10-Sep-2015 Dan Austin <danielaustin@google.com> Benign unsigned integer overflow in Parcel

The realloc case in continueWrite did not update the
gParcelGlobalAllocCount value when an allocation occurred.

In addition, there are conditions that could cause the
gParcelGlobalAllocCount value to be decremented below 0, resulting
in a benign unsigned integer overflow that can cause corrupted values
to be returned through system profiling mechanisms.

BUG: 23972600
Change-Id: Ibe07db91a811a04b486760eb78d81c926ba8503d
/frameworks/native/libs/binder/Parcel.cpp
134fd91bccde911bf9497f09841ec9922bbefec9 02-Jul-2015 Christopher Tate <ctate@google.com> am 708b42e0: am eba7afcc: am 2f340be3: Disregard alleged binder entities beyond parcel bounds

* commit '708b42e0ee5ad97b8426a6245f73131ddfc59a33':
Disregard alleged binder entities beyond parcel bounds
e59cb43edad0eff28a81b18c3c4484442ff680dd 30-Jun-2015 Chad Brubaker <cbrubaker@google.com> Fix writeByteArray/writeInt32Array size on x64

writeByteArray writes the size using sizeof(size_t), however it is always
read using readInt32(). On devices where sizeof(size_t) != 4 this causes
extra bytes to be written.

BUG: 22204736
Change-Id: I8d4507b6b616857ef5827f1fe9da0907d09abf0e
/frameworks/native/libs/binder/Parcel.cpp
bb686c25b214edadd1830abd056db2d570d716ff 28-May-2015 Christopher Tate <ctate@google.com> Disregard alleged binder entities beyond parcel bounds

When appending one parcel's contents to another, ignore binder
objects within the source Parcel that appear to lie beyond the
formal bounds of that Parcel's data buffer.

Bug 17312693

Change-Id: If592a260f3fcd9a56fc160e7feb2c8b44c73f514
(cherry picked from commit 27182be9f20f4f5b48316666429f09b9ecc1f22e)
/frameworks/native/libs/binder/Parcel.cpp
2f340be345612d9fc2ecb1ea2a4c9e147610a593 28-May-2015 Christopher Tate <ctate@google.com> Disregard alleged binder entities beyond parcel bounds

When appending one parcel's contents to another, ignore binder
objects within the source Parcel that appear to lie beyond the
formal bounds of that Parcel's data buffer.

Bug 17312693

Change-Id: If592a260f3fcd9a56fc160e7feb2c8b44c73f514
(cherry picked from commit 27182be9f20f4f5b48316666429f09b9ecc1f22e)
/frameworks/native/libs/binder/Parcel.cpp
1b8a2f82fedffbc0b24c884def197db392b16576 28-May-2015 Christopher Tate <ctate@google.com> Disregard alleged binder entities beyond parcel bounds

When appending one parcel's contents to another, ignore binder
objects within the source Parcel that appear to lie beyond the
formal bounds of that Parcel's data buffer.

Bug 17312693

Change-Id: If592a260f3fcd9a56fc160e7feb2c8b44c73f514
(cherry picked from commit 27182be9f20f4f5b48316666429f09b9ecc1f22e)
/frameworks/native/libs/binder/Parcel.cpp
ed7a50cc7d490ae7aece2d16422c5f7941876468 08-Jun-2015 Christopher Tate <ctate@google.com> Prevent integer overflow when calculating buffer resizes

Make sure that we don't go haywire if an exponential buffer growth
operation winds up wrapping integer range. Along the way, fix a
bookkeeping bug in BufferedTextOutput that would cause it to keep
spuriously realloc()ing on every append().

Bug 20674694

Change-Id: Ia845b7de36b90672a151a918ffc26c7da68e20a2
/frameworks/native/libs/binder/Parcel.cpp
98e67d352b8805a868ca0e7c2be3ea830fb7c338 04-Jun-2015 Christopher Tate <ctate@google.com> Don't corrupt parcel when writeFileDescriptor() fails

We now check for fd-legality before committing binder objects to
the flattened data buffer rather than after. Previously we would
wind up corrupting the parcel and incurring driver-level errors,
as well as potentially leaking FDs.

Bug 21428802

Change-Id: Ice0d641b3dcc41fb1b8c68ce2e2ebd744c2863a1
/frameworks/native/libs/binder/Parcel.cpp
13b1604018968408bcc5553e1fa5ea9df3e4e009 12-Nov-2014 Jeff Brown <jeffbrown@google.com> Enable more flexible usage of blobs in parcels.

Add functions to allow a client to take over the ashmem region
that was transferred so that it can claim it for its own and
reuse it.

Add support for mutable ashmem regions too.

Bug: 21428802
Change-Id: I16eca338cdb99b07d81fc43573d53ce86dbc60c8
/frameworks/native/libs/binder/Parcel.cpp
9e6d2ee0302c6f6108488237821958c42ac380a1 03-Jun-2015 Tim Kilbourn <tkilbourn@google.com> DO NOT MERGE Remove unused ParcelFileDescriptor methods in parcel.

Attempts to replicate Java parceling in native code is fraught with
peril.

Change-Id: I4359036c5dddd1b886d886beef1d060523e53e5f
(cherry picked from commit f47a381001d4d4ce66c2e35aac5b96a26acc0730)
/frameworks/native/libs/binder/Parcel.cpp
d2fb7a6e49f04182ba7b639c340414b1745137f2 29-May-2015 Adam Lesinski <adamlesinski@google.com> am 8728c390: am 2c4f5fde: am 861c3f56: am 9004e7f5: am 4ff0cb44: Verify that the native handle was created

* commit '8728c390476110857dd6b290dac3bfdf13b33e81':
Verify that the native handle was created
2c4f5fdeca8e7a6f672bbcb8c25e6b81bf4eaa5b 28-May-2015 Adam Lesinski <adamlesinski@google.com> am 861c3f56: am 9004e7f5: am 4ff0cb44: Verify that the native handle was created

* commit '861c3f56157813627467054f488ecff7d339f2b0':
Verify that the native handle was created
861c3f56157813627467054f488ecff7d339f2b0 28-May-2015 Adam Lesinski <adamlesinski@google.com> am 9004e7f5: am 4ff0cb44: Verify that the native handle was created

* commit '9004e7f5516c5b4a1b4178fa6a8bb4b3ca4ddcd0':
Verify that the native handle was created
27182be9f20f4f5b48316666429f09b9ecc1f22e 28-May-2015 Christopher Tate <ctate@google.com> Disregard alleged binder entities beyond parcel bounds

When appending one parcel's contents to another, ignore binder
objects within the source Parcel that appear to lie beyond the
formal bounds of that Parcel's data buffer.

Bug 17312693

Change-Id: If592a260f3fcd9a56fc160e7feb2c8b44c73f514
/frameworks/native/libs/binder/Parcel.cpp
4ff0cb4404db31576cd8a81ca5ef3b044d492904 13-May-2015 Adam Lesinski <adamlesinski@google.com> Verify that the native handle was created

The inputs to native_handle_create can cause an overflowed allocation,
so check the return value of native_handle_create before accessing
the memory it returns.

Bug:19334482
Change-Id: I1f489382776c2a1390793a79dc27ea17baa9b2a2
(cherry picked from commit eaac99a7172da52a76ba48c26413778a74951b1a)
/frameworks/native/libs/binder/Parcel.cpp
f183395296328a0eb96065c1e426b91bbd11b54b 16-Mar-2015 Ronghua Wu <ronghuawu@google.com> binder: add uint64 support to Parcel.

Bug: 19620911
Change-Id: Ifce5319e4e35afd344dead67ab7ba1cd399476a3
(cherry picked from commit 2d13afdfa1f43973bf3cb917c7d6496a38baa446)
/frameworks/native/libs/binder/Parcel.cpp
eaac99a7172da52a76ba48c26413778a74951b1a 13-May-2015 Adam Lesinski <adamlesinski@google.com> Verify that the native handle was created

The inputs to native_handle_create can cause an overflowed allocation,
so check the return value of native_handle_create before accessing
the memory it returns.

Bug:19334482
Change-Id: I1f489382776c2a1390793a79dc27ea17baa9b2a2
/frameworks/native/libs/binder/Parcel.cpp
e9881a3961888c4264034473021f42f9f0305026 29-Apr-2015 Nick Kralevich <nnk@google.com> Parcel.cpp: use calloc instead of malloc

(cherrypicked from commit 6329f0199ed04030e6c2bd7aecd036387b732c71)

Bug: 20669363
Change-Id: Ia4c8d8ca9d8b4b87954d7267e8b1c94cf4e570e1
/frameworks/native/libs/binder/Parcel.cpp
6329f0199ed04030e6c2bd7aecd036387b732c71 29-Apr-2015 Nick Kralevich <nnk@google.com> Parcel.cpp: use calloc instead of malloc

Bug: 20669363
Change-Id: Ia4c8d8ca9d8b4b87954d7267e8b1c94cf4e570e1
/frameworks/native/libs/binder/Parcel.cpp
aa5c2346c7291465aaca53f59878582dccbe4835 10-Apr-2015 Dan Sandler <dsandler@android.com> Add ashmem stats to Parcels

Requires change Ifaf115da in frameworks/base.

Bug: 20079551
Change-Id: Ifaf115dabd1a59cdb1b46e2d49c41f64ac107de4
/frameworks/native/libs/binder/Parcel.cpp
b6b1423c87e457097875dc304fbbe38db6c41abd 02-Apr-2015 Nick Kralevich <nnk@google.com> Parcel.cpp: reject size_t arguments greater than INT32_MAX

It's a security best practice for size_t values to be rejected if
they are greater than INT32_SIZE. This is intended to prevent the
common error of inadvertently passing a negative int value to a
function, which after conversion to an unsigned type, becomes a huge
number, defeating the purpose of bounds checking.

This patch also addresses a bug where the call to:
Parcel::write(buf, (size_t) -1);
would call writeInPlace() which uses PAD_SIZE on the supplied
argument. This would then cause an integer overflow, with PAD_SIZE
returning a small value, but the memcpy in Parcel::write using the
old large length value.

Bug: 19573085
Change-Id: Ib11bfb3dae4f3be91cd17b2c676926700972c7b8
/frameworks/native/libs/binder/Parcel.cpp
2d13afdfa1f43973bf3cb917c7d6496a38baa446 16-Mar-2015 Ronghua Wu <ronghuawu@google.com> binder: add uint64 support to Parcel.

Bug: 19620911
Change-Id: Ifce5319e4e35afd344dead67ab7ba1cd399476a3
/frameworks/native/libs/binder/Parcel.cpp
499127eab812088ca24421b59ebfac6f47ea850f 16-Jan-2015 Jeff Sharkey <jsharkey@android.com> am 8f3ade0c: Merge "Follow StrictMode refactoring."

* commit '8f3ade0c9ab52a1e4f13d6ff1922dd98e3ccdbcc':
Follow StrictMode refactoring.
0c1f5cbb8a41d19195ab49dcfeb5caaea2d3fcda 18-Dec-2014 Jeff Sharkey <jsharkey@android.com> Follow StrictMode refactoring.

Bug: 18335678
Change-Id: Iea920cfa26b5ebfd77b4601c9e6e65b21599342a
/frameworks/native/libs/binder/Parcel.cpp
e4ea03f74ded76f588501bd2e90ecb767c6426b3 01-Dec-2014 Dan Stoza <stoza@google.com> am 80e81505: Merge "binder: Add {read,write}Uint32 methods to Parcel"

* commit '80e8150549c9d8380dadf942336d41ab3d92bf78':
binder: Add {read,write}Uint32 methods to Parcel
41a0f2f86c0ca7d2fef50aef6215987f445a7231 01-Dec-2014 Dan Stoza <stoza@google.com> binder: Add {read,write}Uint32 methods to Parcel

Adds readUint32 and writeUint32 methods to the Parcel class. This
saves a lot of static_casting in anything implementing a Binder
interface on the native side.

Change-Id: Iafc73b0633654a3a4c49767f41806b56906c924f
/frameworks/native/libs/binder/Parcel.cpp
c1ced8bbcd0ab8ddb75513290954e8a56f80040e 21-Nov-2014 Dan Albert <danalbert@google.com> am c894c204: Merge "C++11 compatibility."

* commit 'c894c2045f589571c80af0648e7a9dcd7e97b6a8':
C++11 compatibility.
3bdc5b826803dca10d3625c56de38d6c55d869c8 20-Nov-2014 Dan Albert <danalbert@google.com> C++11 compatibility.

* Explicit conversion for atomic_uintptr_t initialization.
* Fix string literal concatenation to not be a UD literal.
* Use __typeof__ instead of typeof (should become decltype once this
actually moves to C++11).

Bug: 18466763
Change-Id: I4eedddfb945a2a703ed27317cb6e2b3041b1ebfc
/frameworks/native/libs/binder/Parcel.cpp
a4cff88d80bf1acbdbd063af88ecad83a8b9b7b4 14-Nov-2014 Dianne Hackborn <hackbod@google.com> Fix issue #18356768: some app process may hang at Runtime#exit...

...in Parcel destructor

Don't use a Mutux object, just use simple posix mutex primitives,
to avoid static init/destroy order problems.

Change-Id: Ic012d94297564c0a55d58869f8276d7d10545fbc
/frameworks/native/libs/binder/Parcel.cpp
7e790af756d7891cb1cf1374bb283a8fbcbe6b49 11-Nov-2014 Dianne Hackborn <hackbod@google.com> Add tracking of parcel memory allocations.

Change-Id: I76ffed0e69ccfe70e87d98646f11d4de7c3fd980
/frameworks/native/libs/binder/Parcel.cpp
fee99040de000a64f6036a7db172fb7c68d9764a 04-Nov-2014 Jesse Hall <jessehall@google.com> Revert "Add more logging for dup(fd) failure"

Underlying bug has been fixed, extra debug code no longer needed

This reverts commit 36273c991b189c5516819f4d5e3f83061c320593.

Change-Id: Ia47f1ae9ee7338329bfb8d710aff57e15e944f20
/frameworks/native/libs/binder/Parcel.cpp
8e5cf83afbe2b671f96d04786cf0d0f967e342f9 04-Nov-2014 Jesse Hall <jessehall@google.com> Revert "Parcel: extra validation/debug code for writeDupFileDescriptor"

Underlying bug has been fixed, extra debug code no longer needed.

This reverts commit ccf851f108c008d086b7f3c3923d60d385985e71.

Change-Id: I19ad9239efdf1d8f70cd74af9b7c2ae97713208f
/frameworks/native/libs/binder/Parcel.cpp
9ea09757fa63ad2a9bea9c846b51c1210d69c79f 08-Oct-2014 Narayan Kamath <narayan@google.com> Fix broken error check in Parcel::readBlob

mmap returns MAP_FAILED (which is -1) and not NULL on
failure.

Diagnosed by cferris.

bug: 17909809

Change-Id: I609788ebf94742ef88af002d2d3f3bc9b9e520ac
/frameworks/native/libs/binder/Parcel.cpp
ccf851f108c008d086b7f3c3923d60d385985e71 06-Oct-2014 Jesse Hall <jessehall@google.com> Parcel: extra validation/debug code for writeDupFileDescriptor

Temporary extra debug validation for b/17477219: a Parcel recipient is
getting a positive but invalid fd unexpectedly. Trying to track down
where it's coming from.

Debug code for bug: 17477219
Change-Id: Idb1e71621025a3928c7adc88fd44790e1abd2a01
/frameworks/native/libs/binder/Parcel.cpp
36273c991b189c5516819f4d5e3f83061c320593 02-Oct-2014 Michael Lentine <mlentine@google.com> Add more logging for dup(fd) failure

Bug: 17477219
Change-Id: Ide0ae16d777c9af783023c705c18a93c00999147
/frameworks/native/libs/binder/Parcel.cpp
7da40c0a84dd89e92201448dd5ed3387dc94df2b 12-Jun-2014 Narayan Kamath <narayan@google.com> Remove Parcel::writeIntPtr.

All uses of this API have been removed. It should
never have been made public in the first place.

bug: 15424960
Change-Id: Id07d24ec95b2b393e6da138a7e8a9a4ecebeca94
/frameworks/native/libs/binder/Parcel.cpp
87947be61828a43fc738ffd204f72ab18b31946e 04-Jun-2014 Narayan Kamath <narayan@google.com> Merge "Fix mips build for libbinder."
2c68d380c9ef765a7d46e5a4735f39e6c27849f2 04-Jun-2014 Narayan Kamath <narayan@google.com> Fix mips build for libbinder.

Mips specific code was using an uninitialized variable.

Change-Id: I445043c76ebfa420b26376ade60f8068b4ea0b11
/frameworks/native/libs/binder/Parcel.cpp
b09b936d8ec7f1afe77f4f53ff4d4920c8b59092 03-Jun-2014 Mark Salyzyn <salyzyn@google.com> am f0a24759: am a28750ee: Merge "binder: Turn on -Werror"

* commit 'f0a2475905786d5457e7af838ac714acbfdafa4f':
binder: Turn on -Werror
f0a2475905786d5457e7af838ac714acbfdafa4f 03-Jun-2014 Mark Salyzyn <salyzyn@google.com> am a28750ee: Merge "binder: Turn on -Werror"

* commit 'a28750eec38c848230adfeef28725b29cc36a9da':
binder: Turn on -Werror
d4ecccfd206604a9b2d8a1220844fc2df85a5998 31-May-2014 Mark Salyzyn <salyzyn@google.com> binder: Turn on -Werror

Change-Id: I0ee785927a7ae5f731b02176b0b781b87c22a24e
/frameworks/native/libs/binder/Parcel.cpp
13de7f1defd259f41da9d1044c8aec779c60c1c4 05-May-2014 Jesse Hall <jessehall@google.com> am 57fdbbda: am 4314ccd1: am 70278fbf: Merge "Add error message for hints when exceptions occur during binder transactions."

* commit '57fdbbda2c475d2abdd828177f942ddb6d164bef':
Add error message for hints when exceptions occur during binder transactions.
57fdbbda2c475d2abdd828177f942ddb6d164bef 05-May-2014 Jesse Hall <jessehall@google.com> am 4314ccd1: am 70278fbf: Merge "Add error message for hints when exceptions occur during binder transactions."

* commit '4314ccd1ba9fe773b0fc91f0a08dc536ebce8dfe':
Add error message for hints when exceptions occur during binder transactions.
4314ccd1ba9fe773b0fc91f0a08dc536ebce8dfe 05-May-2014 Jesse Hall <jessehall@google.com> am 70278fbf: Merge "Add error message for hints when exceptions occur during binder transactions."

* commit '70278fbfe012c1fce3e63a41ffb9feaf1e53a64a':
Add error message for hints when exceptions occur during binder transactions.
abf8a2c608cb5f0d1523ab7d0c56e0da8a09cc87 29-Apr-2014 Jun Jiang <jun.a.jiang@intel.com> Add error message for hints when exceptions occur during binder transactions.

It can help to detect some kind of error, such as why GraphicBuffer::flatten
will crash when handle is null.

Change-Id: I703cd035b96edb7afb324cf24d8230d4e55f4f52
Signed-off-by: Jun Jiang <jun.a.jiang@intel.com>
/frameworks/native/libs/binder/Parcel.cpp
75d840693466125f14613e736fdd6a557f1f8dff 18-Mar-2014 Kenny Root <kroot@google.com> am ca609e43: am 38e2aaaa: am 5b61ad2c: Check the padded size of the read byte array

* commit 'ca609e4300d88ad1e815581ebc6a478b446d3882':
Check the padded size of the read byte array
ca609e4300d88ad1e815581ebc6a478b446d3882 17-Mar-2014 Kenny Root <kroot@google.com> am 38e2aaaa: am 5b61ad2c: Check the padded size of the read byte array

* commit '38e2aaaa3dd62a20eb211808ae6fe45ec37ee6d5':
Check the padded size of the read byte array
9ff2aad010f77a7f095d2802587775a59ed2384a 17-Mar-2014 Kenny Root <kroot@google.com> am 5b61ad2c: Check the padded size of the read byte array

* commit '5b61ad2cda8ec8ab634ce02f388bb2d3c5ab048d':
Check the padded size of the read byte array
5b61ad2cda8ec8ab634ce02f388bb2d3c5ab048d 17-Mar-2014 Kenny Root <kroot@google.com> Check the padded size of the read byte array

Bug: 13509200
Change-Id: Id93894fcc617ec1cd4ce66921c6e1f1c3cf40b09
/frameworks/native/libs/binder/Parcel.cpp
ce9f107c9d9ad4fdc0ad43ccd545823caa3cf933 15-Mar-2014 Marco Nelissen <marcone@google.com> am 793be12c: am b730a452: am f0190bff: Add support for writing byte arrays to parcels

* commit '793be12c0f5a7878d1085e94e58a9c36c84f0911':
Add support for writing byte arrays to parcels
793be12c0f5a7878d1085e94e58a9c36c84f0911 15-Mar-2014 Marco Nelissen <marcone@google.com> am b730a452: am f0190bff: Add support for writing byte arrays to parcels

* commit 'b730a45216991cf22c39451c47393b4bccae111b':
Add support for writing byte arrays to parcels
446ef4bae2605f4d4ef83c57803a9f8c2e901f8e 15-Mar-2014 Marco Nelissen <marcone@google.com> am f0190bff: Add support for writing byte arrays to parcels

* commit 'f0190bff38b6c29abbfc4a877442f71fc3d7dad8':
Add support for writing byte arrays to parcels
f0190bff38b6c29abbfc4a877442f71fc3d7dad8 13-Mar-2014 Marco Nelissen <marcone@google.com> Add support for writing byte arrays to parcels

b/13418320

Change-Id: I2285df9e9d3dc8a6a54055b13b352b81660bf45d
/frameworks/native/libs/binder/Parcel.cpp
614019cd1f73686f9f5883cf0a7505887f44af26 10-Mar-2014 Arve Hjønnevåg <arve@android.com> am d1c87d37: Merge changes I3432d9d3,I90fcf538,I64398603

* commit 'd1c87d37025c49f6a47fe43328572da495ff04c1':
Binder: Fix some valgrind errors.
Binder: Don't cast directly from a pointer to binder_uintptr_t
Binder: Disable attemptIncStrongHandle
8ff043d3fb0eb913aee9afe2a741bf0c30abb7d7 07-Mar-2014 Colin Cross <ccross@android.com> am 74be0f7b: Merge "binder: fix all warnings"

* commit '74be0f7be35e7b40a322fa9a407cb49265333a0b':
binder: fix all warnings
eea5b2984204a9da2a59a8092a4191a33c8e7640 07-Mar-2014 Arve Hjønnevåg <arve@android.com> am 58242fc2: Merge changes Ib0e5a037,I1bd7c38e,Icfc67c2a,I96c64312,I59528054, ...

* commit '58242fc29881cf29d56ee6e5fde6d73b16d0b67c':
ServiceManager: Implement PING_TRANSACTION
ServiceManager: Use 32/64 bit types from new binder header
Binder: Use 64 bit pointers in 32 processes if selected by the target
Add BINDER_IPC_32BIT to CFLAGS unless TARGET_USES_64_BIT_BINDER is true
Binder: Make binder portable
ServiceManager: Fix the binder interface
ServiceManager: Store handles in uint32_t instead of void *
ServiceManager: Generic Fixes
ServiceManager: Add extra error handling
ServiceManager: Fix Android.mk
ServiceManager: Make use of kernel exported structures
4cab0fd7f788995e3858f992ae760df1cfb7f63d 14-Feb-2014 Arve Hjønnevåg <arve@android.com> Binder: Make sure binder objects do not overlap

Fixes crashing part of bug 11355082.
The driver still leaks references.

Change-Id: Ibc6a63b151c1fc1f7666237f25255ba781e02071
/frameworks/native/libs/binder/Parcel.cpp
3c98ba77b9c44037a63d84d185d4128216d8b38a 22-Feb-2014 Arve Hjønnevåg <arve@android.com> am c5294424: am d1c87d37: Merge changes I3432d9d3,I90fcf538,I64398603

* commit 'c5294424386bedad2a240074d0845999f28e662d':
Binder: Fix some valgrind errors.
Binder: Don't cast directly from a pointer to binder_uintptr_t
Binder: Disable attemptIncStrongHandle
c5294424386bedad2a240074d0845999f28e662d 22-Feb-2014 Arve Hjønnevåg <arve@android.com> am d1c87d37: Merge changes I3432d9d3,I90fcf538,I64398603

* commit 'd1c87d37025c49f6a47fe43328572da495ff04c1':
Binder: Fix some valgrind errors.
Binder: Don't cast directly from a pointer to binder_uintptr_t
Binder: Disable attemptIncStrongHandle
ee319ab1d29f9cfd98752e8e3e876c9e7fccb264 20-Feb-2014 Arve Hjønnevåg <arve@android.com> am 6f286114: Revert "Fix "Binder: Make sure binder objects do not overlap" to work old binder kernel interface"

* commit '6f286114ec1d597f3dae987bba6e72dbbc404e32':
Revert "Fix "Binder: Make sure binder objects do not overlap" to work old binder kernel interface"
5febeff15f71f3826b91a51990c901746f97e950 20-Feb-2014 Arve Hjønnevåg <arve@android.com> am 9b5c3b91: am d5a354c6: am d06f6b00: am 67903293: Fix "Binder: Make sure binder objects do not overlap" to work old binder kernel interface

* commit '9b5c3b9132831ba9078fc7c4001821bcfe8dd39d':
Fix "Binder: Make sure binder objects do not overlap" to work old binder kernel interface
6f286114ec1d597f3dae987bba6e72dbbc404e32 20-Feb-2014 Arve Hjønnevåg <arve@android.com> Revert "Fix "Binder: Make sure binder objects do not overlap" to work old binder kernel interface"

This branch has the new driver interface so it should not have this change.

This reverts commit 6790329358d1c84af2fe9ba093bcfc1c6176e758.

Change-Id: I9b6d0d653d98dbdb521ef964c5e7c2f14859d340
/frameworks/native/libs/binder/Parcel.cpp
9b5c3b9132831ba9078fc7c4001821bcfe8dd39d 20-Feb-2014 Arve Hjønnevåg <arve@android.com> am d5a354c6: am d06f6b00: am 67903293: Fix "Binder: Make sure binder objects do not overlap" to work old binder kernel interface

* commit 'd5a354c6b7f2ae0b93e018f3024a2fca5f6543a1':
Fix "Binder: Make sure binder objects do not overlap" to work old binder kernel interface
6790329358d1c84af2fe9ba093bcfc1c6176e758 20-Feb-2014 Arve Hjønnevåg <arve@android.com> Fix "Binder: Make sure binder objects do not overlap" to work old binder kernel interface

DO NOT MERGE into any branch that uses the new interface

Change-Id: Id54308a89327e69a389ac5916c052ad97f57cb28
/frameworks/native/libs/binder/Parcel.cpp
79aa621330e1fefcfc7ccf7c14ef51a8d0ea8c9c 19-Feb-2014 Arve Hjønnevåg <arve@android.com> am 7cc5b880: am e45636a8: am d437364e: am f50b9eaa: Binder: Make sure binder objects do not overlap

* commit '7cc5b8800c22790b0db9ea0af62fcad2cc998303':
Binder: Make sure binder objects do not overlap
7cc5b8800c22790b0db9ea0af62fcad2cc998303 19-Feb-2014 Arve Hjønnevåg <arve@android.com> am e45636a8: am d437364e: am f50b9eaa: Binder: Make sure binder objects do not overlap

* commit 'e45636a8674b9cbb9305648e21316210e1daf920':
Binder: Make sure binder objects do not overlap
07fd0f195db6d341cab4e54257f508d802c98832 19-Feb-2014 Arve Hjønnevåg <arve@android.com> Binder: Fix some valgrind errors.

When using 64 bit binder pointers, only initializing the 32 bit
handle, in a stack allocated struct, will pass uninitialized stack
data to the kernel and other processes.

Change-Id: I3432d9d36bb251d8ddb0a863661aeb80aabb3d92
/frameworks/native/libs/binder/Parcel.cpp
f50b9eaaeeaeae16981f11b05d3f3a6fb0dea30d 14-Feb-2014 Arve Hjønnevåg <arve@android.com> Binder: Make sure binder objects do not overlap

Fixes crashing part of bug 11355082.
The driver still leaks references.

Change-Id: Ibc6a63b151c1fc1f7666237f25255ba781e02071
/frameworks/native/libs/binder/Parcel.cpp
4ba492f23b6fb0d5a95174cc194ce04e1497c0d7 06-Feb-2014 Colin Cross <ccross@android.com> am 2b957503: am 74be0f7b: Merge "binder: fix all warnings"

* commit '2b957503b77c938e0698ffa8904e20c38c408d81':
binder: fix all warnings
6f4f3ab36c5ed1df84eb3a9f7475f0ac42952f58 06-Feb-2014 Colin Cross <ccross@android.com> binder: fix all warnings

Fix warnings related to casting pointers to ints, using %d or %ld to
print size_t/ssize_t, and unused parameters.

Change-Id: I7a13ba83d402952989c1f795cd9e880a95b98d9e
/frameworks/native/libs/binder/Parcel.cpp
88f6ad18de946307b9b1db68faad84b991528e88 03-Feb-2014 Arve Hjønnevåg <arve@android.com> am c93865de: am 58242fc2: Merge changes Ib0e5a037,I1bd7c38e,Icfc67c2a,I96c64312,I59528054, ...

* commit 'c93865de80a16d3638936890fb42eb175284044b':
ServiceManager: Implement PING_TRANSACTION
ServiceManager: Use 32/64 bit types from new binder header
Binder: Use 64 bit pointers in 32 processes if selected by the target
Add BINDER_IPC_32BIT to CFLAGS unless TARGET_USES_64_BIT_BINDER is true
Binder: Make binder portable
ServiceManager: Fix the binder interface
ServiceManager: Store handles in uint32_t instead of void *
ServiceManager: Generic Fixes
ServiceManager: Add extra error handling
ServiceManager: Fix Android.mk
ServiceManager: Make use of kernel exported structures
84e625ac1e01f5a9c3ed16664da6498212ed662b 29-Jan-2014 Arve Hjønnevåg <arve@android.com> Binder: Use 64 bit pointers in 32 processes if selected by the target

Uses new kernel header where void * has been replaced by binder_uintptr_t

Change-Id: Icfc67c2a279269f700343bd9246fd7cb94efe2c1
/frameworks/native/libs/binder/Parcel.cpp
f683e0163a84d93448b9388126902242367cd961 05-Nov-2013 Serban Constantinescu <serban.constantinescu@arm.com> Binder: Make binder portable

Changes include
- Binder attempts to cast pointers to a int datatype
which is not sufficient on a 64-bit platform.

- This patch introduces new read/write functions into
Parcel that allow pointers to be written using the
uintptr_t datatype for compile-time data type size
selection.

- Change access specifier for the methods above.

- Binder uses the 64bit android_atomic_release_cas64
(aka cmpxchg)

Change-Id: I595280541e0ba1d19c94b2ca2127bf9d96efabf1
Signed-off-by: Matthew Leach <matthew.leach@arm.com>
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
/frameworks/native/libs/binder/Parcel.cpp
708cc794f6ccd4d31e0a00a23b289272c665adc1 16-Oct-2013 Marco Nelissen <marcone@google.com> Native counterpart of new power manager method

Cherrypicked from master.

b/9464621

Change-Id: I54c0ed50a57ac870da91db8589a73a2c792dbd8d
/frameworks/native/libs/binder/Parcel.cpp
5c0106e134366312206702f1b072347e20c90374 16-Oct-2013 Marco Nelissen <marcone@google.com> Native counterpart of new power manager method

Change-Id: I54c0ed50a57ac870da91db8589a73a2c792dbd8d
/frameworks/native/libs/binder/Parcel.cpp
cbe36fe1ec21e22e6649d47144c91260ba51d753 05-Sep-2013 Mike Lockwood <lockwood@google.com> Add support for sending and receiving ParcelFileDescriptors from native Binder code

Change-Id: I7f308e28ebac0755628e19c9b4d0d7399341b435
/frameworks/native/libs/binder/Parcel.cpp
e142428a9c8b9d2380032cd4d7b55ee440fe8770 30-Jul-2013 Mathias Agopian <mathias@google.com> Make Flattenable not virtual

Fallout from the Flattenable change, update all its uses.

Additionnaly, fix/tighten size checks when (un)flatten()ing
things.

Removed the assumption by some flattenables (e.g.: Fence)
that the size passed to them would be exact (it can
and will be larger in some cases)

The code in Parcel is a bit complicated so that we don't
have to expose the full implementation (and also to
keep the code smallish).

Change-Id: I0bf1c8aca2a3128491b4f45510bc46667e566dde
/frameworks/native/libs/binder/Parcel.cpp
af0f8c0a56b1b6b7fe20f34f04e0e15b518fb494 30-May-2013 Jeff Brown <jeffbrown@android.com> am 255405eb: am 86b2ecdd: Merge "fix mem leak on error handling"

* commit '255405eb19e6a3fa7f7bb4de9b07beacdf65ece9':
fix mem leak on error handling
3f727c0ea3ad1de512c935c6e80423f2115b46c0 09-Mar-2013 Hyejin Kim <hyejin.kim@lge.com> fix mem leak on error handling

Change-Id: I40d8e371c46184aa701fa676246201a9d8f6e27d
/frameworks/native/libs/binder/Parcel.cpp
002e1e58dfe19dd3e49a59c6827cbf51573941a2 07-May-2013 Mathias Agopian <mathias@google.com> libutils clean-up

Change-Id: I6ff4cfc736751de2912c697f954e45e275f2d386
/frameworks/native/libs/binder/Parcel.cpp
cc1a4bb1e1da3f2f38bdaf1f76348c7bc9fb6adb 12-Jan-2013 Douglas Leung <douglas@mips.com> [MIPS] Avoid unaligned load/store for 64-bit doubles.

Change-Id: Iefdcac8742f23fef31f63730b48698fc4205c3ad
Signed-off-by: Douglas Leung <douglas@mips.com>
/frameworks/native/libs/binder/Parcel.cpp
1ba24574b2debd3ca012adbbd77f12bed4f2d266 03-May-2011 Magnus Strandberg <magnus.strandberg@sonyericsson.com> Aligning native Parcel implementation to Java.

The Java implementation of writing the RPC response header
calculates the length of the header including the 4 bytes
specifying the header length but the native implementation
excludes the 4 bytes specifying the length from the header
length.
The native implementation has been aligned to the Java impl.

Change-Id: I325bf272a63152d8fded4cf4e51a906b5a9bfe19
/frameworks/native/libs/binder/Parcel.cpp
e6f43ddce78d6846af12550ff9193c5c6fe5844b 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
/frameworks/native/libs/binder/Parcel.cpp
32397c1cd3327905173b36baa6fd1c579bc328ff 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
/frameworks/native/libs/binder/Parcel.cpp
a19954ab377b46dbcb9cbe8a6ab6d458f2e32bca 04-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156801

Bug: 5449033
Change-Id: Ib08fe86d23db91ee153e9f91a99a35c42b9208ea
/frameworks/native/libs/binder/Parcel.cpp
9d4536835248525f32f1504a3d28d5bbfa0a2910 20-Dec-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
/frameworks/native/libs/binder/Parcel.cpp
d341c7178fffc7ad5b57645c2bcf5a395ca95591 05-Nov-2011 Jeff Brown <jeffbrown@google.com> Fix possible leak in Parcel::writeDupFileDescriptor.

Also, check the result of dup() just in case we got EMFILE
or something.

Change-Id: I18e627bd84f4c7941813fe1c2bad2cdd9e5afa83
/frameworks/native/libs/binder/Parcel.cpp
c17f56fdf11d5c5207d02d457692a40252aa3f34 07-Nov-2011 Jeff Brown <jeffbrown@google.com> am 88061d6b: am 5462bc63: Fix a leak in Parcel::writeBlob.

* commit '88061d6b38cfb4bf374039846b753a3b21ac61e1':
Fix a leak in Parcel::writeBlob.
93ff1f985e233fe04412a65041e977c9f0c21f5b 05-Nov-2011 Jeff Brown <jeffbrown@google.com> Fix a leak in Parcel::writeBlob.

Was mistakenly assuming that Parcel::writeFileDescriptor took
ownership of the fd that was passed in. It does not!
Added some comments and a default parameter to allow the caller
to specify whether it wishes the Parcel to take ownership.

Bug: 5563374
Change-Id: I5a12f51d582bf246ce90133cce7690bb9bca93f6
/frameworks/native/libs/binder/Parcel.cpp
6807e59e0ff943cc6225d46e3c33a8a7eae9b3d7 20-Oct-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/143865

Bug: 5449033
Change-Id: I0122812ed6ff6f5b59fe4a43ab8bff0577adde0a
/frameworks/native/libs/binder/Parcel.cpp
9f760150f6e0f39b9923cfdc875373606839ee00 12-Oct-2011 Steve Block <steveblock@google.com> Rename (IF_)LOG() to (IF_)ALOG() DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/141576

Bug: 5449033
Change-Id: I42575e7c29cf1c0f465c357a5c97ab118df6f473
/frameworks/native/libs/binder/Parcel.cpp
ec4e0063a1c5cc6e01472cc2a9d27609ce3827d7 10-Oct-2011 Jeff Brown <jeffbrown@google.com> Use ashmem for CursorWindows.
Bug: 5332296

The memory dealer introduces additional delays for reclaiming
the memory owned by CursorWindows because the Binder object must
be finalized. Using ashmem instead gives CursorWindow more
direct control over the lifetime of the shared memory region.

The provider now allocates the CursorWindows and returns them
to clients with a read-only protection bit set on the ashmem
region.

Improved the encapsulation of CursorWindow. Callers shouldn't
need to care about details like how string fields are allocated.

Removed the compile-time configuration of string and numeric
storage modes to remove some dead weight.

Change-Id: I07c2bc2a9c573d7e435dcaecd269d25ea9807acd
/frameworks/native/libs/binder/Parcel.cpp
7746cc318829358bb2c4dc0a03d40a7856a6d13e 04-Oct-2011 Dianne Hackborn <hackbod@google.com> Fix handling of "allow fds" state.

Didn't take into account nesting of bundles. Boo.

Change-Id: Ic8cf21ad8d6f4938a3e105128624c9d162310d01
/frameworks/native/libs/binder/Parcel.cpp
5707dbf15d0b44c88fbaa6dd271097f2d42932e0 24-Sep-2011 Jeff Brown <jeffbrown@google.com> Transfer large bitmaps using ashmem.
Bug: 5224703

Change-Id: If385a66adf4c6179a0bb49c0e6d09a9567e23808
/frameworks/native/libs/binder/Parcel.cpp
8938ed2c8e906fc332301b64787728d4d34da571 29-Sep-2011 Dianne Hackborn <hackbod@google.com> Add mechanism for Parcel to not allow FDs to be written to it.

This is to help implement issue #5224703.

Change-Id: I026a5890495537d15b57fe61227a640aac806d46
/frameworks/native/libs/binder/Parcel.cpp
8acda7803417cc38cb284298fcb86b479d11fdb5 25-Sep-2011 Bart Sears <bsears@google.com> Revert "Transfer large bitmaps using ashmem. Bug: 5224703"

This reverts commit 56c58f66b97d22fe7e7de1f7d9548bcbe1973029

This CL was causing the browser to crash when adding bookmarks, visiting the bookmarks page, and sharing pages (see bug http://b/issue?id=5369231
/frameworks/native/libs/binder/Parcel.cpp
f4c1088d750a182bd85889c86b3c9ef4ba772405 24-Sep-2011 Jeff Brown <jeffbrown@google.com> Transfer large bitmaps using ashmem.
Bug: 5224703

Change-Id: Ic7481dd9f173986f085a8bbdcc59bbe9830d7a44
/frameworks/native/libs/binder/Parcel.cpp
6e9eb7453fe81fd0bb06eaa263c1767765ef5a78 18-Apr-2011 Andreas Huber <andih@google.com> Merge "Parcel::appendFrom({const } Parcel *parcel, size_t, size_t)"
97e2bcd76021b31c5064fd3f669bc3f450b4c952 14-Apr-2011 Dianne Hackborn <hackbod@google.com> Rewrite battery history storage.

We now write battery history directly into a buffer, instead of
creating objects. This allows for more efficient storage; later
it can be even better because we can only write deltas.

The old code is still there temporarily for validation.

Change-Id: I9707d4d8ff30855be8ebdc93bc078911040d8e0b
/frameworks/native/libs/binder/Parcel.cpp
51faf46e2958c57dab46d9420e585319125c7c42 13-Apr-2011 Andreas Huber <andih@google.com> Parcel::appendFrom({const } Parcel *parcel, size_t, size_t)

As far as I can tell "parcel" isn't actually modified by the implementation.

Change-Id: Ib806eefdc13c97b932773e1dc9ca3a4aad4422b2
/frameworks/native/libs/binder/Parcel.cpp
d1dff8d4d47a5f9142a22b11950adc55ea2b36df 15-Dec-2010 Pravat Dalbehera <pravat.dalbehera@sonyericsson.com> Fix for writing empty strings to Parcel::writeString8()

If writeString8 is called with the following sequence:

writeString8(String8(""));
writeString8(String8("TempString"));

Then in the readString8, the 2nd String i.e. "TempString" is not read,
instead an empty string is read.

The bug comes because of the write call for String8("") where there are
no String bytes present. In the write Statement, an extra ‘\0’ is
written. During the Marshalling, Following bytes are written:

1 2 3 4 5 ...
0x0 0x0 0xB ‘T’ ‘e’ ...

The readString8 function has a check that, if String length is 0, don’t
read anything. So the first byte is read as the length for the first
string. The second byte i.e. ‘\0’ is read as the length for the second
string and hence the second string becomes empty too.

Change-Id: Id7acc0c80ae16e77be4331f1ddf69ea87e758420
/frameworks/native/libs/binder/Parcel.cpp
5273603e98d2db3bac656b7bcf5352c04c86d62f 31-Aug-2010 Brad Fitzpatrick <bradfitz@android.com> Don't propagate StrictMode over one-way Binder calls.

This was causing stack stitching problems where a one-way call with
violations followed by a two-way call without violations was getting
the previous one-way call's violation stack stitched on to the second
caller's stack.

The solution is a little more indirect than I would've liked
(preserving the binder's onTransact flags until enforceInterface) but
was seemingly necessary to work without changing the AIDL compiler.
It should also be sufficiently cheap, since no new calls to
thread-local IPCThreadState lookups were required. The additional
work is just same-thread getter/setters on the existing
IPCThreadState.

Change-Id: I4b6db1d445c56e868e6d0d7be3ba6849f4ef23ae
/frameworks/native/libs/binder/Parcel.cpp
70081a1511955f53bd0ed7f2aec9a1bf09f0f379 27-Jul-2010 Brad Fitzpatrick <bradfitz@android.com> Replace several IPCThreadState::get() lookups with one.

Also, make StrictMode's ThreadLocal final.

Change-Id: I08d400ed254fa67bb7a3dae1227f205a54c00df0
/frameworks/native/libs/binder/Parcel.cpp
d36f4a5f130be7f7b29a8b63cedbc8edfa56db96 12-Jul-2010 Brad Fitzpatrick <bradfitz@android.com> StrictMode: gather and return violating stacks in Binder replies

Now, when Thread A has a strict mode policy in effect and does a
Binder call to Thread B (most likely in another process), the strict
mode policy is passed along, but with the GATHER penalty bit set which
overrides other policies and instead gathers all offending stack
traces to a threadlocal which are then written back in the Parcel's
reply header.

Change-Id: I7d4497032a0609b37b1a2a15855f5c929ba0584d
/frameworks/native/libs/binder/Parcel.cpp
a877cd85b5a026384542e3271fc310d6a8fe24c6 08-Jul-2010 Brad Fitzpatrick <bradfitz@android.com> More StrictMode work, keeping Binder & BlockGuard's thread-locals in-sync.

Change-Id: Ia67cabcc17a73a0f15907ffea683d06bc41b90e5
/frameworks/native/libs/binder/Parcel.cpp
837a0d0fb2c3fba8082d47d04cb6120af1eb9a54 14-Jul-2010 Brad Fitzpatrick <bradfitz@android.com> Add Parcel::readExceptionCode() and Parcel::writeNoException()

Add native Parcel methods analogous to the Java versions.

Currently, these don't do much, but upcoming StrictMode work changes
the RPC calling conventions in some cases, so it's important that
everybody uses these consistently, rather than having a lot of code
trying to parse RPC responses out of Parcels themselves.

As a summary, the current convention that Java Binder services use is
to prepend the reply Parcel with an int32 signaling the exception
status:

0: no exception
-1: Security exception
-2: Bad Parcelable
-3: ...
-4: ...
-5: ...

... followed by Parceled String if the exception code is non-zero.

With an upcoming change, it'll be the case that a response Parcel can,
non-exceptionally return rich data in the header, and also return data
to the caller. The important thing to note in this new case is that
the first int32 in the reply parcel *will not be zero*, so anybody
manually checking for it with reply.readInt32() will get false
negative failures.

Short summary: If you're calling into a Java service and manually
checking the exception status with reply.readInt32(), change it to
reply.readExceptionCode().

Change-Id: I23f9a0e53a8cfbbd9759242cfde16723641afe04
/frameworks/native/libs/binder/Parcel.cpp
702ea9d42f52fc145090c0f0bfbe64993e4b8b33 18-Jun-2010 Brad Fitzpatrick <bradfitz@android.com> Start of work on passing around StrictMode policy over Binder calls.

This is (intendend to be) a no-op change.

At this stage, Binder RPCs just have an additional uint32 passed around
in the header, right before the interface name. But nothing is actually
done with them yet. That value should right now always be 0.

This now boots and seems to work.

Change-Id: I135b7c84f07575e6b9717fef2424d301a450df7b
/frameworks/native/libs/binder/Parcel.cpp
98e71ddaede9a0bfb681fd237bec1f66c6c53193 12-Feb-2010 Mathias Agopian <mathias@google.com> remove a dependency of GraphicBuffer (libui) on Parcel (libbinder).

Add a Flattenable interface to libutils which can be used to flatten
an object into bytestream + filedescriptor stream.
Parcel is modified to handle Flattenable. And GraphicBuffer implements
Flattenable.

Except for the overlay classes libui is now independent of libbinder.
/frameworks/native/libs/binder/Parcel.cpp
84a6d041e2c69d4d0b69269a0b59e725c9f119a3 17-Aug-2009 Andreas Huber <andih@google.com> Support for marshalling pointers / intptr_t in Parcel.

Some refactoring to eliminate code duplication in Parcel implementation.
/frameworks/native/libs/binder/Parcel.cpp
1d0a95b12a9194f64dd436224ec3bf8e0622d678 01-Aug-2009 Mathias Agopian <mathias@google.com> don't crash in Parcel when given a null (and therfore invalid) native_handle_t
/frameworks/native/libs/binder/Parcel.cpp
83c0446f27b9542d6c2e724817b2b2d8d1f55085 23-May-2009 Mathias Agopian <mathias@google.com> some work to try to reduce the code size of some native libraries

- make sure that all binder Bn classes define a ctor and dtor in their respective library.
This avoids duplication of the ctor/dtor in libraries where these objects are instantiated.
This is also cleaner, should we want these ctor/dtor to do something one day.

- same change as above for some Bp classes and various other non-binder classes

- moved the definition of CHECK_INTERFACE() in IInterface.h instead of having it everywhere.

- improved the CHECK_INTERFACE() macro so it calls a single method in Parcel, instead of inlining its code everywhere

- IBinder::getInterfaceDescriptor() now returns a "const String16&" instead of String16, which saves calls to String16 and ~String16

- implemented a cache for BpBinder::getInterfaceDescriptor(), since this does an IPC. HOWEVER, this method never seems to be called.
The cache makes BpBinder bigger, so we need to figure out if we need this method at all.
/frameworks/native/libs/binder/Parcel.cpp
4e97f8c62f3eb3c51343e9f4bbd898992a13903d 22-May-2009 Android (Google) Code Review <android-gerrit@google.com> am d50a458b: Merge change 2351 into donut

Merge commit 'd50a458bb291801ab9fdc119301bc7b84b42a6e3'

* commit 'd50a458bb291801ab9fdc119301bc7b84b42a6e3':
Fix a major bug in Bundle when unparcelling from AIDL.
a47f02afb1e1f2c4abd9379c13903a5dde89d354 22-May-2009 Mathias Agopian <mathias@google.com> change 2115 wasn't merged properly into master. this fixes that.

Merge change 2115 into donut

* changes:
bring the native_handle stuff back from master_gl

Conflicts:

libs/binder/Parcel.cpp
/frameworks/native/libs/binder/Parcel.cpp
c5b2c0bf8007562536b822eb060fc54a01f8e08b 20-May-2009 Mathias Agopian <mathias@google.com> move libbinder's header files under includes/binder
/frameworks/native/libs/binder/Parcel.cpp
208059f67ed2dd9fa025e07fcb6954d3cb61c79e 19-May-2009 Mathias Agopian <mathias@google.com> checkpoint: split libutils into libutils + libbinder
/frameworks/native/libs/binder/Parcel.cpp