commit | 59dc7956ff8b8d4f06439ab24eed562db695df8a | [log] [tgz] |
---|---|---|
author | Florian Mayer <fmayer@google.com> | Fri Jun 21 16:15:12 2024 -0700 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Wed Jun 26 02:59:32 2024 +0000 |
tree | 9b832c800d04c05d03efe209280b686670dd69d7 | |
parent | 0ccd76cbb62905dc60a48b1ebd182eef58e432a7 [diff] |
[MTE] fix longjmp handling untag_memory didn't correctly handle the case where from = to, and would always untag the first byte. not changing the assembly for now to make this more obvious for cherry-picking purposes. Test: atest bionic-unit-tests-static Bug: 348142687 (cherry picked from https://android-review.googlesource.com/q/commit:6b174efa140304f857547e3058baff445dd2f17f) Merged-In: I47c635897e0b50bbe4367a869d9b53fa45be0dc0 Change-Id: I47c635897e0b50bbe4367a869d9b53fa45be0dc0
diff --git a/libc/bionic/heap_tagging.cpp b/libc/bionic/heap_tagging.cpp index cadab3c..3d92404 100644 --- a/libc/bionic/heap_tagging.cpp +++ b/libc/bionic/heap_tagging.cpp
@@ -184,6 +184,9 @@ #ifdef __aarch64__ static inline __attribute__((no_sanitize("memtag"))) void untag_memory(void* from, void* to) { + if (from == to) { + return; + } __asm__ __volatile__( ".arch_extension mte\n" "1:\n"