I am trying to execute my script /vendor/bin/init.inmod.sh using below method:

Script init.inmod.sh:


/vendor/bin/test_disp hdcp disable

In vendor specific .rc file:

on ???
    start inmod_sh

service inmod_sh /vendor/bin/init.inmod.sh
    class main
    user root
    group root system

My file context:

(vendor|system/vendor)/bin/init\.inmod\.sh    u:object_r:init_inmod_sh_exec:s0

And my init_inmod_sh.te:

type init_inmod_sh, domain;
type init_inmod_sh_exec, exec_type, vendor_file_type, file_type;

allow init_inmod_sh vendor_shell_exec:file rx_file_perms;
allow init_inmod_sh vendor_toolbox_exec:file rx_file_perms;
allow init_inmod_sh self:capability { sys_module sys_admin };

allow init_inmod_sh system_file:system module_load;
allow init_inmod_sh vendor_file:system module_load;
allow init_inmod_sh debugfs_pvr:dir r_dir_perms;

allow init_inmod_sh ampservice:unix_stream_socket { connectto };
allow init_inmod_sh ampservice:unix_dgram_socket { sendto };
allow init_inmod_sh ion_device:chr_file rw_file_perms;

allow init_inmod_sh init_inmod_sh_exec:file { execute_no_trans getattr execute read open };
permissive init_inmod_sh;

I am getting below error:

02-14 00:31:34.580 221 221 I init.inmod.sh: type=1400 audit(0.0:4): avc: denied { execute_no_trans } for path="/vendor/bin/test_disp" dev="dm-1" ino=274 scontext=u:r:init_inmod_sh:s0 tcontext=u:object_r:vendor_file:s0 tclass=file permissive=1

Why am I getting the execute_no_trans denial even after I set .sh file to permissive?

| improve this question | | | | |
  • Please complete missing parts of your question (highlighted with ???). Did you resolve the problem? If yes, you can answer your question yourself for future visitors. Btw development questions are off-topic here. – Irfan Latif Jun 19 '19 at 9:28
  • The apparent reason is that your script isn't getting the context u:object_r:init_inmod_sh_exec:s0, instead the general context of vendor partition: u:object_r:vendor_file:s0. Did you try restorecon -v /vendor/bin/init.inmod.sh or chcon u:object_r:init_inmod_sh_exec:s0 /vendor/bin/init.inmod.sh? – Irfan Latif Jun 19 '19 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.