pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: jit: Do not try to shut down LLVM state in case of LLVM triggere
Date: Tue, 14 Sep 2021 01:31:14 +0000
Message-ID: <E1mPxI2-0007p4-3p@gemulon.postgresql.org> (raw)

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

Branch
------
REL_13_STABLE

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

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(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1mPxI2-0007p4-3p@gemulon.postgresql.org>
Permalink:  ../E1mPxI2-0007p4-3p@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mPxI2-0007p4-3p@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de
  Subject: Re: pgsql: jit: Do not try to shut down LLVM state in case of LLVM triggere
  In-Reply-To: <E1mPxI2-0007p4-3p@gemulon.postgresql.org>
  References: <E1mPxI2-0007p4-3p@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox