postgresql/src/backend
Heikki Linnakangas 9d9b9d46f3 Move cancel key generation to after forking the backend
Move responsibility of generating the cancel key to the backend
process. The cancel key is now generated after forking, and the
backend advertises it in the ProcSignal array. When a cancel request
arrives, the backend handling it scans the ProcSignal array to find
the target pid and cancel key. This is similar to how this previously
worked in the EXEC_BACKEND case with the ShmemBackendArray, just
reusing the ProcSignal array.

One notable change is that we no longer generate cancellation keys for
non-backend processes. We generated them before just to prevent a
malicious user from canceling them; the keys for non-backend processes
were never actually given to anyone. There is now an explicit flag
indicating whether a process has a valid key or not.

I wrote this originally in preparation for supporting longer cancel
keys, but it's a nice cleanup on its own.

Reviewed-by: Jelte Fennema-Nio
Discussion: https://www.postgresql.org/message-id/508d0505-8b7a-4864-a681-e7e5edfe32aa@iki.fi
2024-07-29 15:37:48 +03:00
..
access Fix more holes with SLRU code in need of int64 for segment numbers 2024-07-27 07:16:52 +09:00
archive Fix memory leaks in error reporting with LOG level 2024-05-14 10:41:32 +02:00
backup Optimize escaping of JSON strings 2024-07-27 23:46:07 +12:00
bootstrap Add extern declarations for Bison global variables 2024-07-25 09:26:08 +02:00
catalog Reset relhassubclass upon attaching table as a partition 2024-07-24 12:38:18 +02:00
commands Clarify error message and documentation related to typed tables. 2024-07-26 12:39:45 -04:00
executor SQL/JSON: Remove useless code in ExecInitJsonExpr() 2024-07-26 16:38:46 +09:00
foreign Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
jit Move resowner from common JitContext to LLVM specific 2024-07-19 10:27:06 +03:00
lib Revert: Implement pg_wal_replay_wait() stored procedure 2024-04-11 17:28:15 +03:00
libpq libpq: Use strerror_r instead of strerror 2024-07-28 09:23:24 +02:00
main Tighten check for --forkchild argument when spawning child process 2024-07-03 15:53:30 +03:00
nodes SQL/JSON: Always coerce JsonExpr result at runtime 2024-06-28 21:58:13 +09:00
optimizer Reduce memory used by partitionwise joins 2024-07-29 11:35:51 +09:00
parser SQL/JSON: Rethink c2d93c3802 2024-07-17 17:14:01 +09:00
partitioning Fix creation of partition descriptor during concurrent detach 2024-06-11 11:38:45 +02:00
po Translation updates 2024-06-24 13:11:27 +02:00
port Revise GUC names quoting in messages again 2024-05-17 11:44:26 +02:00
postmaster Move cancel key generation to after forking the backend 2024-07-29 15:37:48 +03:00
regex Refactor pg_set_regex_collation() for clarity. 2024-07-28 16:55:17 -07:00
replication Add extern declarations for Bison global variables 2024-07-25 09:26:08 +02:00
rewrite Correctly check updatability of columns targeted by INSERT...DEFAULT. 2024-07-20 13:40:15 -04:00
snowball Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
statistics Fix typos and duplicate words 2024-04-18 21:28:07 +02:00
storage Move cancel key generation to after forking the backend 2024-07-29 15:37:48 +03:00
tcop Move cancel key generation to after forking the backend 2024-07-29 15:37:48 +03:00
tsearch Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
utils Move cancel key generation to after forking the backend 2024-07-29 15:37:48 +03:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
Makefile Fix make build on MinGW 2024-06-21 08:17:23 +02:00
meson.build meson: Fix import library name in Windows 2024-06-20 09:08:36 +02:00
nls.mk Add missing gettext triggers 2024-05-14 12:57:22 +02:00