From: Gianni Tedesco Date: Fri, 20 Aug 2010 16:12:00 +0000 (+0100) Subject: xl: poison data objects in auto-generated destructors X-Git-Tag: 4.1.0-rc1~661 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=f69a68961f4e99444bb609893baa2f7e92c9d9d3;p=xen.git 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 Acked-by: Ian Campbell Signed-off-by: Ian Jackson --- 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 #include +#include #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()