Bug 26232 - FAIL: support/tst-timespec for 32-bit targets
Summary: FAIL: support/tst-timespec for 32-bit targets
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: time (show other bugs)
Version: 2.32
: P2 normal
Target Milestone: 2.32
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-13 13:00 UTC by H.J. Lu
Modified: 2020-07-31 09:11 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2020-07-13 13:00:49 UTC
For 32-bit targets,

commit 04deeaa9ea74b0679dfc9d9155a37b6425f19a9f
Author: Lucas A. M. Magalhaes <lamm@linux.ibm.com>
Date:   Fri Jul 10 19:41:06 2020 -0300

    Fix time/tst-cpuclock1 intermitent failures

caused:

FAIL: support/tst-timespec

$ cat support/tst-timespec.out
Testing support_timespec_ns
Testing support_timespec_normalize
tst-timespec.c:301: numeric comparison failure
   left: 2147483647 (0x7fffffff); from: norm_cases[i].norm.tv_sec
  right: 2147483648 (0x80000000); from: result.tv_sec
tst-timespec.c:302: numeric comparison failure
   left: 999999999 (0x3b9ac9ff); from: norm_cases[i].norm.tv_nsec
  right: 0 (0x0); from: result.tv_nsec
tst-timespec.c:301: numeric comparison failure
   left: -2147483648 (0xffffffff80000000); from: norm_cases[i].norm.tv_sec
  right: -2147483649 (0xffffffff7fffffff); from: result.tv_sec
tst-timespec.c:302: numeric comparison failure
   left: -999999999 (0xffffffffc4653601); from: norm_cases[i].norm.tv_nsec
  right: 0 (0x0); from: result.tv_nsec
Testing support_timespec_check_in_range
Test case 0
Test case 1
Test case 2
Test case 3
Test case 4
Test case 5
Test case 6
Test case 7
Test case 8
Test case 9
Test case 10
Test case 11
Test case 12
Test case 13
Test case 14
Test case 15
Test case 16
Test case 17
Test case 18
Test case 19
Test case 20
error: 4 test failures
Comment 1 Andreas Schwab 2020-07-13 13:07:44 UTC
No failure on arm or ppc.
Comment 2 H.J. Lu 2020-07-13 13:13:18 UTC
It fails for i686 and x32 under x86-64 5.7.8 kernel.
Comment 3 H.J. Lu 2020-07-14 12:41:09 UTC
Fixed by

commit f896fc0f2bfc9f3f8df0563a7c99dcbf24bab655
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Jul 13 16:15:56 2020 -0700

    Correct timespec implementation [BZ #26232]
    
    commit 04deeaa9ea74b0679dfc9d9155a37b6425f19a9f
    Author: Lucas A. M. Magalhaes <lamm@linux.ibm.com>
    Date:   Fri Jul 10 19:41:06 2020 -0300
    
        Fix time/tst-cpuclock1 intermitent failures
    
    has 2 issues:
    
    1. It assumes time_t == long which is false on x32.
    2. tst-timespec.c is compiled without -fexcess-precision=standard which
    generates incorrect results on i686 in support_timespec_check_in_range:
    
      double ratio = (double)observed_norm / expected_norm;
      return (lower_bound <= ratio && ratio <= upper_bound);
    
    This patch does
    
    1. Compile tst-timespec.c with -fexcess-precision=standard.
    2. Replace long with time_t.
    3. Replace LONG_MIN and LONG_MAX with TYPE_MINIMUM (time_t) and
    TYPE_MAXIMUM (time_t).