AArch64 ILP32 strcmp bug

Kinsey Moore <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <BN6PR19MB3201EAC562D6CA9D01A2BD5A907B0@BN6PR19MB3201.namprd19.prod.outlook.com>
Hi,
It appears that the hand-coded assembly in AArch64 strcmp does not sanitize the incoming address parameters in x0 and x1 when compiled for AArch64 ILP32. Based on my reading of the AArch64 Procedure Call Specification and GCC's output for similar function signatures, the callee is responsible for sanitization of the pointer addresses. I encountered this because I have a struct containing a pointer and length returned from another function that happens to get packed into a single register (x0) and GCC passes this unmodified into strcmp as the first argument.

According to the aapcs64: "Any part of a register or a stack slot that is not used for an argument (padding bits) has unspecified content at the callee entry point."

I suspect this is a problem for the majority of hand-written AArch64 assembly in newlib.

Please let me know if I missed something.

Thanks,
Kinsey Moore
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.