Open Bug 1731102 Opened 4 years ago Updated 11 months ago

SM/arm64: infrastructure for SP/PSP assertion checking at call sites

Categories

(Core :: JavaScript Engine: JIT, enhancement, P3)

ARM64
All
enhancement

Tracking

()

People

(Reporter: jseward, Assigned: jseward)

References

(Blocks 2 open bugs)

Details

Attachments

(2 files, 1 obsolete file)

This bug serves as a placeholder for SP vs PSP assertion checking
infrastructure on SM/arm64:

  • check PSP == SP at most blr reg insns, implemented using a 5-insn sequence

  • check SP is 16-aligned at ditto

  • for debugging convenience, also add X16-based no-op markers at blr reg and
    ret (2 insns)

Currently bl simm26 cannot be similarly asserted, but such calls are rare.

The WIP patch mostly concerns itself with not breaking anything, given the
additional 5+2 insns before each call. The actual assertion sequence is
currently just 5 no-ops since SM currently violates both PSP == SP and
SP % 16 == 0 at call insns.

WIP patch, per comment 0. Do not commit.

Depends on: 1736009
Attachment #9241616 - Attachment is obsolete: true

Inserting assertion code directly (meaning, literally directly) after call
instructions causes breakage in various places that require knowing the
assembler buffer offset of the first byte after the call instruction itself,
that is, the return point. Typically such places find that offset by
consulting masm.currentOffset(), which implicitly assumes that no post-call
assertion code is present. This patch fixes that by making all
call-generating instructions return the offset of the return point. This has
only been done for arm64 and will need to be completed for all other targets;
it should be pretty simple to do that.

This patch adds a mechanism to add assertions immediately before and after
call instructions on arm64. This centers around a new enum class CallInvariants, which indicates the ABI to be used for each call instruction.
That is passed downwards to MacroAssembler-arm64.cpp, where it is used to
select the correct assertion code. Currently the assertions are just a
sequence of 5 no-ops, mainly to test that the offset-management machinery in
the first patch is working. Up-front annotating of all call-generating
assembler methods so as to specify such a tag is a big task. To provide an
incremental path for dealing with that, the relevant parameters to such
methods are defaulted to CallInvariants::Unset.

The patch also contains some "missing" AutoCreatedBy annotations that have
been helpful in debugging so far. They should be landed separately and before
either of these patches.

The patches are against 665740:8679a50bd45a (= autoland of 13 Oct 2021).

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: