libgimpbase: fix _gimp_reloc_init_lib().

While testing the relocatable code paths, I realized that
_br_find_exe_for_symbol() was always returning NULL. The reason is that
our code looking at /proc/self/maps was expecting that the searched
pointer would be in a "r-xp" memory region. On my machine though, it was
in a "r--p" region.
Maybe in some cases or some older kernel, the "r-xp" permission is/was
right, I have no idea, so now let's just not make any assumption on the
region's permission, where we expect to find our static string, i.e.
let's not do any test on the region permission anymore.
This commit is contained in:
Jehan 2021-03-20 20:36:59 +01:00
parent 47fbfc2f0e
commit 8586f16f31
1 changed files with 8 additions and 1 deletions

View File

@ -201,7 +201,14 @@ _br_find_exe_for_symbol (const void *symbol, GimpBinrelocInitError *error)
break; break;
/* Sanity check. */ /* Sanity check. */
if (strstr (line, " r-xp ") == NULL || strchr (line, '/') == NULL) /* XXX Early versions of this code would check that the mapped
* region was with r-xp permission. It might have been true at
* some point in time, but last I tested, the searched pointer was
* in a r--p region for libgimpbase. Thus _br_find_exe_for_symbol()
* would fail to find the executable's path.
* So now we don't test the region's permission anymore.
*/
if (strchr (line, '/') == NULL)
continue; continue;
/* Parse line. */ /* Parse line. */