WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH]: xl: poison data objects in auto-generated destr

To: "Gianni Tedesco (3P)" <gianni.tedesco@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH]: xl: poison data objects in auto-generated destructors
From: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>
Date: Fri, 20 Aug 2010 16:05:59 +0100
Cc: Xen Devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Fri, 20 Aug 2010 08:41:36 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1282315791.3731.60.camel@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Citrix Systems, Inc.
References: <1282315791.3731.60.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Fri, 2010-08-20 at 15:49 +0100, Gianni Tedesco (3P) wrote:
> Increase the probability of blowing up badly up during any
> use-after-destroy scenarios.
> 
> Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>

I'd suggest perhaps only for debug=y builds but we don't seem to
propagate that concept into tools/ and it's probably not worth it
anyhow.

So:

Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>


> diff -r f68726cdf357 tools/libxl/gentypes.py
> --- a/tools/libxl/gentypes.py Thu Aug 19 18:24:12 2010 +0100
> +++ b/tools/libxl/gentypes.py Fri Aug 20 15:51:35 2010 +0100
> @@ -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()
> 
> 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel