Skip to content

Make stack depth check work with asan's use-after-return - #21

Open
ninilo97 wants to merge 1 commit into
yb-pg19from
import-asan-stack-depth
Open

Make stack depth check work with asan's use-after-return#21
ninilo97 wants to merge 1 commit into
yb-pg19from
import-asan-stack-depth

Conversation

@ninilo97

Copy link
Copy Markdown

With address sanitizer's stack-use-after-return check, stack variables are moved to heap allocations, to allow to detect references to the memory at a later time. That broke our stack-depth check, which is why we had to disable detect_stack_use_after_return in CI. Luckily __builtin_frame_address() works correctly, even under asan, so use that.

We started using __builtin_frame_address() with de447bb, however as of that commit we just used it for the stack base address, not for the value to compare to the base address. Now we use it for both.

When building without __builtin_frame_address() support, we continue to use stack variables for the stack depth determination.

Reviewed-by: Tom Lane tgl@sss.pgh.pa.us
Discussion: https://postgr.es/m/2kk4z4odvuyrg7qlwjd7ft4eron4cle4btb33v4qatgsdkayir@gj6e62rgsel4 Backpatch-through: 14
(cherry picked from commit 6597017)

With address sanitizer's stack-use-after-return check, stack variables are
moved to heap allocations, to allow to detect references to the memory at a
later time. That broke our stack-depth check, which is why we had to disable
detect_stack_use_after_return in CI. Luckily __builtin_frame_address() works
correctly, even under asan, so use that.

We started using __builtin_frame_address() with de447bb, however as of
that commit we just used it for the stack base address, not for the value to
compare to the base address.  Now we use it for both.

When building without __builtin_frame_address() support, we continue to use
stack variables for the stack depth determination.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/2kk4z4odvuyrg7qlwjd7ft4eron4cle4btb33v4qatgsdkayir@gj6e62rgsel4
Backpatch-through: 14
(cherry picked from commit 6597017)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants