Blame elf/tst-auditmanymod.h

Packit Service 952f27
/* Check cookie initialization for many auditors.  Auditor template.
Packit Service 952f27
   Copyright (C) 2019 Free Software Foundation, Inc.
Packit Service 952f27
   This file is part of the GNU C Library.
Packit Service 952f27
Packit Service 952f27
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 952f27
   modify it under the terms of the GNU Lesser General Public
Packit Service 952f27
   License as published by the Free Software Foundation; either
Packit Service 952f27
   version 2.1 of the License, or (at your option) any later version.
Packit Service 952f27
Packit Service 952f27
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 952f27
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 952f27
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 952f27
   Lesser General Public License for more details.
Packit Service 952f27
Packit Service 952f27
   You should have received a copy of the GNU Lesser General Public
Packit Service 952f27
   License along with the GNU C Library; if not, see
Packit Service 952f27
   <https://www.gnu.org/licenses/>.  */
Packit Service 952f27
Packit Service 952f27
/* The macro MOD must be defined to the number of this auditor (an
Packit Service 952f27
   integer) before including this file.  */
Packit Service 952f27
Packit Service 952f27
#include <link.h>
Packit Service 952f27
#include <stdio.h>
Packit Service 952f27
#include <unistd.h>
Packit Service 952f27
Packit Service 952f27
/* Error counter for delayed error reporting.  */
Packit Service 952f27
static int errors;
Packit Service 952f27
Packit Service 952f27
unsigned int
Packit Service 952f27
la_version (unsigned int version)
Packit Service 952f27
{
Packit Service 952f27
  return version;
Packit Service 952f27
}
Packit Service 952f27
Packit Service 952f27
unsigned int
Packit Service 952f27
la_objopen (struct link_map *map, Lmid_t lmid,
Packit Service 952f27
            uintptr_t *cookie)
Packit Service 952f27
{
Packit Service 952f27
  struct link_map *cookie_map = (struct link_map *) *cookie;
Packit Service 952f27
  printf ("info: %d, la_objopen: map=%p name=%s cookie=%p:%p diff=%td\n",
Packit Service 952f27
          MOD, map, map->l_name, cookie, cookie_map,
Packit Service 952f27
          (char *) cookie - (char *) map);
Packit Service 952f27
  fflush (stdout);
Packit Service 952f27
  if (map != cookie_map)
Packit Service 952f27
    {
Packit Service 952f27
      printf ("error: %d, la_objopen:"
Packit Service 952f27
              " map address does not match cookie value\n",
Packit Service 952f27
              MOD);
Packit Service 952f27
      fflush (stdout);
Packit Service 952f27
      ++errors;
Packit Service 952f27
    }
Packit Service 952f27
  return 0;
Packit Service 952f27
}
Packit Service 952f27
Packit Service 952f27
extern unsigned int
Packit Service 952f27
la_objclose (uintptr_t *__cookie)
Packit Service 952f27
{
Packit Service 952f27
  if (errors != 0)
Packit Service 952f27
    {
Packit Service 952f27
      printf ("error: exiting due to previous errors");
Packit Service 952f27
      _exit (1);
Packit Service 952f27
    }
Packit Service 952f27
  return 0;
Packit Service 952f27
}