diff --git a/services/BUILD.gn b/services/BUILD.gn index d1a1f0bdc2ee6de70b9fe61d9e85cd9c1026ecee..a317ab1b727223f16d0831930fe8331a90008338 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -169,6 +169,11 @@ if (defined(ohos_lite)) { part_name = "init" } + ohos_prebuilt_etc("group") { + source = "//base/startup/init_lite/services/etc/group" + part_name = "init" + } + ohos_prebuilt_etc("init.Hi3516DV300.cfg") { source = "//device/hisilicon/hi3516dv300/build/rootfs/init.Hi3516DV300.cfg" part_name = "init" @@ -197,6 +202,7 @@ if (defined(ohos_lite)) { ":init.usb.cfg", ":init.usb.configfs.cfg", ":passwd", + ":group", ] } } diff --git a/services/etc/group b/services/etc/group new file mode 100755 index 0000000000000000000000000000000000000000..47bc75cf076aee5a0fccaa2fc38ba263b8f8ce57 --- /dev/null +++ b/services/etc/group @@ -0,0 +1,115 @@ +root:x:0 +daemon:x:1 +bin:x:2 +system:x:1000 +radio:x:1001 +bluetooth:x:1002 +graphics:x:1003 +input:x:1004 +audio:x:1005 +camera:x:1006 +log:x:1007 +compass:x:1008 +mount:x:1009 +wifi:x:1010 +adb:x:1011 +install:x:1012 +media:x:1013 +dhcp:x:1014 +sdcard_rw:x:1015 +vpn:x:1016 +keystore:x:1017 +usb:x:1018 +drm:x:1019 +mdnsr:x:1020 +gps:x:1021 +unused1:x:1022 +media_rw:x:1023 +mtp:x:1024 +unused2:x:1025 +drmrpc:x:1026 +nfc:x:1027 +sdcard_r:x:1028 +clat:x:1029 +loop_radio:x:1030 +media_drm:x:1031 +package_info:x:1032 +sdcard_pics:x:1033 +sdcard_av:x:1034 +sdcard_all:x:1035 +logd:x:1036 +shared_relro:x:1037 +dbus:x:1038 +tlsdate:x:1039 +media_ex:x:1040 +audioserver:x:1041 +metrics_coll:x:1042 +metricsd:x:1043 +webserv:x:1044 +debuggerd:x:1045 +media_codec:x:1046 +cameraserver:x:1047 +firewall:x:1048 +trunks:x:1049 +nvram:x:1050 +dns:x:1051 +dns_tether:x:1052 +webview_zygote:x:1053 +vehicle_network:x:1054 +media_audio:x:1055 +media_video:x:1056 +media_image:x:1057 +tombstoned:x:1058 +media_obb:x:1059 +ese:x:1060 +ota_update:x:1061 +automotive_evs:x:1062 +lowpan:x:1063 +hsm:x:1064 +reserved_disk:x:1065 +statsd:x:1066 +incidentd:x:1067 +secure_element:x:1068 +lmkd:x:1069 +llkd:x:1070 +iorapd:x:1071 +gpu_service:x:1072 +network_stack:x:1073 +gsid:x:1074 +shell:x:2000 +cache:x:2001 +diag:x:2002 +oem_reserved_start:x:2900 +oem_reserved_end:x:2999 +net_bt_admin:x:3001 +net_bt:x:3002 +inet:x:3003 +net_raw:x:3004 +net_admin:x:3005 +net_bw_stats:x:3006 +net_bw_acct:x:3007 +readproc:x:3009 +wakelock:x:3010 +uhid:x:3011 +oem_reserved_2_start:x:5000 +oem_reserved_2_end:x:5999 +everybody:x:9997 +misc:x:9998 +nobody:x:9999 +app:x:10000 +app_start:x:10000 +app_end:x:19999 +cache_gid_start:x:20000 +cache_gid_end:x:29999 +ext_gid_start:x:30000 +ext_gid_end:x:39999 +ext_cache_gid_start:x:40000 +ext_cache_gid_end:x:49999 +shared_gid_start:x:50000 +shared_gid_end:x:59999 +overflowuid:x:65534 +isolated_start:x:90000 +isolated_end:x:99999 +user:x:100000 +user_offset:x:100000 + diff --git a/services/etc/passwd b/services/etc/passwd index bad5f0ff960420ccaba17beac7b2769cfa516a0b..f84c1e21ebc2e81ba435539ab3f379701c91d680 100755 --- a/services/etc/passwd +++ b/services/etc/passwd @@ -112,4 +112,3 @@ isolated_start:x:90000:90000:::/bin/false isolated_end:x:99999:99999:::/bin/false user:x:100000:100000:::/bin/false user_offset:x:100000:100000:::/bin/false - diff --git a/services/src/uevent.c b/services/src/uevent.c index 103952fb9586f86f6a0da023cbe5ff349fe43640..b9f422d0f56353ba4ad1f4060d39e77b26926ca4 100644 --- a/services/src/uevent.c +++ b/services/src/uevent.c @@ -33,7 +33,7 @@ #include "securec.h" #define LINK_NUMBER 4 -#define DEFAULT_DIR_MODE 0755 +#define DEFAULT_DIR_MODE (S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) #define DEV_DRM 3 #define DEV_ONCRPC 6 #define DEV_ADSP 4 @@ -67,7 +67,7 @@ #define DEFAULT_MODE 0000 #define DEVICE_SKIP 5 #define HANDLE_DEVICE_USB 3 -#define DEFAULT_NO_AUTHORITY_MODE 0600 +#define DEVICE_DEFAULT_MODE (S_IRUSR | S_IWUSR | S_IRGRP) int g_ueventFD = -1; @@ -387,6 +387,58 @@ struct DevPermissionMapper { struct DevPermissionMapper DEV_MAPPER[] = { {"/dev/binder", 0666, 0, 0}, + {"/dev/input/event0", 0660, 0, 1004}, + {"/dev/input/event1", 0660, 0, 1004}, + {"/dev/input/mice", 0660, 0, 1004}, + {"/dev/input/mouse0", 0660, 0, 1004}, + {"/dev/snd/timer", 0660, 1000, 1005}, + {"/dev/zero", 0666, 0, 0}, + {"/dev/full", 0666, 0, 0}, + {"/dev/ptmx", 0666, 0, 0}, + {"/dev/tty", 0666, 0, 0}, + {"/dev/random", 0666, 0, 0}, + {"/dev/urandom", 0666, 0, 0}, + {"/dev/ashmem", 0666, 0, 0}, + {"/dev/pmsg0", 0222, 0, 0}, + {"/dev/jpeg", 0666, 1000, 1003}, + {"/dev/vinput", 0660, 1000, 1004}, + {"/dev/mmz_userdev", 0644, 1000, 1005}, + {"/dev/graphics/fb0", 0660, 1000, 1003}, + {"/dev/mem", 0660, 1000, 1005}, + {"/dev/ion", 0666, 1000, 1000}, + {"/dev/btusb0", 0660, 1002, 1002}, + {"/dev/uhid", 0660, 1002, 1002}, + {"/dev/tc_ns_client", 0660, 1000, 1005}, + {"/dev/rtk_btusb", 0660, 1002, 0}, + {"/dev/sil9293", 0660, 1000, 1005}, + {"/dev/stpbt", 0660, 1002, 1001}, + {"/dev/avs", 0660, 1000, 1005}, + {"/dev/gdc", 0660, 1000, 1005}, + {"/dev/hdmi", 0660, 1000, 1005}, + {"/dev/hi_mipi", 0660, 1000, 1005}, + {"/dev/hi_mipi_tx", 0660, 1000, 1005}, + {"/dev/hi_tde", 0644, 1000, 1003}, + {"/dev/isp_dev", 0660, 1000, 1006}, + {"/dev/match", 0660, 1000, 1005}, + {"/dev/photo", 0660, 1000, 1005}, + {"/dev/rect", 0660, 1000, 1005}, + {"/dev/rgn", 0660, 1000, 1005}, + {"/dev/sys", 0660, 1000, 1005}, + {"/dev/vb", 0666, 1000, 1005}, + {"/dev/vdec", 0666, 1000, 1005}, + {"/dev/venc", 0666, 1000, 1005}, + {"/dev/vi", 0660, 1000, 1005}, + {"/dev/vo", 0660, 1000, 1005}, + {"/dev/vpss", 0660, 1000, 1005}, + {"/dev/i2c-0", 0660, 1000, 1006}, + {"/dev/i2c-1", 0660, 1000, 1006}, + {"/dev/i2c-2", 0660, 1000, 1006}, + {"/dev/i2c-3", 0660, 1000, 1006}, + {"/dev/i2c-4", 0660, 1000, 1006}, + {"/dev/i2c-5", 0660, 1000, 1006}, + {"/dev/i2c-6", 0660, 1000, 1006}, + {"/dev/i2c-7", 0660, 1000, 1006}, + {"/dev/vgs", 0666, 1000, 1005}, {"/dev/dri/card0", 0666, 0, 1003}, {"/dev/dri/card0-DSI-1", 0666, 0, 1003}, {"/dev/dri/card0-HDMI-A-1", 0666, 0, 1003}, @@ -415,7 +467,7 @@ static void MakeDevice(const char *devPath, const char *path, int block, int maj /* Only for super user */ gid_t gid = 0; dev_t dev; - mode_t mode = DEFAULT_NO_AUTHORITY_MODE; + mode_t mode = DEVICE_DEFAULT_MODE; mode |= (block ? S_IFBLK : S_IFCHR); dev = makedev(major, minor); setegid(gid);