This is an archive of the discontinued LLVM Phabricator instance.

[MSan] Fix calling pointers to varargs functions on SystemZ
ClosedPublic

Authored by iii on Feb 3 2023, 2:11 PM.

Details

Summary

VarArgSystemZHelper.visitCallBase() checks whether the callee has the
"use-soft-float" attribute, but if the callee is a function pointer, a
null pointer dereference happens.

Fix by checking this attribute on the current function. Alternatively,
one could try the callee first, but this is pointless, since one should
not be mixing hardfloat and softfloat code anyway.

Diff Detail

Event Timeline

iii created this revision.Feb 3 2023, 2:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2023, 2:11 PM
iii requested review of this revision.Feb 3 2023, 2:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2023, 2:11 PM
uweigand accepted this revision.Feb 6 2023, 9:24 AM

Fix by checking this attribute on the current function. Alternatively, one could try the callee first, but this is pointless, since one should not be mixing hardfloat and softfloat code anyway.

Agreed. If the current function is compiled for soft-float, it cannot use any FP registers and therefore could not set up arguments for a hard-float routine.

The patch LGTM.

This revision is now accepted and ready to land.Feb 6 2023, 9:24 AM
This revision was automatically updated to reflect the committed changes.