From josh.m.ulrich at gmail.com  Fri Oct  6 15:48:24 2017
From: josh.m.ulrich at gmail.com (Joshua Ulrich)
Date: Fri, 6 Oct 2017 08:48:24 -0500
Subject: [Rd] SIGSEGV during startup
Message-ID: <CAPPM_gSv7cvneEbnummWvwPCnf69__xcNSn6OsRG+SmXjBmTvA@mail.gmail.com>

Hi,

This problem started as of r73472 ("Merged in the rest of the basic
ALTREP framework."); I tested r73471 and it did not exist.

I'm building R devel on Ubuntu 16.04.3 LTS (64-bit), with the following flags:
  CC="gcc -std=gnu99 -fsanitize=address -fno-omit-frame-pointer"
  CFLAGS="-fno-omit-frame-pointer -g -O2 -Wall -pedantic -mtune=native"
and using
  configure --with-valgrind-instrumentation=2

Running 'make' builds the R binary, but R fails to start.  So 'make'
ultimately fails when trying to install sysdata.rda during the tools
package build.  Here is the traceback:

make[5]: Leaving directory '/home/josh/R/R-build/src/library/tools/src'
make[4]: Leaving directory '/home/josh/R/R-build/src/library/tools'
make[4]: Entering directory '/home/josh/R/R-build/src/library/tools'
installing 'sysdata.rda'
ASAN:SIGSEGV
=================================================================
==3543==ERROR: AddressSanitizer: SEGV on unknown address
0x000000000000 (pc 0x00000043b2f2 bp 0x7ffeb5fdc670 sp 0x7ffeb5fdc660
T0)
    #0 0x43b2f1 in ALTVEC_DATAPTR ../../../R-svn/src/main/altrep.c:305
    #1 0x6b1068 in DATAPTR ../../../R-svn/src/include/Rinlinedfuns.h:105
    #2 0x6b1068 in GetNewPage ../../../R-svn/src/main/memory.c:908
    #3 0x6b5284 in Rf_allocVector3 ../../../R-svn/src/main/memory.c:2514
    #4 0x654a49 in Rf_allocVector ../../../R-svn/src/include/Rinlinedfuns.h:514
    #5 0x654a49 in Rf_mkTrue ../../../R-svn/src/main/gram.c:4164
    #6 0x6b616c in Rf_InitMemory ../../../R-svn/src/main/memory.c:2137
    #7 0x69186a in setup_Rmainloop ../../../R-svn/src/main/main.c:842
    #8 0x694488 in Rf_mainloop ../../../R-svn/src/main/main.c:1088
    #9 0x41e398 in main ../../../R-svn/src/main/Rmain.c:29
    #10 0x7f9d71f4182f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #11 0x41fbe8 in _start (/home/josh/R/R-build/bin/exec/R+0x41fbe8)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ../../../R-svn/src/main/altrep.c:305
ALTVEC_DATAPTR
==3543==ABORTING
../../../../R-svn/share/make/basepkg.mk:150: recipe for target 'sysdata' failed
make[4]: *** [sysdata] Error 1
make[4]: Leaving directory '/home/josh/R/R-build/src/library/tools'
Makefile:30: recipe for target 'all' failed
make[3]: *** [all] Error 2
make[3]: Leaving directory '/home/josh/R/R-build/src/library/tools'
Makefile:36: recipe for target 'R' failed
make[2]: *** [R] Error 1
make[2]: Leaving directory '/home/josh/R/R-build/src/library'
Makefile:28: recipe for target 'R' failed
make[1]: *** [R] Error 1
make[1]: Leaving directory '/home/josh/R/R-build/src'
Makefile:60: recipe for target 'R' failed
make: *** [R] Error 1

The context around memory.c:908 is below, and suggests the issue
manifests with the combination of the ALTREP framework and valgrind
instrumentation level >1.

#if  VALGRIND_LEVEL > 1
if (NodeClassSize[node_class] > 0)
    VALGRIND_MAKE_MEM_NOACCESS(DATAPTR(s),
NodeClassSize[node_class]*sizeof(VECREC));
#endif


-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com



[Rd] SIGSEGV during startup
Joshua Ulrich