From 43ba6916268078a5adf6f75b9140566412e98e63 Mon Sep 17 00:00:00 2001 From: Alexander Aksenov Date: Tue, 25 Oct 2016 16:16:19 +0300 Subject: [PATCH] GOT patcher: add pthread's data initialization Issue: Now GOT patcher module uses probes on pthread init function, so it needs data about pthread's path and __pthread_initialize_minimal() offset. Solution: Add to swap_gtp_init.sh generation getting and writing neccessary information. Change-Id: If0b8f50d1ccb981d3e6a5e62df14a1a7b50659f6 Signed-off-by: Alexander Aksenov --- scripts/gen_gtp_data.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/gen_gtp_data.sh b/scripts/gen_gtp_data.sh index e1a7b2e..7eb56e2 100644 --- a/scripts/gen_gtp_data.sh +++ b/scripts/gen_gtp_data.sh @@ -5,6 +5,8 @@ handlers_lib="/usr/lib/da_probe_tizen.so" fixup_handler="__dl_fixup_wrapper" reloc_handler="__dl_reloc_wrapper" linker_info_header="/usr/local/include/linker_info.h" +libpthread_pkg_name="glibc" +libpthread_init_func="__pthread_initialize_minimal" output=$1 @@ -71,6 +73,17 @@ function print_dl_reloc_handler_off() echo -e "/bin/echo \"$addr\" > /sys/kernel/debug/swap/got_patcher/handler/reloc_handler_off" >> $filename } +function print_libpthread() +{ + filename=$1 + + libpthread_path=$(rpm -ql $libpthread_pkg_name | grep "/lib/libpthread" | head -1) + addr=$(readelf -sW $libpthread_path | grep $libpthread_init_func | awk '{print "0x" $2}') + + echo -e "/bin/echo \"$libpthread_path\" > /sys/kernel/debug/swap/got_patcher/pthread/path" >> $filename + echo -e "/bin/echo \"$addr\" > /sys/kernel/debug/swap/got_patcher/pthread/minimal_init_off" >> $filename +} + function print_enable() { filename=$1 @@ -85,4 +98,5 @@ print_dl_reloc_off $output print_probe_lib $output print_dl_fixup_handler_off $output print_dl_reloc_handler_off $output +print_libpthread $output print_enable $output -- 2.7.4