android system 32512,Errno 13 - EACCES从Android框架中的cpp代码调用system()时权限被拒绝...

我试图从cpp代码向Android框架中的java代码发送一个intent . 这是我用于此目的的代码:

int ret = system("/system/bin/am broadcast -a android.intent.action.MIKE_ACCESSED --user all"); returned 256 0

__android_log_print(ANDROID_LOG_DEBUG, "test", "Shell command returned %i %i", ret, errno);

如果SELinux处于强制模式,Logcat将返回以下内容

D/test ( 187): Shell command returned 32512 13

如果SELinux处于许可模式,Logcat将返回以下内容

D/test ( 187): Shell command returned 256 0

Errno 13对应EACCES权限被拒绝!为了能够从cpp代码进行系统调用,我需要在AOSP中进行哪些更改?请注意,源文件是在./framework/av/media/libmedia下可用的AudioSystem.cpp . 代码由mediaserver进程使用 .

来自SELinux的AVC在许可模式下

<4>[ 209.136465] type=1400 audit(1427229550.386:6): avc: denied { execute } for pid=3514 comm="Binder_5" name="sh" dev="mmcblk0p25" ino=284 scontext=u:r:mediaserver:s0 tcontext=u:object_r:shell_exec:s0 tclass=file

<4>[ 209.137013] type=1400 audit(1427229550.386:7): avc: denied { read open } for pid=3514 comm="Binder_5" name="sh" dev="mmcblk0p25" ino=284 scontext=u:r:mediaserver:s0 tcontext=u:object_r:shell_exec:s0 tclass=file

<4>[ 209.137634] type=1400 audit(1427229550.386:8): avc: denied { execute_no_trans } for pid=3514 comm="Binder_5" path="/system/bin/sh" dev="mmcblk0p25" ino=284 scontext=u:r:mediaserver:s0 tcontext=u:object_r:shell_exec:s0 tclass=file

<4>[ 209.143705] type=1400 audit(1427229550.396:9): avc: denied { execute_no_trans } for pid=3514 comm="sh" path="/system/bin/am" dev="mmcblk0p25" ino=132 scontext=u:r:mediaserver:s0 tcontext=u:object_r:system_file:s0 tclass=file

<4>[ 209.156557] type=1400 audit(1427229550.406:10): avc: denied { getattr } for pid=3514 comm="am" path="/system/bin/app_process32" dev="mmcblk0p25" ino=134 scontext=u:r:mediaserver:s0 tcontext=u:object_r:zygote_exec:s0 tclass=file

<4>[ 209.156896] type=1400 audit(1427229550.406:11): avc: denied { execute } for pid=3514 comm="am" name="app_process32" dev="mmcblk0p25" ino=134 scontext=u:r:mediaserver:s0 tcontext=u:object_r:zygote_exec:s0 tclass=file

<4>[ 209.157186] type=1400 audit(1427229550.406:12): avc: denied { read open } for pid=3514 comm="am" name="app_process32" dev="mmcblk0p25" ino=134 scontext=u:r:mediaserver:s0 tcontext=u:object_r:zygote_exec:s0 tclass=file

<4>[ 209.157430] type=1400 audit(1427229550.406:13): avc: denied { execute_no_trans } for pid=3514 comm="am" path="/system/bin/app_process32" dev="mmcblk0p25" ino=134 scontext=u:r:mediaserver:s0 tcontext=u:object_r:zygote_exec:s0 tclass=file

<4>[ 209.366659] type=1400 audit(1427229550.616:14): avc: denied { execute } for pid=3514 comm="app_process" path="/data/dalvik-cache/arm/system@framework@boot.oat" dev="mmcblk0p28" ino=105876 scontext=u:r:mediaserver:s0 tcontext=u:object_r:dalvikcache_data_file:s0 tclass=file

<7>[ 215.752267] wlan0: no IPv6 routers present

非常感谢

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值