[IMPROVE] Preload: Generate ignore binaries list 79/52179/4
authorAlexander Aksenov <a.aksenov@samsung.com>
Mon, 16 Nov 2015 08:53:20 +0000 (11:53 +0300)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Mon, 23 Nov 2015 06:41:57 +0000 (22:41 -0800)
Issue:
Binaries ignored for preloading execution were hardcoded
in modules. This causes errors when binary names are changed.

Solution:
Now ignored binaries pathes are found on manager compile time
and are passed to kernel via debugfs.

Change-Id: Ic81e44dcde2ceff951163f602dff52ca16bc77d0
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
scripts/gen_preload_header.sh

index c74178c..5616a17 100755 (executable)
@@ -6,6 +6,9 @@ handlers_lib="/usr/lib/da_probe_tizen.so"
 linker_path="/lib/"
 linker_sym="_r_debug"
 test_bin="/usr/bin/WebProcess"
+libc_pkg_name="glibc"
+libpthread_pkg_name="glibc"
+libsmack_pkg_name="smack"
 
 output=$1
 
@@ -51,6 +54,39 @@ function print_linker()
     echo -e "/bin/echo 0x$r_debug_offset > /sys/kernel/debug/swap/preload/linker/r_debug_offset" >> $filename
 }
 
+function print_libc()
+{
+    filename=$1
+
+    libc_path=$(rpm -ql $libc_pkg_name | grep "/lib/libc" | head -1)
+    echo -e "/bin/echo \"$libc_path\" > /sys/kernel/debug/swap/preload/ignored_binaries/bins_add" >> $filename
+}
+
+function print_libpthread()
+{
+    filename=$1
+
+    libpthread_path=$(rpm -ql $libpthread_pkg_name | grep "/lib/libpthread" | head -1)
+    echo -e "/bin/echo \"$libpthread_path\" > /sys/kernel/debug/swap/preload/ignored_binaries/bins_add" >> $filename
+}
+
+function print_libsmack()
+{
+    filename=$1
+
+    libsmack_path=$(rpm -ql $libsmack_pkg_name | grep "/lib/libsmack" | head -1)
+    echo -e "/bin/echo \"$libsmack_path\" > /sys/kernel/debug/swap/preload/ignored_binaries/bins_add" >> $filename
+}
+
+function print_ignored()
+{
+    filename=$1
+
+    print_libc $filename
+    print_libpthread $filename
+    print_libsmack $filename
+}
+
 ##################################
 #       Script entry point       #
 ##################################
@@ -60,6 +96,7 @@ print_header $output
 print_loader $output
 print_probe_lib $output
 print_linker $output
+print_ignored $output
 
 # check addresses
 grep 0x00000000 $output && echo "ERROR: generate preload info" >&2 && exit 1