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.
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.
Created attachment 9900 [details] fix for master, proposed on samba-technical list
Hi, David! How did you find this? Is there a remote chance we can run this somehow in qemu/powerpc? Volker
Created attachment 9901 [details] fix for 4.1 branch, same as master
Created attachment 9902 [details] fix for 4.0 branch, same as master
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 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 on attachment 9901 [details] fix for 4.1 branch, same as master Same as on master patch, the include should not be necessary.
Comment on attachment 9902 [details] fix for 4.0 branch, same as master Same as on master patch, the include should not be necessary.
Created attachment 9917 [details] fix for 4.0 branch, cherry-picked from master (without ccan include)
Created attachment 9918 [details] fix for 4.1 branch, cherry-picked from master (without ccan include)
@Karolin, please merge for 4.0 and 4.1. Thanks!
(In reply to comment #12) > @Karolin, please merge for 4.0 and 4.1. Thanks! Pushed to autobuild-v4-[0|1]-test.
(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!