bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH hurd 2/2] libshouldbeinlibc: add safe port handling macros


From: Samuel Thibault
Subject: Re: [PATCH hurd 2/2] libshouldbeinlibc: add safe port handling macros
Date: Sun, 5 Jun 2016 23:12:13 +0200
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Ludovic Courtès, on Sun 05 Jun 2016 21:53:35 +0200, wrote:
> Justus Winter <justus@gnupg.org> skribis:
> > +#define Mach_port_check(NAME)                                           \
> > +  void _Mach_port_check_##NAME(char *_unused[] __attribute__ ((unused))) \
> > +  {                                                                     \
> > +  if (MACH_PORT_VALID (NAME))                                           \
> > +    __print_fail_backtrace (#NAME " leaked",                            \
> > +                            __FILE__, __LINE__, "Port leak detector");  \
> > +  }                                                                     \
> > +  char _Mach_port_check_x_##NAME[0]                                     \
> > +  __attribute__ ((unused, cleanup (_Mach_port_check_##NAME)))
> 
> I think writing a GCC plug-in that would automatically add a cleanup
> handler to automatic variables of type ‘mach_port_t’ wouldn’t be
> unreasonable.

I don't enough to be sure, but isn't that the typical work of
LocalitySanitizer, precisely?

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]