From 0596f7ad3becb6539255fcff5f91d87cff121808 Mon Sep 17 00:00:00 2001 From: Alexander Aksenov Date: Mon, 16 Nov 2015 11:53:20 +0300 Subject: [PATCH] [IMPROVE] Preload: Generate ignore binaries list 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 --- scripts/gen_preload_header.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/scripts/gen_preload_header.sh b/scripts/gen_preload_header.sh index c74178c..5616a17 100755 --- a/scripts/gen_preload_header.sh +++ b/scripts/gen_preload_header.sh @@ -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 -- 2.7.4