Bug 1733967 - Peer authentication broken on ppc64le
Summary: Peer authentication broken on ppc64le
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: postgresql
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Patrik Novotný
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-29 11:04 UTC by Tom Hughes
Modified: 2019-07-31 12:18 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-07-31 12:18:28 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tom Hughes 2019-07-29 11:04:49 UTC
Description of problem:

Peer authentication appears to be broken in the latest ppc64le build for rawhide - all my builds which use postgres in their %check failed during the mass rebuild with:

createdb: could not connect to database template1: FATAL:  Peer authentication failed for user "mockbuild"

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

postgresql-11.4-1.fc31

How reproducible:

Reproduced in rawhide mock on ppc64le test machine.

Steps to Reproduce:
1. initdb $PWD/data -U $(id -un) --auth-local=peer --auth-host=md5
2. pg_ctl -D $PWD/data -l $PWD/data/start.log start -o '-k /tmp -p 58196' -w
3. createdb -h /tmp $(id -un) --owner $(id -un) -p 58196

Actual results:

createdb: could not connect to database template1: FATAL:  Peer authentication failed for user "mockbuild"

Expected results:

Database is created.

Additional info:

Comparing an strace of the server on ppc64le shows:

4761  recv(10, "\0\0\0D\0\3\0\0user\0mockbuild\0database\0"..., 8192, 0) = 68 
...

4761  getsockopt(10, SOL_SOCKET, SO_SNDLOWAT, [1], [12->4]) = 0 

while on x86_64 we see:

24657 recvfrom(9, "\0\0\0>\0\3\0\0user\0thh\0database\0postgr"..., 8192, 0, NULL, NULL) = 62 
...
24657 getsockopt(9, SOL_SOCKET, SO_PEERCRED, {pid=24656, uid=2067, gid=103}, [12]) = 0 

I'm not sure why ppc64le is using recv instead of recvfrom, but the big issue is that it uses the wrong socket option to get the peer credentials. I think because of this on ppc64le:

[tomh@ppc64le-test ~][PROD]$ fgrep SO_PEERCRED /usr/include/**/*.h
/usr/include/asm-generic/socket.h:#define SO_PEERCRED   17
/usr/include/asm/socket.h:#define SO_PEERCRED   21
[tomh@ppc64le-test ~][PROD]$ fgrep SO_SNDLOWAT /usr/include/**/*.h
/usr/include/asm-generic/socket.h:#define SO_SNDLOWAT   19
/usr/include/asm/socket.h:#define SO_SNDLOWAT   17

versus x86_64:

rawhide [~] % fgrep SO_PEERCRED /usr/include/**/*.h
/usr/include/asm-generic/socket.h:#define SO_PEERCRED    17
rawhide [~] % fgrep SO_SNDLOWAT /usr/include/**/*.h
/usr/include/asm-generic/socket.h:#define SO_SNDLOWAT    19 

So on ppc64le it has obviously used the generic value of SO_PEERCRED which actually matches the ppc64le specific value of SO_SNDLOWAT :-(

Comment 1 Tom Hughes 2019-07-29 11:05:31 UTC
Oh the previous build (postgresql-11.3-2.fc31) seems to have been fine as the same packages built OK against that.

Comment 2 Tom Hughes 2019-07-29 12:01:37 UTC
Per Florian on the devel list this was likely due to broken kernel-headers on ppc64le when postgresql-11.4-1.fc31 was built, and it should be fixed by the masss rebuild...

Comment 3 Tom Hughes 2019-07-31 12:18:28 UTC
I can confirm that the mass rebuild has fixed this.


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