[m-rev.] diff: Avoid potential loop when checking for SIGSEGV signal handling.

Peter Wang novalazy at gmail.com
Mon May 10 15:22:47 AEST 2021


configure.ac:
    Detect a signal handler being invoked over and over in a loop for a
    single SIGSEGV signal; fail the test in that case.

    This has been observed on Ubuntu 18.04.5 amd64 (running on a VPS),
    when using gcc -m32 to target x86. As far as I understand, this is
    not supposed to happen, so it is probably a bug.

diff --git a/configure.ac b/configure.ac
index 234682f46..c44626b7a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1543,6 +1543,11 @@ AC_TRY_RUN(
             exit(0);
         }
         void handler(int signum, siginfo_t *info, void *context) {
+            if (save_signum == signum) {
+                // We are stuck in a loop! Seen on Ubuntu 18.04.5 amd64
+                // when using gcc -m32 to target x86.
+                exit(2);
+            }
             save_signum = signum;
             save_cause = info->si_code;
         }
-- 
2.30.0



More information about the reviews mailing list