void linker_env_init(KernelArgumentBlock& args) {
  // Store environment pointer - can't be NULL.
  _envp = args.envp;

  __init_AT_SECURE(args);
  __sanitize_environment_variables();
}
Example #2
0
void linker_env_init(KernelArgumentBlock& args) {
  // Store environment pointer - can't be NULL.
  _envp = args.envp;
  // ARC MOD BEGIN
  // Neither NaCl nor Bare Metal provides AT_SECURE.
#if !defined(HAVE_ARC)
  __init_AT_SECURE(args);
  __sanitize_environment_variables();
#endif
  // ARC MOD END
}
unsigned* linker_env_init(unsigned* environment_and_aux_vectors) {
  // Store environment pointer - can't be NULL.
  _envp = reinterpret_cast<char**>(environment_and_aux_vectors);

  // Skip over all environment variable definitions.
  // The end of the environment block is marked by two NULL pointers.
  unsigned* aux_vectors = environment_and_aux_vectors;
  while (aux_vectors[0] != 0) {
    ++aux_vectors;
  }
  ++aux_vectors;

  __remove_invalid_environment_variables();
  __init_AT_SECURE(aux_vectors);

  // Sanitize environment if we're loading a setuid program.
  if (get_AT_SECURE()) {
    __remove_unsafe_environment_variables();
  }

  return aux_vectors;
}