[R-pkg-devel] Package gcc-ASAN issue

Kevin Ushey kev|nu@hey @end|ng |rom gm@||@com
Fri Apr 16 19:27:24 CEST 2021


>From https://www.stats.ox.ac.uk/pub/bdr/memtests/gcc-ASAN/rTLS/00check.log,
you can see errors of the form:

==3566104==ERROR: AddressSanitizer: stack-use-after-scope on address
0x7fffc2651f80 at pc 0x7f7ba5b635de bp 0x7fffc2651eb0 sp
0x7fffc2651ea0
< ... >

The slides here explain what that means in more detail:
https://llvm.org/devmtg/2016-11/Slides/Buka-StackUseAfterScope.pdf

But, in short, it usually means you took a reference to a variable on
the stack, and then tried to access memory via that reference after
that variable went out-of-scope.

Based on the associated code here:

https://github.com/Antguz/rTLS/blob/449b5c98942a37d4d98d4d2d27ac04caf3cc2cb6/src/knn_rcpp.cpp#L20-L48

A guess is that the issue is related to your use of the non-copying
arma::mat constructors + attempts to transpose them. Could you use
.inplace_trans() instead?

You can also try to verify locally using e.g. Docker; the rocker
images here are immensely helpful:

https://github.com/rocker-org/r-devel-san

Best,
Kevin


On Fri, Apr 16, 2021 at 8:43 AM J. Antonio Guzmán Q. <antguz06 using gmail.com> wrote:
>
> Hello,
>
> We publish in CRAN our package rTLS [1]. The package passed the test
> without problems. However, at some point, additional testing suggests that
> it has issues with 'gcc-ASAN' [2]. For me this error is not informative,
> and thus, I do not have an idea how to start. I have been looking for
> guides or help on the web and unsure of this issue's reason or meaning. It
> is not clear to me what to do based on Writing R Extensions in section
> 4.3.3.
>
> When I see the log files [2], the issue seems to be located in a specific
> function. However, not sure why this is in a specific function since the
> based code is also shared with other functions.
>
> Can you guide me or help me with this? I know that my message is not so
> informative, but I do not know how to start to ask about this issue or
> reproduce the error. Here is the code development repository for this
> package [3].
>
> Antonio,
>
> [1]
> https://cran-archive.r-project.org/web/checks/2021/2021-03-30_check_results_rTLS.html
> [2] https://www.stats.ox.ac.uk/pub/bdr/memtests/gcc-ASAN/rTLS/00check.log
> [3] https://github.com/Antguz/rTLS
>
> --
> _______________________
> J. Antonio Guzmán Q., Ph.D.
> Alberta Centre for Earth Observation Sciences
> University of Alberta, Canada
> jaguzmanq.com
> Look my work in Google Scholar
> <https://scholar.google.es/citations?user=Ev3ofxwAAAAJ&hl=es> and/or
> ResearchGate <https://www.researchgate.net/profile/J_Antonio_Guzman_Q>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list