pgsql: Add CHECK_FOR_INTERRUPTS() in scram_SaltedPassword() for the bac

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add CHECK_FOR_INTERRUPTS() in scram_SaltedPassword() for the bac
Date: 2023-11-27 23:36:26
Message-ID: E1r7l9O-007ZgG-9A@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add CHECK_FOR_INTERRUPTS() in scram_SaltedPassword() for the backend

scram_SaltedPassword() could take a long time to compute when the number
of iterations used is large enough, and this code uses a tight loop to
compute a salted password.

Note that the same issue exists in libpq when using \password and a
large iteration number, but this cannot be interrupted. A CFI in the
backend is useful for server-side computations, at least.

Backpatch down to 16, where the user-settable GUC scram_iterations has
been added.

Author: Bowen Shi
Reviewed-by: Aleksander Alekseev, Daniel Gustafsson
Discussion: https://postgr.es/m/CAM_vCueV6xfr08KczfaCEk5J_qeTZtgqN7+orkNLx=g+phE82Q@mail.gmail.com
Backpatch-through: 16

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/14f2f9eb1a15f234f1ef417b8e62a6b7f950be4d

Modified Files
--------------
src/common/scram-common.c | 11 +++++++++++
1 file changed, 11 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2023-11-27 23:45:19 pgsql: Fix comment in tableam.h about GetHeapamTableAmRoutine()
Previous Message David Rowley 2023-11-27 21:42:06 pgsql: Don't use bms_membership() in cases where we don't need to