Bug 27511 - S390 memmove assumes Vector Facility when MIE Facility 3 is present
Summary: S390 memmove assumes Vector Facility when MIE Facility 3 is present
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.32
: P2 normal
Target Milestone: 2.34
Assignee: Stefan Liebler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-04 15:06 UTC by Ian
Modified: 2021-03-26 10:44 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2021-03-23 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ian 2021-03-04 15:06:19 UTC
glibc-2.32\sysdeps\s390\memmove.c contains:-

s390_libc_ifunc_expr (__redirect_memmove, memmove,
          ({
      s390_libc_ifunc_expr_stfle_init ();
      (HAVE_MEMMOVE_ARCH13
       && S390_IS_ARCH13_MIE3 (stfle_bits))
        ? MEMMOVE_ARCH13
        : (HAVE_MEMMOVE_Z13 && (hwcap & HWCAP_S390_VX))
        ? MEMMOVE_Z13
        : MEMMOVE_DEFAULT;
          })
          )

If S390_IS_ARCH13_MIE3 is on (i.e. Miscellaneous-Instruction-Extensions Facility 3 is installed) the function MEMMOVE_ARCH13 is called, which contains Vector Facility instructions. As the Vector Facility is optional, MEMMOVE_ARCH13 abends with an Operation Exception.

The problem could be avoided if the code was changed to:

s390_libc_ifunc_expr (__redirect_memmove, memmove,
          ({
      s390_libc_ifunc_expr_stfle_init ();
      (HAVE_MEMMOVE_ARCH13 && (hwcap & HWCAP_S390_VX)
       && S390_IS_ARCH13_MIE3 (stfle_bits))
        ? MEMMOVE_ARCH13
        : (HAVE_MEMMOVE_Z13 && (hwcap & HWCAP_S390_VX))
        ? MEMMOVE_Z13
        : MEMMOVE_DEFAULT;
          })
          )
Comment 1 Stefan Liebler 2021-03-23 16:41:34 UTC
Thanks Ian,

you are right, if vector support is not present, this leads to an exception.
This is e.g. observable if you are booting with "novx" kernel-parameter on a z15 or if you e.g. running on a zVM guest with an older zVM which has no support for vector registers. I think some valgrind versions are also disabling the vector HWCAPs, but not the stfle bits.

Which environment / distro are you using which leads to this exception?

I've just posted this patch:
[PATCH] S390: Also check vector support in memmove ifunc-selector [BZ #27511]
https://sourceware.org/pipermail/libc-alpha/2021-March/124311.html
Comment 2 Ian 2021-03-23 18:51:55 UTC
I discovered the problem using Fedora 33 s390x under Hercules (the S390 emulator). Hercules does not support Vector, but recently started supporting MIE3, whereupon the problem surfaced. However, as Vector is still optional even on a z15 (though possibly not for much longer) someone somewhere might experience the problem on real hardware.
Comment 3 Stefan Liebler 2021-03-26 10:44:03 UTC
Committed to master:
"S390: Also check vector support in memmove ifunc-selector [BZ #27511]"
https://sourceware.org/git/?p=glibc.git;a=commit;h=7759be2593b689cb1eafc0f52ee7f59c639e5d2f

and to the release branches 2.30 - 2.33