← Back to team overview

kernel-packages team mailing list archive

[Bug 1548414] Comment bridged from LTC Bugzilla

 

------- Comment From brueckner@xxxxxxxxxx 2016-02-26 10:59 EDT-------
Problem fix is now upstream:

commit 1b17cb796f5d40ffa239c6926385abd83a77a49b
Author: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
Date:   Fri Feb 19 15:29:05 2016 +0100

s390/fpu: signals vs. floating point control register
git commit 904818e2f229f3d94ec95f6932a6358c81e73d78
"s390/kernel: introduce fpu-internal.h with fpu helper functions"
introduced the fpregs_store / fp_regs_load helper. These function
fail to save and restore the floating pointer control registers.
The effect is that the FPC is not correctly handled on signal
delivery and signal return.
Cc: stable@xxxxxxxxxxxxxxx # 4.4
Signed-off-by: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1548414

Title:
  Floating-point exception handler receives empty Data-Exception Code in
  Floating Point Control register

Status in linux package in Ubuntu:
  Fix Committed
Status in linux source package in Xenial:
  Fix Committed

Bug description:
  == Comment: #0 - Alexander Efremkin <a.efremkin@xxxxxxxxxx> - 2016-02-17 12:18:14 ==
  With a C program sets FPE handler and triggers an FPE exception, it expects that machine-dependent context data, which is passed to the handler, will contain sensible values.

  In this scenario, however, FPC register was zero and contained no DXC
  (Data-Exception Code) indication:

  #include <stdio.h>
  #include <string.h>
  #include <signal.h>

  void trapFunction() {
     asm volatile ("lhi %r1,0\n\t"
                   "cit %r1,0,8\n\t");
  }

  static void sigFPE_handler(int signal, siginfo_t *info, void *context) {
     ucontext_t *uc = context;
     mcontext_t mc = uc->uc_mcontext;
     fpregset_t fpregs = mc.fpregs;
     unsigned int fpc = fpregs.fpc;

     printf("received signal!\n");
     printf("fpc: %08x\n", fpc );
  }

  int main() {
     struct sigaction action;
     memset(&action, '\0', sizeof(action));

     printf("registering signal handler\n");

     action.sa_flags |= SA_SIGINFO;
     action.sa_sigaction = sigFPE_handler;
     if (sigaction(SIGFPE, &action, NULL))
        printf("error calling sigaction\n");

     printf("firing trap\n");
     trapFunction();
     return 0;
  }

  This program prints "fpc: 00000000", but the expected output is "fpc:
  0000ff00"..

  The IBM Java team has encountered test failures around the use of trap
  instructions; Linux on z Distribution Test reproduced the issue on the
  following system:

  z13 LPAR
  Ubuntu 16.04
  Kernel 4.4.0-4-generic
  gcc (Ubuntu 5.3.1-8ubuntu2) 5.3.1 20160205
  libc6 2.21-0ubuntu5

  Also, similar issue has been found during test of SIMD (vector)
  instructions, FPC contents was also zero, whereas it expected at least
  an exception mask and vector-defined DXC.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1548414/+subscriptions