Skip to content

Commit 686b4ea

Browse files
committed
Adjust address to point at or within the call
Change-Id: Id142d6c0c8e07622a34dc03a86a9161a6fbee199
1 parent 24ca959 commit 686b4ea

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

amd/device-libs/asanrtl/inc/asan_util.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ typedef unsigned long u64;
1919

2020
#define SHADOW_GRANULARITY (1ULL << ASAN_SHADOW)
2121

22-
#define GET_CALLER_PC() (uptr) __builtin_return_address(0)
22+
#define CALL_BYTES 4
23+
#define GET_CALLER_PC() ((uptr)__builtin_return_address(0) - CALL_BYTES)
2324

2425
#define WORKGROUP_ID(dim) __builtin_amdgcn_workgroup_id_##dim()
2526

amd/device-libs/asanrtl/src/dm.cl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ __asan_free_impl(ulong aa, ulong pc)
333333
if (!aa)
334334
return;
335335

336+
pc -= CALL_BYTES;
337+
336338
uptr sa = MEM_TO_SHADOW(aa);
337339
s8 sb = *(__global s8*) sa;
338340
if (sb != 0 && ((s8)(aa & (SHADOW_GRANULARITY-1)) >= sb)) {
@@ -613,6 +615,8 @@ NO_SANITIZE_ADDR
613615
ulong
614616
__asan_malloc_impl(ulong sz, ulong pc)
615617
{
618+
pc -= CALL_BYTES;
619+
616620
if (sz > SLAB_THRESHOLD)
617621
return non_slab_malloc(sz, pc);
618622
else

0 commit comments

Comments
 (0)