Skip to content
Snippets Groups Projects
Commit 5a8bed09 authored by Vivek Das Mohapatra's avatar Vivek Das Mohapatra
Browse files

Automatically restrict shim dlsym wrapper to exported DSO list

The dlsym wrapper allows the program or a non-encapsulated DSO to
get symbols from within the capsule with dlsym: capsule shims which
use the provided dlsym tooling now do this correctly automatically.
parent df4c3e8f
No related branches found
No related tags found
1 merge request!311Build capsule-capture-libs from a bundled copy of libcapsule
...@@ -81,8 +81,7 @@ cat - <<EOF > shim/$base.so.c.dlsym ...@@ -81,8 +81,7 @@ cat - <<EOF > shim/$base.so.c.dlsym
// export list even if the target libGL has them) // export list even if the target libGL has them)
static void *_dlsym (void *handle, const char *symbol) static void *_dlsym (void *handle, const char *symbol)
{ {
const char *valid_sources[] = { "libGL.so.1", NULL }; return capsule_shim_dlsym( dso, handle, symbol, valid_dlsym_sources );
return capsule_shim_dlsym( dso, handle, symbol, valid_sources );
} }
EOF EOF
......
...@@ -123,6 +123,16 @@ fi ...@@ -123,6 +123,16 @@ fi
if [ -f ${dlsym_file} ]; if [ -f ${dlsym_file} ];
then then
echo "// DSOs to restrict dlsym lookups to:";
echo "static const char *valid_dlsym_sources[] = ";
echo "{";
for pt in $proxied_dso $(cat $proxy_extra);
do
echo " \"$pt\",";
done;
echo " NULL";
echo "};";
echo "// -------------------------------------------------------------"; echo "// -------------------------------------------------------------";
echo "// start of ${proxy_src%.c} dlsym wrapper"; echo "// start of ${proxy_src%.c} dlsym wrapper";
cat $dlsym_file; cat $dlsym_file;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment