Improve FORTIFY failure diagnostics.
Our FORTIFY _chk functions' implementations were very repetitive and verbose
but not very helpful. We'd also screwed up and put the SSIZE_MAX checks where
they would never fire unless you actually had a buffer as large as half your
address space, which probably doesn't happen very often.
Factor out the duplication and take the opportunity to actually show details
like how big the overrun buffer was, or by how much it was overrun.
Also remove the obsolete FORTIFY event logging.
Also remove the unused __libc_fatal_no_abort.
This change doesn't improve the diagnostics from the optimized assembler
implementations.
Change-Id: I176a90701395404d50975b547a00bd2c654e1252
diff --git a/libc/bionic/open.cpp b/libc/bionic/open.cpp
index a6d8086..41dce43 100644
--- a/libc/bionic/open.cpp
+++ b/libc/bionic/open.cpp
@@ -64,7 +64,7 @@
int __open_2(const char* pathname, int flags) {
if (__predict_false((flags & O_CREAT) != 0)) {
- __fortify_chk_fail("open(O_CREAT): called without specifying a mode", 0);
+ __fortify_fatal("open(O_CREAT): called without specifying a mode");
}
return __openat(AT_FDCWD, pathname, force_O_LARGEFILE(flags), 0);
@@ -86,7 +86,7 @@
int __openat_2(int fd, const char* pathname, int flags) {
if ((flags & O_CREAT) != 0) {
- __fortify_chk_fail("openat(O_CREAT): called without specifying a mode", 0);
+ __fortify_fatal("openat(O_CREAT): called without specifying a mode");
}
return __openat(fd, pathname, force_O_LARGEFILE(flags), 0);