]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Prevent race condition while reading relmapper file.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 24 Jun 2021 07:45:23 +0000 (10:45 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 24 Jun 2021 07:45:46 +0000 (10:45 +0300)
commitc78bb32c19fe0b69d8ce75d6304c2394c4c7cd6b
tree52abca3497110a4d33358bafee0cea7783209af6
parente00e5db22d79a1870d21cee229b51fea4476e7c4
Prevent race condition while reading relmapper file.

Contrary to the comment here, POSIX does not guarantee atomicity of a
read(), if another process calls write() concurrently. Or at least Linux
does not. Add locking to load_relmap_file() to avoid the race condition.

Fixes bug #17064. Thanks to Alexander Lakhin for the report and test case.

Backpatch-through: 9.6, all supported versions.
Discussion: https://www.postgresql.org/message-id/17064-bb0d7904ef72add3@postgresql.org
src/backend/utils/cache/relmapper.c