Back to index

glibc  2.9
Functions | Variables
dl-support.c File Reference
#include <errno.h>
#include <libintl.h>
#include <stdlib.h>
#include <unistd.h>
#include <ldsodefs.h>
#include <dl-machine.h>
#include <bits/libc-lock.h>
#include <dl-cache.h>
#include <dl-librecon.h>
#include <dl-procinfo.h>
#include <unsecvars.h>
#include <hp-timing.h>
#include <dl-procinfo.c>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 ElfW (Addr)
struct r_strlenpair
*internal_function 
_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz, size_t *max_capstrlen)

Variables

char * __progname
char ** _dl_argv = &__progname
const char * _dl_platform
size_t _dl_platformlen
int _dl_debug_mask
int _dl_lazy

Function Documentation

struct r_strlenpair* internal_function _dl_important_hwcaps ( const char *  platform,
size_t  platform_len,
size_t sz,
size_t max_capstrlen 
) [read]

Definition at line 304 of file dl-support.c.

{
  static struct r_strlenpair result;
  static char buf[1];

  result.str = buf;  /* Does not really matter.  */
  result.len = 0;

  *sz = 1;
  return &result;
}

Here is the caller graph for this function:

ElfW ( Addr  )

Definition at line 45 of file dl-support.c.

{
  int seen = 0;
  uid_t uid = 0;
  gid_t gid = 0;

  for (; av->a_type != AT_NULL; ++av)
    switch (av->a_type)
      {
      case AT_PAGESZ:
       GLRO(dl_pagesize) = av->a_un.a_val;
       break;
      case AT_CLKTCK:
       GLRO(dl_clktck) = av->a_un.a_val;
       break;
      case AT_PHDR:
       GL(dl_phdr) = (void *) av->a_un.a_val;
       break;
      case AT_PHNUM:
       GL(dl_phnum) = av->a_un.a_val;
       break;
      case AT_HWCAP:
       GLRO(dl_hwcap) = (unsigned long int) av->a_un.a_val;
       break;
#ifdef NEED_DL_SYSINFO
      case AT_SYSINFO:
       GL(dl_sysinfo) = av->a_un.a_val;
       break;
#endif
#if defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO
      case AT_SYSINFO_EHDR:
       GL(dl_sysinfo_dso) = (void *) av->a_un.a_val;
       break;
#endif
      case AT_UID:
       uid ^= av->a_un.a_val;
       seen |= 1;
       break;
      case AT_EUID:
       uid ^= av->a_un.a_val;
       seen |= 2;
       break;
      case AT_GID:
       gid ^= av->a_un.a_val;
       seen |= 4;
       break;
      case AT_EGID:
       gid ^= av->a_un.a_val;
       seen |= 8;
       break;
      case AT_SECURE:
       seen = -1;
       __libc_enable_secure = av->a_un.a_val;
       __libc_enable_secure_decided = 1;
       break;
# ifdef DL_PLATFORM_AUXV
      DL_PLATFORM_AUXV
# endif
      }
  if (seen == 0xf)
    {
      __libc_enable_secure = uid != 0 || gid != 0;
      __libc_enable_secure_decided = 1;
    }
}
#endif


void
internal_function
_dl_non_dynamic_init (void)
{
  if (HP_TIMING_AVAIL)
    HP_TIMING_NOW (_dl_cpuclock_offset);

  if (!_dl_pagesize)
    _dl_pagesize = __getpagesize ();

  _dl_verbose = *(getenv ("LD_WARN") ?: "") == '\0' ? 0 : 1;

  /* Initialize the data structures for the search paths for shared
     objects.  */
  _dl_init_paths (getenv ("LD_LIBRARY_PATH"));

  _dl_lazy = *(getenv ("LD_BIND_NOW") ?: "") == '\0';

  _dl_bind_not = *(getenv ("LD_BIND_NOT") ?: "") != '\0';

  _dl_dynamic_weak = *(getenv ("LD_DYNAMIC_WEAK") ?: "") == '\0';

  _dl_profile_output = getenv ("LD_PROFILE_OUTPUT");
  if (_dl_profile_output == NULL || _dl_profile_output[0] == '\0')
    _dl_profile_output
      = &"/var/tmp\0/var/profile"[__libc_enable_secure ? 9 : 0];

  if (__libc_enable_secure)
    {
      static const char unsecure_envvars[] =
       UNSECURE_ENVVARS
#ifdef EXTRA_UNSECURE_ENVVARS
       EXTRA_UNSECURE_ENVVARS
#endif
       ;
      const char *cp = unsecure_envvars;

      while (cp < unsecure_envvars + sizeof (unsecure_envvars))
       {
         __unsetenv (cp);
         cp = (const char *) __rawmemchr (cp, '\0') + 1;
       }

      if (__access ("/etc/suid-debug", F_OK) != 0)
       __unsetenv ("MALLOC_CHECK_");
    }

#ifdef DL_PLATFORM_INIT
  DL_PLATFORM_INIT;
#endif

#ifdef DL_OSVERSION_INIT
  DL_OSVERSION_INIT;
#endif

  /* Now determine the length of the platform string.  */
  if (_dl_platform != NULL)
    _dl_platformlen = strlen (_dl_platform);

  /* Scan for a program header telling us the stack is nonexecutable.  */
  if (_dl_phdr != NULL)
    for (uint_fast16_t i = 0; i < _dl_phnum; ++i)
      if (_dl_phdr[i].p_type == PT_GNU_STACK)
       {
         _dl_stack_flags = _dl_phdr[i].p_flags;
         break;
       }
}

Variable Documentation

char* __progname

Definition at line 24 of file init-misc.c.

char** _dl_argv = &__progname

Definition at line 37 of file dl-support.c.

Definition at line 43 of file dl-support.c.

Definition at line 44 of file dl-support.c.

Definition at line 40 of file dl-support.c.

Definition at line 41 of file dl-support.c.