[gdal-dev] gdal git - Test 28 test-virtual-memory (SEGFAULT)

Even Rouault even.rouault at spatialys.com
Thu Jan 12 10:49:02 PST 2023


Andrew,

how did you get clang 15.0.2 on Ubuntu 21:10 ? Not through the apt 
package manager with the default apt repositories, right ? Because I've 
just tried with ubuntu 22.04 and this is only clang 14.0.0 that gets 
distributed, and the test runs fine.

That said, I'm moderately surprised that you hit an issue. The 
virtualmem code stuff does some on-the-fly at-hand un-assembling (cf 
https://gdal.org/development/rfc/rfc45_virtualmem.html#low-level-machinery-cpl-virtualmem-h), 
so if a compiler emits new machine instructions the code isn't ready 
for, such errors could happen. So, assuming the compiler you use isn't 
broken, I suspect some code updates are required. But we need to be able 
to reproduce first. Did you also use particular CPPFLAGS that activate 
AVX instruction set or something like that ?

Apart from the inconvenience of the test suite not passing, that doesn't 
invalidate your GDAL build in general. This is a very specific 
functionality that no one triggers without explicitly asking for it.

Even

Le 12/01/2023 à 18:34, Andrew C Aitchison a écrit :
>
> git master sources from today, on Ubuntu 21/10.
>
> With Ubuntu clang version 15.0.2-1 there is one failure that
> is not present in my g++ (Ubuntu 12.2.0-3ubuntu1) build:
>     28 - test-virtual-memory (SEGFAULT)
>
> Here is a section of the "make test" output, followed by
>     autotest/cpp/testvirtualmem
> and
>     gdb autotest/cpp/testvirtualmem
> runs.
>
> 28/51 Testing: test-virtual-memory
> 28/51 Test: test-virtual-memory
> Command: "/home/werdna/git/gdal.build./autotest/cpp/testvirtualmem"
> Directory: /home/werdna/git/gdal.build./autotest/cpp
> Output:
> ----------------------------------------------------------
> [==========] Running 1 test from 1 test suite.
> [----------] Global test environment set-up.
> [----------] 1 test from testvitualmem
> [ RUN      ] testvitualmem.test
> ERROR 1: CPLVirtualMemManagerThread: trying to write into read-only 
> mapping
> <end of output>
> ----------------------------------------------------------
> Test Failed.
> ----------------------------------------------------------
>
>
> *******************************
>
>
> # autotest/cpp/testvirtualmem
> [==========] Running 1 test from 1 test suite.
> [----------] Global test environment set-up.
> [----------] 1 test from testvitualmem
> [ RUN      ] testvitualmem.test
> Physical memory : 16645120000 bytes
> Testing CPLVirtualMemFileMapNew()
> test_two_pages()
> test_raw_auto(format=EHDR, bFileMapping=1)
> test_raw_auto(format=EHDR, bFileMapping=0)
> ERROR 1: CPLVirtualMemManagerThread: trying to write into read-only 
> mapping
> Segmentation fault (core dumped)
>
>
> *******************************
>
>
> # gdb autotest/cpp/testvirtualmem
> Starting program: 
> /home/werdna/git/gdal.build.llvm/autotest/cpp/testvirtualmem
>
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library 
> "/lib/x86_64-linux-gnu/libthread_db.so.1".
> [==========] Running 1 test from 1 test suite.
> [----------] Global test environment set-up.
> [----------] 1 test from testvitualmem
> [ RUN      ] testvitualmem.test
> Physical memory : 16645120000 bytes
> Testing CPLVirtualMemFileMapNew()
> [New Thread 0x7fffec1ff6c0 (LWP 2288144)]
> test_two_pages()
> [New Thread 0x7fffeb9fe6c0 (LWP 2288145)]
>
> Thread 1 "testvirtualmem" received signal SIGSEGV, Segmentation fault.
> 0x000055555556291d in (anonymous namespace)::test_two_pages 
> (ctxt=0x55555560dc10) at 
> /home/werdna/git/gdal/autotest/cpp/testvirtualmem.cpp:133
> 133                 char val = addr[MINIMUM_PAGE_SIZE * (i % 3)];
> (gdb) where
> #0  0x000055555556291d in (anonymous namespace)::test_two_pages 
> (ctxt=0x55555560dc10)
>     at /home/werdna/git/gdal/autotest/cpp/testvirtualmem.cpp:133
> #1  0x000055555556250e in (anonymous 
> namespace)::testvitualmem_test_Test::TestBody (this=0x55555560bd10)
>     at /home/werdna/git/gdal/autotest/cpp/testvirtualmem.cpp:266
> #2  0x0000555555599d6f in void 
> testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, 
> void>(testing::Test*, void (testing::Test::*)(), char const*) ()
> #3  0x0000555555589f56 in testing::Test::Run() ()
> #4  0x000055555558a115 in testing::TestInfo::Run() ()
> #5  0x000055555558a6e9 in testing::TestSuite::Run() ()
> #6  0x000055555558fbdf in 
> testing::internal::UnitTestImpl::RunAllTests() ()
> #7  0x000055555559a337 in bool 
> testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, 
> bool>(testing::internal::UnitTestImpl*, bool 
> (testing::internal::UnitTestImpl::*)(), char const*) ()
> #8  0x000055555558a1d5 in testing::UnitTest::Run() ()
> #9  0x0000555555566971 in RUN_ALL_TESTS () at 
> /usr/include/gtest/gtest.h:2293
> #10 0x0000555555566853 in main (argc=1, argv=0x55555560bc00) at 
> /home/werdna/git/gdal/autotest/cpp/main_gtest.cpp:55
>
>
-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list