| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, processes started via `adb shell` have an oom_score_adj of
-1000, making them invisible to the oom killer. This makes running a
process that consumes all memory (e.g. by leaking in a loop) lead to
the entire rest of the system (including adbd, because of bad
heuristics in the kernel) being oom killed before getting to it.
Bug: http://b/63143027
Test: `adb shell cat /proc/self/oom_score_adj` with adb root
Change-Id: I59111134e36dc271adf4c1dd4bd4400d4fe6aee0
(cherry picked from commit 2de2ade387774effee209a1498f16babab81e4ee)
|
| |
|
|
|
|
|
|
|
|
|
|
| |
There exists no path through which a value other than -1 can be written
to the SHELL_EXIT_NOTIFY_FD.
Bug: http://b/74616284
Test: adb_test
Test: adbd_test
Test: python test_device.py
Change-Id: I0630c302ba06bc76917f0445aea75d2dbe1dc865
(cherry picked from commit dcc055af644ce87f1590ab82680f3e0ca4cee54c)
|
| |
|
|
|
|
|
|
|
|
| |
Add an implementation of std::make_unique for Windows, where we're
currently stuck with C++11, and switch some uses of new over to it.
Bug: http://b/74616284
Test: treehugger
Change-Id: I99b85f07754adda7c525243480c3e0bce9a25ce7
(cherry picked from commit 31b5be69f4f39365ce0faad85faba604a2509022)
|
| |
|
|
|
|
| |
Bug: http://b/19635681
Test: printenv
Change-Id: I21e89b9d7cccad23f32a3062a9e04e59b8278104
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
bash sets this itself, but mksh doesn't.
This also makes interactive and non-interactive adb shells more similar,
because when we set this in mkshrc that wouldn't affect non-interactive
shells. (I'm not sure whether this is an improvement or not.)
This is certainly _cheaper_ than doing this in mkshrc by calling out to
getprop though.
Bug: N/A
Test: `adb shell printenv` and `adb shell`, `printenv`
Change-Id: I3ff724f19a5098313df83836253f1f7e7872d6a4
|
| |
|
|
|
|
|
|
| |
Name each service thread specifically to improve debuggability.
Bug: http://b/65648324
Test: adb shell debuggerd -b `adb shell pidof adbd` during a sync
Change-Id: I644e25fc2f14a26eafd19f596e4e8f3c2bb79967
|
| |
|
|
|
|
|
|
|
|
| |
We have std::thread now, so we can delete this cruft.
Test: python test_device.py
Test: adb_test
Test: wine adb_test.exe
Test: /data/nativetest/adbd_test/adbd_test
Change-Id: Ie1c1792547b20dec45e2a62ce6515fcb981c3ef8
|
| |
|
|
|
|
|
|
|
| |
POSIX lets you choose whether or not SIGPIPE disposition is inherited,
and Linux chose "yes". Work around that.
Bug: http://b/35209888
Test: "ps -A | head" without the toybox workaround
Change-Id: I6b5afa3d87eb2af04b24c6c37fa338ab60ad2336
|
| |
|
|
|
|
|
|
| |
At this point, we can't write to oom_score_adj anyway.
Bug: https://code.google.com/p/android/issues/detail?id=227721
Test: boots, adb shell still works
Change-Id: I07e6ad32765f6582f316973547a3a3d552808287
|
| |
|
|
|
|
|
|
|
| |
Test: Compile & adb functioning
Bug: 19235719
Bug: 26552300
Bug: 31289077
Bug: 31456426
Change-Id: I7ad8963bcca3d8b5c37b547c11d163b652d35556
|
| |
|
|
|
|
|
|
|
|
|
| |
Should use android/log.h instead of log/log.h as a good example
to all others. Adjust header order to comply with Android Coding
standards.
Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I33a8fb4e754d2dc4754d335660c450e0a67190fc
|
| |
|
|
|
|
|
| |
unique_fd is modeled on unique_ptr, so make this consistent.
Test: m checkbuild
Change-Id: Ia6a77095dc18746fbb432e96bb8dccfc049c57f6
|
| |
|
|
|
|
|
|
|
|
| |
Some POSIX-only files would like to use functions declared in
adb_utils.h without being forced to use the sysdeps stuff for open,
close, etc. Extract the adb-specific unique_fd into its own header so
those files can use adb_utils.h alongside the real unique_fd.
Change-Id: I10344ef26b7e72fce46bf7e3033f89aa54bd6118
Test: mm
|
| |
|
|
|
| |
Bug: http://b/29565233
Change-Id: Ia59c6dbe5ac033425c11739579e85cbcad1170d1
|
| |
|
|
|
|
|
|
|
|
|
| |
SIGHUP handling depends on the local socket fd being fully closed in
order to trigger an event on its counterpart. Release the local socket
fd inside of Subprocess when returning it to ensure this.
Functionally, a cherry-pick of internal commit 42afe20.
Bug: http://b/29565233
Change-Id: I13b17bcddf0b396a5f4880f9e410fbbf24d9370d
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit fixes two somewhat related issues in shell_service.
- The fd returned by StartSubprocess is owned by a unique_fd
contained in the Subprocess object, but also gets closed by the
caller. Resolve this by duping the returned file descriptor.
- A Subprocess object can be destroyed immediately after its initial
construction in StartSubprocess if we're sufficiently unlucky.
Split up the fork/exec and "start management thread" steps, so that
we can safely do everything we need to do on the Subprocess before
handing it over to the thread that'll eventually destroy it.
Bug: http://b/29254462
Change-Id: Id9cf0b7e7a7293bee7176919edc758597691c636
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
When non-interactive sessions exit via Ctrl+C, adbd sends SIGHUP
to the child process to let it know to exit. However, adbd was not
closing the pipes to the child process, so if the subprocess ignored
SIGHUP and continued writing it could fill up the pipe and block
forever while adbd waits for it to exit.
This CL adds the necessary calls to close the subprocess pipe after
sending SIGHUP.
Bug: 28981563
Change-Id: I318e322e563241052648361172f4859c297837fb
|
| |
|
|
|
|
| |
It's the adb unique_fd, but at least it's the same API...
Change-Id: If5d6642457e145c450374fde6f1358e5ac386a96
|
| |
|
|
|
|
|
|
| |
This makes it possible to get a core dump from adbd when it decides to
exit.
Bug: http://b/28347842
Change-Id: I4cfe5f273f62b2c32e61232d3c39881ecdd6b582
|
| |
|
|
| |
Change-Id: I80c3349ee93d2b3f16c6fadc7f34b2bf4f2cc0d3
|
| |\
| |
| |
| |
| |
| |
| | |
* changes:
adb: wait for restore to complete before returning.
adb: wait for adbd to die and respawn in root/unroot.
adb: make ScopedFd universally accessible and useful.
|
| | |
| |
| |
| | |
Change-Id: I707ffbd10958e7449b4c95dff48638480c746939
|
| |/
|
|
|
|
|
|
| |
forkpty only returns an fd on the master side; trying to keep track of
it on both sides is incorrect.
Bug: http://b/27504427
Change-Id: Ia4a454d8490c77738f9c3350a4236b3d99c8758b
|
| |
|
|
|
|
|
|
|
| |
Windows restricts the return value of threads to 32-bits, even on 64-bit
platforms. Since we don't actually return meaningful values from thread,
resolve this inconsistency with POSIX by making adb's thread abstraction
only take void functions.
Change-Id: I5c23b4432314f13bf16d606fd5e6b6b7b6ef98b5
|
| |
|
|
|
| |
Bug: http://b/26589627
Change-Id: I38e7a33ea8274f0eb47dc0ed87fcbca08a0ab22a
|
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
http://r.android.com/166419 changed `adb shell` behavior to not
allocate a remote PTY for non-interactive commands, but adbd relied on
having a PTY to properly terminate the subprocess.
One impact of this is that when using older versions of adb or passing
the -x flag, `adb screenrecord` wasn't properly terminating and closing
out the video file.
This CL restores the old behavior for legacy shell connections: always
use a PTY, but put it in raw mode if the client is doing local PTY
input/output processing itself.
Bug: http://b/26742824
Change-Id: I9ee630c0ff0d2d6a0db367387af7123deea79676
|
| |/
|
|
|
|
|
| |
Log adb shell, pull and push operations to the security log.
Bug: 22860162
Change-Id: I5d24e9d51040ae05a41d9fcb079e84351a217bd3
|
| |
|
|
|
| |
Bug: http://b/26236990
Change-Id: I8baa4009a2fbe9a4c93f6ef5350ce61161b7237d
|
| |
|
|
|
| |
Bug: http://b/26660675
Change-Id: I8e65d51af73f409c30be47575f76bc6b0f227c54
|
| |
|
|
| |
Change-Id: I0c20e58e14ef756a8c45dd5ea85f7301157a3c8e
|
| |
|
|
|
|
|
|
|
|
|
| |
Previously, for `adb shell`, we were using setenv after forking to set
up the child's environment. This would occasionally deadlock in the
child, which would cause the main thread to deadlock waiting for the
child to complete. This patch constructs the environment before forking
and passes it to execle, eliminating the deadlock.
Bug: http://b/25847115
Change-Id: I720d472770564b1449819ddaab945a89844244a8
|
| |
|
|
|
|
|
|
|
|
|
| |
During early boot, we may be mounting and unmounting /data.
Having the home directory for adb shell commands, such as
"adb shell logcat", on the /data directory prevents unmounting.
This reverts commit 173eb396c7854a3b6c18d0d65865ad05c8b0e195.
Bug: 26132185
Change-Id: Ib7c2f9e696f52bf5bbb79223d90dd76791779587
|
| |
|
|
|
|
|
| |
Make the home directory for adb shell be /data/local/tmp and
automatically change into that directory.
Change-Id: Ib5cc6e1ecdd31a37e986cf03836f7589ebd40868
|
| |
|
|
| |
Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unfortunately, this isn't backwards-compatible with the current shell
protocol because we made unknown shell: arguments errors. We could try
to commit the change to make them just warnings first, but how would
we know when everyone was running adbd with that change? Bumping the
protocol version doesn't help because that only affects the code running
on the host. And although we could add another feature to the reported
features, since shell_v2 is still in development, that doesn't seem
worthwhile.
Bug: http://b/25601436
Change-Id: I12b81aa656cd25b91d14ef691dcbd2b7dab49535
|
| |
|
|
|
| |
Bug: http://b/19734542
Change-Id: Ic9404a132cb9c42cb6a378bcd4b3dea9188d0a44
|
| |
|
|
|
|
|
|
| |
Previously we've set these from /system/etc/mkshrc, which caused a behavioral
difference between interactive and non-interactive shells.
Bug: http://b/19635681
Change-Id: I4608c42dd3de821046220fdb1770ab3216b5d5eb
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Non-interactive `adb shell` previously only read from the remote shell,
but we want it to write as well so interactive and non-interactive
shells can both send data. With this CL, we can now do:
$ echo foo | adb shell cat
foo
This is primarily usable with newer devices that support the shell_v2
features. Older devices will receive stdin but the shell will still
hang after all input has been sent, requiring user Ctrl+C. This seems
better than closing communication altogether which could potentially
miss an unpredictable amount of return data by closing too early.
Known issue: non-interactive stdin to a PTY shell isn't reliable.
However I don't think this is a common case as ssh doesn't seem to
handle it properly either. Examples:
* echo 'echo foo' | adb shell
* echo 'foo' | adb shell -t cat
Bug: http://b/24565284
Change-Id: I5b017fd12d8478765bb6e8400ea76d535c24ce42
|
| |
|
|
|
| |
Bug: 24615098
Change-Id: Ia791ecbe612f09aca3bbd5787513f121fae54da5
|
| |
|
|
|
|
|
| |
As there are too many D(), we can keep both VLOG() and D() now, and get
rid of D() gradually.
Change-Id: I2f1cb70bcab3e82c99fed939341d03f6b2216076
|
| |
|
|
|
|
|
|
| |
When the client exits (e.g. with Ctrl+C) the subprocess should be
notified as well so it can cleanup if needed.
Bug: http://b/23825725
Change-Id: Idb771710b293e0a9f7bebc9e2814b3a816e2c50e
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds functionality for handling stdin/stdout/stderr streams and exit
codes using the shell protocol.
This CL just contains implementation for adbd which will not yet be
enabled. Once we have the ability to query transport features from the
adb client, another CL will add the implementation for the client side
and update the feature list to turn this on.
Note: this CL must be submitted together with a minadbd CL to update
the service_to_fd() function signature.
Bug: http://b/23030641
Change-Id: Ibed55e9c1946d8a35190696163ff63e8fb880238
|
| |
|
|
|
|
|
|
|
|
| |
Refactor shell_service.cpp to remove dependencies on service.cpp and
combine some common logic between PTY and raw subprocesses.
This will make it easier to add additional common code paths for
the upcoming shell protocol.
Change-Id: I497d30dd388de61b6e68d9086dce38f33dd92876
|
|
|
Upcoming changes to the shell will require significant additions to
the subprocess code, and it will be cleaner if it's in a separate file.
The only functional change here is a new debug tag specifically for
the shell service. Everything else has been copied exactly as-is in
order to make it easier to determine what's changing in upcoming CLs.
Change-Id: I13bd4294059051ee10e0d0c6a06affd8eca62967
|