phhusson / treble_app

An app which will do various stuff for Treble ROMs
68 stars 92 forks source link

Should we ask for su permissions first before changing hostapd params? #9

Closed TenSeventy7 closed 5 years ago

TenSeventy7 commented 5 years ago

I mean, it spouts permission denied when changing the name/password. Reference from this.

Logs are here: hostapd_issue2.log

Device: Huawei Y6 (2018) - ATU-L22 ROM: AospExtended v6.0 GSI by EnesSastim

phhusson commented 5 years ago

Does it work on my GSI? Please give the result of ls -lZ /data /data/misc /data/misc/wifi /data/misc/wifi/*

TenSeventy7 commented 5 years ago

Does it work on my GSI? Please give the result of ls -lZ /data /data/misc /data/misc/wifi /data/misc/wifi/*

Weirdly enough, it works on some of our devices with the same ROM installed.

HWATU-QG:/ # ls -lZ /data /data/misc /data/misc/wifi /data/misc/wifi/*

-rw-------  1 system system u:object_r:wifi_data_file:s0    236 2018-12-27 15:03 /data/misc/wifi/WifiConfigStore.xml
-rw-------  1 wifi   wifi   u:object_r:wifi_data_file:s0     21 2018-12-27 15:26 /data/misc/wifi/entropy.bin
-rw-rw----  1 wifi   wifi   u:object_r:wifi_data_file:s0    280 2018-12-27 15:21 /data/misc/wifi/hostapd.conf
-rw-------  1 root   root   u:object_r:wifi_data_file:s0      4 2018-12-27 15:26 /data/misc/wifi/hostapd.pid
-rw-r-----  1 wifi   wifi   u:object_r:wifi_data_file:s0     18 1970-07-10 22:29 /data/misc/wifi/macwifi
-rw-rw----  1 wifi   wifi   u:object_r:wifi_data_file:s0     96 1970-07-10 20:26 /data/misc/wifi/p2p_supplicant.conf
-rw-------  1 system system u:object_r:wifi_data_file:s0     42 2018-12-27 15:26 /data/misc/wifi/softap.conf
-rw-rw----  1 wifi   wifi   u:object_r:wifi_data_file:s0     96 1970-07-10 20:26 /data/misc/wifi/wpa_supplicant.conf

/data:
total 272
drwxrwxr-x   2 system   system   u:object_r:mmi_data_file:s0            3488 1970-07-08 23:36 FTM_AP
drwx------   5 root     root     u:object_r:adb_data_file:s0            3488 2018-12-27 15:35 adb
drwxrwxr-x   2 system   system   u:object_r:anr_data_file:s0            3488 2018-12-27 15:21 anr
drwxrwx---   2 system   cache    u:object_r:cache_recovery_file:s0      3488 1970-07-08 23:36 apkpush
drwxrwx--x  73 system   system   u:object_r:apk_data_file:s0           20480 2018-12-27 14:50 app
drwx------   2 root     root     u:object_r:asec_image_file:s0          3488 1970-07-08 23:36 app-asec
drwxrwx--x   2 system   system   u:object_r:system_data_file:s0         3488 1970-07-08 23:36 app-ephemeral
drwxrwx--x   2 system   system   u:object_r:system_data_file:s0         3488 1970-07-08 23:36 app-lib
drwxrwx--x   2 system   system   u:object_r:apk_private_data_file:s0    3488 1970-07-08 23:36 app-private
drwx------   6 system   system   u:object_r:backup_data_file:s0         3488 1970-07-10 22:29 backup
drwxr-xr-x   2 shell    shell    u:object_r:bootchart_data_file:s0      3488 1970-07-08 23:36 bootchart
drwxrwx---   5 system   cache    u:object_r:cache_file:s0               3488 1970-07-08 23:36 cache
drwxrwx--x   2 system   system   u:object_r:cnd_data_file:s0            3488 1970-07-08 23:36 connectivity
drwxrwxr-x   3 system   system   u:object_r:cust_file:s0                3488 1970-07-08 23:36 cota
lrwxrwxrwx   1 root     root     u:object_r:cust_data_file:s0             16 1970-07-10 22:28 cust -> /cust/hw/spcseas
-rwxr-xr-x   1 root     root     u:object_r:cust_data_file:s0              0 1970-07-10 22:28 cust_ver.bin
-rwxr-xr-x   1 root     root     u:object_r:cust_data_file:s0             10 1970-07-10 22:28 custom.bin
drwxrwx--x   4 root     root     u:object_r:dalvikcache_data_file:s0    3488 1970-07-08 23:36 dalvik-cache
drwxrwx--x 295 system   system   u:object_r:system_data_file:s0        24576 1970-07-10 21:40 data
drwxrwx--x   3 system   system   u:object_r:system_data_file:s0         3488 1970-07-08 23:36 dpm
drwxrwx---   5 drm      drm      u:object_r:drm_data_file:s0            3488 1970-07-08 23:42 drm
drwxrwx--x   2 system   system   u:object_r:system_data_file:s0         3488 1970-07-08 23:36 fota
drwxrwx---   2 system   wifi     u:object_r:system_data_file:s0         3488 1970-07-08 23:36 hostapd
drwxr-xr-x   2 system   system   u:object_r:memtester_output_file:s0    3488 1970-07-08 23:36 hwzd_logs
drwxrwxr-x   2 system   camera   u:object_r:huawei_camera_info:s0       3488 1970-07-08 23:36 img
drwxr-x--x   3 root     root     u:object_r:system_data_file:s0         3488 1970-07-08 23:36 local
drwxrwxr-x   8 system   system   u:object_r:log_data_file:s0            3488 1970-07-08 23:36 log
drwxrwx---   2 root     root     u:object_r:system_data_file:s0         3488 1970-07-08 23:32 lost+found
drwxrwx---   4 media_rw media_rw u:object_r:media_rw_data_file:s0       3488 1970-07-08 23:32 media
drwxrwx---   3 mediadrm mediadrm u:object_r:media_data_file:s0          3488 2018-12-25 16:33 mediadrm
drwxrwx--t  47 system   misc     u:object_r:system_data_file:s0         3488 1970-07-10 20:25 misc
drwxrwx--t   3 system   misc     u:object_r:system_data_file:s0         3488 1970-07-08 23:43 misc_ce
drwxrwx--t   3 system   misc     u:object_r:system_data_file:s0         3488 1970-07-08 23:36 misc_de
drwxrwx---   3 nfc      nfc      u:object_r:nfc_data_file:s0            3488 1970-07-08 23:36 nfc
drwxrwx--x   2 root     root     u:object_r:ota_data_file:s0            3488 1970-07-08 23:36 ota
drwxrwx---   2 system   cache    u:object_r:ota_package_file:s0         3488 1970-07-08 23:36 ota_package
-rwxr-xr-x   1 root     root     u:object_r:cust_data_file:s0              7 1970-07-10 22:28 product.bin
drwx------   2 root     root     u:object_r:property_data_file:s0       3488 2018-12-27 15:34 property
drwxrwx--x   2 system   system   u:object_r:resourcecache_data_file:s0 20480 2018-12-27 14:17 resource-cache
drwxrwx---   2 media_rw media_rw u:object_r:media_rw_data_file:s0       3488 1970-07-08 23:36 share
drwxr-xr-x   2 system   system   u:object_r:system_data_file:s0         3488 1970-07-08 23:36 shared
drwx------   2 system   system   u:object_r:system_data_file:s0         3488 1970-07-08 23:36 ss
drwxrwxr-x  21 system   system   u:object_r:system_data_file:s0         3488 2018-12-27 15:34 system
drwxrwx---   3 system   system   u:object_r:system_data_file:s0         3488 1970-07-08 23:43 system_ce
drwxrwx---   3 system   system   u:object_r:system_data_file:s0         3488 1970-07-08 23:36 system_de
drwxr-xr-x   3 root     root     u:object_r:system_data_file:s0         3488 2018-12-27 15:13 tenseventyseven
drwxrwx--x   6 system   system   u:object_r:tombstone_data_file:s0      3488 2018-12-27 14:52 tombstones
drwxrwx---   2 system   cache    u:object_r:cache_recovery_file:s0      3488 1970-07-08 23:36 update
drwx--x--x   2 system   system   u:object_r:system_data_file:s0         3488 1970-07-08 23:36 user
drwx--x--x   3 system   system   u:object_r:system_data_file:s0         3488 1970-07-08 23:36 user_de
drwxrwx--x  26 root     root     u:object_r:vendor_data_file:s0         3488 1970-07-08 23:36 vendor
drwxrwx--x   3 root     root     u:object_r:system_data_file:s0         3488 1970-07-08 23:43 vendor_ce
drwxrwx--x   3 root     root     u:object_r:system_data_file:s0         3488 1970-07-08 23:36 vendor_de
drwxrwx---   2 system   wifi     u:object_r:wapi_cert_file:s0           3488 1970-07-08 23:36 wapi_certificate

/data/misc:
total 180
drwxr-s--- 2 system       shell        u:object_r:adb_keys_file:s0             3488 1970-07-08 23:36 adb
drwx------ 2 audioserver  audioserver  u:object_r:audioserver_data_file:s0     3488 1970-07-08 23:36 audioserver
drwxrws--- 2 bluetooth    bluetooth    u:object_r:bluetooth_data_file:s0       3488 2018-12-25 20:32 bluedroid
drwxrwx--- 3 bluetooth    bluetooth    u:object_r:bluetooth_data_file:s0       3488 1970-07-08 23:36 bluetooth
drwx------ 2 system       log          u:object_r:bootstat_data_file:s0        3488 1970-07-08 23:36 bootstat
drwxrwx--x 2 system       shell        u:object_r:boottrace_data_file:s0       3488 1970-07-08 23:36 boottrace
drwxrwx--- 2 camera       camera       u:object_r:camera_data_file:s0          3488 1970-07-08 23:36 camera
drwx------ 2 cameraserver cameraserver u:object_r:system_data_file:s0          3488 1970-07-08 23:36 cameraserver
drwxrwx--- 2 media        audio        u:object_r:system_data_file:s0          3488 1970-07-08 23:36 dash
drwxrwxrwx 2 dhcp         dhcp         u:object_r:dhcp_data_file:s0            3488 2018-12-27 08:43 dhcp
drwxrwx--- 2 media        audio        u:object_r:dts_data_file:s0             3488 1970-07-08 23:36 dts
drwxrwx--- 2 system       system       u:object_r:system_data_file:s0          3488 1970-07-08 23:36 ethernet
drwxrwx--- 2 system       system       u:object_r:fm_data_file:s0              3488 1970-07-08 23:36 fm
drwx------ 2 system       system       u:object_r:gatekeeper_data_file:s0      3488 2018-12-25 16:34 gatekeeper
drwxrwx--- 2 root         root         u:object_r:system_data_file:s0          3488 1970-07-08 23:36 gcov
drwxrwx--- 2 system       system       u:object_r:hwsystemmanager_data_file:s0 3488 1970-07-08 23:36 hsm
drwxrwx--- 2 system       system       u:object_r:push_data_file:s0            3488 1970-07-08 23:36 hwpush
drwxrwx--- 2 root         root         u:object_r:incident_data_file:s0        3488 1970-07-08 23:36 incidents
drwxrwx--x 2 system       system       u:object_r:keychain_data_file:s0        3488 2018-12-25 16:33 keychain
drwx------ 3 keystore     keystore     u:object_r:keystore_data_file:s0        3488 2018-12-27 15:01 keystore
drwx------ 2 logd         log          u:object_r:misc_logd_file:s0            3488 1970-07-08 23:36 logd
drwx------ 2 media        media        u:object_r:media_data_file:s0           3488 1970-07-08 23:36 media
drwxr-x--- 2 root         shell        u:object_r:net_data_file:s0             3488 1970-07-10 22:28 net
drwx------ 3 system       system       u:object_r:system_data_file:s0          3488 2018-12-25 16:33 network_watchlist
drwxrwxr-x 2 root         root         u:object_r:perfprofd_data_file:s0       3488 1970-07-08 23:36 perfprofd
drwxrwx--x 4 system       system       u:object_r:system_data_file:s0          3488 1970-07-08 23:36 profiles
drwxrwx--- 2 system       shell        u:object_r:profman_dump_data_file:s0    3488 1970-07-08 23:36 profman
drwxrwx--- 2 system       system       u:object_r:data_qsee_file:s0            3488 1970-07-08 23:36 qsee
drwxrwx--x 2 system       system       u:object_r:qvop-daemon_data_file:s0     3488 1970-07-08 23:36 qvop
drwxrwx--- 2 system       radio        u:object_r:radio_data_file:s0           3488 1970-07-08 23:36 radio
drwx------ 2 system       system       u:object_r:system_data_file:s0          3488 1970-07-08 23:39 reboot
drwxrwx--- 2 system       log          u:object_r:recovery_data_file:s0        3488 1970-07-08 23:36 recovery
drwxrwx--x 2 shared_relro shared_relro u:object_r:shared_relro_file:s0         3488 1970-07-10 22:29 shared_relro
drwxrwx--- 3 system       radio        u:object_r:radio_data_file:s0           3488 2018-12-27 07:32 sms
drwxrwx--- 2 root         system       u:object_r:stats_data_file:s0           3488 1970-07-08 23:36 stats-data
drwxrwx--- 2 root         system       u:object_r:stats_data_file:s0           3488 1970-07-08 23:36 stats-service
drwx------ 2 system       system       u:object_r:systemkeys_data_file:s0      3488 1970-07-08 23:36 systemkeys
drwxrwx--x 3 system       system       u:object_r:textclassifier_data_file:s0  3488 2018-12-25 17:09 textclassifier
drwx------ 2 root         root         u:object_r:method_trace_data_file:s0    3488 1970-07-08 23:36 trace
drwx------ 2 root         root         u:object_r:update_engine_data_file:s0   3488 1970-07-08 23:36 update_engine
drwxrwx--x 3 root         root         u:object_r:misc_user_data_file:s0       3488 1970-07-08 23:36 user
drwx------ 2 root         root         u:object_r:vold_data_file:s0            3488 1970-07-08 23:32 vold
drwxrwx--- 2 system       vpn          u:object_r:vpn_data_file:s0             3488 1970-07-08 23:36 vpn
drwxrwx--- 5 wifi         system       u:object_r:wifi_data_file:s0            3488 2018-12-27 15:21 wifi
drwxrwxr-x 2 system       system       u:object_r:zoneinfo_data_file:s0        3488 1970-07-08 23:36 zoneinfo

/data/misc/wifi:
total 44
-rw------- 1 system system u:object_r:wifi_data_file:s0  236 2018-12-27 15:03 WifiConfigStore.xml
-rw------- 1 wifi   wifi   u:object_r:wifi_data_file:s0   21 2018-12-27 15:26 entropy.bin
drwxrwx--- 3 wifi   wifi   u:object_r:hostapd_socket:s0 3488 1970-07-10 20:29 hostapd
-rw-rw---- 1 wifi   wifi   u:object_r:wifi_data_file:s0  280 2018-12-27 15:21 hostapd.conf
-rw------- 1 root   root   u:object_r:wifi_data_file:s0    4 2018-12-27 15:26 hostapd.pid
-rw-r----- 1 wifi   wifi   u:object_r:wifi_data_file:s0   18 1970-07-10 22:29 macwifi
-rw-rw---- 1 wifi   wifi   u:object_r:wifi_data_file:s0   96 1970-07-10 20:26 p2p_supplicant.conf
drwxrwx--- 2 wifi   wifi   u:object_r:wpa_socket:s0     3488 2018-12-27 15:26 sockets
-rw------- 1 system system u:object_r:wifi_data_file:s0   42 2018-12-27 15:26 softap.conf
drwxrwx--- 2 wifi   wifi   u:object_r:wifi_data_file:s0 3488 1970-07-10 20:25 wpa_supplicant
-rw-rw---- 1 wifi   wifi   u:object_r:wifi_data_file:s0   96 1970-07-10 20:26 wpa_supplicant.conf

/data/misc/wifi/hostapd:
total 4
drwxrwx--- 2 wifi wifi u:object_r:hostapd_socket:s0 3488 2018-12-27 15:26 ctrl

/data/misc/wifi/sockets:
total 8
srwxrwx--- 1 wifi wifi u:object_r:wpa_socket:s0 0 2018-12-27 15:26 p2p0
srwxrwx--- 1 wifi wifi u:object_r:wpa_socket:s0 0 2018-12-27 15:26 wlan0

/data/misc/wifi/wpa_supplicant`
phhusson commented 5 years ago

Ok /data/misc/wifi/hostapd.conf is owned by wifi:wifi You did a full factory reset when switching ROM right?

TenSeventy7 commented 5 years ago

Yes. Is there any problem?

On Thu, Dec 27, 2018, 4:12 PM Pierre-Hugues HUSSON <notifications@github.com wrote:

Ok /data/misc/wifi/hostapd.conf is owned by wifi:wifi You did a full factory reset when switching ROM right?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/phhusson/treble_app/issues/9#issuecomment-450100316, or mute the thread https://github.com/notifications/unsubscribe-auth/AbM5R3B-tz-r1lhemr50hnsHmcI4w_sVks5u9IDQgaJpZM4ZiXXm .

pascua28 commented 5 years ago

IO should be able to read the file. It seems it doesn't have enough previlages

TenSeventy7 commented 5 years ago

We already talked about this, albeit on Telegram. And while the app has the necessary permissions, it seems that something is re-owning hostapd.conf to wifi (instead of system).

On Fri, Dec 28, 2018, 12:00 PM pascua28 <notifications@github.com wrote:

IO should be able to read the file. It seems it doesn't have enough previlages

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/phhusson/treble_app/issues/9#issuecomment-450285158, or mute the thread https://github.com/notifications/unsubscribe-auth/AbM5R-taeg8iMl158hiZg9fUdq6D-tbuks5u9ZdtgaJpZM4ZiXXm .

phhusson commented 5 years ago

The fix should/might be to delete /data/misc/wifi/hostapd.conf before writing to it: https://gist.github.com/phhusson/b55e2234db75e7310e11941ab6aa9275 (this should be possible since system is group-owner of the fholder)