frexpl math library function is showing wrong output when value slightly smaller than a power of two is passed

Bug #1333506 reported by Adam Conrad
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
eglibc (Ubuntu)
Invalid
Undecided
Unassigned
Trusty
New
Undecided
Adam Conrad
glibc (Ubuntu)
Fix Released
Undecided
Adam Conrad
Trusty
Invalid
Undecided
Unassigned

Bug Description

Description:
============
Install a Power 8 machine with Ubuntu LE guest VM.
Then compile and execute the below test case code.

root@ubuntu:~# cat frexpl_example.c
#include <stdio.h>
#include <math.h>

int main(void)
{
  union { long double ld; double d[2]; int i[4]; long long l[2]; } x;
  int expon;

  x.d[0] = 0x1p0;
  x.d[1] = -0x1p-106;
  printf ("%La %13a %13a 0x%16llx 0x%16llx\n",
          x.ld, x.d[0], x.d[1], x.l[0], x.l[1]);
  x.ld = frexpl (x.ld, &expon);
  printf ("%La %13a %13a 0x%16llx 0x%16llx\n",
          x.ld, x.d[0], x.d[1], x.l[0], x.l[1]);
  printf ("expon = %d\n", expon);
  return 0;
}

root@ubuntu:~# gcc frexpl_example.c -lm
root@ubuntu:~# ./a.out
0x1.ffffffffffffffffffffffffff8p-1 0x1p+0 -0x1p-106 0x3ff0000000000000 0xb950000000000000
0x1.ffffffffffffffffffffffffff8p-2 0x1p-1 -0x1p-107 0x3fe0000000000000 0xb940000000000000
expon = 1

root@ubuntu:~# uname -a
Linux ubuntu 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:09:21 UTC 2014 ppc64le ppc64le ppc64le GNU/Linux
root@ubuntu:~#

root@ubuntu:~# dpkg --list | grep libc6
ii libc6:ppc64el 2.19-0ubuntu6 ppc64el Embedded GNU C Library: Shared libraries
ii libc6-dbg:ppc64el 2.19-0ubuntu6 ppc64el Embedded GNU C Library: detached debugging symbols
ii libc6-dev:ppc64el 2.19-0ubuntu6 ppc64el Embedded GNU C Library: Development Libraries and Header Files
root@ubuntu:~#

The fix is available at the upstream commit: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=aa5f0ff11ad2cc85277c64cf65c723a9664e1149

Tags: ppc64el

CVE References

Adam Conrad (adconrad)
Changed in eglibc (Ubuntu):
status: New → Invalid
Changed in glibc (Ubuntu Trusty):
status: New → Invalid
Adam Conrad (adconrad)
tags: added: ppc64el
Adam Conrad (adconrad)
Changed in eglibc (Ubuntu Trusty):
assignee: nobody → Adam Conrad (adconrad)
Changed in glibc (Ubuntu):
assignee: nobody → Adam Conrad (adconrad)
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (6.6 KiB)

This bug was fixed in the package glibc - 2.19-4ubuntu1

---------------
glibc (2.19-4ubuntu1) utopic; urgency=medium

  * Merge with Debian unstable, switching us to glibc and fixing bugs:
    - Fix invalid fd reuse while sending DNS queries (LP: #1328975)
    - Avoid Freescale 8xx dcbz workaround on ppc64el (LP: #1333499)
    - Remove wrong ibm long double assembly routines (LP: #1294588)
    - Fix incorrect frexpl results with long doubles (LP: #1333506)
  * debian/patches/powerpc/local-tune-power8.diff: When configured for
    --with-cpu=power7, adjust -mtune for power8 instead (LP: #1333524)

glibc (2.19-4) unstable; urgency=medium

  [ Aurelien Jarno ]
  * debian/debhelper.in/libc.{preinst,postrm,postinst}: correctly remove
    old ld.so configuration if more than one libc6 package is installed
    (multiarch case). Closes: #752389, #752404.

  [ Samuel Thibault ]
  * patches/hurd-i386/tg-tls-threadvar.diff: Update to fix gcc-4.9 build.

  [ Adam Conrad ]
  * debian/control.in/main: glibc-source Conflics/Replaces eglibc-source.
  * debian/patches/powerpc/local-powerpc8xx-dcbz.diff: Restrict the trap
    to 32-bit builds, since the Freescale 8xx CPUs aren't 64-bit capable.

glibc (2.19-3experimental0) experimental; urgency=medium

  [ Aurelien Jarno]
  * Switch back to glibc sources:
    - debian/control.in/*: replace eglibc by glibc, update descriptions.
    - rename debian/debhelper.in/eglibc-source.install into
      glibc-source.install.
    - rename debian/debhelper.in/eglibc-source.lintian-overrides into
      glibc-source.lintian-overrides.
    - rename debian/eglibc-source.filelist into glibc-source.filelist
    - debian/copyright: update.
    - debian/rules, debian/rules.d/*: replace eglibc by glibc.
    - source/lintian-overrides: replace eglibc by glibc.
    - debian/sysdeps/*: replace eglibc by glibc.
    - debian/po/*: update using debconf-updatepo.
    - debian/rules.d/tarball.mk: rewrite to generate the orig tarball and
      to fetch the branch updates through git.
    - patches/any/submitted-nl_langinfo-static.diff: refresh.
    - patches/any/submitted-ldsodefs_rtld_debug.diff: drop.
    - patches/any/local-dynamic-resolvconf.diff: new patch from the eglibc
      tree to dynamically take into account changes in resolv.conf.
    - patches/powerpc/local-powerpc8xx-dcbz.diff: new patch from the eglibc
      tree to workaround dcbz issues on PowerPC 8XX CPUs.
    - patches/sh4/local-fpscr_values.diff: new patch from eglibc tree to
      export the ___fpscr_values symbol on SH4.
    - patches/any/local-libpic.diff: new patch from eglibc tree to install
      *_pic.a files.
    - patches/any/local-bootstrap-headers.diff: new patch from eglibc tree
      to ease header installation when bootstrapping.

eglibc (2.19-3) unstable; urgency=medium

  [ Aurelien Jarno ]
  * debian/control.in/libc: fix libtirpc1 breaks. Closes: #751852.
  * debian/rules.d/build.mk: generate ld.so configuration file using
    DEB_HOST_MULTIARCH instead of DEB_HOST_GNU_TYPE to have a stable
    path even when the GNU triplet change.
  * debian/debhelper.in/libc.{preinst,postrm,postinst}: remove old
    ld.so configuration file on hurd-i386, i386 and k...

Read more...

Changed in glibc (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.