Bug 22505 - ldconfig processes include directive in locale-specific order
Summary: ldconfig processes include directive in locale-specific order
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: 2.27
Assignee: Aurelien Jarno
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-27 20:56 UTC by Aurelien Jarno
Modified: 2017-12-16 11:29 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aurelien Jarno 2017-11-27 20:56:46 UTC
ldconfig supports "include" directives and use the glob function to process them. The glob function sort entries according to the LC_COLLATE category. When using a standard "include /etc/ld.so.conf.d/*.conf" entry in /etc/ld.so.conf, the order therefore depends on the locale used to run ldconfig.

A few examples of locale specific order that might be disturbing compared to the C locale:
- The et_EE locale sorts the "z" between "s" and "t".
- The cs_CZ and sk_SK locales sort the digits after the letters.
Comment 1 Sourceware Commits 2017-12-16 11:28:34 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  7d38eb38977980efe703eac93645b1af5a5f8a0c (commit)
      from  2e77deef676677a7bed97d87d2519679654a2772 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7d38eb38977980efe703eac93645b1af5a5f8a0c

commit 7d38eb38977980efe703eac93645b1af5a5f8a0c
Author: Aurelien Jarno <aurelien@aurel32.net>
Date:   Sat Dec 16 12:25:41 2017 +0100

    ldconfig: set LC_COLLATE to C [BZ #22505]
    
    ldconfig supports `include' directives and use the glob function to
    process them. The glob function sort entries according to the LC_COLLATE
    category. When using a standard "include /etc/ld.so.conf.d/*.conf" entry
    in /etc/ld.so.conf, the order therefore depends on the locale used to
    run ldconfig. A few examples of locale specific order that might be
    disturbing in that context compared to the C locale:
    - The cs_CZ and sk_SK locales sort the digits after the letters.
    - The et_EE locale sorts the 'z' between 's' and 't'.
    
    This patch fixes that by setting LC_COLLATE to C in order to process
    files in deterministic order, independently of the locale used to launch
    ldconfig.
    
    NOTE: This should NOT be backported to older release branches.
    
    Changelog:
    	[BZ #22505]
    	* elf/ldconfig.c (main): Call setlocale to force LC_COLLATE to C.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog      |    5 +++++
 NEWS           |    4 ++++
 elf/ldconfig.c |    4 ++++
 3 files changed, 13 insertions(+), 0 deletions(-)
Comment 2 Aurelien Jarno 2017-12-16 11:29:29 UTC
Fixed by commit 7d38eb38977980efe703eac93645b1af5a5f8a0c