Bug#1013940: nfft breaks pynfft autopkgtest on i386: Segmentation fault

Bernhard Übelacker bernhardu at mailbox.org
Sat Jul 23 15:45:18 BST 2022


Dear Maintainer,
I tried to have a look and I believe there is an disagreement of
the size of a structure, specifically the packing of it.

I am not sure if the packed structure is expected
or that with the padding.

At least a package nfft compiled with the below patch [3],
die no longer crash in the pynfft test.
If the padded version is expected, pynfft has to be modified.

Kind regards,
Bernhard


[1]
     Program received signal SIGSEGV, Segmentation fault.
     0xb539e12a in sort0 (ar_x=0x1, local_x=0xf71a40, local_x_num=8, m=<optimized out>, n=0x1243420, d=<optimized out>) at ../../../kernel/nfft/nfft.c:84
     84          ar_x[2 * i] = 0;
     (rr) bt 10
     #0  0xb539e12a in sort0 (ar_x=0x1, local_x=0xf71a40, local_x_num=8, m=<optimized out>, n=0x1243420, d=<optimized out>) at ../../../kernel/nfft/nfft.c:84
     #1  sort (ths=0xb53de034) at ../../../kernel/nfft/nfft.c:122
     #2  sort (ths=0xb53de034) at ../../../kernel/nfft/nfft.c:119
     #3  nfft_precompute_psi (ths=0xb53de034) at ../../../kernel/nfft/nfft.c:5522
     #4  0xb539e5ff in nfft_precompute_one_psi (ths=0xb53de034) at ../../../kernel/nfft/nfft.c:5643
     #5  0xb5475257 in __pyx_f_6pynfft_4nfft_4NFFT__precompute (__pyx_v_self=0xb53de028) at /home/benutzer/source/python3-pynfft/try1/pynfft-1.3.2/pynfft/nfft.c:5422
     #6  0xb5474de9 in __pyx_pf_6pynfft_4nfft_4NFFT_6precompute (__pyx_v_self=0xb53de028) at /home/benutzer/source/python3-pynfft/try1/pynfft-1.3.2/pynfft/nfft.c:5067
     #7  __pyx_pw_6pynfft_4nfft_4NFFT_7precompute (__pyx_v_self=<pynfft.nfft.NFFT at remote 0xb53de028>, unused=0x0) at /home/benutzer/source/python3-pynfft/try1/pynfft-1.3.2/pynfft/nfft.c:5048
     #8  0x005ffedb in method_vectorcall_NOARGS (func=<method_descriptor at remote 0xb53d94b0>, args=<optimized out>, nargsf=2147483649, kwnames=0x0) at ../Objects/descrobject.c:432
     #9  0x005e7ecf in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0xb59f6f84, callable=<method_descriptor at remote 0xb53d94b0>, tstate=0xdf8f70) at ../Include/cpython/abstract.h:114
     (More stack frames follow...)
     (rr) print ar_x
     $1 = (INT *) 0x1
     (rr) up
     #1  sort (ths=0xb53de034) at ../../../kernel/nfft/nfft.c:122
     122         sort0(ths->d, ths->n, ths->m, ths->M_total, ths->x, ths->index_x);
     (rr) print ths->index_x
     $2 = (NFFT_INT *) 0x1
     (rr) print ths
     $3 = (const nfft_plan *) 0xb53de034

     (rr) up
     #2  sort (ths=0xb53de034) at ../../../kernel/nfft/nfft.c:119
     119     static inline void sort(const X(plan) *ths)
     (rr) up
     #3  nfft_precompute_psi (ths=0xb53de034) at ../../../kernel/nfft/nfft.c:5522
     5522      sort(ths);
     (rr) up
     #4  0xb539e5ff in nfft_precompute_one_psi (ths=0xb53de034) at ../../../kernel/nfft/nfft.c:5643
     5643        X(precompute_psi)(ths);
     (rr) up
     #5  0xb5475257 in __pyx_f_6pynfft_4nfft_4NFFT__precompute (__pyx_v_self=0xb53de028) at /home/benutzer/source/python3-pynfft/try1/pynfft-1.3.2/pynfft/nfft.c:5422
     5422            nfft_precompute_one_psi((&__pyx_v_self->_plan));
     (rr) print __pyx_v_self->_plan->index_x
     $4 = (NFFT_INT *) 0x0


[2]
     (rr) ptype /o ths                                                  (rr) ptype /o __pyx_v_self->_plan
     type = const struct {                                              type = struct {
     /*      0      |       4 */    NFFT_INT N_total;                   /*      0      |       4 */    NFFT_INT N_total;
     /*      4      |       4 */    NFFT_INT M_total;                   /*      4      |       4 */    NFFT_INT M_total;
     /*      8      |       4 */    fftw_complex *f_hat;                /*      8      |       4 */    fftw_complex *f_hat;
     /*     12      |       4 */    fftw_complex *f;                    /*     12      |       4 */    fftw_complex *f;
     /*     16      |       4 */    void (*mv_trafo)(void *);           /*     16      |       4 */    void (*mv_trafo)(void *);
     /*     20      |       4 */    void (*mv_adjoint)(void *);         /*     20      |       4 */    void (*mv_adjoint)(void *);
     /*     24      |       4 */    NFFT_INT d;                         /*     24      |       4 */    NFFT_INT d;
     /*     28      |       4 */    NFFT_INT *N;                        /*     28      |       4 */    NFFT_INT *N;
     /*     32      |       4 */    double *sigma;                      /*     32      |       4 */    double *sigma;
     /*     36      |       4 */    NFFT_INT *n;                        /*     36      |       4 */    NFFT_INT *n;
     /*     40      |       4 */    NFFT_INT n_total;                   /*     40      |       4 */    NFFT_INT n_total;
     /*     44      |       4 */    NFFT_INT m;                         /*     44      |       4 */    NFFT_INT m;
     /*     48      |       4 */    double *b;                          /*     48      |       4 */    double *b;
     /*     52      |       4 */    NFFT_INT K;                         /*     52      |       4 */    NFFT_INT K;
     /*     56      |       4 */    unsigned int flags;                 /*     56      |       4 */    unsigned int flags;
     /*     60      |       4 */    unsigned int fftw_flags;            /*     60      |       4 */    unsigned int fftw_flags;
     /*     64      |       4 */    double *x;                          /*     64      |       4 */    double *x;
     /* XXX  4-byte hole      */                                        /*     68      |      24 */    double MEASURE_TIME_t[3];
     /*     72      |      24 */    double MEASURE_TIME_t[3];           /*     92      |       4 */    fftw_plan my_fftw_plan1;
     /*     96      |       4 */    fftw_plan my_fftw_plan1;            /*     96      |       4 */    fftw_plan my_fftw_plan2;
     /*    100      |       4 */    fftw_plan my_fftw_plan2;            /*    100      |       4 */    double **c_phi_inv;
     /*    104      |       4 */    double **c_phi_inv;                 /*    104      |       4 */    double *psi;
     /*    108      |       4 */    double *psi;                        /*    108      |       4 */    NFFT_INT *psi_index_g;
     /*    112      |       4 */    NFFT_INT *psi_index_g;              /*    112      |       4 */    NFFT_INT *psi_index_f;
     /*    116      |       4 */    NFFT_INT *psi_index_f;              /*    116      |       4 */    fftw_complex *g;
     /*    120      |       4 */    fftw_complex *g;                    /*    120      |       4 */    fftw_complex *g_hat;
     /*    124      |       4 */    fftw_complex *g_hat;                /*    124      |       4 */    fftw_complex *g1;
     /*    128      |       4 */    fftw_complex *g1;                   /*    128      |       4 */    fftw_complex *g2;
     /*    132      |       4 */    fftw_complex *g2;                   /*    132      |       4 */    double *spline_coeffs;
     /*    136      |       4 */    double *spline_coeffs;              /*    136      |       4 */    NFFT_INT *index_x;
     /*    140      |       4 */    NFFT_INT *index_x;
                                                                                                     /* total size (bytes):  140 */
                                 /* total size (bytes):  144 */                                   }
                                 } *



[3]
--- nfft-3.3.2.orig/include/nfft3.h
+++ nfft-3.3.2/include/nfft3.h
@@ -106,7 +106,7 @@ typedef struct \
} X(mv_plan_double); \
\
/** data structure for an NFFT (nonequispaced fast Fourier transform) plan with R precision */ \
-typedef struct\
+typedef struct __attribute__ ((__packed__)) \
{\
MACRO_MV_PLAN(C)\
\



More information about the debian-science-maintainers mailing list