diff options
author | Gianni Tedesco <gianni.tedesco@citrix.com> | 2010-08-20 17:12:00 +0100 |
---|---|---|
committer | Gianni Tedesco <gianni.tedesco@citrix.com> | 2010-08-20 17:12:00 +0100 |
commit | f69a68961f4e99444bb609893baa2f7e92c9d9d3 (patch) | |
tree | 99d166baa4a829cbfd88b4ee922c4de3b105ee86 /tools/libxl/gentypes.py | |
parent | 603b00dba7e1c5d5f0975af35578a9792cd105cb (diff) | |
download | xen-f69a68961f4e99444bb609893baa2f7e92c9d9d3.tar.gz xen-f69a68961f4e99444bb609893baa2f7e92c9d9d3.tar.bz2 xen-f69a68961f4e99444bb609893baa2f7e92c9d9d3.zip |
xl: poison data objects in auto-generated destructors
Increase the probability of blowing up badly up during any
use-after-destroy scenarios.
Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/gentypes.py')
-rw-r--r-- | tools/libxl/gentypes.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py index 175fae3e3c..52cbf1f25b 100644 --- a/tools/libxl/gentypes.py +++ b/tools/libxl/gentypes.py @@ -145,15 +145,19 @@ if __name__ == '__main__': #include <stdint.h> #include <stdlib.h> +#include <string.h> #include "libxl.h" +#define LIBXL_DTOR_POISON 0xa5 + """ % " ".join(sys.argv)) for ty in [t for t in types if t.destructor_fn is not None and t.autogenerate_destructor]: f.write("void %s(%s *p)\n" % (ty.destructor_fn, ty.typename)) f.write("{\n") f.write(libxl_C_type_destroy(ty, "p", True)) + f.write("\tmemset(p, LIBXL_DTOR_POISON, sizeof(*p));\n") f.write("}\n") f.write("\n") f.close() |