submitted-ld.so-cache-new-format

2018-09-16  Josh Triplett  <josh@joshtriplett.org>

        * elf/ldconfig.c: Default to the new format for ld.so.cache. glibc has
        supported this format for 18+ years.
        * elf/dl-cache.c (_dl_load_cache_lookup): Reorder conditionals to look
        for the new format first.


Gbp-Pq: Topic any
Gbp-Pq: Name submitted-ld.so-cache-new-format.diff
This commit is contained in:
Ubuntu Developers 2022-05-13 23:32:11 +08:00 committed by openKylinBot
parent 9f1f6ce62f
commit 6c4e37fb02
2 changed files with 10 additions and 10 deletions

View File

@ -206,7 +206,14 @@ _dl_load_cache_lookup (const char *name)
- the old format with the new format in it
- only the new format
The following checks if the cache contains any of these formats. */
if (file != MAP_FAILED && cachesize > sizeof *cache
if (file != MAP_FAILED && cachesize > sizeof *cache_new
&& memcmp (file, CACHEMAGIC_VERSION_NEW,
sizeof CACHEMAGIC_VERSION_NEW - 1) == 0)
{
cache_new = file;
cache = file;
}
else if (file != MAP_FAILED && cachesize > sizeof *cache
&& memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC - 1) == 0
/* Check for corruption, avoiding overflow. */
&& ((cachesize - sizeof *cache) / sizeof (struct file_entry)
@ -226,13 +233,6 @@ _dl_load_cache_lookup (const char *name)
sizeof CACHEMAGIC_VERSION_NEW - 1) != 0)
cache_new = (void *) -1;
}
else if (file != MAP_FAILED && cachesize > sizeof *cache_new
&& memcmp (file, CACHEMAGIC_VERSION_NEW,
sizeof CACHEMAGIC_VERSION_NEW - 1) == 0)
{
cache_new = file;
cache = file;
}
else
{
if (file != MAP_FAILED)

View File

@ -110,7 +110,7 @@ int opt_verbose;
/* Format to support. */
/* 0: only libc5/glibc2; 1: both; 2: only glibc 2.2. */
int opt_format = 1;
int opt_format = 2;
/* Build cache. */
static int opt_build_cache = 1;
@ -163,7 +163,7 @@ static const struct argp_option options[] =
{ NULL, 'f', N_("CONF"), 0, N_("Use CONF as configuration file"), 0},
{ NULL, 'n', NULL, 0, N_("Only process directories specified on the command line. Don't build cache."), 0},
{ NULL, 'l', NULL, 0, N_("Manually link individual libraries."), 0},
{ "format", 'c', N_("FORMAT"), 0, N_("Format to use: new, old or compat (default)"), 0},
{ "format", 'c', N_("FORMAT"), 0, N_("Format to use: new (default), old, or compat"), 0},
{ "ignore-aux-cache", 'i', NULL, 0, N_("Ignore auxiliary cache file"), 0},
{ NULL, 0, NULL, 0, NULL, 0 }
};