Seg fault in libvectorscan5 hs_compile_multi on ARM64

Bug #2064951 reported by Alex Kenion
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
vectorscan (Ubuntu)
New
Undecided
Unassigned

Bug Description

I have recreated this on both Ubuntu 22.04 and 24.04 on multiple ARM64 environments. This was initially encountered in a Python application that uses ctypes to interface with the shared vectorscan library. The back trace for the seg fault is below.

Program received signal SIGSEGV, Segmentation fault.
ue2::shellHasOnePath<boost::iterator_range<ue2::ue2_graph<ue2::NGHolder, ue2::NFAGraphVertexProps, ue2::NFAGraphEdgeProps>::adjacency_iterator> (*)(ue2::graph_detail::vertex_descriptor<ue2::ue2_graph<ue2::NGHolder, ue2::NFAGraphVertexProps, ue2::NFAGraphEdgeProps> > const&, ue2::NGHolder const&)> (adj_range_func=<optimized out>, shell=..., g=...) at ./src/nfagraph/ng_calc_components.cpp:232
Download failed: Invalid argument. Continuing without source file ./obj-aarch64-linux-gnu/./src/nfagraph/ng_calc_components.cpp.
232 ./src/nfagraph/ng_calc_components.cpp: No such file or directory.
(gdb) bt
#0 ue2::shellHasOnePath<boost::iterator_range<ue2::ue2_graph<ue2::NGHolder, ue2::NFAGraphVertexProps, ue2::NFAGraphEdgeProps>::adjacency_iterator> (*)(ue2::graph_detail::vertex_descriptor<ue2::ue2_graph<ue2::NGHolder, ue2::NFAGraphVertexProps, ue2::NFAGraphEdgeProps> > const&, ue2::NGHolder const&)> (adj_range_func=<optimized out>, shell=..., g=...) at ./src/nfagraph/ng_calc_components.cpp:232
#1 ue2::shellHasOnePath (tail_shell=..., head_shell=..., g=...) at ./src/nfagraph/ng_calc_components.cpp:257
#2 ue2::splitIntoComponents (g=std::unique_ptr<ue2::NGHolder> = {...}, comps=std::deque with 0 elements, max_head_depth=...,
    max_tail_depth=..., shell_comp=shell_comp@entry=0xffffffffc6cf) at ./src/nfagraph/ng_calc_components.cpp:306
#3 0x0000fffff638c774 in ue2::calcComponents (g=..., grey=...) at ./src/util/depth.h:80
#4 0x0000fffff632cf00 in ue2::NG::addGraph (g_ptr=..., expr=..., this=0xffffffffcc28) at ./src/nfagraph/ng.cpp:470
#5 ue2::addExpression (ng=..., index=index@entry=0, expression=<optimized out>, flags=<optimized out>, ext=ext@entry=0x0, id=<optimized out>)
    at ./src/compiler/compiler.cpp:384
#6 0x0000fffff632f060 in ue2::hs_compile_multi_int (expressions=0xaaaaab757930, flags=0xaaaaab6fcac0, ids=0xaaaaab658ab0, ext=ext@entry=0x0,
    elements=5778, mode=<optimized out>, platform=platform@entry=0x0, db=0xfffff5736410, comp_error=0xfffff5736510, g=...) at ./src/hs.cpp:242
#7 0x0000fffff632f644 in hs_compile_multi (expressions=<optimized out>, flags=<optimized out>, ids=<optimized out>, elements=<optimized out>,
    mode=<optimized out>, platform=0x0, db=<optimized out>, error=<optimized out>) at ./src/hs.cpp:441
#8 0x0000fffff6836e10 in ffi_call_SYSV () at ../src/aarch64/sysv.S:127
#9 0x0000fffff6833a94 in ffi_call_int (cif=0xffffffffd588, fn=<optimized out>, orig_rvalue=<optimized out>, avalue=0xffffffffd380,
    closure=<optimized out>) at ../src/aarch64/ffi.c:762
#10 0x0000fffff68621c8 in ?? () from /usr/lib/python3.10/lib-dynload/_ctypes.cpython-310-aarch64-linux-gnu.so
#11 0x0000fffff6860974 in ?? () from /usr/lib/python3.10/lib-dynload/_ctypes.cpython-310-aarch64-linux-gnu.so
#12 0x0000aaaaaab9aca0 in _PyObject_MakeTpCall ()
#13 0x0000aaaaaab91af4 in _PyEval_EvalFrameDefault ()
#14 0x0000aaaaaaba5348 in _PyFunction_Vectorcall ()
#15 0x0000aaaaaab8e2ac in _PyEval_EvalFrameDefault ()
#16 0x0000aaaaaaba5348 in _PyFunction_Vectorcall ()
#17 0x0000aaaaaab8d3f8 in _PyEval_EvalFrameDefault ()
#18 0x0000aaaaaaba5348 in _PyFunction_Vectorcall ()
#19 0x0000aaaaaab8d3f8 in _PyEval_EvalFrameDefault ()
#20 0x0000aaaaaaba5348 in _PyFunction_Vectorcall ()
#21 0x0000aaaaaab9177c in _PyEval_EvalFrameDefault ()
#22 0x0000aaaaaaba5348 in _PyFunction_Vectorcall ()
#23 0x0000aaaaaab8d3f8 in _PyEval_EvalFrameDefault ()
#24 0x0000aaaaaaba5348 in _PyFunction_Vectorcall ()
#25 0x0000aaaaaab8d3f8 in _PyEval_EvalFrameDefault ()
#26 0x0000aaaaaabb4148 in ?? ()
#27 0x0000aaaaaab8e2ac in _PyEval_EvalFrameDefault ()
#28 0x0000aaaaaaba5348 in _PyFunction_Vectorcall ()
#29 0x0000aaaaaab8d3f8 in _PyEval_EvalFrameDefault ()
#30 0x0000aaaaaaba5348 in _PyFunction_Vectorcall ()
#31 0x0000aaaaaab8d3f8 in _PyEval_EvalFrameDefault ()
#32 0x0000aaaaaaba5348 in _PyFunction_Vectorcall ()
#33 0x0000aaaaaab8d2bc in _PyEval_EvalFrameDefault ()
#34 0x0000aaaaaac89760 in ?? ()
#35 0x0000aaaaaac895e4 in PyEval_EvalCode ()
#36 0x0000aaaaaac9186c in ?? ()
#37 0x0000aaaaaaba559c in ?? ()
#38 0x0000aaaaaab8d2bc in _PyEval_EvalFrameDefault ()
#39 0x0000aaaaaaba5348 in _PyFunction_Vectorcall ()
#40 0x0000aaaaaab8d2bc in _PyEval_EvalFrameDefault ()
#41 0x0000aaaaaaba5348 in _PyFunction_Vectorcall ()
#42 0x0000aaaaaacad824 in ?? ()
#43 0x0000aaaaaacabe90 in Py_RunMain ()
#44 0x0000aaaaaac7a748 in Py_BytesMain ()
#45 0x0000fffff7d273fc in __libc_start_call_main (main=main@entry=0xaaaaaac7a720, argc=argc@entry=9, argv=argv@entry=0xfffffffff358)
    at ../sysdeps/nptl/libc_start_call_main.h:58
#46 0x0000fffff7d274cc in __libc_start_main_impl (main=0xaaaaaac7a720, argc=9, argv=0xfffffffff358, init=<optimized out>, fini=<optimized out>,
    rtld_fini=<optimized out>, stack_end=<optimized out>) at ../csu/libc-start.c:392
#47 0x0000aaaaaac7a630 in _start ()

When manually building/installing the exact same version of vectorscan on the same host (from the original source at https://github.com/VectorCamp/vectorscan), no seg fault occurs and this works as expected. As far as I can tell, this seg fault is an internal issue with the build of the library rather than an issue with the invocation thereof. I've put together a minimal example that recreates it (see attached).

To recreate, install libvectorscan5 and libvectorscan5-dev, then build the attached example program (clang -o vectorscan_segfault vectorscan_segfault.c -l hs). Invoking vectorscan_segfault will trigger a seg fault during the invocation of hs_compile_multi. Running this same code against a manual build of the same version of vectorscan on ARM or x86 with libhyperscan5 works without issue. I also tested against libvectorscan5 on Debian 12 and 13 and everything works as expected there, so it appears to be specific to the Ubuntu variant of the package.

Revision history for this message
Alex Kenion (wfalexk) wrote :

It doesn't look like my initial attachment was saved, so I'm attaching it again. This is a minimal example program that recreates the issue with the shared library.

description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.