Skip to content

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

4 messages · J. Antonio Guzmán Q., Kevin Ushey, Dirk Eddelbuettel

#
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
#
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 at gmail.com> wrote:
#
On 16 April 2021 at 10:27, Kevin Ushey wrote:
| 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

Thanks but that container image may be stale at times. The daily rebuilds by
Kevin's colleague Winston of his (mega) container r-debug may be better:

   https://github.com/wch/r-debug

Dirk
#
Hello,

Thanks for your response Kevin. It works using 'inplace_trans()', but it
takes a long time to solve.

I will try to reproduce the error using Dirk's suggestion.

Your guides are appreciated.

AG.

El vie, 16 abr 2021 a las 17:00, Dirk Eddelbuettel (<edd at debian.org>)
escribi?: