Skip to content

Commit

Permalink
Fix stacktarget handling in zai_hook_safe_finish
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
  • Loading branch information
bwoebi committed Oct 29, 2024
1 parent 2a9899e commit 2c614f2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions zend_abstract_interface/interceptor/php8/interceptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ static void zai_hook_safe_finish(zend_execute_data *execute_data, zval *retval,
void *volatile stack = malloc(stack_size);
void *stacktop = stack + stack_size;
#if PHP_VERSION_ID >= 80300
register
register void *volatile
#else
void *
#endif
void *stacktarget = stacktop - stack_top_offset;
stacktarget = stacktop - stack_top_offset;

#ifdef __SANITIZE_ADDRESS__
void *volatile fake_stack;
Expand Down Expand Up @@ -105,8 +107,12 @@ static void zai_hook_safe_finish(zend_execute_data *execute_data, zval *retval,
#ifdef __SANITIZE_ADDRESS__
, "+r"(fake_stack)
#endif
#if PHP_VERSION_ID >= 80300
, "+r"(stacktarget)
#else
: "r"(stacktarget)
#if defined(__SANITIZE_ADDRESS__) && defined(__aarch64__)
#endif
#if defined(__SANITIZE_ADDRESS__) && defined(__aarch64__) && !defined(__clang__)
: "x7"
#endif
);
Expand Down

0 comments on commit 2c614f2

Please sign in to comment.