Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8262726

AArch64: C1 StubAssembler::call_RT can corrupt stack

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b12
    • CPU:
      aarch64

      Backports

        Description

        StubAssembler::call_RT() has some code to shuffle arguments using the stack as temporary storage:

          // if there is any conflict use the stack
          if (arg1 == c_rarg2 || arg1 == c_rarg3 ||
              arg2 == c_rarg1 || arg2 == c_rarg3 ||
              arg3 == c_rarg1 || arg3 == c_rarg2) {
            stp(arg3, arg2, Address(pre(sp, 2 * wordSize)));
            stp(arg1, zr, Address(pre(sp, -2 * wordSize)));
            ldp(c_rarg1, zr, Address(post(sp, 2 * wordSize)));
            ldp(c_rarg3, c_rarg2, Address(post(sp, 2 * wordSize)));

        Unfortunately there's a typo: the first pre(sp, 2 * wordSize) should be pre(sp, -2 * wordSize) otherwise the pushes and pops are unbalanced.

        I think this was exposed by JDK-8259619 which fixed the conflict check but AFAIK it only causes a problem on the Valhalla lworld branch and is not used otherwise.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                ngasson Nick Gasson
                Reporter:
                ngasson Nick Gasson
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: