]> git.ipfire.org Git - thirdparty/postgresql.git/commit
llvmjit: Also copy parameter / return value attributes from template functions.
authorAndres Freund <andres@anarazel.de>
Thu, 15 Oct 2020 20:39:41 +0000 (13:39 -0700)
committerAndres Freund <andres@anarazel.de>
Thu, 15 Oct 2020 21:31:32 +0000 (14:31 -0700)
commitc8a2bb0f1abfa2c6ca4ed253a581431855e639c5
tree7d2e97aad76de639b8bafc3aaf29fa78cd746947
parentf915453c5a38c3dcd5f87efec630801adc3c93a9
llvmjit: Also copy parameter / return value attributes from template functions.

Previously we only copied the function attributes. That caused problems at
least on s390x: Because we didn't copy the 'zeroext' attribute for
ExecAggTransReparent()'s *IsNull parameters, expressions invoking it didn't
ensure that the upper bytes of the registers were zeroed. In the - relatively
rare - cases where not, ExecAggTransReparent() wrongly ended up in the
newValueIsNull branch due to the register not being zero. Subsequently causing
a crash.

It's quite possible that this would cause problems on other platforms, and in
other places than just ExecAggTransReparent() on s390x.

Thanks to Christoph (and the Debian project) for providing me with access to a
s390x machine, allowing me to debug this.

Reported-By: Christoph Berg
Author: Andres Freund
Discussion: https://postgr.es/m/20201015083246.kie5726xerdt3ael@alap3.anarazel.de
Backpatch: 11-, where JIT was added
src/backend/jit/llvm/llvmjit.c