Looking at __msan_test_shadow definition, we can see that it returns index of first poisioned (uninitialized) member of the argument.
For example consider :
int i[10]; printf("\nBefore init: %d",__msan_test_shadow(&i, sizeof(i))); i[0] = 7; printf("\nAfter init: %d",__msan_test_shadow(&i, sizeof(i)));
will give output:
Before init: 0 After init: 4
So to check for tls limit, I am initializing 801 size buffer till 800th value, and we can see that part which does not fit is considered fully initialized, i.e. instead of 800, __msan_test_shadow will return -1.
Please correct my understanding if its wrong, as I can see test fails on every arch except x86.