pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix ASAN failure after flex errors in GUC file parsing 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix ASAN failure after flex errors in GUC file parsing @ 2026-08-16 23:53 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 3+ messages in thread From: Michael Paquier @ 2026-08-16 23:53 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix ASAN failure after flex errors in GUC file parsing As detected by ASAN, the scanner value used when parsing GUC files can be indeterminate when the flex error handler sigjumps to the old cleanup path, before yylex_init() is called. The flex scanner state is now made volatile in ParseConfigFp(), since its value is assigned after sigsetjmp() and cna be accessed after siglongjmp(). yylex_init() cannot use a volatile pointer; a temporary variable is used before assigning the result of yylex_init() to it. While on it, yy_create_buffer() is changed to detect the case where it returns a NULL value. Based on my read of the flex code, this cannot be reached currently. Future upstream changes or changes in the error logic of the GUC file parsing could make that reachable, and it is four extra lines of code. Oversight in d663f150b5ed. Reported-by: Ilia Kashintsev <ilia.kashintsev@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Andrey Rachitskiy <pl0h0yp1@gmail.com> Discussion: https://postgr.es/m/19612-24ccb4fc6da7786f@postgresql.org Backpatch-through: 18 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/803583ce74d37c27167bd4d1c9e9dd2421735943 Modified Files -------------- src/backend/utils/misc/guc-file.l | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix ASAN failure after flex errors in GUC file parsing @ 2026-08-16 23:53 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 3+ messages in thread From: Michael Paquier @ 2026-08-16 23:53 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix ASAN failure after flex errors in GUC file parsing As detected by ASAN, the scanner value used when parsing GUC files can be indeterminate when the flex error handler sigjumps to the old cleanup path, before yylex_init() is called. The flex scanner state is now made volatile in ParseConfigFp(), since its value is assigned after sigsetjmp() and cna be accessed after siglongjmp(). yylex_init() cannot use a volatile pointer; a temporary variable is used before assigning the result of yylex_init() to it. While on it, yy_create_buffer() is changed to detect the case where it returns a NULL value. Based on my read of the flex code, this cannot be reached currently. Future upstream changes or changes in the error logic of the GUC file parsing could make that reachable, and it is four extra lines of code. Oversight in d663f150b5ed. Reported-by: Ilia Kashintsev <ilia.kashintsev@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Andrey Rachitskiy <pl0h0yp1@gmail.com> Discussion: https://postgr.es/m/19612-24ccb4fc6da7786f@postgresql.org Backpatch-through: 18 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/13967fe0e2b64cfcaab53ca05f4e11b34147423e Modified Files -------------- src/backend/utils/misc/guc-file.l | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix ASAN failure after flex errors in GUC file parsing @ 2026-08-16 23:53 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 3+ messages in thread From: Michael Paquier @ 2026-08-16 23:53 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix ASAN failure after flex errors in GUC file parsing As detected by ASAN, the scanner value used when parsing GUC files can be indeterminate when the flex error handler sigjumps to the old cleanup path, before yylex_init() is called. The flex scanner state is now made volatile in ParseConfigFp(), since its value is assigned after sigsetjmp() and cna be accessed after siglongjmp(). yylex_init() cannot use a volatile pointer; a temporary variable is used before assigning the result of yylex_init() to it. While on it, yy_create_buffer() is changed to detect the case where it returns a NULL value. Based on my read of the flex code, this cannot be reached currently. Future upstream changes or changes in the error logic of the GUC file parsing could make that reachable, and it is four extra lines of code. Oversight in d663f150b5ed. Reported-by: Ilia Kashintsev <ilia.kashintsev@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Andrey Rachitskiy <pl0h0yp1@gmail.com> Discussion: https://postgr.es/m/19612-24ccb4fc6da7786f@postgresql.org Backpatch-through: 18 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0391fee2dc30c801fc17a1eeb6a82448d359e052 Modified Files -------------- src/backend/utils/misc/guc-file.l | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-08-16 23:53 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-08-16 23:53 pgsql: Fix ASAN failure after flex errors in GUC file parsing Michael Paquier <michael@paquier.xyz> 2026-08-16 23:53 pgsql: Fix ASAN failure after flex errors in GUC file parsing Michael Paquier <michael@paquier.xyz> 2026-08-16 23:53 pgsql: Fix ASAN failure after flex errors in GUC file parsing 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