History log of /system/libhwbinder/IPCThreadState.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
0ce07ce06005048eeef327af14b8958878e1aad7 14-Jul-2017 Martijn Coenen <maco@google.com> Only print starvation messages for >1 thread.

These kind of messages cause a lot of confusion:

binder thread pool (1 threads) starved for 4922 ms

what this really says is that one thread was busy
with a transaction for almost 5 seconds. It does
*not* necessarily mean that another transaction
was pending; if there is only a single-threaded
client, nobody would be blocked on this, and
it's not really starvation.

Only print the message when there's more than
one thread in the pool. Note that even in that
case, it doesn't necessarily mean starvation,
but it's a somewhat stronger signal.

Bug: 37647467
Test: mma
Change-Id: I1526690462ce144a6136e4da171c040c5c757e2a
/system/libhwbinder/IPCThreadState.cpp
310feda820900b170daf1604251fc32070fdcb6b 11-Apr-2017 Dan Willemsen <dwillemsen@google.com> Remove unused cutils/sched_policy.h include

Bug: 36426473
Bug: 36079834
Test: m -j libhwbinder
Change-Id: I3560f17bae126abde0a66505ea9a1287ab47e06a
/system/libhwbinder/IPCThreadState.cpp
c4dd210df92f8d58adae5e27631be4d92cba0c43 23-Feb-2017 Steven Moreland <smoreland@google.com> Distinguish libhwbinder log tags.

find ./*.cpp -type f -exec sed -i -e 's/LOG_TAG "/LOG_TAG "hw-/g' {} \;

Also added logtag for BufferedTextOutput.

Fixes: 35713802
Test: hidl_test (for sanity)
Change-Id: I7159dca318c1014a61046d247ef31d67c3ac2b55
/system/libhwbinder/IPCThreadState.cpp
865da06f1c9933b533f21f8fd86896faea4520e8 11-Jan-2017 Tim Murray <timmurray@google.com> libhwbinder: remove set_sched_policy

libhwbinder should not be setting cgroups or priorities.

bug 34204478
Test: 75us -> 55us on libhwbinder_benchmark

Change-Id: I1fc3bb061971ae8666d8ee53bac37fbedc2e8bd7
/system/libhwbinder/IPCThreadState.cpp
1e118d2b86540f7a7d840ec1510337da49f1446c 12-Jan-2017 Yifan Hong <elsk@google.com> BpBinder -> BpHwBinder.

Test: mma
Test: croot && make
Bug: 33554989
Change-Id: I484c9e2e30f12ac3352aabecdf5b30fcf090a191
/system/libhwbinder/IPCThreadState.cpp
dde40f31347a51aa7249cb192f97276c30d984f5 12-Jan-2017 Yifan Hong <elsk@google.com> BBinder -> BHwBinder.

Test: mma
Test: croot && make

Bug: 33554989
Change-Id: Ia1356012d0cc1aef56884bfbd1a6af2a2504ab23
/system/libhwbinder/IPCThreadState.cpp
8a2e8ac7b2a44b6f37e209fa186a06326e82661e 14-Oct-2016 Wei Wang <wvw@google.com> Fix log function for potential overflow

On LP64 system, unsigned long can be 64bit
Also clean out unused static variables.

Test: flash on ARM64 device
Bug: 32181382
Change-Id: Ib91f157b7852cc98d0e4b8d914785ce5162303d8
/system/libhwbinder/IPCThreadState.cpp
0e72fd55c5369bfdb3e61b11f720c5f118fa3031 06-Oct-2016 Chia-I Wu <olv@google.com> Fix compiler warnings.

system/libhwbinder/include/hwbinder/binder_kernel.h:68:3: error: anonymous structs are a GNU extension [-Werror,-Wgnu-anonymous-struct]
struct {
^
system/libhwbinder/include/hwbinder/binder_kernel.h:72:3: error: anonymous structs are a GNU extension [-Werror,-Wgnu-anonymous-struct]
struct {
^
system/libhwbinder/include/hwbinder/binder_kernel.h:68:3: error: anonymous types declared in an anonymous union are an extension [-Werror,-Wnested-anon-types]
struct {
^
system/libhwbinder/include/hwbinder/binder_kernel.h:72:3: error: anonymous types declared in an anonymous union are an extension [-Werror,-Wnested-anon-types]
struct {

system/libhwbinder/include/hwbinder/Parcel.h:476:46: error: extra ';' after member function definition [-Werror,-Wextra-semi]
inline int fd() const { return mFd; };

system/libhwbinder/include/hwbinder/Parcel.h:580:27: error: implicit conversion changes signedness: 'size_t' (aka 'unsigned int') to 'const int32_t' (aka 'const int') [-Werror,-Wsign-conversion]
const int32_t start = dataPosition();

system/libhwbinder/include/hwbinder/Parcel.h:589:21: error: implicit conversion changes signedness: 'const int32_t' (aka 'const int') to 'size_t' (aka 'unsigned int') [-Werror,-Wsign-conversion]
setDataPosition(start);

Test: mm
Change-Id: I6d262e2443a43922828b5684bb6c9d3c6929e20a
/system/libhwbinder/IPCThreadState.cpp
f75a23d54cc9e5f7b6b976e65b6ec346178f306d 01-Aug-2016 Martijn Coenen <maco@google.com> Move android::hidl to android::hardware.

Also moved Status and PersistableBundle out of their
respective 'binder' and 'os' namespaces.

Bug: 30507513
Change-Id: I8822070049a9c1b1b89753aaeb148b05b2aa851d
/system/libhwbinder/IPCThreadState.cpp
80ca4c3e5744a524063bc01443a24643425a8f86 14-Jul-2016 Martijn Coenen <maco@google.com> Debug: dump buffers in transactions.

Shows contents of buffers when enabling
transaction debugging. Also disables
bundling of transaction debug output -
while less efficient, this avoids truncating
the output when the transaction string
representation exceeds 1024 bytes - apparently
a liblog limitation.

Change-Id: I3183e2259fd0ae9e75e3d2e27d4c0660d4202a04
/system/libhwbinder/IPCThreadState.cpp
fd51ebbe7e0a9d1fdb2a205350ecdb2aff801785 05-Jul-2016 Martijn Coenen <maco@google.com> native_handle_t support.

- writeEmbeddedNativeHandle to write a native_handle_t*
embedded inside a buffer.
- Factored out writeEmbeddedBuffer to make clear the buffer
is pointed to from inside another buffer.
- readBuffer()/readEmbeddedBuffer()/readEmbeddedNativeHandle()
- Added writeNativeHandleNoDup()/readNativeHandleNoDup() to
avoid copying file descriptors around if the caller doesn't
need it.
- Moved the binder header modifications inside libhwbinder
for now, until we can get them upstreamed and pulled down
to bionic's uapi headers again.

Change-Id: I3a2c44732f5dc9ed92363552b42aa3ff55a06a8d
/system/libhwbinder/IPCThreadState.cpp
d39a168ff68941c13c5bfc78b5d113c22ef0fd51 03-Jun-2016 Martijn Coenen <maco@google.com> Initial shot at scatter gather support.

Adds APIs to add a nested buffer structure to be
scatter gathered. Uses the new BC_TRANSACTION_SG
and BC_REPLY_SG commands in the kernel driver to
make sure libbinder is fully backwards compatible.

This is likely not the final API, and a lot of
checking is still missing from this implementation.
Change-Id: I66bd11907cb0697aeffa4b710efa4aa75826e9c4
/system/libhwbinder/IPCThreadState.cpp
a660cbcab5c8c9b53c1d022d8a11a0c384237569 12-May-2016 Martijn Coenen <maco@google.com> Servicemanager interfaces for libhwbinder.

Main difference between the hardware servicemanager
and the binder servicemanager is that the former supports
versioned interfaces. For now, support registering a single
supported version per interface, on the assumption that
interfaces with a different major version require a different
implementation (and hence a second call to register).

Switch ProcessState to start using /dev/hwbinder.

This also makes IPCThreadState::setTheContextObject() a
valid method for registering yourself as the servicemanager
again. In "plain" binder, this method was not used, because
the servicemanager for binder doesn't link against libbinder
at all.

Note that while any process can calls this method, it's useless
without also being able to tell the kernel driver that you are
the servicemanager. Since that will be SELinux protected, there's
no further need to protect this call.

Change-Id: If9bfb0305d16010788942aaca7ee1279aea88135
/system/libhwbinder/IPCThreadState.cpp
79c2f4d38c83ac8fe4c9c77e98e04f310016e7a6 20-May-2016 Martijn Coenen <maco@google.com> Callback support for libhwbinder.

One of the prime differences between HIDL and Binder
is that HIDL allows the server implementation to do
a synchronous callback into the client with response
data. This callback allows the server to respond with
data that is anywhere - on the stack, the heap or globals -
without worrying about the lifetime of the data, since
it can immediately clean up (if necessary) when the callback
returns.

So we go from a chain like this:
IPCThreadState::executeCommand() // Execute BR_TRANSACTION
BBinder::transact()
ServerStub::onTransact()
Server::some_method()
// Do work, copy data, and return to ServerStub
// serialize data, and return to BBinder
// return to IPCThreadState
IPCThreadState::sendReply()
// done

to a chain like this:
IPCThreadState::executeCommand () // Execute BR_TRANSACTION
BBinder::transact ()
ServerStub::onTransact()
Server::some_method()
// Do work, send reply
ServerStub::TransactCallback(reply)
// Serialize data (until we get scatter-gather)
BBinder::TransactCallback(serialized_reply)
IPCThreadState::sendReply(serialized_reply)
// send reply over binder, return to BBinder
// return to ServerStub
// return to Server, server can clean up
// return to ServerStub
// return to BBinder
// return to IPCThreadState
// IPCThreadState cleanup
// done

To support this, the transact() and onTransact() methods
must support a callback argument, which is added here.

On the proxy side, this callback argument for transact()
can be ignored for now; after all, once the client side gets a
reply, the data is now in the reply Parcel, and the lifetime
of that Parcel is controlled by the Proxy itself. So it
can simply wait for transact() to return, at which point
the reply Parcel is filled.

In the existing Binder model, it would then deserialize
the reply Parcel into arguments that the client had passed
in, and then the Parcel will go out of scope and gets cleaned up.

In HIDL, we deseralize, call the *client* callback, and
then the Parcel goes out of scope and gets cleaned up.

This will change when we get scatter-gather support, but
this allows us to work with the callback-model before that.

Change-Id: If59ee37f68376bc232f3ecbfbe789f7f4d522003
/system/libhwbinder/IPCThreadState.cpp
e01f4f2b38beb5799dece8742eef5d70d131dbd3 12-May-2016 Martijn Coenen <maco@google.com> Move hwbinder to the android::hidl namespace.

This should prevent clashes if projects do want
to link in both libbinder and libhwbinder.

Also had to pull in Static.h from
frameworks/native/include/private/binder, as that
was not part of the history we pulled from
frameworks/native.

Change-Id: Ib7379e61229c3e68478f9c5530875292e1d51ded
/system/libhwbinder/IPCThreadState.cpp
4080edcfb5810a4a1817c03740f5f1bb19815ae1 04-May-2016 Martijn Coenen <maco@google.com> Make libhwbinder build.

- Moved Android.mk to root
- Changed module name to libhwbinder
- Updated all references to include/binder to include/hwbinder
- Removed services that we know will certainly not exist in hwbinder:
* AppOps
* BatteryStats
* MediaResourceMonitor
* ProcessInfoService
* PermissionCache
- Removed tests (we'll have new ones).

Change-Id: Ie8cc7d3a36032ad42c02b46655f0e015033d232c
/system/libhwbinder/IPCThreadState.cpp
23817585631e749ac72cd80b1fb0da22ca9c9356 16-Apr-2016 Colin Cross <ccross@android.com> Merge "Log when binder thread pool is starved" into nyc-dev
am: 43dcac7

* commit '43dcac7500833c465c417805adc4693c60c3bb5e':
Log when binder thread pool is starved

Change-Id: I420d31273aec69eab9d8e4faa10001ef48b17aa8
b1dc654b9dbf8640605629a64b646ef1577c0db9 15-Apr-2016 Colin Cross <ccross@android.com> Log when binder thread pool is starved

Log when the number of threads executing binder commands is equal to the
maximium size of the thread pool for >100ms.

Bug: 28201939
Change-Id: I892863d8a81c06e362d4ae18ab08485fdec3c0bb
/system/libhwbinder/IPCThreadState.cpp
9d6ce6347a49765f4ef7b6e824a9570493fb99f3 21-Mar-2016 Dianne Hackborn <hackbod@google.com> Merge "Fix issue #27252896: Security Vulnerability -- weak binder" into nyc-dev
am: b49576d

* commit 'b49576d5241859a3cf03c9f34b8030ad25d3806b':
Fix issue #27252896: Security Vulnerability -- weak binder
839f707a38ed15685da48bbd5f4458817b5a54c6 21-Mar-2016 Dianne Hackborn <hackbod@google.com> Fix issue #27252896: Security Vulnerability -- weak binder

Sending transaction to freed BBinder through weak handle
can cause use of a (mostly) freed object. We need to try to
safely promote to a strong reference first.

Change-Id: Ic9c6940fa824980472e94ed2dfeca52a6b0fd342
/system/libhwbinder/IPCThreadState.cpp
8e8a025a6587a97e3ed048b47a02575551f4db43 09-Mar-2016 zhongjie <zhongjie.shi@intel.com> Release resources when repeating dlopen-dlcose.

When the libbinder.so is dlopen and dlclose many
times, we need to delete the pthread_key and
munmap the memory mapping.

Otherwise, it will crash as the leakage causes
the pthread_key or memory mapping surpass their
limit.

Change-Id: Ice64d4ef685c1f665350286f9e5ddf790beac236
Signed-off-by: zhongjie <zhongjie.shi@intel.com>
/system/libhwbinder/IPCThreadState.cpp
1d5dc2bf97110aa3a00236afc64018dfe79b97d8 01-Feb-2016 Andreas Gampe <agampe@google.com> Binder: Add log output in IPCThreadState::self()

In the failure case, and on shutdown, add log output. It's highly
likely the client will crash when a null value is returned. Displaying
a possible root cause helps diagnosing issues.

Bug: 26865304
Change-Id: Ie5255ac50d6dcdf9f918dcef785788ea795a4791
/system/libhwbinder/IPCThreadState.cpp
870d28cbfb8d3d7905b936543cebdca50a56f33a 13-Aug-2015 Elliott Hughes <enh@google.com> am 6a846dd5: am 5f5a0e0f: Merge "Lose HAVE_ANDROID_OS from frameworks/native."

* commit '6a846dd51885df861f4e1e30fcca86b9dd2f4092':
Lose HAVE_ANDROID_OS from frameworks/native.
e5e7055dcbfcabfdd735318a0d712e07544a523a 13-Aug-2015 Elliott Hughes <enh@google.com> Lose HAVE_ANDROID_OS from frameworks/native.

Change-Id: I8e6af2a46a9d875192fc7957ada9b5f66d84bad6
/system/libhwbinder/IPCThreadState.cpp
319900a48d6dfdb230d5eba0658ef92682145339 21-Apr-2015 Wale Ogunwale <ogunwale@google.com> Fixed build error with clang/llvm.

Change-Id: Ideacdc974ebad542df724464ccba9fcfb2b7ea91
/system/libhwbinder/IPCThreadState.cpp
2e604f066e712d99b5cd8ba4115f7ed2578d4a5d 14-Apr-2015 Wale Ogunwale <ogunwale@google.com> Added IPCThreadState::blockUntilThreadAvailable() method.

Will be used by the system_server watchdog to monitor the
availability of binder threads in the process to handle
incoming IPC requests.

Bug: 19297165
Change-Id: I39175f3869ad14da5620fddb47f454e6e4ee2b25
/system/libhwbinder/IPCThreadState.cpp
bbef2baee419a27bc8e8c40e80e296b145e2c9ab 27-Jan-2015 Yabin Cui <yabinc@google.com> Kill HAVE_PTHREADS.

Bug: 19083585
Change-Id: I355491de945590f43c82bdcb7968b01b4bff6e06
/system/libhwbinder/IPCThreadState.cpp
e8da8a4d96938fbe2db67928f176ab11d341ac31 26-Nov-2014 Dan Stoza <stoza@google.com> binder: Return pid_t/uid_t instead of int

Makes IPCThreadState::getCalling{Pid,Uid} return a more
appropriate type.

Change-Id: I97f8a83c1c0722bc1afbf8a6df1a288f8f1f0d2c
/system/libhwbinder/IPCThreadState.cpp
b184ed0c2835773cf75b88b3330653cc4222ce9a 25-Nov-2014 Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> Fix build with clang in C++11 mode

Now that we're in C++11 mode by default, clang complains about switch
statements with case values not matching the type -- since some
binder_driver_return_protocol values are > 0x7fffffff, we need to make
the switch statements operate on uint32_t rather than int32_t.

BUG: 18466763
Change-Id: Iedbfd5c7a3d3d9f087d2eab4ff21343ad7a2a448
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
/system/libhwbinder/IPCThreadState.cpp
c1c85fd86a61032ceb5b7b4a8385407bd1ea3630 24-Nov-2014 Andreas Gampe <agampe@google.com> Binder: Remove unused functions & variables

For build-system CFLAGS clean-up, remove unused functions and
variables.

Change-Id: I88abc2bc99e6b91c7aa56470ff9671bf8bf29f8d
/system/libhwbinder/IPCThreadState.cpp
f9371f6a63796349884b6701d87434e239af0346 04-Nov-2014 Chih-Hung Hsieh <chh@google.com> am dbab409c: Merge "Avoid two warnings from clang."

* commit 'dbab409c49ca5dd6686912d0b3eeb19ef1c37a3e':
Avoid two warnings from clang.
30dcad775deba8134cbbcb93a9b15412f9b1d2a0 24-Oct-2014 Chih-Hung Hsieh <chh@google.com> Avoid two warnings from clang.

Clang compiler warns about undefined static functions like getReturnString
before all references are removed inside IF_LOG_COMMANDS.
To remove such warnings, we can leave those static functions defined
and the compiler will remove them at the end when they are not used.

Add a cast to long before converting from int to void*,
to avoid type cast warnings on 64 bit targets.

BUG: 17043248
Change-Id: Ica31101522279d2c8eacc90e2939767002fb827b
/system/libhwbinder/IPCThreadState.cpp
e993e6fe94a9c93fd83d68cac3e9341055226d24 30-Sep-2014 Dianne Hackborn <hackbod@google.com> am 5ee2c9d2: Work on issue #17656716: Unhandled exception in Window Manager

* commit '5ee2c9d20c0fbecf6b4a482eb8d8bfdf85d0d424':
Work on issue #17656716: Unhandled exception in Window Manager
f99aec6a0cff674e0a010cf5789beb4cf4be592d 30-Sep-2014 Dianne Hackborn <hackbod@google.com> Work on issue #17656716: Unhandled exception in Window Manager

Try to clean up the code paths coming in and out of binder IPCs to
plug any places where we could disrupt the gather flag of a thread,
causing it to keep gathering stack crawls (which is the thing that
is causing our strict mode data to become so large).

We now take care of saving and restoring this state in the core
IPC code path, not at the Java layer.

Change-Id: I73d564778da127bdce00f304225930e7f2318293
/system/libhwbinder/IPCThreadState.cpp
07cf48a1aaa0601c837024d159599ed9de19f5a9 18-Aug-2014 Elliott Hughes <enh@google.com> Use gettid directly in binder.

Bug: 17048545
Change-Id: I1df378135961e085a52f6cc5694ad74cd73aac19
/system/libhwbinder/IPCThreadState.cpp
37888cd63a3d24ec9d1497d134c40d3797941b98 29-May-2014 Mark Salyzyn <salyzyn@google.com> binder: rm utils/Debug.h

Change-Id: I16931919a26c16a0d701771c93fa7fe1c6f60ef8
/system/libhwbinder/IPCThreadState.cpp
ea8e05d41dad46a19b14cabd1697976b00caf3b7 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
/system/libhwbinder/IPCThreadState.cpp
4bdf7e9b35d72a8c62c2b271c398f7e572d55a1c 19-Feb-2014 Arve Hjønnevåg <arve@android.com> Binder: Don't cast directly from a pointer to binder_uintptr_t

When using the 64 bit binder interface from a 32 bit process the
pointer may get sign extended and cause the kernel to fail to read
from it.

Change-Id: I90fcf53880e2aa92e230a9723f9b3f7696170e32
/system/libhwbinder/IPCThreadState.cpp
304dcaedb7aabc7d070329e641fc4a6a3bac2918 15-Feb-2014 Arve Hjønnevåg <arve@android.com> Binder: Disable attemptIncStrongHandle

The driver does not support BC_ATTEMPT_ACQUIRE and will return an error.
IPCThreadState does not handle driver errors, and will resend the failed
command blocking all other commands.

Change-Id: I643986037341821b27b62dc82df933844f4842b8
/system/libhwbinder/IPCThreadState.cpp
f04879896beb41f2455017ace482283bc2ef321c 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
/system/libhwbinder/IPCThreadState.cpp
a544070681ccced272b4fa3b5781096cba05dde5 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
/system/libhwbinder/IPCThreadState.cpp
4ca5bafb8da8e2316464be178f32a170b494300b 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>
/system/libhwbinder/IPCThreadState.cpp
b699a79a34045bf15394edaca665d06ccecf4567 13-Jul-2013 Jeff Brown <jeffbrown@google.com> Make getCallingUid/Pid const.

Change-Id: I1853b21eaa45d85274189dfd72f73fec48d0d6b7
/system/libhwbinder/IPCThreadState.cpp
0646cb013e216d9f1fcd76365d07f369af8b989d 26-Jun-2013 Todd Poynor <toddpoynor@google.com> binder: add polling / single-threaded operation

This is currently safe to do only for processes that disallow any binder
threads to be created: setThreadPoolMaxThreadCount(0).

Change-Id: I8a27f3cf26f4d51edb7f222af487ac256cbcab65
/system/libhwbinder/IPCThreadState.cpp
f9952ab562d6c6476768a955ff58254aba294469 12-Jun-2013 Jeff Tinker <jtinker@google.com> am de836890: am ef07386e: Prevent IPCThreadState::joinThreadPool from spinning on unexpected error

* commit 'de836890abc7b5381e285833052375cbb85730cb':
Prevent IPCThreadState::joinThreadPool from spinning on unexpected error
ee711ec34a64cf71e5f3e9c1494a988fd9002936 11-Jun-2013 Jeff Tinker <jtinker@google.com> Prevent IPCThreadState::joinThreadPool from spinning on unexpected error

Adds logging to help determine what is happening to the /dev/binder
fd and dump the process state when it happens.

bug: 8912673
Change-Id: I2aa0c66fc499e91e0bf9ee4ae20404bec35adc82
/system/libhwbinder/IPCThreadState.cpp
4ea13dcd270953215f51345e83708c16963d332f 07-May-2013 Mathias Agopian <mathias@google.com> libutils clean-up

Change-Id: I6ff4cfc736751de2912c697f954e45e275f2d386
/system/libhwbinder/IPCThreadState.cpp
68b83cc5c694c43a922915a11f3103366ed7ea9c 07-Oct-2012 Dave Burke <daveburke@google.com> Revert "ugly, temporary, workaroung for a problem where a binder thread spins forever"

This reverts commit 0845d0245e09548110cacb0f20e9934753388aab

Change-Id: I395037cb9427cd11f7de6bb78fbdfa917fc6263a
/system/libhwbinder/IPCThreadState.cpp
84fcf442be2107ea16cf85603b8999ee2bea0d59 06-Oct-2012 Mathias Agopian <mathias@google.com> ugly, temporary, workaroung for a problem where a binder thread spins forever

Bug: 7289992
Change-Id: I0c3d482a1af57e5f444be2ba7f2751ac3e954af2
/system/libhwbinder/IPCThreadState.cpp
1611a893f26fe09ae62442cf88d88e130ff5667e 31-Aug-2012 Dianne Hackborn <hackbod@google.com> No longer need "original calling uid".

Change-Id: Ifc4a89dd088609a5a8553f6ac6553174e09e8222
/system/libhwbinder/IPCThreadState.cpp
597a3c7696af00cc4c3e6d919c507adc552cdfd7 17-Feb-2011 Johannes Carlsson <johannes.carlsson.x@sonyericsson.com> Fix shutdown sequence to avoid SIGSEGV when running am command

When the app_process is shutting down the main thread will close the
binder fd while pool threads are executing an ioctl (in
IPCThreadState::stopProcess called by AppRuntime::onStarted in
app_main.c).

The binder driver will then return all pending calls in ioctl
without any error and with a command. One of the threads gets a
BR_SPAWN_LOOPER which will create a new thread (the other thread
gets a BR_NOOP). This new thread then calls
vm->AttachCurrentThread. Usually this results in a log entry with
"AndroidRuntime: NOTE: attach of thread 'Binder Thread #3' failed",
but sometimes it also causes a SIGSEGV. This depends on the timing
between the new thread an the main thread that calls DestroyJavaVM
(in AndroidRuntime::start).

If IPCThreadState.cpp is compiled with "#define LOG_NDEBUG 0" the
pool thread will loop and hit the
ALOG_ASSERT(mProcess->mDriverFD >= 0) in
IPCThreadState::talkWithDriver.

Crashes like this has been seen when running the am command and
other commands that use the app_process.

This fix makes sure that any command that is received when the driver
fd is closed are ignored and IPCThreadState::talkWithDriver instead
returns an error which will cause the pool thread to exit and detach
itself from the vm. A check to avoid calling ioctl to a fd with -1
was also added in IPCThreadState::threadDestructor.

Another solution might be to change the binder driver so that it
returns an error when the fd is closed (or atleast not a
BR_SPAWN_LOOPER command). It might also be possible to call exit(0)
which is done when System.exit(0) is called from java.

Change-Id: I3d1f0ff64896c44be2a5994b3a90f7a06d27f429
/system/libhwbinder/IPCThreadState.cpp
cb5e24201c07fc7d9cff87c60251b54a4f2a21c9 16-Mar-2012 Glenn Kasten <gkasten@google.com> Scheduling group cleanup

Remove C++ APIs androidSetThreadSchedulingGroup and
androidGetThreadSchedulingGroup, and the ANDROID_TGROUP_* constants.

Former callers of these should now use the C APIs set_sched_policy and
get_sched_policy, and the SP_* constants.

Note: debug.sys.noschedgroups is not supported by the C APIs,
this needs to be discussed.

Change-Id: I32bbfc539ef4090faf9ef0320380e8cca9eae07c
/system/libhwbinder/IPCThreadState.cpp
7d95b34b9d593a156b5b7db48607a999ce43dfd9 06-Mar-2012 Glenn Kasten <gkasten@google.com> Remove obsolete references to sched_policy.h

As part of scheduling policy cleanup, remove or isolate
all references to the scheduling policy APIs.

Change-Id: Ia1ea2fe711a399039f25217309e061267744b856
/system/libhwbinder/IPCThreadState.cpp
e99f1392043425c910c27984868e2767faa04c69 04-May-2011 Amith Yamasani <yamasani@google.com> Multi-user - 1st major checkin

Switching activity stacks
Cache ContentProvider per user
Long-press power to switch users (on phone)

Added ServiceMap for separating services by user
Launch PendingIntents on the correct user's uid
Fix task switching from Recents list
AppWidgetService is mostly working.

Commands added to pm and am to allow creating and switching profiles.

Change-Id: I15810e8cfbe50a04bd3323a7ef5a8ff4230870ed
/system/libhwbinder/IPCThreadState.cpp
d0bfabc8c2b42ca8f71f066b8a6de2e8f7995203 09-Jan-2012 Steve Block <steveblock@google.com> Rename LOG_ASSERT to ALOG_ASSERT DO NOT MERGE

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

Bug: 5449033
Change-Id: I8ceb2dba1b031a0fd68d15d146960d9ced62bbf3
/system/libhwbinder/IPCThreadState.cpp
93cf854f5e563ba575691b4b639365fe6c517193 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
/system/libhwbinder/IPCThreadState.cpp
8071bf0b070daf407d014752ba91c81feedbe90f 02-Dec-2011 Ben Cheng <bccheng@google.com> am f1a4c48b: am e21dabf6: Merge "Initialize bwr.read_buffer in IPCThreadState::talkWithDriver." into ics-mr1

* commit 'f1a4c48b886d53e2afceb0620215e3792af79fd5':
Initialize bwr.read_buffer in IPCThreadState::talkWithDriver.
455a70a568f5fa2351d31a64e390246b2e4c4d3e 02-Dec-2011 Ben Cheng <bccheng@google.com> Initialize bwr.read_buffer in IPCThreadState::talkWithDriver.

I/valgrind( 1309): ==1310== Syscall param
ioctl(BINDER_WRITE_READ).read_buffer points to uninitialised byte(s)
I/valgrind( 1309): ==1310== at 0x480E670: __ioctl (__ioctl.S:10)
I/valgrind( 1309): ==1310== Address 0xbda651b4 is on thread 1's stack

Change-Id: I02893df7b5786b6b2dbd9659f5706d7171295ab2
/system/libhwbinder/IPCThreadState.cpp
5854b917f0d7b18a74786f652a981f241cc906f5 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
/system/libhwbinder/IPCThreadState.cpp
457d51fd623e7572aa0279ef63d8e00a2ace1841 31-Aug-2011 Andy McFadden <fadden@android.com> Resurrect verbose binder logging

Updated the command name lists, and masked off the additional bits in
the command word when doing the name lookup.

Made descriptor values easier to grep for and consistent with kernel
output (i.e. decimal rather than hex). Attempt to show transaction
descriptors as such (they're in a union with a pointer).

Also, the writeLines() function in Static was using a no-op
logging call to write an iovec. It looks like all callers are using
N=1, so I just added a log for the first string.

Bug 5155269

Change-Id: I417b8d77da3eb6ee1d2069ba94047210f75738bc
/system/libhwbinder/IPCThreadState.cpp
68c8a657d43a7346746794194093d3912583a34b 21-Apr-2011 Evgeniy Stepanov <eugenis@google.com> Make sure binder ioctl structs don't contain uninitialized values.

Change-Id: I8a678f91262417bb120e65e32c244ce1512b46c2
/system/libhwbinder/IPCThreadState.cpp
7794994fc8947b65730108aa4700b109c268bb6d 14-Dec-2010 Brad Fitzpatrick <bradfitz@android.com> Framework-side support for Dalvik "isSensitiveThread" hook.

Used in lock contention stats.

Bug: 3226270
Change-Id: Ie6f58d130a29079a59bdefad40b80304d9bc3623
/system/libhwbinder/IPCThreadState.cpp
9887826b424612da22b61bc2b73adc88a4af9c7c 24-Sep-2010 Dianne Hackborn <hackbod@google.com> Some debugging support.

- New feature to "am monitor" to have it automatically launch
gdbserv for you when a crash/ANR happens, and tell you how to
run the client.

- Update dumpstate to match new location of binder debug logs

- Various commented out logs that are being used to track down
issues.

Change-Id: Ia5dd0cd2df983a1fc6be697642a4590aa02a26a5
/system/libhwbinder/IPCThreadState.cpp
24f8bca9cb9778ae67a3642108d4ab67eca642f8 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
/system/libhwbinder/IPCThreadState.cpp
3f4ef59401d7c2115c273ab1e76c221da22cf8d0 08-Jul-2010 Brad Fitzpatrick <bradfitz@android.com> More StrictMode work, keeping Binder & BlockGuard's thread-locals in-sync.

Change-Id: Ia67cabcc17a73a0f15907ffea683d06bc41b90e5
/system/libhwbinder/IPCThreadState.cpp
94c3634ac573531efe9a5abbc122a35c201567ad 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
/system/libhwbinder/IPCThreadState.cpp
7c4dfece81abcf7d67b747ce25d452b150f9e9cb 19-Mar-2010 Christopher Tate <ctate@google.com> Ensure that binder incalls to the system process keep the fg cgroup

On binder incalls, the handler thread is given the caller's priority by the
driver, but not the caller's cgroup. We have explicit code that sets the
handler's cgroup to match the caller's, *except* that the system process
explicitly disables this behavior. This led to a siuation in which we were
running binder incalls to the system process at nice=10 but cgroup=fg.

That's fine as far as it goes, except that if a GC happened in the handler
thread, it would be promoted to foreground priority and cgroup both, to avoid
having the GC take forever. Then, when GC finished, the original priority
is reset, and the cgroup set *based on that priority*. This would push the
handler thread into nice=10 cgroup=bg_non_interactive -- which matches the
caller, but is supposed to be impossible in the system process.

The end result of this was that we could be running "lengthy" operations in
the system process in the background. Unfortunately, some of the operations
that wound up like this would hold important global system locks for up to
twenty seconds as a result, making the entire device unresponsive to input
for that period.

This CL fixes the binder incall setup to ensure that within the system process,
a binder incall is always begun from the normal foreground priority as well
as cgroup. In practice now the device still becomes laggy/sluggish when the
offending lock-holding time-consuming incall occurs, but since it still runs
as a foreground task it is able to proceed to completion within a short time
rather than taking 20 seconds.

Fixes bug #2403717

Change-Id: Id046aeabd0e80c48eef94accc37842835eab308d
/system/libhwbinder/IPCThreadState.cpp
5f4d7e81777db67004bdd7836a133607c37ae936 08-Dec-2009 Dianne Hackborn <hackbod@google.com> Propagate background scheduling class across processes.

This is a very simply implementation: upon receiving an IPC, if the handling
thread is at a background priority (the driver will have taken care of
propagating this from the calling thread), then stick it in to the background
scheduling group. Plus an API to turn this off for the process, which is
used by the system process.

This also pulls some of the code for managing scheduling classes out of
the Process JNI wrappers and in to some convenience methods in thread.h.
/system/libhwbinder/IPCThreadState.cpp
0d7c8beb3788e64c201f8a40d629b43c8a5519b7 08-Nov-2009 Christopher Tate <ctate@android.com> Reset binder service threads' cgroup/priority after command completion

To prevent buggy command implementations from poisoning binder threads'
scheduling class & priority for future command execution, we now reset the
cgroup and thread priority to foreground/normal when a binder service thread
finishes executing the designated command.

Change-Id: Ibc0ab2485751453f6dc96fdb4eb877fd02796e3f
/system/libhwbinder/IPCThreadState.cpp
5b81687803ddae3564f725aaa7b28c5351ebeb9f 06-Nov-2009 Evan Millar <emillar@google.com> Revert jparks code from IPCThreadState.
/system/libhwbinder/IPCThreadState.cpp
4ab6311f0564d1c4ba666ac556b5baf10caf4207 04-Nov-2009 Jason Parks <jparks@google.com> When a thread is about to be put back onto the thread pool ensure that it is in the foreground cgroup.
/system/libhwbinder/IPCThreadState.cpp
2b17f147508401f8e8cdf59f7a329cb677bd7ead 03-Nov-2009 Jason Parks <jparks@google.com> Add a warning when we leave threads in the binder thread pool in the background scheduling group.
/system/libhwbinder/IPCThreadState.cpp
b4f35d0238103bd22c1a2cf1b6a31f2fba21fc3e 17-Jul-2009 Marco Nelissen <marcone@google.com> Instead of using -1 for pid and uid in the simulator, and then having
to special-case the simulator case all over the framework, just use
getuid and getpid, and intercept those in the simulator wrapper.
/system/libhwbinder/IPCThreadState.cpp
164757037f944dae1eb5f76176570b2e43a37b55 20-May-2009 Mathias Agopian <mathias@google.com> move libbinder's header files under includes/binder
/system/libhwbinder/IPCThreadState.cpp
7922fa29f3a18386b6eb4cb19e8c582d9f751345 19-May-2009 Mathias Agopian <mathias@google.com> checkpoint: split libutils into libutils + libbinder
/system/libhwbinder/IPCThreadState.cpp