summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/ldconfig.c25
-rw-r--r--elf/tst-stackguard1.c8
2 files changed, 25 insertions, 8 deletions
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 78a0f0c2a8..4886645dfa 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -1020,17 +1020,19 @@ search_dirs (void)
static void parse_conf_include (const char *config_file, unsigned int lineno,
- bool do_chroot, const char *pattern);
+ const char *prefix, bool do_chroot,
+ const char *pattern);
/* Parse configuration file. */
static void
-parse_conf (const char *filename, bool do_chroot)
+parse_conf (const char *filename, const char *prefix, bool do_chroot)
{
FILE *file = NULL;
char *line = NULL;
const char *canon;
size_t len = 0;
unsigned int lineno;
+ size_t prefix_len = prefix ? strlen (prefix) : 0;
if (do_chroot && opt_chroot)
{
@@ -1091,7 +1093,14 @@ parse_conf (const char *filename, bool do_chroot)
cp += 8;
while ((dir = strsep (&cp, " \t")) != NULL)
if (dir[0] != '\0')
- parse_conf_include (filename, lineno, do_chroot, dir);
+ parse_conf_include (filename, lineno, prefix, do_chroot, dir);
+ }
+ else if (prefix != NULL)
+ {
+ size_t cp_len = strlen (cp);
+ char new_cp [prefix_len + cp_len + 1];
+ memcpy (mempcpy (new_cp, prefix, prefix_len), cp, cp_len + 1);
+ add_dir (new_cp);
}
else if (!strncasecmp (cp, "hwcap", 5) && isblank (cp[5]))
{
@@ -1154,7 +1163,7 @@ parse_conf (const char *filename, bool do_chroot)
config files to read. */
static void
parse_conf_include (const char *config_file, unsigned int lineno,
- bool do_chroot, const char *pattern)
+ const char *prefix, bool do_chroot, const char *pattern)
{
if (opt_chroot && pattern[0] != '/')
error (EXIT_FAILURE, 0,
@@ -1184,7 +1193,7 @@ parse_conf_include (const char *config_file, unsigned int lineno,
{
case 0:
for (size_t i = 0; i < gl.gl_pathc; ++i)
- parse_conf (gl.gl_pathv[i], false);
+ parse_conf (gl.gl_pathv[i], prefix, false);
globfree64 (&gl);
break;
@@ -1227,6 +1236,8 @@ main (int argc, char **argv)
/* Set the text message domain. */
textdomain (_libc_intl_domainname);
+ arch_startup (argc, argv);
+
/* Parse and process arguments. */
int remaining;
argp_parse (&argp, argc, argv, 0, &remaining, NULL);
@@ -1338,12 +1349,14 @@ main (int argc, char **argv)
if (!opt_only_cline)
{
- parse_conf (config_file, true);
+ parse_conf (config_file, NULL, true);
/* Always add the standard search paths. */
add_system_dir (SLIBDIR);
if (strcmp (SLIBDIR, LIBDIR))
add_system_dir (LIBDIR);
+
+ add_arch_dirs (config_file);
}
if (! opt_ignore_aux_cache)
diff --git a/elf/tst-stackguard1.c b/elf/tst-stackguard1.c
index 480f9297d0..50739e5b2e 100644
--- a/elf/tst-stackguard1.c
+++ b/elf/tst-stackguard1.c
@@ -160,17 +160,21 @@ do_test (void)
the 16 runs, something is very wrong. */
int ndifferences = 0;
int ndefaults = 0;
+ int npartlyrandomized = 0;
for (i = 0; i < N; ++i)
{
if (child_stack_chk_guards[i] != child_stack_chk_guards[i+1])
ndifferences++;
else if (child_stack_chk_guards[i] == default_guard)
ndefaults++;
+ else if (*(char *) &child_stack_chk_guards[i] == 0)
+ npartlyrandomized++;
}
- printf ("differences %d defaults %d\n", ndifferences, ndefaults);
+ printf ("differences %d defaults %d partly randomized %d\n",
+ ndifferences, ndefaults, npartlyrandomized);
- if (ndifferences < N / 2 && ndefaults < N / 2)
+ if ((ndifferences + ndefaults + npartlyrandomized) < 3 * N / 4)
{
puts ("stack guard canaries are not randomized enough");
puts ("nor equal to the default canary value");