Improve diagnostics from the assembler __memcpy_chk routines.
Change-Id: Iec16c92ed80beee505cba2121ea33e3550197b02
diff --git a/libc/arch-arm64/generic/bionic/memcpy.S b/libc/arch-arm64/generic/bionic/memcpy.S
index 83ab5d1..0be2aac 100644
--- a/libc/arch-arm64/generic/bionic/memcpy.S
+++ b/libc/arch-arm64/generic/bionic/memcpy.S
@@ -31,29 +31,18 @@
#include <private/bionic_asm.h>
ENTRY(__memcpy_chk)
- cmp x2, x3
- b.hi __memcpy_chk_fail
+ cmp x2, x3
+ bls memcpy
- // Fall through to memcpy...
+ // Preserve for accurate backtrace.
+ stp x29, x30, [sp, -16]!
+ .cfi_def_cfa_offset 16
+ .cfi_rel_offset x29, 0
+ .cfi_rel_offset x30, 8
+
+ bl __memcpy_chk_fail
END(__memcpy_chk)
ENTRY(memcpy)
#include "memcpy_base.S"
END(memcpy)
-
-ENTRY_PRIVATE(__memcpy_chk_fail)
- // Preserve for accurate backtrace.
- stp x29, x30, [sp, -16]!
- .cfi_def_cfa_offset 16
- .cfi_rel_offset x29, 0
- .cfi_rel_offset x30, 8
-
- adrp x0, error_string
- add x0, x0, :lo12:error_string
- bl __fortify_fatal
-END(__memcpy_chk_fail)
-
- .data
- .align 2
-error_string:
- .string "memcpy: prevented write past end of buffer"