Blame elf/tst-auditmanymod.h

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