0

I have an android device.. and Honor View 10... L04 version (US). I have a set of tweaks I am injecting into my kernels ramdisk, that all fire off without issue when I adb shell in and manually run them.

The issue I am finding, is when I setup the services to run in a *.rc file, I am getting a "Permission Denied" error on all of them.

12,8553,14938568,-;[pid:1,cpu7,init]KEVS LATE-INIT Tweaks Fired - Turned of ZRAM and Swapinit: starting service 'kev_swapoff'...
5,8559,14939392,-;[pid:379,cpu4,init]audit: type=1400 audit(1538398511.359:3): avc:  denied  { transition } for  pid=379 comm="init" path="/sbin/kev_swapoff" dev="rootfs" ino=3170 scontext=u:r:init:s0 tcontext=u:object_r:shell_exec:s0 tclass=process permissive=0
11,8560,14939422,-;[pid:379,cpu4,init]init: cannot execve('/sbin/kev_swapoff'): Permission denied
14,10535,16594177,-;[pid:1,cpu7,init]init: starting service 'kev_rib'...
14,10536,16594696,-;[pid:1,cpu7,init]init: starting service 'kev_wl'...
14,10537,16595275,-;[pid:1,cpu7,init]init: starting service 'kev_tweaks'...
14,10538,16595642,-;[pid:1,cpu7,init]init: starting service 'kev_initd'...
11,10562,16627655,-;[pid:651,cpu2,init]init: cannot execve('/sbin/kev_rib'): Permission denied
36,10565,16628234,-;[pid:426,cpu2,logd.auditd]type=1400 audit(1538398513.047:39): avc: denied { transition } for pid=651 comm="init" path="/root/kev_rib" dev="rootfs" ino=3171 scontext=u:r:init:s0 tcontext=u:object_r:shell_exec:s0 tclass=process permissive=0
11,10579,16643981,-;[pid:654,cpu2,init]init: cannot execve('/sbin/kev_initd'): Permission denied
11,10580,16644195,-;[pid:653,cpu7,init]init: cannot execve('/sbin/kev_tweaks'): Permission denied
11,10581,16644348,-;[pid:652,cpu0,init]init: cannot execve('/sbin/kev_wl'): Permission denied

My *.rc file contains:

# Kevp75s Tweaks
on early-init
    write /dev/kmsg "KEVS Tweaks Fired - Set Governor"
    write /sys/devices/system/cpu/cpufreq/policy0/scaling_governor "interactive"
    write /sys/devices/system/cpu/cpufreq/policy4/scaling_governor "interactive"

on boot
    write /dev/kmsg "KEVS Tweaks Fired - Set Governor Settings"
    # force system to be the owner
    # this section is too long to post here...

on late-init
    write /dev/kmsg "KEVS LATE-INIT Tweaks Fired - Turned of ZRAM and Swap"
    start kev_swapoff

on property:sys.boot_completed=1
    write /dev/kmsg "KEVS Tweaks Fired - Cache Tweaks"
    write /sys/module/dm_bufio/parameters/max_cache_size_bytes 71061504
    write /sys/module/dm_bufio/parameters/peak_allocated_bytes 40079360
    write /sys/module/fuse/parameters/max_user_bgreq 1022
    write /sys/module/fuse/parameters/max_user_congthresh 1022
    write /proc/sys/vm/swappiness 0
    write /dev/kmsg "KEVS Tweaks Fired - Networking Tweaks"
    write /sys/kernel/ipv4/tcp_rmem_def 1048576
    write /sys/kernel/ipv4/tcp_rmem_max 2097120
    write /sys/kernel/ipv4/tcp_rmem_min 524288
    write /sys/kernel/ipv4/tcp_wmem_max 4194240
    write /dev/kmsg "KEVS Tweaks Fired - RIB Applied"
    start kev_rib
    write /dev/kmsg "KEVS Tweaks Fired - WL Applied"
    start kev_wl
    write /dev/kmsg "KEVS Tweaks Fired - TWEAKS Applied"
    start kev_tweaks
    write /dev/kmsg "KEVS Tweaks Fired - Init.d Started"
    start kev_initd

service kev_swapoff /sbin/kev_swapoff
    class main
    user root
    group shell
    oneshot
    seclabel u:object_r:shell_exec:s0

service kev_rib /sbin/kev_rib
    class main
    user root
    group shell
    seclabel u:object_r:shell_exec:s0

service kev_wl /sbin/kev_wl
    class main
    user root
    group shell
    seclabel u:object_r:shell_exec:s0

service kev_tweaks /sbin/kev_tweaks
    class main
    user root
    group shell
    seclabel u:object_r:shell_exec:s0

service kev_initd /sbin/kev_initd
    class main
    user root
    group shell
    oneshot
    seclabel u:object_r:shell_exec:s0

I am assuming my seclabels are incorrect, but I'm not 100% sure about that.

What can I do to fix this, so my scripts run properly?

UPDATE

Changerd the seclabel to seclabel u:r:init:s0, and now my error log changed... so I think I'm getting on the right track....

12,8545,16210571,-;[pid:1,cpu6,init]KEVS LATE-INIT Tweaks Fired - Turned of ZRAM and Swapinit: starting service 'kev_swapoff'...
11,8549,16211151,-;[pid:378,cpu7,init]init: cannot execve('/sbin/kev_swapoff'): Permission denied
14,10451,17738830,-;[pid:1,cpu5,init]init: starting service 'kev_rib'...
14,10453,17739257,-;[pid:1,cpu5,init]init: starting service 'kev_wl'...
14,10454,17739593,-;[pid:1,cpu5,init]init: starting service 'kev_tweaks'...
14,10455,17740356,-;[pid:1,cpu5,init]init: starting service 'kev_initd'...
11,10477,17763122,-;[pid:627,cpu2,init]init: cannot execve('/sbin/kev_initd'): Permission denied
11,10505,17765930,-;[pid:624,cpu2,init]init: cannot execve('/sbin/kev_rib'): Permission denied
11,10509,17775024,-;[pid:626,cpu2,init]init: cannot execve('/sbin/kev_tweaks'): Permission denied
11,10510,17775634,-;[pid:625,cpu2,init]init: cannot execve('/sbin/kev_wl'): Permission denied
14,10527,17795806,-;[pid:1,cpu4,init]init: Sending signal 9 to service 'kev_rib' (pid 624) process group...
14,10529,17796386,-;[pid:1,cpu4,init]init: Sending signal 9 to service 'kev_wl' (pid 625) process group...
14,10531,17822357,-;[pid:1,cpu4,init]init: Sending signal 9 to service 'kev_tweaks' (pid 626) process group...
7
  • 1
    Yes they seem to be due to SELinux context enforcement. Simple is to test after setting selinux permissive. Scripts should work then. To avoid SELinux denials in enforcing mode, you need to modify sepolicy using supolicy tool. Commented Oct 1, 2018 at 21:32
  • Stock kernel. Wont be able to make it permissive... unfortunately, sources are broken as well, so the best I can do is modify the seperated ramdisk
    – Kevin
    Commented Oct 2, 2018 at 12:15
  • I'm going to start playing around, probably later today... going to see where this leads me: forum.xda-developers.com/apps/supersu/…
    – Kevin
    Commented Oct 2, 2018 at 12:26
  • 1
    This can be helpful: su.chainfire.eu/#selinux-policies Commented Oct 2, 2018 at 12:30
  • 1
    Yes but basic concepts remain same Commented Oct 2, 2018 at 12:36

0

You must log in to answer this question.

Browse other questions tagged .