termux / termux/termux-api

[Android 10] termux-api hangs on sshd

Open
#301 10 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug report
Dominant language
Java
Stars
4.3k
Forks
920
PR merge metrics
No merged PRs in 30d

Description

Hello!

I have a Pixel 4 (Android 10 Q) with installed termux-api and apk Termux:API from Play Store.
Granting all permissions and disabled battery optimization for termux:api.
Running sshd in termux terminal.

Using termux-api (for example /data/data/com.termux/files/usr/libexec/termux-api BatteryStatus) works well when using termux directly on the phone, but via ssh it is hanging at:

11-10 12:50:10.015 20878 20878 W bash : type=1400 audit(0.0:11281): avc: granted { execute } for name="ps" dev="dm-4" ino=12791 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:50:10.015 20878 20878 W bash : type=1400 audit(0.0:11282): avc: granted { execute } for name="ps" dev="dm-4" ino=12791 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:50:10.015 20878 20878 W bash : type=1400 audit(0.0:11283): avc: granted { execute_no_trans } for path="/data/data/com.termux/files/usr/bin/ps" dev="dm-4" ino=12791 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:50:10.015 20878 20878 W ps : type=1400 audit(0.0:11284): avc: granted { execute } for path="/data/data/com.termux/files/usr/bin/ps" dev="dm-4" ino=12791 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:50:10.035 20878 20878 W ps : type=1400 audit(0.0:11285): avc: granted { execute } for path="/data/data/com.termux/files/usr/lib/libtermux-exec.so" dev="dm-4" ino=13421 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:50:10.035 20878 20878 W ps : type=1400 audit(0.0:11286): avc: granted { execute } for path="/data/data/com.termux/files/usr/lib/libprocps.so" dev="dm-4" ino=13422 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:50:10.039 20878 20878 W ps : type=1400 audit(0.0:11287): avc: denied { read } for name="osrelease" dev="proc" ino=195981 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=0 11-10 12:50:10.039 20878 20878 W ps : type=1400 audit(0.0:11288): avc: denied { read } for name="pid_max" dev="proc" ino=195983 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:proc_pid_max:s0 tclass=file permissive=0 11-10 12:50:30.819 20884 20884 W bash : type=1400 audit(0.0:11292): avc: granted { execute } for name="ps" dev="dm-4" ino=12791 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:50:30.819 20884 20884 W bash : type=1400 audit(0.0:11293): avc: granted { execute } for name="ps" dev="dm-4" ino=12791 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:50:30.819 20884 20884 W bash : type=1400 audit(0.0:11294): avc: granted { execute_no_trans } for path="/data/data/com.termux/files/usr/bin/ps" dev="dm-4" ino=12791 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:50:30.819 20884 20884 W ps : type=1400 audit(0.0:11295): avc: granted { execute } for path="/data/data/com.termux/files/usr/bin/ps" dev="dm-4" ino=12791 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:50:30.822 20884 20884 W ps : type=1400 audit(0.0:11296): avc: granted { execute } for path="/data/data/com.termux/files/usr/lib/libtermux-exec.so" dev="dm-4" ino=13421 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:52:14.452 20912 20912 W bash : type=1400 audit(0.0:11304): avc: granted { execute } for name="termux-api" dev="dm-4" ino=61722 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:52:14.452 20912 20912 W bash : type=1400 audit(0.0:11305): avc: granted { execute } for name="termux-api" dev="dm-4" ino=61722 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:52:14.452 20912 20912 W bash : type=1400 audit(0.0:11306): avc: granted { execute_no_trans } for path="/data/data/com.termux/files/usr/libexec/termux-api" dev="dm-4" ino=61722 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:52:14.452 20912 20912 W termux-api: type=1400 audit(0.0:11307): avc: granted { execute } for path="/data/data/com.termux/files/usr/libexec/termux-api" dev="dm-4" ino=61722 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:52:14.452 20913 20913 W bash : type=1400 audit(0.0:11309): avc: granted { execute } for name="logcat" dev="dm-4" ino=12728 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:52:14.452 20914 20914 W bash : type=1400 audit(0.0:11308): avc: granted { execute } for name="coreutils" dev="dm-4" ino=12888 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:52:14.452 20913 20913 W bash : type=1400 audit(0.0:11310): avc: granted { execute } for name="logcat" dev="dm-4" ino=12728 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:52:14.452 20913 20913 W bash : type=1400 audit(0.0:11311): avc: granted { execute_no_trans } for path="/data/data/com.termux/files/usr/bin/logcat" dev="dm-4" ino=12728 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:52:14.452 20913 20913 W bash : type=1400 audit(0.0:11312): avc: granted { execute } for name="dash" dev="dm-4" ino=12795 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file 11-10 12:52:14.534 20915 20915 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 10211 <<<<<<

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce /data/data/com.termux/files/usr/libexec/termux-api BatteryStatus directly on the phone and through sshd, comparing the hang with the supplied Android log output. Trace the termux-api entry point and the BatteryStatus invocation path; done means the command returns successfully when run over SSH as well as locally.

Written by the indexing model from the issue text.

Assessment

Tech stack
android
Domain
api, cli, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.