]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - debug/fortify_fail.c
Avoid backtrace from __stack_chk_fail [BZ #12189]
[thirdparty/glibc.git] / debug / fortify_fail.c
index a31977a40f7bf0fcc72c8968c61ea1855e97b20b..c90d384dafb081ff5295fa058d2e322b2d53f6a8 100644 (file)
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdbool.h>
 
 
 extern char **__libc_argv attribute_hidden;
 
 void
 __attribute__ ((noreturn)) internal_function
-__fortify_fail (const char *msg)
+__fortify_fail_abort (_Bool do_backtrace, const char *msg)
 {
   /* The loop is added only to keep gcc happy.  */
   while (1)
-    __libc_message (2, "*** %s ***: %s terminated\n",
+    __libc_message (do_backtrace ? (do_abort | do_backtrace) : do_abort,
+                   "*** %s ***: %s terminated\n",
                    msg, __libc_argv[0] ?: "<unknown>");
 }
+
+void
+__attribute__ ((noreturn)) internal_function
+__fortify_fail (const char *msg)
+{
+  __fortify_fail_abort (true, msg);
+}
+
 libc_hidden_def (__fortify_fail)
+libc_hidden_def (__fortify_fail_abort)