summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua_scripts/pathmaps/emulate/00_default.lua16
-rwxr-xr-xutils/sb215
2 files changed, 28 insertions, 3 deletions
diff --git a/lua_scripts/pathmaps/emulate/00_default.lua b/lua_scripts/pathmaps/emulate/00_default.lua
index 368816d..250c3f4 100644
--- a/lua_scripts/pathmaps/emulate/00_default.lua
+++ b/lua_scripts/pathmaps/emulate/00_default.lua
@@ -143,7 +143,23 @@ emulate_mode_target_ld_library_path = nil -- default = not needed
emulate_mode_target_ld_library_path_suffix = nil
if (conf_target_sb2_installed) then
+ --
+ -- When libsb2 is installed to target we don't want to map
+ -- the path where it is found. For example gdb needs access
+ -- to the library and dynamic linker. So here we insert special
+ -- rules on top of mapall_chain that prevents sb2 to map these
+ -- paths.
+ --
+ if (conf_target_libsb2_dir ~= nil) then
+ table.insert(mapall_chain.rules, 1,
+ { prefix = conf_target_libsb2_dir, use_orig_path = true,
+ readonly = true })
+ end
if (conf_target_ld_so ~= nil) then
+ table.insert(mapall_chain.rules, 1,
+ { path = conf_target_ld_so, use_orig_path = true,
+ readonly = true })
+
-- use dynamic libraries from target,
-- when executing native binaries!
emulate_mode_target_ld_so = conf_target_ld_so
diff --git a/utils/sb2 b/utils/sb2
index aa63d0a..277c2ab 100755
--- a/utils/sb2
+++ b/utils/sb2
@@ -510,6 +510,7 @@ function write_libsb2_and_ld_so_state_to_exec_config()
sbox_dir_varname=$3
ld_so_path_varname=$4
ld_so_supports_argv0_varname=$5
+ libsb2_dir_varname=$6
# Check if ld.so can be used from $rootdir by
# checking that libsb2 has been installed to tools
@@ -528,8 +529,12 @@ function write_libsb2_and_ld_so_state_to_exec_config()
fi
if [ -f $libsb2_path ]; then
+ libsb2_dir=`/usr/bin/dirname $libsb2_path`
echo "-- $libsb2_path" >>$SBOX_SESSION_DIR/exec_config.lua
- echo "$sb2_installed_varname = true" >>$SBOX_SESSION_DIR/exec_config.lua
+ echo "$libsb2_dir_varname = \"$libsb2_dir\"" \
+ >>$SBOX_SESSION_DIR/exec_config.lua
+ echo "$sb2_installed_varname = true" \
+ >>$SBOX_SESSION_DIR/exec_config.lua
ld_so_found="yes"
else
echo "$sb2_installed_varname = false" >>$SBOX_SESSION_DIR/exec_config.lua
@@ -684,7 +689,8 @@ END
write_libsb2_and_ld_so_state_to_exec_config \
$SBOX_TOOLS_ROOT \
conf_tools_sb2_installed conf_tools_sbox_dir \
- conf_tools_ld_so conf_tools_ld_so_supports_argv0
+ conf_tools_ld_so conf_tools_ld_so_supports_argv0 \
+ conf_tools_libsb2_dir
write_locale_paths_to_exec_config \
$SBOX_TOOLS_ROOT \
@@ -712,6 +718,7 @@ conf_tools_sb2_installed = false
conf_tools_sbox_dir = ""
conf_tools_ld_so = nil
conf_tools_ld_so_supports_argv0 = false
+conf_tools_libsb2_dir = nil
conf_tools_locale_path = nil
conf_tools_message_catalog_prefix = nil
END
@@ -738,7 +745,8 @@ END
write_libsb2_and_ld_so_state_to_exec_config \
$SBOX_TARGET_ROOT \
conf_target_sb2_installed conf_target_sbox_dir \
- conf_target_ld_so conf_target_ld_so_supports_argv0
+ conf_target_ld_so conf_target_ld_so_supports_argv0 \
+ conf_target_libsb2_dir
write_locale_paths_to_exec_config \
$SBOX_TARGET_ROOT \
@@ -754,6 +762,7 @@ conf_target_sb2_installed = false
conf_target_sbox_dir = ""
conf_target_ld_so = nil
conf_target_ld_so_supports_argv0 = false
+conf_target_libsb2_dir = nil
conf_target_locale_path = nil
conf_target_message_catalog_prefix = nil
END