OpenVPN
memdbg.h
Go to the documentation of this file.
1/*
2 * OpenVPN -- An application to securely tunnel IP networks
3 * over a single UDP port, with support for SSL/TLS-based
4 * session authentication and key exchange,
5 * packet encryption, packet authentication, and
6 * packet compression.
7 *
8 * Copyright (C) 2002-2026 OpenVPN Inc <sales@openvpn.net>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef MEMDBG_H
24#define MEMDBG_H
25
26/*
27 * Valgrind debugging support.
28 *
29 * Valgrind is a great tool for debugging memory issues,
30 * though it seems to generate a lot of warnings in OpenSSL
31 * about uninitialized data. To silence these warnings,
32 * I've put together a suppressions file
33 * in debug/valgrind-suppress.
34 *
35 * Also, grep for VALGRIND_MAKE_READABLE in the OpenVPN source.
36 * Because valgrind thinks that some of the data passed from
37 * OpenSSL back to OpenVPN is tainted due to being sourced
38 * from uninitialized data, we need to untaint it before use --
39 * otherwise we will get a lot of useless warnings.
40 *
41 * valgrind --tool=memcheck --error-limit=no --suppressions=debug/valgrind-suppress
42 * --gen-suppressions=yes ./openvpn ...
43 */
44
45#ifdef USE_VALGRIND
46#include <valgrind/memcheck.h>
47#endif
48
49#define VALGRIND_MAKE_READABLE(addr, len)
50
51/*
52 * Force buffers to be zeroed after allocation.
53 * For debugging only.
54 */
55/*#define ZERO_BUFFER_ON_ALLOC*/
56
57#endif /* MEMDBG_H */