pgsql: jit: Do not try to shut down LLVM state in case of LLVM triggere

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: jit: Do not try to shut down LLVM state in case of LLVM triggere
Date: 2021-09-14 01:31:08
Message-ID: E1mPxHw-0007oA-Hw@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(dot)Fennema(at)microsoft(dot)com>
Author: Andres Freund <andres(at)anarazel(dot)de>
Author: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Discussion: https://postgr.es/m/AM5PR83MB0178C52CCA0A8DEA0207DC14F7FF9@AM5PR83MB0178.EURPRD83.prod.outlook.com
Backpatch: 11-, where jit was introduced

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/edb4d95ddf8984ad5b24d964d45884977d2fde4b

Modified Files
--------------
src/backend/jit/llvm/llvmjit.c | 18 ++++++++++++++++--
src/backend/jit/llvm/llvmjit_error.cpp | 10 ++++++++++
src/include/jit/llvmjit.h | 1 +
3 files changed, 27 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2021-09-14 01:31:11 pgsql: jit: Do not try to shut down LLVM state in case of LLVM triggere
Previous Message Michael Paquier 2021-09-14 01:16:15 pgsql: Remove code duplication for permission checks with replication s