prerun : use system_info_init_db instead of system_info_update_db 20/143420/2 accepted/tizen/4.0/unified/20170828.224249 accepted/tizen/unified/20170818.000013 submit/tizen/20170811.083904 submit/tizen/20170816.021143 submit/tizen/20171016.080448 submit/tizen_4.0/20170828.110001
authorKichan Kwon <k_c.kwon@samsung.com>
Thu, 10 Aug 2017 01:10:13 +0000 (10:10 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Thu, 10 Aug 2017 07:24:51 +0000 (16:24 +0900)
- system_info_update_db is vulnerable because it is static executable

Change-Id: Ib9f69051cba162e004d9dc6a90db460a11e8320d
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
filesystem/etc/emulator/prerun
filesystem/etc/emulator/prerun.d/set-model-config.sh

index 33451de..f0e30cd 100644 (file)
@@ -12,6 +12,7 @@ if [ ! -z $1 ]; then
         ln -sf /bin/busybox /bin/expr
         ln -sf /bin/busybox /bin/readlink
         ln -sf /bin/busybox /bin/rm
+        ln -sf /bin/busybox /bin/chroot
 else
         NEW_ROOT=
 fi
index b0286bb..8bd14cf 100644 (file)
@@ -30,11 +30,11 @@ if grep -q "video=" $CMDLINE ; then
             WIDTH_KEY="tizen.org\/feature\/screen.width\" type=\"int\""
             WIDTH_KEY_NAME="tizen.org/feature/screen.width"
             sed -i s/"$WIDTH_KEY".*\</"$WIDTH_KEY"\>"$WIDTH"\</ $XML
-            ${NEW_ROOT}/usr/bin/system_info_update_db -r ${NEW_ROOT} -k ${WIDTH_KEY_NAME} -t int -g platform -v ${WIDTH}
+            chroot ${NEW_ROOT} system_info_init_db -k ${WIDTH_KEY_NAME} -t int -g platform -v ${WIDTH}
             HEIGHT_KEY="tizen.org\/feature\/screen.height\" type=\"int\""
             HEIGHT_KEY_NAME="tizen.org/feature/screen.height"
             sed -i s/"$HEIGHT_KEY".*\</"$HEIGHT_KEY"\>"$HEIGHT"\</ $XML
-            ${NEW_ROOT}/usr/bin/system_info_update_db -r ${NEW_ROOT} -k ${HEIGHT_KEY_NAME} -t int -g platform -v ${HEIGHT}
+            chroot ${NEW_ROOT} system_info_init_db -k ${HEIGHT_KEY_NAME} -t int -g platform -v ${HEIGHT}
             echo -e "- width=$WIDTH, height=$HEIGHT"
 
             # screen size
@@ -45,10 +45,10 @@ if grep -q "video=" $CMDLINE ; then
 
             sed -i s/"$SCREENSIZE_KEY_NORMAL".[0-9].*"type=\"bool\"".*true/"&!!!"/ $XML
             TMP_RESOLUTION=`grep "true!!!" $XML | sed s/.*normal\.// | cut -d '"' -f1`
-            ${NEW_ROOT}/usr/bin/system_info_update_db -r ${NEW_ROOT} -k ${SCREENSIZE_KEY_NORMAL_NAME}.${TMP_RESOLUTION} -t bool -g platform -v false
+            chroot ${NEW_ROOT} system_info_init_db -k ${SCREENSIZE_KEY_NORMAL_NAME}.${TMP_RESOLUTION} -t bool -g platform -v false
             sed -i s/true!!!/false/ $XML
             sed -i s/"$SCREENSIZE_KEY_NORMAL_RESOLUTION".*\</"$SCREENSIZE_KEY_NORMAL_RESOLUTION"\>true\</ $XML
-            ${NEW_ROOT}/usr/bin/system_info_update_db -r ${NEW_ROOT} -k ${SCREENSIZE_KEY_NORMAL_NAME}.${WIDTH}.${HEIGHT} -t bool -g platform -v true
+            chroot ${NEW_ROOT} system_info_init_db -k ${SCREENSIZE_KEY_NORMAL_NAME}.${WIDTH}.${HEIGHT} -t bool -g platform -v true
         fi
 fi
 
@@ -70,7 +70,7 @@ if grep -q "dpi=" $CMDLINE ; then
             DPI_KEY="tizen.org\/feature\/screen.dpi\" type=\"int\""
             DPI_KEY_NAME="tizen.org/feature/screen.dpi"
             sed -i s/"$DPI_KEY".*\</"$DPI_KEY"\>"$SCREEN_DPI"\</ $XML
-            ${NEW_ROOT}/usr/bin/system_info_update_db -r ${NEW_ROOT} -k ${DPI_KEY_NAME} -t int -g platform -v ${SCREEN_DPI}
+            chroot ${NEW_ROOT} system_info_init_db -k ${DPI_KEY_NAME} -t int -g platform -v ${SCREEN_DPI}
             echo -e "- dpi=$SCREEN_DPI"
         fi
 fi