[KMSAN] Enable on SystemZ
Enable -fsanitize=kernel-memory support in Clang. The x86_64 ABI requires that shadow_origin_ptr_t must be returned via a register pair, and the s390x ABI requires that it must be returned via memory pointed to by a hidden parameter. Normally Clang takes care of the ABI, but the sanitizers run long after it, so unfortunately they have to duplicate the ABI logic. Therefore add a special case for SystemZ and manually emit the s390x-ABI-compliant calling sequences. Since it's only 2 architectures, do not create a VarArgHelper-like abstraction layer. The kernel functions are compiled with the "packed-stack" and "use-soft-float" attributes. For the "packed-stack" functions, it's not correct for copyRegSaveArea() to copy 160 bytes of shadow and origins, since the save area is dynamically sized. Things are greatly simplified by the fact that the vararg "use-soft-float" functions use precisely 56 bytes in order to save the argument registers to where va_arg() can find them. Make copyRegSaveArea() copy only 56 bytes in the "use-soft-float" case. The "packed-stack" && !"use-soft-float" case has no practical uses at the moment, so leave it for the future. Add tests. Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D148596
Loading
Please sign in to comment