[PATCH v3 0/4] Add Memory Sanitizer support

2023-02-13 Thread Ilya Leoshkevich via Elfutils-devel
Hi, I've made a few more updates, as described in the changelog below. Please take a look. v2: https://sourceware.org/pipermail/elfutils-devel/2023q1/005868.html v2 -> v3: * Drop the integrated patches. * Fix all backends with respect to returning references and rvalue references; add a test. *

[PATCH v3 2/4] printversion: Fix unused variable

2023-02-13 Thread Ilya Leoshkevich via Elfutils-devel
clang complains: debuginfod.cxx:354:1: error: unused variable 'apba__' [-Werror,-Wunused-const-variable] ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; ^ ../lib/printversion.h:47:21: note: expanded from macro 'ARGP_PROGRAM_BUG_ADDRESS_DEF' const char *const apba__ __asm

[PATCH v3 4/4] configure: Add --enable-sanitize-memory

2023-02-13 Thread Ilya Leoshkevich via Elfutils-devel
Add support for clang Memory Sanitizer [1], which detects the usage of uninitialized values. While elfutils itself is already checked with valgrind, checking code that depends on elfutils requires elfutils to be built with MSan. MSan is not linked into shared libraries, and is linked into executab

[PATCH v3 1/4] tests: Ignore dwfl-report-offline-memory

2023-02-13 Thread Ilya Leoshkevich via Elfutils-devel
It's showing up in git status when configuring in the source directory. Signed-off-by: Ilya Leoshkevich --- tests/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/.gitignore b/tests/.gitignore index 99d04819..536a41ec 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -4

[PATCH v3 3/4] backends: Support returning lvalue and rvalue references

2023-02-13 Thread Ilya Leoshkevich via Elfutils-devel
On the low level, they are the same as pointers. The change needs to be done for all backends, so define a function and a macro to avoid repetition. Also add a native test, which has to be implemented in C++. Add the configure check for it. Signed-off-by: Ilya Leoshkevich --- backends/aarch64_re

Re: [PATCH] libdw: check memory access in get_(u|s)leb128

2023-02-13 Thread Aleksei Vetrov via Elfutils-devel
Hi Mark, On Sat, Feb 11, 2023 at 11:43 PM Mark Wielaard wrote: > After this code we will do: > > /* There might be one extra byte. */ > unsigned char b = **addrp; > ++*addrp; > > So I think we want to catch that too. Easiest imho seems to move (and > invert) the max check immediately afte

[PATCH v2] libdw: check memory access in get_(u|s)leb128

2023-02-13 Thread Aleksei Vetrov via Elfutils-devel
From: Aleksei Vetrov __libdw_get_uleb128 and __libdw_get_sleb128 should check if addrp has already reached the end before unrolling the first step. It is done by moving __libdw_max_len to the beginning of the function, which can notice, that addrp is beyond the end. Then we just check the result