Bug#999474: llvm-13: segmentation fault (and corrupted stack) while compiling some OpenCL kernel with pocl on i386

Andreas Beckmann anbe at debian.org
Thu Nov 11 14:58:27 GMT 2021


Package: llvm-13
Version: 1:13.0.0-9
Severity: important

This bug is also reproducible with llvm-9/11/12, and probably with
older versions, too.

This bug is a bit tricky to reproduce as it will need a version of pocl
built with a different target cpu than what is uploaded in the archive.

In an i386 chroot ...

Get the pocl source package, unpack and apply patches.
Install the pocl build-depends.
Install clang-13 libclang-13-dev libclang-cpp13-dev llvm-13-dev
(or the corresponding packages of any other llvm version).
In debian/control set the llvm version in the clang/llvm B-D to
the version you want to use. (d/rules parses the version from there)
In debian/rules set
	LLVM_ARCH-i386                   = x86-64
(instead of LLVM_ARCH-i386 = i686)
(anything like pentium4 or newer would work to reproduce the bug,
only when targeting the really old CPUs like i686 it works fine)
Build the package: debian/rules build
This will abort with some failing tests ...

Now we can reproduce the segmentation fault:

# cd obj-i686-linux-gnu
# POCL_DEVICES=basic POCL_BUILDING=1 OCL_ICD_VENDORS="$(pwd)/ocl-vendors" ./tests/kernel/kernel test_ilogb
Running test test_ilogb...
Segmentation fault (core dumped)

retry in gdb:

# POCL_DEVICES=basic POCL_BUILDING=1 OCL_ICD_VENDORS="$(pwd)/ocl-vendors" gdb --args ./tests/kernel/kernel test_ilogb
GNU gdb (Debian 10.1-2) 10.1.90.20210103-git
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./tests/kernel/kernel...
(gdb) run
Starting program: /pocl-1.8/obj-i686-linux-gnu/tests/kernel/kernel test_ilogb
Running test test_ilogb...
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0xf05c7d22 in ?? () from /usr/lib/llvm-13/lib/libLLVM-13.so.1
(gdb) bt
#0  0xf05c7d22 in ?? () from /usr/lib/llvm-13/lib/libLLVM-13.so.1
#1  0x5655d210 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)


I had tried to install the relevant -dbgsym packages, but the
backtrace didn't get better.

If there is anything I can do to help you debug this?


Andreas



More information about the Pkg-llvm-team mailing list