0

/system/bin/ ディレクトリにシェル スクリプト (AutoStartSvc.sh) があり、実行可能なパーミッションが付与されています。リモートからキー コードを押すと、IR リモート ドライバーからこのシェル スクリプトをトリガーしたいと考えています。リモート ドライバーで "call_usermodehelper" API を使用して、IR キー コードの照合時にシェル スクリプトを呼び出しています。

シェルスクリプトの内容:ifconfig wlan0 192.168.23.1 up

IR リモート ドライバーの変更点:

int result=-1;
char* argv[] = {"/system/bin/sh", "-c","/system/bin/DVBT2_WiFi_indoor_v11", NULL };
static char* envp[] = {"HOME=/","TERM=linux","PATH=/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin", NULL};
if(iscodematched() == 0) // checks the code match
{
    free_irq(chip->irqno, chip);// call_usermodehelper won't work in interrupt mode so exit from the interrupt mode
    printk("Key code matched. \n");
    result = call_usermodehelper(argv[0], argv, envp, UMH_NO_WAIT);
    printk("return value of call_usermodehelper: %d \n", result);
}

カーネル エラー ログ:

Key code matched. 
[  922.686115@2] type=1400 audit(1420080107.660:117): avc: denied { execute } for pid=7665 comm="kworker/u8:0" name="sh" dev="mmcblk0p12" ino=351 scontext=u:r:kernel:s0 tcontext=u:object_r:shell_exec:s0 tclass=file permissive=0
[  922.667383@1] return value of call_usermodehelper: 0 

私の試行: avc: android の sepolicy による拒否です。この問題を解決するために、Android ソース コードの /system/sepolicy/kernel.te で次の変更を行いました。

#added this line:
allow kernel shell_exec:file { getattr open read execute execute_no_trans rx_file_perms };
#uncommented the following line
neverallow kernel { file_type fs_type -rootfs }:file { entrypoint execute_no_trans };

上記の kernel.te の変更でも、シェル スクリプトはトリガーされません no service denial しかし、今度は no service denial メッセージが消えました。しかし、「call_usermodehelper」の戻り値はゼロです。どんな助けでも大歓迎です。

4

0 に答える 0