Bug 10590 - Multi-byte storage/retrieval broken on little endian Power8
Multi-byte storage/retrieval broken on little endian Power8
Status: RESOLVED FIXED
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Other
unspecified
All All
: P5 major
: ---
Assigned To: Karolin Seeger
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-05 14:15 UTC by David Disseldorp
Modified: 2014-05-20 09:54 UTC (History)
1 user (show)

See Also:


Attachments
fix for master, proposed on samba-technical list (1.52 KB, patch)
2014-05-05 15:16 UTC, David Disseldorp
cs: review+
Details
fix for 4.1 branch, same as master (1.52 KB, patch)
2014-05-05 15:19 UTC, David Disseldorp
cs: review+
Details
fix for 4.0 branch, same as master (1.52 KB, patch)
2014-05-05 15:20 UTC, David Disseldorp
cs: review+
Details
fix for 4.0 branch, cherry-picked from master (without ccan include) (1.46 KB, patch)
2014-05-07 09:56 UTC, David Disseldorp
cs: review+
Details
fix for 4.1 branch, cherry-picked from master (without ccan include) (1.46 KB, patch)
2014-05-07 09:57 UTC, David Disseldorp
cs: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Disseldorp 2014-05-05 14:15:22 UTC
byteorder.h currently uses reverse-indexing ASM instructions for little endian multi-byte storage/retrieval on PowerPC. With Power8, this is an incorrect assumption, as it can be big or little endian.
Comment 1 David Disseldorp 2014-05-05 15:11:54 UTC
See https://www.power.org/wp-content/uploads/2013/05/PowerISA_V2.07_PUBLIC.pdf as a reference for the l[h/w]brx and st[h/w]brx instructions, in particular:

  These instructions have the effect of loading and
  storing data in the opposite byte ordering from that
  which would be used by other Load and Store
  instructions.
Comment 2 David Disseldorp 2014-05-05 15:16:12 UTC
Created attachment 9900 [details]
fix for master, proposed on samba-technical list
Comment 3 Volker Lendecke 2014-05-05 15:18:53 UTC
Hi, David!

How did you find this? Is there a remote chance we can run this somehow in
qemu/powerpc?

Volker
Comment 4 David Disseldorp 2014-05-05 15:19:41 UTC
Created attachment 9901 [details]
fix for 4.1 branch, same as master
Comment 5 David Disseldorp 2014-05-05 15:20:08 UTC
Created attachment 9902 [details]
fix for 4.0 branch, same as master
Comment 6 David Disseldorp 2014-05-05 15:24:19 UTC
Hi Volker,

(In reply to comment #3)
> Hi, David!
> 
> How did you find this? Is there a remote chance we can run this somehow in
> qemu/powerpc?

The issue was reported by IBM.
SUSE have a number of local Power8 and Power7 machines that I've used for testing. I don't know of whether this can be tested via an emulator.
Comment 7 Christof Schmitt 2014-05-05 21:08:35 UTC
Comment on attachment 9900 [details]
fix for master, proposed on samba-technical list

Looks good. You should remove the include since it is not required.
Comment 8 Christof Schmitt 2014-05-05 21:10:34 UTC
Comment on attachment 9901 [details]
fix for 4.1 branch, same as master

Same as on master patch, the include should not be necessary.
Comment 9 Christof Schmitt 2014-05-05 21:10:45 UTC
Comment on attachment 9902 [details]
fix for 4.0 branch, same as master

Same as on master patch, the include should not be necessary.
Comment 10 David Disseldorp 2014-05-07 09:56:41 UTC
Created attachment 9917 [details]
fix for 4.0 branch, cherry-picked from master (without ccan include)
Comment 11 David Disseldorp 2014-05-07 09:57:15 UTC
Created attachment 9918 [details]
fix for 4.1 branch, cherry-picked from master (without ccan include)
Comment 12 David Disseldorp 2014-05-07 20:27:09 UTC
@Karolin, please merge for 4.0 and 4.1. Thanks!
Comment 13 Karolin Seeger 2014-05-19 10:18:48 UTC
(In reply to comment #12)
> @Karolin, please merge for 4.0 and 4.1. Thanks!

Pushed to autobuild-v4-[0|1]-test.
Comment 14 Karolin Seeger 2014-05-20 09:54:37 UTC
(In reply to comment #13)
> (In reply to comment #12)
> > @Karolin, please merge for 4.0 and 4.1. Thanks!
> 
> Pushed to autobuild-v4-[0|1]-test.

Pushed to both branches.
Closing out bug report.

Thanks!