Boost logo

Boost Users :

Subject: Re: [Boost-users] [test] Bluegene/Q issue: sigaltstack
From: Ewart Timothée (timothee.ewart_at_[hidden])
Date: 2014-07-14 06:13:19


Hello all,

Into Boost, this macro is defined between a !defined

# if !defined(__CYGWIN__) && !defined(__QNXNTO__)
# define BOOST_TEST_USE_ALT_STACK
# endif

Should we add a C++ macro provided by the compiled to disable this define ?

That seems to be the right thing to do since sigaltstack doesn't
appear to be valid on your platform.

I recompiled boost.test using gcc of the compute node (not xlc). I use gcc because the performances
of xlc with meta-programming are bad (the inlining does not work). For my work, I utilise an experimental clang + boost compiled with gcc.
So into 1.54/include/boost/test/impl/execution_monitor.ipp, I did

 176 # if !defined(__CYGWIN__) && !defined(__QNXNTO__) &&! defined(__bgq__)
 177 # define BOOST_TEST_USE_ALT_STACK
 178 # endif

I recompiled the library, and my tests using static link or the include version of the lib (I use a large sets of feature of the framework)
I have a correct execution of my tests with the patch.

Can you verify that this function is not supported on Bluegene/Q?
If it is not supported, then it seems that the right change is to add
a check for __bgq__ or __bg__ and not define BOOST_TEST_USE_ALT_STACK
if the appropriate symbol is defined.

We test a small test case (thank Sam): "BG/Q compute nodes do not support the establishment of an alternate signal stack using sigaltstack() and sigaction().
The example code when compiled with bgxlc & gcc (compute node) and run on a compute node produces an error output."

#include <signal.h>
#include <stdio.h>
#include <errno.h>

void handler(int sig) {}

int main() {
    static char stack_buf[SIGSTKSZ];
    stack_t stack={ .ss_sp=stack_buf, .ss_flags=0, .ss_size=SIGSTKSZ};

    int rv;
    rv=sigaltstack(&stack,0);
    if (rv) perror("sigaltstack");

    struct sigaction sa={ .sa_handler=handler, .sa_flags=SA_ONSTACK};
    sigfillset(&sa.sa_mask);

    rv=sigaction(SIGSEGV,&sa,0);
    if (rv) perror("sigaction");

    return 0;
}

We get :

% bgxlc sigaction_altstack.c
% srun -n1 ./a.out
sigaltstack: Function not implemented
sigaction: Invalid argument
%

This behaviour about sigaction is considered as a bug ? Should open a ticket somewhere ? Will it be patched for the next release of boost ?

Cheers,

Tim



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net