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 2091553 - glibc: Incorrect results of POWER9-optimized strncpy [rhel-8.7.0]
Summary: glibc: Incorrect results of POWER9-optimized strncpy [rhel-8.7.0]
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: glibc
Version: 8.7
Hardware: ppc64le
OS: All
Target Milestone: rc
: ---
Assignee: DJ Delorie
QA Contact: Martin Coufal
Depends On: 2091549
Blocks: 2094540
TreeView+ depends on / blocked
Reported: 2022-05-30 10:05 UTC by Florian Weimer
Modified: 2023-07-18 14:30 UTC (History)
13 users (show)

Fixed In Version: glibc-2.28-205.el8
Doc Type: Bug Fix
Doc Text:
.POWER9-optimized strncpy function no longer gives incorrect results Previously, the POWER9 strncpy function did not use the correct register as the source of the NUL bytes for padding. Consequently, the output buffer contained uninitialized register content instead of the NUL padding. With this update, the strncpy function has been fixed, and the end of the output buffer is now correctly padded with NUL bytes.
Clone Of: 2091549
: 2094540 (view as bug list)
Last Closed: 2022-11-08 10:43:12 UTC
Type: Bug
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1918719 1 None None None 2023-07-18 14:30:35 UTC
Red Hat Issue Tracker RHELPLAN-123641 0 None None None 2022-05-30 10:18:57 UTC
Red Hat Product Errata RHBA-2022:7684 0 None None None 2022-11-08 10:43:40 UTC
Sourceware 29197 0 P2 UNCONFIRMED __strncpy_power9() uses uninitialised register vs18 value for filling after \0 2022-05-30 10:08:27 UTC

Description Florian Weimer 2022-05-30 10:05:33 UTC
+++ This bug was initially created as a clone of Bug #2091549 +++

Zdenek Sojka reported that strncpy does not always clear the destination buffer. The upstream bug gives the following reproducer:

#include <string.h>
#include <stdlib.h>

#define N 3
char a[N];
char c[N];

main (void)
  __asm__ volatile ("xxspltib 18, 0xf":::"vs18");
  strncpy (c, a, N);
  for (unsigned i = 0; i < N; i++)
    if (c[i])
      abort ();
  return 0;

Comment 8 Matheus Castanho 2022-06-08 14:36:21 UTC
The fix has been applied upstream for glibc 2.36 and has been backported to all affected versions (glibc >= 2.33).

Commit for glibc 2.36:

Commit for glibc 2.33:

Comment 14 errata-xmlrpc 2022-11-08 10:43:12 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 and enhancement 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.


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