Ok - I was wrong. The problem is that is_valid_for_client is too strict. And or'ing that with is_valid_for_valgrind is too loose. In the end, by trial and error, I came with a test that seems to work for Daikon.
First, I check the original is_mem_defined, if that fails, then we're done. If that passes, then check is_valid_for_client and is_valid_for_valgrind. If they are both zero then the address is bad, otherwise it's ok. Based on our tests, it looks like is_mem_defined does what I want, except it lets through references to user code pages. The two is_valid checks catch this case. So it seems I've fixed my problem - but I wonder if this technique makes sense to you? Thanks, Mark > -----Original Message----- > From: Mark Roberts [mailto:mar...@cs.washington.edu] > Sent: Tuesday, August 30, 2016 7:29 AM > To: 'Philippe Waroquiers' > Cc: 'valgrind-users@lists.sourceforge.net' > Subject: RE: [Valgrind-users] memcheck question > > Thank you, that is a big help. I do have a follow up question. When a > Valgrind client allocates memory that will be used as a shadow copy of the > user's data, I would guess that is not included in is_valid_for_client. As an > experiment, I ORd together the results of is_valid_for_cleint and > is_valid_for_valgrind and the results of running Daikon matched our previous > results - modulo now detecting reads from user space marked executable. > > Thanks, > Mark > > > > -----Original Message----- > > From: Philippe Waroquiers [mailto:philippe.waroqui...@skynet.be] > > Sent: Monday, August 29, 2016 1:52 PM > > To: Mark Roberts > > Cc: valgrind-users@lists.sourceforge.net > > Subject: Re: [Valgrind-users] memcheck question > > > > > > Checking the protection can be done with VG_(am_is_valid_for_client). > > This check is implemented by the address space manager, that maintains > > the address space segments and protections. > > ------------------------------------------------------------------------------ _______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users