[git] GPG-ERROR - branch, master, updated. libgpg-error-1.21-15-g52c3606
by Peter Wu
cvs at cvs.gnupg.org
Thu Mar 24 10:18:01 CET 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Error codes used by GnuPG et al.".
The branch, master has been updated
via 52c3606b2384f33ef30ea5ada3f187829de9dcf7 (commit)
from 140cfd51cee738a55caf9d347981f6f81e1990a4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 52c3606b2384f33ef30ea5ada3f187829de9dcf7
Author: Peter Wu <peter at lekensteyn.nl>
Date: Wed Mar 23 23:23:06 2016 +0100
Add function gpgrt_annotate_leaked_object.
* src/gpg-error.h.in: add gpgrt_annotate_leaked_object to support
marking memory as non-leaked for Clang and GCC.
--
This annotation can be used to mark objects as explicitly leaked such
that it can be ignored in tools like LeakSanitizer.
The GPGRT_HAVE_LEAK_SANITIZER macro is explicitly not undefined to
support -fsanitize=leak, a user or configure script could then decide to
add this macro when just -fsanitize=leak is given.
Signed-off-by: Peter Wu <peter at lekensteyn.nl>
Additional changes by -wk:
- But __GNUC__ guard around the entire GPGRT_HAVE_LEAK_SANITIZER
detection.
- Add NEWS entry.
Signed-off-by: Werner Koch <wk at gnupg.org>
diff --git a/NEWS b/NEWS
index b8d6be5..d1d21fa 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ Noteworthy changes in version 1.22 (unreleased) [C17/A17/R_)
* Interface changes relative to the 1.20 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GPG_ERR_DB_CORRUPTED NEW.
+ gpgrt_annotate_leaked_object NEW inline func.
Noteworthy changes in version 1.21 (2015-12-12) [C17/A17/R0]
diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in
index b32b4c4..f0043f3 100644
--- a/src/gpg-error.h.in
+++ b/src/gpg-error.h.in
@@ -246,10 +246,40 @@ typedef unsigned int gpg_error_t;
# define GPGRT_HAVE_PRAGMA_GCC_PUSH 1
#endif
+/* Detect LeakSanitizer (LSan) support for GCC and Clang based on
+ * whether AddressSanitizer (ASAN) is enabled via -fsanitize=address).
+ * Note that -fsanitize=leak just affect the linker options which
+ * cannot be detected here. In that case you have to define the
+ * GPGRT_HAVE_LEAK_SANITIZER macro manually. */
+#ifdef __GNUC__
+# ifdef __SANITIZE_ADDRESS__
+# define GPGRT_HAVE_LEAK_SANITIZER
+# elif defined(__has_feature)
+# if __has_feature(address_sanitizer)
+# define GPGRT_HAVE_LEAK_SANITIZER
+# endif
+# endif
+#endif
+
/* The new name for the inline macro. */
#define GPGRT_INLINE GPG_ERR_INLINE
+#ifdef GPGRT_HAVE_LEAK_SANITIZER
+# include <sanitizer/lsan_interface.h>
+#endif
+
+/* Mark heap objects as non-leaked memory. */
+static GPGRT_INLINE void
+gpgrt_annotate_leaked_object (const void *p)
+{
+#ifdef GPGRT_HAVE_LEAK_SANITIZER
+ __lsan_ignore_object(p);
+#else
+ (void)p;
+#endif
+}
+
/* Initialization function. */
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
src/gpg-error.h.in | 30 ++++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
hooks/post-receive
--
Error codes used by GnuPG et al.
http://git.gnupg.org
More information about the Gnupg-commits
mailing list