NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

py313-tortoisehg-7.2.2 on NetBSD 11.0; mysterious segfault



I wanted to update devel/py-tortoisehg, because the current version
7.0.1 (on the quarterly branch) refuses to work with the mercurial
version from the same branch (7.2.2). Updating tortoisehg to the current
7.2.2 fixes this (fortunately this just involves changing the version
number in devel/py-tortoisehg/Makefile).

I had already done this on NetBSD 10, and now I updated to 11. Strangely
enough, now thg (i.e. python) crashes on startup with a segfault.

Running from within gdb we see a call through a NULL pointer, even
though it also shows that this is not possible:


$ gdb --args /usr/pkg/bin/python3.13 /usr/pkg/bin/thg
...
(gdb) r
Starting program: /usr/pkg/bin/python3.13 /usr/pkg/bin/thg

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x000076176e90483f in doall_util_fn (arg=0x7f7fff7d3f50, wfunc_arg=0x0, 
    func_arg=0x76176ee072b1 <do_name>, func=0x0, wfunc=0x0, use_arg=1, 
    lh=0x761778d5cdf0)
    at /usr/src/crypto/external/apache2/openssl/dist/crypto/lhash/lhash.c:207
#2  OPENSSL_LH_doall_arg (lh=0x761778d5cdf0, func=0x76176ee072b1 <do_name>, 
    arg=0x7f7fff7d3f50)
    at /usr/src/crypto/external/apache2/openssl/dist/crypto/lhash/lhash.c:230

frame #0 is the call to the NULL pointer
frame #1 shows that  wfunc_arg=0x0 and use_arg=1.
frame #2 shows func=0x76176ee072b1 (not NULL) which is supposed to be the
value which is passed as wfunc_arg.

Relevant code from
/usr/src/crypto/external/apache2/openssl/dist/crypto/lhash/lhash.c:

185 static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
186     OPENSSL_LH_DOALL_FUNC_THUNK wfunc,
187     OPENSSL_LH_DOALL_FUNC func,
188     OPENSSL_LH_DOALL_FUNCARG func_arg,
189     OPENSSL_LH_DOALL_FUNCARG_THUNK wfunc_arg,
190     void *arg)
191 {
192     int i;
193     OPENSSL_LH_NODE *a, *n;
194 
195     if (lh == NULL)
196         return;
197 
198     /*
199      * reverse the order so we search from 'top to bottom' We were having
200      * memory leaks otherwise
201      */
202     for (i = lh->num_nodes - 1; i >= 0; i--) {
203         a = lh->b[i];
204         while (a != NULL) {
205             n = a->next;
206             if (use_arg)
207                 wfunc_arg(a->data, arg, func_arg); <<< this line crashes
208             else
209                 wfunc(a->data, func);
210             a = n;
211         }
212     }
213 }

224 void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh,
225     OPENSSL_LH_DOALL_FUNCARG func, void *arg)
226 {
227     if (lh == NULL)
228         return;
229 
230     doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC_THUNK)NULL,
231         (OPENSSL_LH_DOALL_FUNC)NULL, func, lh->daaw, arg); <<< func is
                          <<< passed to func_arg, and gdb frame #2 shows that
                          <<< func is not NULL
232 }

So how can this be? In frame #2 we see that func is not NULL. It is
passed to doall_util_fn as argument func_arg and there frame #1 shows it
as NULL. Is this some gcc code generation bug? Is gdb deceiving me?

(I built the package with gcc 12 from pkgsrc, and these are still
binaries I built for NetBSD/amd64 10.1, but I'm running on 11.0 and this
openssl code would be compiled for NetBSD 11 by the official release)

(I sent this to netbsd-users@ and not pkgsrc-users@ because so far this
seems to be a weird issue with a base system library, not something from
pkgsrc)

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert                            <rhialto/at/falu.nl>
\X/ There is no AI. There is just someone else's work.           --I. Rose

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index