public inbox for [email protected]
help / color / mirror / Atom feedpgsql: Make stack depth check work with asan's use-after-return
6+ messages / 1 participants
[nested] [flat]
* pgsql: Make stack depth check work with asan's use-after-return
@ 2026-05-28 16:21 Andres Freund <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: Andres Freund @ 2026-05-28 16:21 UTC (permalink / raw)
To: [email protected]
Make stack depth check work with asan's use-after-return
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 de447bb8e6fb, 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 <[email protected]>
Discussion: https://postgr.es/m/2kk4z4odvuyrg7qlwjd7ft4eron4cle4btb33v4qatgsdkayir@gj6e62rgsel4
Backpatch-through: 14
Branch
------
REL_17_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/7ab11e09f98b6f144aabc3c36b86738ecc83049e
Modified Files
--------------
.cirrus.tasks.yml | 2 +-
src/backend/tcop/postgres.c | 22 +++++++++++++++++++---
2 files changed, 20 insertions(+), 4 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Make stack depth check work with asan's use-after-return
@ 2026-05-28 16:21 Andres Freund <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: Andres Freund @ 2026-05-28 16:21 UTC (permalink / raw)
To: [email protected]
Make stack depth check work with asan's use-after-return
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 de447bb8e6fb, 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 <[email protected]>
Discussion: https://postgr.es/m/2kk4z4odvuyrg7qlwjd7ft4eron4cle4btb33v4qatgsdkayir@gj6e62rgsel4
Backpatch-through: 14
Branch
------
REL_16_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/970ac13791fd7ee02e559f6bdfd4fcf88b5ced14
Modified Files
--------------
.cirrus.tasks.yml | 2 +-
src/backend/tcop/postgres.c | 22 +++++++++++++++++++---
2 files changed, 20 insertions(+), 4 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Make stack depth check work with asan's use-after-return
@ 2026-05-28 16:21 Andres Freund <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: Andres Freund @ 2026-05-28 16:21 UTC (permalink / raw)
To: [email protected]
Make stack depth check work with asan's use-after-return
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 de447bb8e6fb, 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 <[email protected]>
Discussion: https://postgr.es/m/2kk4z4odvuyrg7qlwjd7ft4eron4cle4btb33v4qatgsdkayir@gj6e62rgsel4
Backpatch-through: 14
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/ed7cf181038680ea0147d100eb2f0db6207d60a3
Modified Files
--------------
src/backend/tcop/postgres.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Make stack depth check work with asan's use-after-return
@ 2026-05-28 16:21 Andres Freund <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: Andres Freund @ 2026-05-28 16:21 UTC (permalink / raw)
To: [email protected]
Make stack depth check work with asan's use-after-return
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 de447bb8e6fb, 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 <[email protected]>
Discussion: https://postgr.es/m/2kk4z4odvuyrg7qlwjd7ft4eron4cle4btb33v4qatgsdkayir@gj6e62rgsel4
Backpatch-through: 14
Branch
------
REL_14_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/b67b2cd702725f79ff16b7e01b3d49e54a360a2a
Modified Files
--------------
src/backend/tcop/postgres.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Make stack depth check work with asan's use-after-return
@ 2026-05-28 16:21 Andres Freund <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: Andres Freund @ 2026-05-28 16:21 UTC (permalink / raw)
To: [email protected]
Make stack depth check work with asan's use-after-return
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 de447bb8e6fb, 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 <[email protected]>
Discussion: https://postgr.es/m/2kk4z4odvuyrg7qlwjd7ft4eron4cle4btb33v4qatgsdkayir@gj6e62rgsel4
Backpatch-through: 14
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/659701788171a5899119a6ddd98771371b355437
Modified Files
--------------
.cirrus.tasks.yml | 2 +-
src/backend/utils/misc/stack_depth.c | 22 +++++++++++++++++++---
2 files changed, 20 insertions(+), 4 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Make stack depth check work with asan's use-after-return
@ 2026-05-28 16:21 Andres Freund <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: Andres Freund @ 2026-05-28 16:21 UTC (permalink / raw)
To: [email protected]
Make stack depth check work with asan's use-after-return
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 de447bb8e6fb, 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 <[email protected]>
Discussion: https://postgr.es/m/2kk4z4odvuyrg7qlwjd7ft4eron4cle4btb33v4qatgsdkayir@gj6e62rgsel4
Backpatch-through: 14
Branch
------
REL_18_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/c0bf1d89df29e81c6fdad64e0f7cde10f16322bd
Modified Files
--------------
.cirrus.tasks.yml | 2 +-
src/backend/utils/misc/stack_depth.c | 22 +++++++++++++++++++---
2 files changed, 20 insertions(+), 4 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2026-05-28 16:21 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-05-28 16:21 pgsql: Make stack depth check work with asan's use-after-return Andres Freund <[email protected]>
2026-05-28 16:21 pgsql: Make stack depth check work with asan's use-after-return Andres Freund <[email protected]>
2026-05-28 16:21 pgsql: Make stack depth check work with asan's use-after-return Andres Freund <[email protected]>
2026-05-28 16:21 pgsql: Make stack depth check work with asan's use-after-return Andres Freund <[email protected]>
2026-05-28 16:21 pgsql: Make stack depth check work with asan's use-after-return Andres Freund <[email protected]>
2026-05-28 16:21 pgsql: Make stack depth check work with asan's use-after-return Andres Freund <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox