[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#630695: LD_PRELOAD not working when running kfreebsd-9 (9.0~svn223109)



It looks like a collision, namely between
AT_STACKPROT x AT_SECURE

Here's a possible patch to fix this.  I haven't tested it yet.  Does
this look like the right approach?

I also wonder if we should hunt down the other Linux-specific ELF
notes in that file.

I would say we should ignore all Linux-specific ELF notes.

In ideal world, with welcoming (e)glibc upstream:
there is bits/elf.h with OS specific AT_

elf/dl-sysdep.c contains not only

*******
#ifdef DL_PLATFORM_AUXV
      DL_PLATFORM_AUXV
#endif
*******

but also

*******
#ifdef DL_OS_AUXV
      DL_OS_AUXV
#endif
*******

And all Linux-specific ELF AT_* cases are in DL_OS_AUXV.

In the current world, we might end with patch in kfreebsd specific series:

--- a/elf/dl-sysdep.c
+++ b/elf/dl-sysdep.c
@@ -147,6 +147,7 @@
        gid ^= av->a_un.a_val;
        break;
 #endif
+#ifdef __linux__
       case AT_SECURE:
 #ifndef HAVE_AUX_SECURE
        seen = -1;
@@ -178,6 +179,7 @@
       case AT_RANDOM:
        _dl_random = (void *) av->a_un.a_val;
        break;
+#endif
 #ifdef DL_PLATFORM_AUXV
       DL_PLATFORM_AUXV
 #endif


Or in our glibc-ports/kfreebsd/dl-sysdep.c:


#ifdef SHARED
# define _dl_sysdep_start _dl_sysdep_start_ignored_code
# include <elf/dl-sysdep.c>
# undef dl_sysdep_start

ElfW(Addr)
_dl_sysdep_start (void **start_argptr,
                  void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phnum,
                                   ElfW(Addr) *user_entry, ElfW(auxv_t) *auxv))
{

...
	copy & paste of really generic part of _dl_sysdep_start
...


}

#endif

We should try to include such fix also into
point release of squeeze eglibc.

Petr


Reply to: