This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients bkabrda, vstinner
Date 2014-04-02.09:56:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1396432607.89.0.149445482326.issue21131@psf.upfronthosting.co.za>
In-reply-to
Content
"test_faulthandler.test_register_chain fails on some 64bit architectures (arm8, ppc64) with kernel >= 3.10"

I am a little bit surprised that the bug depends on the kernel version.

Does test_register_chain_segfault_reproducer.py also crash with chain=False?

Can you check if HAVE_SIGACTION is defined in pyconfig.h? Or in Python: import sysconfig; print(sysconfig.get_config_var('HAVE_SIGACTION')).

Wit chain=True, faulthandler_register() registers its signal handler with SA_NODEFER flag:
---
    /* if the signal is received while the kernel is executing a system
       call, try to restart the system call instead of interrupting it and
       return EINTR. */
    action.sa_flags = SA_RESTART;
    if (chain) {
        /* do not prevent the signal from being received from within its
           own signal handler */
        action.sa_flags = SA_NODEFER;
    }
---

With chain=True, the faulthandler_user() function calls the previous signal handler with:
---
#ifdef HAVE_SIGACTION
    if (user->chain) {
        (void)sigaction(signum, &user->previous, NULL);
        errno = save_errno;

        /* call the previous signal handler */
        raise(signum);

        save_errno = errno;
        (void)faulthandler_register(signum, user->chain, NULL);
        errno = save_errno;
    }
#else
    if (user->chain) {
        errno = save_errno;
        /* call the previous signal handler */
        user->previous(signum);
    }
#endif
---

You can try to add "#undef HAVE_SIGACTION" in faulthandler.c (after #include "Python.h") to see if the bug can be reproduced without sigaction. The code using signal() is very different, especially when chaining signal handlers.
History
Date User Action Args
2014-04-02 09:56:47vstinnersetrecipients: + vstinner, bkabrda
2014-04-02 09:56:47vstinnersetmessageid: <1396432607.89.0.149445482326.issue21131@psf.upfronthosting.co.za>
2014-04-02 09:56:47vstinnerlinkissue21131 messages
2014-04-02 09:56:47vstinnercreate