aboutsummaryrefslogtreecommitdiff
path: root/src/backend/regex/regerror.c
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2024-12-24 14:54:24 +1300
committerDavid Rowley <drowley@postgresql.org>2024-12-24 14:54:24 +1300
commit6f3820f37aba94232468365bae7ba5de697fe993 (patch)
tree7a27290f3b543c55196ea9d0bec551b1c83781e2 /src/backend/regex/regerror.c
parent38da053463bef32adf563ddee5277d16d2b6c5af (diff)
downloadpostgresql-6f3820f37aba94232468365bae7ba5de697fe993.tar.gz
postgresql-6f3820f37aba94232468365bae7ba5de697fe993.zip
Fix race condition in TupleDescCompactAttr assert code
5983a4cff added CompactAttribute as an abbreviated alternative to FormData_pg_attribute to allow more cache-friendly processing in tasks related to TupleDescs. That commit contained some assert-only code to check that the CompactAttribute had been populated correctly, however, the method used to do that checking caused the TupleDesc's CompactAttribute to be zeroed before it was repopulated and compared to the snapshot taken before the memset call. This caused issues as the type cache caches TupleDescs in shared memory which can be used by multiple backend processes at the same time. There was a window of time between the zero and repopulation of the CompactAttribute where another process would mistakenly think that the CompactAttribute is invalid due to the memset. To fix this, instead of taking a snapshot of the CompactAttribute and calling populate_compact_attribute() and comparing the snapshot to the freshly populated TupleDesc's CompactAttribute, refactor things so we can just populate a temporary CompactAttribute on the stack. This way we don't touch the TupleDesc's memory. Reported-by: Alexander Lakhin, SQLsmith Discussion: https://postgr.es/m/ca3a256a-5d12-42db-aabe-a75a030d9fb9@gmail.com
Diffstat (limited to 'src/backend/regex/regerror.c')
0 files changed, 0 insertions, 0 deletions