Skip to content

./configure check raises a non-critical core dump #2351

Open
@m-schmoock

Description

@m-schmoock

Issue and Steps to Reproduce

When configuring the sandbox on gcc (GCC) 8.2.1 20181127 a seamingly non-critical Segmentation fault is raised. The application compiles and runs normally.

lightning.git]$ ./configure --enable-developer
# ...
checking for working <ucontext.h... yes
checking for passing pointers via makecontext()... sh: line 1:  8792 Segmentation fault  (core dumped) ./configurator.out 2>&1
no
checking for libsodium with IETF chacha20 variants... yes
...

It seems to compile and test a code for a specific pointer behaviour.

Caller

configure

if valgrind -q --error-exitcode=7 --track-origins=yes --leak-check=full --show-reachable=yes --errors-for-leak-kinds=all $CONFIGURATOR --help >/dev/null 2>&1; then

Code that causes it

ccan/tools/configurator/configurator.c

    { "HAVE_POINTER_SAFE_MAKECONTEXT", "passing pointers via makecontext()",    
      "DEFINES_EVERYTHING|EXECUTE|MAY_NOT_COMPILE",                                 
      "HAVE_UCONTEXT", NULL,                                                        
      "#include <stddef.h>\n"                                                       
      "#include <ucontext.h>\n"                                                     
      "static int worked = 0;\n"                                                    
      "static char stack[1024];\n"                                                  
      "static ucontext_t a, b;\n"                                                   
      "static void fn(void *p, void *q) {\n"                                        
      " void *cp = &worked;\n"                                                      
      " void *cq = (void *)(~((ptrdiff_t)cp));\n"                                   
      " if ((p == cp) && (q == cq))\n"                                              
      "     worked = 1;\n"                                                          
      " setcontext(&b);\n"                                                          
      "}\n"                                                                         
      "int main(void) {\n"                                                          
      " void *ap = &worked;\n"                                                      
      " void *aq = (void *)(~((ptrdiff_t)ap));\n"                                   
      " getcontext(&a);\n"                                                          
      " a.uc_stack.ss_sp = stack;\n"                                                
      " a.uc_stack.ss_size = sizeof(stack);\n"                                      
      " makecontext(&a, (void (*)(void))fn, 2, ap, aq);\n"                          
      " swapcontext(&b, &a);\n"                                                 
      " return worked ? 0 : 1;\n"                                               
      "}\n"                                                                     
    },

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions