2017-01-01 00:14:16 +00:00
|
|
|
/* Copyright (C) 2007-2017 Free Software Foundation, Inc.
|
2007-05-24 23:55:28 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
2007-05-24 23:55:28 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2017-07-11 14:44:01 +00:00
|
|
|
#include <stdbool.h>
|
2007-05-24 23:55:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
extern char **__libc_argv attribute_hidden;
|
|
|
|
|
|
|
|
void
|
2017-08-13 19:10:44 +00:00
|
|
|
__attribute__ ((noreturn))
|
2017-07-24 13:06:08 +00:00
|
|
|
__fortify_fail_abort (_Bool need_backtrace, const char *msg)
|
2007-05-24 23:55:28 +00:00
|
|
|
{
|
2017-07-24 13:06:08 +00:00
|
|
|
/* The loop is added only to keep gcc happy. Don't pass down
|
|
|
|
__libc_argv[0] if we aren't doing backtrace since __libc_argv[0]
|
|
|
|
may point to the corrupted stack. */
|
2007-05-24 23:55:28 +00:00
|
|
|
while (1)
|
2017-07-24 13:06:08 +00:00
|
|
|
__libc_message (need_backtrace ? (do_abort | do_backtrace) : do_abort,
|
2017-07-11 14:44:01 +00:00
|
|
|
"*** %s ***: %s terminated\n",
|
2017-07-24 13:06:08 +00:00
|
|
|
msg,
|
|
|
|
(need_backtrace && __libc_argv[0] != NULL
|
|
|
|
? __libc_argv[0] : "<unknown>"));
|
2007-05-24 23:55:28 +00:00
|
|
|
}
|
2017-07-11 14:44:01 +00:00
|
|
|
|
|
|
|
void
|
2017-08-13 19:10:44 +00:00
|
|
|
__attribute__ ((noreturn))
|
2017-07-11 14:44:01 +00:00
|
|
|
__fortify_fail (const char *msg)
|
|
|
|
{
|
|
|
|
__fortify_fail_abort (true, msg);
|
|
|
|
}
|
|
|
|
|
* rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
optimizing with GCC and __va_arg_pack_len is defined.
* rt/bits/mqueue2.h: New file.
* rt/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
(mq_open): New strong_alias.
(__mq_open_2): New function.
* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
* Versions.def (librt): Add GLIBC_2.7 version.
* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
* include/stdio.h (__fortify_fail): Add libc_hidden_proto.
* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
is defined rather than when not C++.
* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
__openat64_alias): New redirects.
(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
(open, open64, openat, openat64): Rewrite as __extern_always_inline
functions instead of function-like macros.
2007-09-15 22:35:27 +00:00
|
|
|
libc_hidden_def (__fortify_fail)
|
2017-07-11 14:44:01 +00:00
|
|
|
libc_hidden_def (__fortify_fail_abort)
|