pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Initialize TransactionState and user ID consistently at transact 6+ messages / 1 participants [nested] [flat]
* pgsql: Initialize TransactionState and user ID consistently at transact @ 2018-11-14 07:50 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 6+ messages in thread From: Michael Paquier @ 2018-11-14 07:50 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Initialize TransactionState and user ID consistently at transaction start If a failure happens when a transaction is starting between the moment the transaction status is changed from TRANS_DEFAULT to TRANS_START and the moment the current user ID and security context flags are fetched via GetUserIdAndSecContext(), or before initializing its basic fields, then those may get reset to incorrect values when the transaction aborts, leaving the session in an inconsistent state. One problem reported is that failing a starting transaction at the first query of a session could cause several kinds of system crashes on the follow-up queries. In order to solve that, move the initialization of the transaction state fields and the call of GetUserIdAndSecContext() in charge of fetching the current user ID close to the point where the transaction status is switched to TRANS_START, where there cannot be any error triggered in-between, per an idea of Tom Lane. This properly ensures that the current user ID, the security context flags and that the basic fields of TransactionState remain consistent even if the transaction fails while starting. Reported-by: Richard Guo Diagnosed-By: Richard Guo Author: Michael Paquier Reviewed-by: Tom Lane Discussion: https://postgr.es/m/CAN_9JTxECSb=pEPcb0a8d+6J+bDcOZ4=DgRo_B7Y5gRHJUM=Rw@mail.gmail.com Backpatch-through: 9.4 Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/5793289c7a45f0cff06985aef49669b697435bf9 Modified Files -------------- src/backend/access/transam/xact.c | 48 +++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 22 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Initialize TransactionState and user ID consistently at transact @ 2018-11-14 07:50 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 6+ messages in thread From: Michael Paquier @ 2018-11-14 07:50 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Initialize TransactionState and user ID consistently at transaction start If a failure happens when a transaction is starting between the moment the transaction status is changed from TRANS_DEFAULT to TRANS_START and the moment the current user ID and security context flags are fetched via GetUserIdAndSecContext(), or before initializing its basic fields, then those may get reset to incorrect values when the transaction aborts, leaving the session in an inconsistent state. One problem reported is that failing a starting transaction at the first query of a session could cause several kinds of system crashes on the follow-up queries. In order to solve that, move the initialization of the transaction state fields and the call of GetUserIdAndSecContext() in charge of fetching the current user ID close to the point where the transaction status is switched to TRANS_START, where there cannot be any error triggered in-between, per an idea of Tom Lane. This properly ensures that the current user ID, the security context flags and that the basic fields of TransactionState remain consistent even if the transaction fails while starting. Reported-by: Richard Guo Diagnosed-By: Richard Guo Author: Michael Paquier Reviewed-by: Tom Lane Discussion: https://postgr.es/m/CAN_9JTxECSb=pEPcb0a8d+6J+bDcOZ4=DgRo_B7Y5gRHJUM=Rw@mail.gmail.com Backpatch-through: 9.4 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/b4721f39505b56dd7b556aef5428a0850230ca59 Modified Files -------------- src/backend/access/transam/xact.c | 48 +++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 22 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Initialize TransactionState and user ID consistently at transact @ 2018-11-14 07:50 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 6+ messages in thread From: Michael Paquier @ 2018-11-14 07:50 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Initialize TransactionState and user ID consistently at transaction start If a failure happens when a transaction is starting between the moment the transaction status is changed from TRANS_DEFAULT to TRANS_START and the moment the current user ID and security context flags are fetched via GetUserIdAndSecContext(), or before initializing its basic fields, then those may get reset to incorrect values when the transaction aborts, leaving the session in an inconsistent state. One problem reported is that failing a starting transaction at the first query of a session could cause several kinds of system crashes on the follow-up queries. In order to solve that, move the initialization of the transaction state fields and the call of GetUserIdAndSecContext() in charge of fetching the current user ID close to the point where the transaction status is switched to TRANS_START, where there cannot be any error triggered in-between, per an idea of Tom Lane. This properly ensures that the current user ID, the security context flags and that the basic fields of TransactionState remain consistent even if the transaction fails while starting. Reported-by: Richard Guo Diagnosed-By: Richard Guo Author: Michael Paquier Reviewed-by: Tom Lane Discussion: https://postgr.es/m/CAN_9JTxECSb=pEPcb0a8d+6J+bDcOZ4=DgRo_B7Y5gRHJUM=Rw@mail.gmail.com Backpatch-through: 9.4 Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/7f8356bd10b5b2a7dd092e158f5ffbf65e6a2c14 Modified Files -------------- src/backend/access/transam/xact.c | 48 +++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 22 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Initialize TransactionState and user ID consistently at transact @ 2018-11-14 07:50 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 6+ messages in thread From: Michael Paquier @ 2018-11-14 07:50 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Initialize TransactionState and user ID consistently at transaction start If a failure happens when a transaction is starting between the moment the transaction status is changed from TRANS_DEFAULT to TRANS_START and the moment the current user ID and security context flags are fetched via GetUserIdAndSecContext(), or before initializing its basic fields, then those may get reset to incorrect values when the transaction aborts, leaving the session in an inconsistent state. One problem reported is that failing a starting transaction at the first query of a session could cause several kinds of system crashes on the follow-up queries. In order to solve that, move the initialization of the transaction state fields and the call of GetUserIdAndSecContext() in charge of fetching the current user ID close to the point where the transaction status is switched to TRANS_START, where there cannot be any error triggered in-between, per an idea of Tom Lane. This properly ensures that the current user ID, the security context flags and that the basic fields of TransactionState remain consistent even if the transaction fails while starting. Reported-by: Richard Guo Diagnosed-By: Richard Guo Author: Michael Paquier Reviewed-by: Tom Lane Discussion: https://postgr.es/m/CAN_9JTxECSb=pEPcb0a8d+6J+bDcOZ4=DgRo_B7Y5gRHJUM=Rw@mail.gmail.com Backpatch-through: 9.4 Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/464dc037ffe7496040fe783a4447c5ce09864100 Modified Files -------------- src/backend/access/transam/xact.c | 48 +++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 22 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Initialize TransactionState and user ID consistently at transact @ 2018-11-14 07:50 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 6+ messages in thread From: Michael Paquier @ 2018-11-14 07:50 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Initialize TransactionState and user ID consistently at transaction start If a failure happens when a transaction is starting between the moment the transaction status is changed from TRANS_DEFAULT to TRANS_START and the moment the current user ID and security context flags are fetched via GetUserIdAndSecContext(), or before initializing its basic fields, then those may get reset to incorrect values when the transaction aborts, leaving the session in an inconsistent state. One problem reported is that failing a starting transaction at the first query of a session could cause several kinds of system crashes on the follow-up queries. In order to solve that, move the initialization of the transaction state fields and the call of GetUserIdAndSecContext() in charge of fetching the current user ID close to the point where the transaction status is switched to TRANS_START, where there cannot be any error triggered in-between, per an idea of Tom Lane. This properly ensures that the current user ID, the security context flags and that the basic fields of TransactionState remain consistent even if the transaction fails while starting. Reported-by: Richard Guo Diagnosed-By: Richard Guo Author: Michael Paquier Reviewed-by: Tom Lane Discussion: https://postgr.es/m/CAN_9JTxECSb=pEPcb0a8d+6J+bDcOZ4=DgRo_B7Y5gRHJUM=Rw@mail.gmail.com Backpatch-through: 9.4 Branch ------ REL9_4_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/e85b729375ed33b478aafbb981cd29cb31c58370 Modified Files -------------- src/backend/access/transam/xact.c | 48 +++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 22 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Initialize TransactionState and user ID consistently at transact @ 2018-11-14 07:50 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 6+ messages in thread From: Michael Paquier @ 2018-11-14 07:50 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Initialize TransactionState and user ID consistently at transaction start If a failure happens when a transaction is starting between the moment the transaction status is changed from TRANS_DEFAULT to TRANS_START and the moment the current user ID and security context flags are fetched via GetUserIdAndSecContext(), or before initializing its basic fields, then those may get reset to incorrect values when the transaction aborts, leaving the session in an inconsistent state. One problem reported is that failing a starting transaction at the first query of a session could cause several kinds of system crashes on the follow-up queries. In order to solve that, move the initialization of the transaction state fields and the call of GetUserIdAndSecContext() in charge of fetching the current user ID close to the point where the transaction status is switched to TRANS_START, where there cannot be any error triggered in-between, per an idea of Tom Lane. This properly ensures that the current user ID, the security context flags and that the basic fields of TransactionState remain consistent even if the transaction fails while starting. Reported-by: Richard Guo Diagnosed-By: Richard Guo Author: Michael Paquier Reviewed-by: Tom Lane Discussion: https://postgr.es/m/CAN_9JTxECSb=pEPcb0a8d+6J+bDcOZ4=DgRo_B7Y5gRHJUM=Rw@mail.gmail.com Backpatch-through: 9.4 Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0d472b1e12efc3b860705cdc629a70d8972f0400 Modified Files -------------- src/backend/access/transam/xact.c | 48 +++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 22 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2018-11-14 07:50 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-11-14 07:50 pgsql: Initialize TransactionState and user ID consistently at transact Michael Paquier <michael@paquier.xyz> 2018-11-14 07:50 pgsql: Initialize TransactionState and user ID consistently at transact Michael Paquier <michael@paquier.xyz> 2018-11-14 07:50 pgsql: Initialize TransactionState and user ID consistently at transact Michael Paquier <michael@paquier.xyz> 2018-11-14 07:50 pgsql: Initialize TransactionState and user ID consistently at transact Michael Paquier <michael@paquier.xyz> 2018-11-14 07:50 pgsql: Initialize TransactionState and user ID consistently at transact Michael Paquier <michael@paquier.xyz> 2018-11-14 07:50 pgsql: Initialize TransactionState and user ID consistently at transact Michael Paquier <michael@paquier.xyz>
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