Hey kcc,

That is indeed exactly what it sounds like (uninitializing memory), stupid 
me. I need __msan_poison, it seems. I will experiment with that. If it 
works as I suspect, this will make our refactoring much easier and safer.

Apologies for the question misfire, and many thanks!

Kind regards,
Nicolas

Am Mittwoch, 18. Juni 2014 10:29:21 UTC+2 schrieb kcc:
>
> Hi Nicolas. 
>
> This sounds more like msan: 
> https://code.google.com/p/memory-sanitizer/wiki/MemorySanitizer 
>
> --kcc 
>
> On Wed, Jun 18, 2014 at 11:05 AM, Nicolas Hillegeer 
> <[email protected] <javascript:>> wrote: 
> > Hi, I'm not sure if this is exactly the right place but some linkes on 
> the 
> > web told me that it was so here goes: 
> > 
> > At the neovim project (https://github.com/neovim/neovim) we're 
> refactoring 
> > the codebase and we've got a few hairy cases: 
> > 
> > - we'd like to replace strncpy with strlcpy. strncpy zero-fills the part 
> of 
> > the buffer after 
> > - we'd like to replace a growing array that memsets the extra memory to 
> 0 
> > with one that doesn't 
> > 
> > Most call-sites are safe to transform as-is, because the zero-filling 
> wasn't 
> > used, but some aren't. This could be 
> > because the memory region is used in some other function way up or down 
> the 
> > call-stack. It's very difficult to 
> > ascertain that a conversion is perfectly safe. 
> > 
> > This is where I thought that manually poisoning the memory that used to 
> be 
> > zero-filled would be a good idea. There 
> > is a snag however: when the poisoned memory is written to before it's 
> read, 
> > that's fine. Because that counts more or less 
> > as initializing. Yet if the poisoned memory is first read, then it 
> should 
> > abort. 
> > 
> > I searched and found the Address Sanitizer manual poisoning wiki page: 
> > https://code.google.com/p/address-sanitizer/wiki/ManualPoisoning 
> > 
> > But at first glance, it doesn't seem like it could do 
> > read-until-write-poisoning. Is what I want doable? If not with ASan, 
> perhaps 
> > with 
> > some other tool or with ASan in the future? 
> > 
> > Kind regards, 
> > Nicolas 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "address-sanitizer" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to [email protected] <javascript:>. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to