diff options
author | Andres Freund <andres@anarazel.de> | 2021-09-13 18:07:19 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2021-09-13 18:26:15 -0700 |
commit | edb4d95ddf8984ad5b24d964d45884977d2fde4b (patch) | |
tree | 7507d785c517ddcf5a4195393481f5ee67cf8100 /src/include | |
parent | 026ed8efd6b1d774924937baf3209b676df4531f (diff) | |
download | postgresql-edb4d95ddf8984ad5b24d964d45884977d2fde4b.tar.gz postgresql-edb4d95ddf8984ad5b24d964d45884977d2fde4b.zip |
jit: Do not try to shut down LLVM state in case of LLVM triggered errors.
If an allocation failed within LLVM it is not safe to call back into LLVM as
LLVM is not generally safe against exceptions / stack-unwinding. Thus errors
while in LLVM code are promoted to FATAL. However llvm_shutdown() did call
back into LLVM even in such cases, while llvm_release_context() was careful
not to do so.
We cannot generally skip shutting down LLVM, as that can break profiling. But
it's OK to do so if there was an error from within LLVM.
Reported-By: Jelte Fennema <Jelte.Fennema@microsoft.com>
Author: Andres Freund <andres@anarazel.de>
Author: Justin Pryzby <pryzby@telsasoft.com>
Discussion: https://postgr.es/m/AM5PR83MB0178C52CCA0A8DEA0207DC14F7FF9@AM5PR83MB0178.EURPRD83.prod.outlook.com
Backpatch: 11-, where jit was introduced
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/jit/llvmjit.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/jit/llvmjit.h b/src/include/jit/llvmjit.h index a8ba5a4facd..3560715e329 100644 --- a/src/include/jit/llvmjit.h +++ b/src/include/jit/llvmjit.h @@ -84,6 +84,7 @@ extern LLVMValueRef AttributeTemplate; extern void llvm_enter_fatal_on_oom(void); extern void llvm_leave_fatal_on_oom(void); +extern bool llvm_in_fatal_on_oom(void); extern void llvm_reset_after_error(void); extern void llvm_assert_in_fatal_section(void); |