RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1925204 - glibc: printf of long double with a value of 0 results in "nan" [rhel-7.9.z]
Summary: glibc: printf of long double with a value of 0 results in "nan" [rhel-7.9.z]
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: glibc
Version: 7.9
Hardware: x86_64
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: glibc team
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
: 1925306 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-02-04 15:19 UTC by Oran Agra
Modified: 2024-03-25 18:07 UTC (History)
26 users (show)

Fixed In Version: glibc-2.17-323.el7_9
Doc Type: Bug Fix
Doc Text:
Cause: The fix for CVE-2020-29573 resulted in a regression in the printf family of functions on i686 and x86_64 when printing zero in long double format. Consequence: The printf function would print "nan" for zero on i686 and x86_64. Fix: The logic to identify NaNs was updated to ensure that printf family of functions identify NaNs correctly. Result: The printf family of functions now print long double zero correctly.
Clone Of:
Environment:
Last Closed: 2021-02-08 15:37:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 5778071 0 None None None 2021-02-08 10:44:21 UTC
Red Hat Product Errata RHBA-2021:0439 0 None None None 2021-02-08 15:37:13 UTC

Description Oran Agra 2021-02-04 15:19:03 UTC
Description of problem:
After a certain upgrade printf of long double with a value of 0, produces "nan"
(printing non-long doubles, or long double with value other than 0 seem fine)


Version-Release number of selected component (if applicable):


How reproducible:
easily reproducible.

Steps to Reproduce:
$ cat ld2str.c
#include <stdio.h>
void main() {
    long double d = 0;
    printf("%Lg\r\n",d);
    printf("%Lf\r\n",d);
}

$ gcc ld2str.c 
$ ./a.out 

Actual results:
nan
nan

Expected results:
0
0.000000

Additional info:
printf("glibc version: %s\n", gnu_get_libc_version());
glibc version: 2.17

$ rpm -q glibc
glibc-2.17-322.el7_9.x86_64


This started failing Redis's CI yesterday (only on CentOS):
https://github.com/redis/redis/runs/1827018214?check_suite_focus=true
so i suppose it's some glibc update that was rolled out by someone.

Comment 3 Matthias Hensler 2021-02-04 22:33:07 UTC
This bug seems to trigger some serious issues.

In my case the glibc-update resulted in a lot of failures in an asterisk-installation where a lot of conditionchecks in the dialplan suddenly returned "nan" instead of "0".

I had to downgrade via "yum downgrade glibc glibc-common glibc-devel glibc-headers" to 0:2.17-317.el7.

Comment 4 Siddhesh Poyarekar 2021-02-05 02:10:16 UTC
*** Bug 1925306 has been marked as a duplicate of this bug. ***

Comment 7 Carlos O'Donell 2021-02-05 04:09:22 UTC
(In reply to Oran Agra from comment #0)
> This started failing Redis's CI yesterday (only on CentOS):
> https://github.com/redis/redis/runs/1827018214?check_suite_focus=true
> so i suppose it's some glibc update that was rolled out by someone.

Thank you very much for this report.

This is related to the fix for CVE-2020-29573, where we made a change with limited scope to correct the security defect.

We are working to correct this issue as quickly as we can. Thank you for your patience.

Comment 19 Florian Weimer 2021-02-05 15:47:35 UTC
I've edited the description to mention the correct expected results, given that %f does not remove trailing zeros after the decimal point:

 Expected results:
 0
-0
+0.000000

Comment 20 Sergey Kolosov 2021-02-05 16:07:43 UTC
Verified, the reproducer returns 0 and 0.000000.

Comment 28 errata-xmlrpc 2021-02-08 15:37:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (glibc bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:0439


Note You need to log in before you can comment on or make changes to this bug.