[R-pkg-devel] can't reproduce 'Additional issues' on CRAN with valgrind

Bill Dunlap w||||@mwdun|@p @end|ng |rom gm@||@com
Mon Aug 2 20:48:21 CEST 2021


I ran the tests of rbibutils-2.2.2, using the latest devel version of R
configured to use valgrind, with

R --debugger=valgrind --debugger-args=--track-origins=yes --quiet -e
'testthat::test_package("rbibutils")'

I saw a lot of 'conditional jump depends on uninitialized value' errors:

==27280== Conditional jump or move depends on uninitialised value(s)
==27280==    at 0x11C420B7: UnknownInlinedFun (xml.c:178)
==27280==    by 0x11C420B7: xml_parse (xml.c:241)
==27280==    by 0x11C514EF: medin_processf (medin.c:683)
==27280==    by 0x11C67ADE: UnknownInlinedFun (bibcore.c:479)
==27280==    by 0x11C67ADE: bibl_read.part.0 (bibcore.c:862)
==27280==    by 0x11C68C66: bibprog (bibprog.c:36)
==27280==    by 0x11C69327: any2xml_main (any2xml.c:127)
==27280==    by 0x307639: do_dotCode (dotcode.c:1814)
==27280==    by 0x2B4600: bcEval.lto_priv.0 (eval.c:7128)
==27280==    by 0x2DADB7: Rf_eval (eval.c:740)
==27280==    by 0x2DD28E: R_execClosure.lto_priv.0 (eval.c:1910)
==27280==    by 0x2DE1EC: Rf_applyClosure (eval.c:1836)
==27280==    by 0x2DAFD3: Rf_eval (eval.c:863)
==27280==    by 0x2D7F22: do_begin (eval.c:2530)
==27280==  Uninitialised value was created by a heap allocation
==27280==    at 0x483DFAF: realloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==27280==    by 0x11C38DB2: str_realloc.part.0 (str.c:90)
==27280==    by 0x11C3B63D: UnknownInlinedFun (str.c:85)
==27280==    by 0x11C3B63D: UnknownInlinedFun (str.c:543)
==27280==    by 0x11C3B63D: UnknownInlinedFun (str.c:551)
==27280==    by 0x11C3B63D: UnknownInlinedFun (str.c:547)
==27280==    by 0x11C3B63D: UnknownInlinedFun (str.c:607)
==27280==    by 0x11C3B63D: str_segcpy (str.c:585)
==27280==    by 0x11C4DDFA: medin_readf (medin.c:144)
==27280==    by 0x11C67A96: UnknownInlinedFun (bibcore.c:471)
==27280==    by 0x11C67A96: bibl_read.part.0 (bibcore.c:862)
==27280==    by 0x11C68C66: bibprog (bibprog.c:36)
==27280==    by 0x11C69327: any2xml_main (any2xml.c:127)
==27280==    by 0x307639: do_dotCode (dotcode.c:1814)

realloc() does not initialize memory.  str.c contains a comment about
replacing malloc() with calloc() to avoid similar problems that valgrind
found.  It states that valgrind is mistaken, that that memory really is
initialized.  Hmm.

I also see the error about reading off the end of a malloc'ed array:

==27280== Invalid read of size 1
==27280==    at 0x11C420A8: UnknownInlinedFun (xml.c:174)
==27280==    by 0x11C420A8: xml_parse (xml.c:241)
==27280==    by 0x11C514EF: medin_processf (medin.c:683)
==27280==    by 0x11C67ADE: UnknownInlinedFun (bibcore.c:479)
==27280==    by 0x11C67ADE: bibl_read.part.0 (bibcore.c:862)
==27280==    by 0x11C68C66: bibprog (bibprog.c:36)
==27280==    by 0x11C69327: any2xml_main (any2xml.c:127)
==27280==    by 0x307639: do_dotCode (dotcode.c:1814)
==27280==    by 0x2B4600: bcEval.lto_priv.0 (eval.c:7128)
==27280==    by 0x2DADB7: Rf_eval (eval.c:740)
==27280==    by 0x2DD28E: R_execClosure.lto_priv.0 (eval.c:1910)
==27280==    by 0x2DE1EC: Rf_applyClosure (eval.c:1836)
==27280==    by 0x2DAFD3: Rf_eval (eval.c:863)
==27280==    by 0x2D7F22: do_begin (eval.c:2530)
==27280==  Address 0x125028af is 0 bytes after a block of size 10,927
alloc'd
==27280==    at 0x483DD99: calloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==27280==    by 0x11C38DF2: str_initalloc (str.c:253)
==27280==    by 0x11C3B66A: UnknownInlinedFun (str.c:541)
==27280==    by 0x11C3B66A: UnknownInlinedFun (str.c:551)
==27280==    by 0x11C3B66A: UnknownInlinedFun (str.c:547)
==27280==    by 0x11C3B66A: UnknownInlinedFun (str.c:607)
==27280==    by 0x11C3B66A: str_segcpy (str.c:585)
==27280==    by 0x11C4DDFA: medin_readf (medin.c:144)


On Mon, Aug 2, 2021 at 10:11 AM Georgi Boshnakov <
georgi.boshnakov using manchester.ac.uk> wrote:

> An update to my package rbibutils triggered 'Additional issues' on CRAN
> from valgrind, CRAN Package Check Results for Package rbibutils (
> r-project.org)<
> https://cran.r-project.org/web/checks/check_results_rbibutils.html>.
>
> However, running the checks with -use-valgrind  on my machine gives zero
> errors.
> I am on Ubuntu (the latest stable version), my R-devel installation was
> updated earlier today and I rebuild it adding the
> --with-valgrind-instrumentation=2 to the call to configure.
> Valgrind coming with Ubuntu is 3.5.0, so I installed its latest version
> from  github (also no errors).
>
> rbibutils has no dependencies, except that testthat is used for testing.
>
> What am I missing? Do I need to have a separate library for the
> instrumented R-devel version?
>
> As a side note, is there a way to find out if R has been built with
> valgrind? It seems that 'capabilities()' and 'R CMD config' do not offer
> this information.
>
> Thanks,
> Georgi Boshnakov
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list