[igt-dev] [PATCH i-g-t] lib: Silence Valgrind warning in synce_fence_status

Chris Wilson chris at chris-wilson.co.uk
Thu Jun 27 14:06:35 UTC 2019


Quoting Tvrtko Ursulin (2019-06-27 14:59:10)
> 
> On 27/06/2019 14:06, Chris Wilson wrote:
> >> +       VG(VALGRIND_MAKE_MEM_DEFINED(&fence_info, sizeof(fence_info)));
> > 
> > More fun would be to
> > 
> > struct sync_fence_info fence_info = { .status = -ENOSYS };
> > 
> > So that valgrind knows it is initialised and we reliably report an error
> > if the kernel fails to fill in the struct.
> 
> ... sure, this is also okay. For me -ENOSYS is not strictly needed at 
> this level. It would be more of a unit test for the ioctl, not belonging 
> to the library helper, but it is also fine to inject some more explicit 
> trash so it can be caught even if there are no specific unit tests.
> 
> I don't also see a problem with Valgrind annotation. It doesn't hide 
> anything, nor does it sanitises. But yes, it is not needed if we go for 
> -ENOSYS trick.

That's all I was thinking, two birds one stone. I think it is a bonus if
we don't paper over the kernel randomly serving up garbage -- but at the
same time random failures are not the easiest to debug. But at least they
serve as canaries.
-Chris


More information about the igt-dev mailing list