pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Defend against self-referential views in relation_is_updatable() 7+ messages / 1 participants [nested] [flat]
* pgsql: Defend against self-referential views in relation_is_updatable() @ 2019-11-21 21:22 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2019-11-21 21:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Defend against self-referential views in relation_is_updatable(). While a self-referential view doesn't actually work, it's possible to create one, and it turns out that this breaks some of the information_schema views. Those views call relation_is_updatable(), which neglected to consider the hazards of being recursive. In older PG versions you get a "stack depth limit exceeded" error, but since v10 it'd recurse to the point of stack overrun and crash, because commit a4c35ea1c took out the expression_returns_set() call that was incidentally checking the stack depth. Since this function is only used by information_schema views, it seems like it'd be better to return "not updatable" than suffer an error. Hence, add tracking of what views we're examining, in just the same way that the nearby fireRIRrules() code detects self-referential views. I added a check_stack_depth() call too, just to be defensive. Per private report from Manuel Rigger. Back-patch to all supported versions. Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/4a0aab14dcb35550b55e623a3c194442c5666084 Modified Files -------------- src/backend/rewrite/rewriteHandler.c | 21 +++++++++++++++++++++ src/backend/utils/adt/misc.c | 4 ++-- src/include/rewrite/rewriteHandler.h | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Defend against self-referential views in relation_is_updatable() @ 2019-11-21 21:22 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2019-11-21 21:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Defend against self-referential views in relation_is_updatable(). While a self-referential view doesn't actually work, it's possible to create one, and it turns out that this breaks some of the information_schema views. Those views call relation_is_updatable(), which neglected to consider the hazards of being recursive. In older PG versions you get a "stack depth limit exceeded" error, but since v10 it'd recurse to the point of stack overrun and crash, because commit a4c35ea1c took out the expression_returns_set() call that was incidentally checking the stack depth. Since this function is only used by information_schema views, it seems like it'd be better to return "not updatable" than suffer an error. Hence, add tracking of what views we're examining, in just the same way that the nearby fireRIRrules() code detects self-referential views. I added a check_stack_depth() call too, just to be defensive. Per private report from Manuel Rigger. Back-patch to all supported versions. Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/bcd541897fcf89b60494700f1f15ff70fae5ced7 Modified Files -------------- src/backend/rewrite/rewriteHandler.c | 21 +++++++++++++++++++++ src/backend/utils/adt/misc.c | 4 ++-- src/include/rewrite/rewriteHandler.h | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Defend against self-referential views in relation_is_updatable() @ 2019-11-21 21:22 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2019-11-21 21:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Defend against self-referential views in relation_is_updatable(). While a self-referential view doesn't actually work, it's possible to create one, and it turns out that this breaks some of the information_schema views. Those views call relation_is_updatable(), which neglected to consider the hazards of being recursive. In older PG versions you get a "stack depth limit exceeded" error, but since v10 it'd recurse to the point of stack overrun and crash, because commit a4c35ea1c took out the expression_returns_set() call that was incidentally checking the stack depth. Since this function is only used by information_schema views, it seems like it'd be better to return "not updatable" than suffer an error. Hence, add tracking of what views we're examining, in just the same way that the nearby fireRIRrules() code detects self-referential views. I added a check_stack_depth() call too, just to be defensive. Per private report from Manuel Rigger. Back-patch to all supported versions. Branch ------ REL9_4_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f09829017d1502a12716fb3fbd116cb2e25897c8 Modified Files -------------- src/backend/rewrite/rewriteHandler.c | 21 +++++++++++++++++++++ src/backend/utils/adt/misc.c | 4 ++-- src/include/rewrite/rewriteHandler.h | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Defend against self-referential views in relation_is_updatable() @ 2019-11-21 21:22 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2019-11-21 21:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Defend against self-referential views in relation_is_updatable(). While a self-referential view doesn't actually work, it's possible to create one, and it turns out that this breaks some of the information_schema views. Those views call relation_is_updatable(), which neglected to consider the hazards of being recursive. In older PG versions you get a "stack depth limit exceeded" error, but since v10 it'd recurse to the point of stack overrun and crash, because commit a4c35ea1c took out the expression_returns_set() call that was incidentally checking the stack depth. Since this function is only used by information_schema views, it seems like it'd be better to return "not updatable" than suffer an error. Hence, add tracking of what views we're examining, in just the same way that the nearby fireRIRrules() code detects self-referential views. I added a check_stack_depth() call too, just to be defensive. Per private report from Manuel Rigger. Back-patch to all supported versions. Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/669138ebd1465944119340397bcf31bab3050404 Modified Files -------------- src/backend/rewrite/rewriteHandler.c | 21 +++++++++++++++++++++ src/backend/utils/adt/misc.c | 4 ++-- src/include/rewrite/rewriteHandler.h | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Defend against self-referential views in relation_is_updatable() @ 2019-11-21 21:22 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2019-11-21 21:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Defend against self-referential views in relation_is_updatable(). While a self-referential view doesn't actually work, it's possible to create one, and it turns out that this breaks some of the information_schema views. Those views call relation_is_updatable(), which neglected to consider the hazards of being recursive. In older PG versions you get a "stack depth limit exceeded" error, but since v10 it'd recurse to the point of stack overrun and crash, because commit a4c35ea1c took out the expression_returns_set() call that was incidentally checking the stack depth. Since this function is only used by information_schema views, it seems like it'd be better to return "not updatable" than suffer an error. Hence, add tracking of what views we're examining, in just the same way that the nearby fireRIRrules() code detects self-referential views. I added a check_stack_depth() call too, just to be defensive. Per private report from Manuel Rigger. Back-patch to all supported versions. Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/5186f7625e5fc0e3ae85419099a75d6aa93d8351 Modified Files -------------- src/backend/rewrite/rewriteHandler.c | 21 +++++++++++++++++++++ src/backend/utils/adt/misc.c | 4 ++-- src/include/rewrite/rewriteHandler.h | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Defend against self-referential views in relation_is_updatable() @ 2019-11-21 21:22 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2019-11-21 21:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Defend against self-referential views in relation_is_updatable(). While a self-referential view doesn't actually work, it's possible to create one, and it turns out that this breaks some of the information_schema views. Those views call relation_is_updatable(), which neglected to consider the hazards of being recursive. In older PG versions you get a "stack depth limit exceeded" error, but since v10 it'd recurse to the point of stack overrun and crash, because commit a4c35ea1c took out the expression_returns_set() call that was incidentally checking the stack depth. Since this function is only used by information_schema views, it seems like it'd be better to return "not updatable" than suffer an error. Hence, add tracking of what views we're examining, in just the same way that the nearby fireRIRrules() code detects self-referential views. I added a check_stack_depth() call too, just to be defensive. Per private report from Manuel Rigger. Back-patch to all supported versions. Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/52434ba73e3cab79f21b5deb921f51ea84a32e53 Modified Files -------------- src/backend/rewrite/rewriteHandler.c | 21 +++++++++++++++++++++ src/backend/utils/adt/misc.c | 4 ++-- src/include/rewrite/rewriteHandler.h | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Defend against self-referential views in relation_is_updatable() @ 2019-11-21 21:22 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2019-11-21 21:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Defend against self-referential views in relation_is_updatable(). While a self-referential view doesn't actually work, it's possible to create one, and it turns out that this breaks some of the information_schema views. Those views call relation_is_updatable(), which neglected to consider the hazards of being recursive. In older PG versions you get a "stack depth limit exceeded" error, but since v10 it'd recurse to the point of stack overrun and crash, because commit a4c35ea1c took out the expression_returns_set() call that was incidentally checking the stack depth. Since this function is only used by information_schema views, it seems like it'd be better to return "not updatable" than suffer an error. Hence, add tracking of what views we're examining, in just the same way that the nearby fireRIRrules() code detects self-referential views. I added a check_stack_depth() call too, just to be defensive. Per private report from Manuel Rigger. Back-patch to all supported versions. Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b9f3d7a5317bbafb0cef1921c2e777bb327fdaee Modified Files -------------- src/backend/rewrite/rewriteHandler.c | 21 +++++++++++++++++++++ src/backend/utils/adt/misc.c | 4 ++-- src/include/rewrite/rewriteHandler.h | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2019-11-21 21:22 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-11-21 21:22 pgsql: Defend against self-referential views in relation_is_updatable() Tom Lane <tgl@sss.pgh.pa.us> 2019-11-21 21:22 pgsql: Defend against self-referential views in relation_is_updatable() Tom Lane <tgl@sss.pgh.pa.us> 2019-11-21 21:22 pgsql: Defend against self-referential views in relation_is_updatable() Tom Lane <tgl@sss.pgh.pa.us> 2019-11-21 21:22 pgsql: Defend against self-referential views in relation_is_updatable() Tom Lane <tgl@sss.pgh.pa.us> 2019-11-21 21:22 pgsql: Defend against self-referential views in relation_is_updatable() Tom Lane <tgl@sss.pgh.pa.us> 2019-11-21 21:22 pgsql: Defend against self-referential views in relation_is_updatable() Tom Lane <tgl@sss.pgh.pa.us> 2019-11-21 21:22 pgsql: Defend against self-referential views in relation_is_updatable() Tom Lane <tgl@sss.pgh.pa.us>
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