Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 30 Oct 2012 20:00:20 +0400
From: Vasily Kulikov <segoon@...nwall.com>
To: owl-dev@...ts.openwall.com
Subject: Re: glibc

On Tue, Oct 30, 2012 at 05:57 +0400, Dmitry V. Levin wrote:
> On Mon, Oct 29, 2012 at 11:34:39PM +0400, Dmitry V. Levin wrote:
> > On Mon, Oct 29, 2012 at 10:17:48PM +0400, Vasily Kulikov wrote:
> > [...]
> > > 'strncmp' symbol is present on x86_64, but absent on i686:
> > > 
> > >     $ readelf -s logs/glibc-build-i386/elf/rtld-libc.a | grep strncmp
> > >         22: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND strncmp
> > >     File: logs/glibc-build-i386/elf/rtld-libc.a(rtld-strncmp-c.os)
> > >          1: 00000000     0 FILE    LOCAL  DEFAULT  ABS strncmp-c.c
> > >         15: 00000000   279 FUNC    GLOBAL DEFAULT    1 __strncmp_ia32
> > >         16: 00000000   279 FUNC    GLOBAL DEFAULT    1 __GI_strncmp
> > > 
> > >     $ readelf -s logs/glibc-build-x86_64/elf/rtld-libc.a | grep strncmp
> > >         19: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND strncmp
> > >     File: logs/glibc-build-x86_64/elf/rtld-libc.a(rtld-strncmp.os)
> > >         10: 0000000000000000    33 FUNC    GLOBAL DEFAULT    1 strncmp
> > >     File: logs/glibc-build-x86_64/elf/rtld-libc.a(rtld-strncmp-ssse3.os)
> > >         11: 0000000000000000    33 FUNC    GLOBAL DEFAULT    4 __strncmp_ssse3
> > 
> > The difference between x86_64 and i686 is due to STT_GNU_IFUNC.
> 
> Try this:
> 
> --- a/sysdeps/i386/i686/multiarch/Makefile
> +++ b/sysdeps/i386/i686/multiarch/Makefile
> @@ -24,6 +24,7 @@ sysdep_routines += bzero-sse2 memset-sse2 memcpy-ssse3 mempcpy-ssse3 \
>  		   strcasecmp_l-c strcasecmp-c strcasecmp_l-ssse3 \
>  		   strncase_l-c strncase-c strncase_l-ssse3 \
>  		   strcasecmp_l-sse4 strncase_l-sse4
> +sysdep-rtld-routines += strncmp-c strncmp-ssse3 strncmp-sse4
>  ifeq (yes,$(config-cflags-sse4))
>  sysdep_routines += strcspn-c strpbrk-c strspn-c strstr-c strcasestr-c
>  CFLAGS-varshift.c += -msse4

The same error.  strncmp-c is compiled in rtld-libc.a:

    $ readelf -s rtld-libc.a | grep strncmp-c.
    File: rtld-libc.a(rtld-strncmp-c.os)
         1: 00000000     0 FILE    LOCAL  DEFAULT  ABS strncmp-c.c

However, strncmp-{ssse3,sse4} are not.

Btw, I see that there is no XXX symbol for any __GI_XXX symbol defined in
'readelf -s elf/rtld-libc.a'.  IOW, no STT_GNU_IFUNC'ish function
wouldn't work in rtld.  Weird.

(from another email)
> > The direct using of 'getenv' adds the dependency.  Commenting 2 usages
> > of 'getenv' in the patch removed the linking problem.
> 
> Which ones?

    const char *value = getenv (cp);

and

    const char *value = getenv (nextp);

from _dl_non_dynamic_init() and process_envvars(), respectively.

-- 
Vasiliy

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ