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 1261738 - xdrstdio_create buffers do not output encoded values on ppc
Summary: xdrstdio_create buffers do not output encoded values on ppc
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libtirpc
Version: 7.2
Hardware: ppc64
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Steve Dickson
QA Contact: Zhi Li
URL:
Whiteboard:
: 1585658 (view as bug list)
Depends On: 1261596
Blocks: TRACKER-bugs-affecting-libguestfs 1484996 1585558
TreeView+ depends on / blocked
 
Reported: 2015-09-10 05:52 UTC by Murphy Zhou
Modified: 2018-10-30 11:48 UTC (History)
8 users (show)

Fixed In Version: libtirpc-0.2.4-0.12.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1261596
Environment:
Last Closed: 2018-10-30 11:48:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Fix for STDIO (950 bytes, patch)
2018-02-15 00:53 UTC, Daniel Sands
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1609208 0 unspecified CLOSED broken for big endian arches 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHBA-2018:3312 0 None None None 2018-10-30 11:48:46 UTC

Internal Links: 1609208

Comment 2 Daniel Sands 2018-02-14 23:31:13 UTC
I have also encountered this bug.  It exists on PPC64.  The cause is that the xdr_putlong uses a long to store the converted value, then passes it to fwrite as a byte buffer.  Only the first 4 bytes are written, which is okay for a LE system after byteswapping, but writes all zeroes on BE systems.

in xdr_stdio.c:
115	xdrstdio_putlong(xdrs, lp)
116		XDR *xdrs;
117		const long *lp;
118	{
119		long mycopy = (long)htonl((u_int32_t)*lp);
120	
121		if (fwrite(&mycopy, sizeof(int32_t), 1, (FILE *)xdrs->x_private) != 1)
122			return (FALSE);
123		return (TRUE);
124	}

It seems incorrect to make "mycopy" a long instead of a u_int32_t, especially considering the result on BE systems.

Comment 3 Daniel Sands 2018-02-15 00:53:32 UTC
Created attachment 1396217 [details]
Fix for STDIO

Comment 4 Steve Dickson 2018-06-22 12:32:07 UTC
I'm not seeing this problem... 

ibm-p730-06-lp2$ arch
ppc64

ibm-p730-06-lp2$ rpm -q libtirpc-devel
libtirpc-devel-0.2.4-0.10.el7.ppc64

ibm-p730-06-lp2$ gcc -I/usr/include/tirpc reader.c -o reader-tirpc -ltirpc
ibm-p730-06-lp2$ gcc -I/usr/include/tirpc writer.c -o writer-tirpc -ltirpc

ibm-p730-06-lp2$ ./writer-tirpc | ./reader-tirpc
0 1 2 3 4 5 6 7 

ibm-p730-06-lp2$ ./writer | hexdump
0000000 0000 0000 0000 0000 0000 0000 0000 0001
0000010 0000 0000 0000 0002 0000 0000 0000 0003
0000020 0000 0000 0000 0004 0000 0000 0000 0005
0000030 0000 0000 0000 0006 0000 0000 0000 0007
0000040
ibm-p730-06-lp2$ ./writer-tirpc | hexdump
0000000 0000 0000 0000 0000 0000 0000 0000 0001
0000010 0000 0000 0000 0002 0000 0000 0000 0003
0000020 0000 0000 0000 0004 0000 0000 0000 0005
0000030 0000 0000 0000 0006 0000 0000 0000 0007
0000040

Comment 6 Daniel Sands 2018-06-22 20:44:54 UTC
Endianness makes the difference.  The code as is passes on LE systems, but fails on BE systems.

As explained above, it writes 4 bytes into an 8-byte temporary variable, then uses the pointer to the first 4 bytes in its write.  On LE systems, the first 4 bytes have the converted value.  On BE systems, the last 4 bytes have it and the first 4 are all zeroes.

Comment 7 Steve Dickson 2018-07-18 18:38:47 UTC
commit 145272c2b6d89a1c3a7de86a2cbef43880f1b61b
Author: Steve Dickson <steved>
Date:   Wed Jul 11 11:21:39 2018 -0400

    xdrstdio_create buffers do not output encoded values on ppc

Comment 9 Richard W.M. Jones 2018-07-24 15:55:10 UTC
*** Bug 1585658 has been marked as a duplicate of this bug. ***

Comment 10 Zhi Li 2018-07-25 02:53:00 UTC
Verified with libtirpc-0.2.4-0.12.el7.ppc64:
~~~~~
[root@xxx]# uname -m
ppc64
[root@xxx]# rpm -q libtirpc
libtirpc-0.2.4-0.10.el7.ppc64
[root@xxx]# ./writer | ./reader
0 1 2 3 4 5 6 7 
>>>> [root@xxx]# ./writer-tirpc  | ./reader-tirpc
2942232856 2942232856 2942232856 2942232856 2942232856 2942232856 2942232856 2942232856 
>>>> [root@xxx]# ./writer-tirpc-header  | ./reader-tirpc-header
2318854424 2318854424 2318854424 2318854424 2318854424 2318854424 2318854424 2318854424 
[root@ibm-p730-06-lp4 ~]# rpm -e --nodeps libtirpc
[root@ibm-p730-06-lp4 ~]# rpm -q libtirpc
package libtirpc is not installed

###############
update libtirpc
###############
[root@xxx]# yum install libtirpc-0.2.4-0.12.el7.ppc64.rpm
....
<snip>
Installed:
  libtirpc.ppc64 0:0.2.4-0.12.el7                                                                                                                                                        
Complete!
[root@xxx]# rpm -q libtirpc
libtirpc-0.2.4-0.12.el7.ppc64
[root@xxx]# ./writer | ./reader
0 1 2 3 4 5 6 7 
>>>> [root@xxx]# ./writer-tirpc  | ./reader-tirpc
0 1 2 3 4 5 6 7 
>>>> [root@xxx]# ./writer-tirpc-header  | ./reader-tirpc-header
0 1 2 3 4 5 6 7

Comment 11 Zhi Li 2018-07-25 02:53:50 UTC
Moving to VERIFIED according to comment #10.

Comment 13 errata-xmlrpc 2018-10-30 11:48:24 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, 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-2018:3312


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