Eric Dumazet
9d76f72325
af_unix: fix races in sk_peer_pid and sk_peer_cred accesses
...
[ Upstream commit 35306eb23814444bd4021f8a1c3047d3cb0c8b2b ]
Jann Horn reported that SO_PEERCRED and SO_PEERGROUPS implementations
are racy, as af_unix can concurrently change sk_peer_pid and sk_peer_cred.
In order to fix this issue, this patch adds a new spinlock that needs
to be used whenever these fields are read or written.
Jann also pointed out that l2cap_sock_get_peer_pid_cb() is currently
reading sk->sk_peer_pid which makes no sense, as this field
is only possibly set by AF_UNIX sockets.
We will have to clean this in a separate patch.
This could be done by reverting b48596d1dc25 "Bluetooth: L2CAP: Add get_peer_pid callback"
or implementing what was truly expected.
Fixes: 109f6e39fa07 ("af_unix: Allow SO_PEERCRED to work across namespaces.")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Jann Horn <jannh@google.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Cc: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-10-06 15:05:09 +02:00
..
2021-08-15 13:03:30 +02:00
2021-06-10 12:43:51 +02:00
2017-11-02 11:10:55 +01:00
2020-09-09 19:03:08 +02:00
2019-06-17 19:52:44 +02:00
2021-06-03 08:36:11 +02:00
2019-03-23 14:35:16 +01:00
2021-08-04 12:22:15 +02:00
2019-05-04 09:15:20 +02:00
2020-06-03 08:17:33 +02:00
2020-08-21 09:48:00 +02:00
2017-08-29 10:55:20 +01:00
2021-08-04 12:22:14 +02:00
2019-08-04 09:31:59 +02:00
2017-11-02 11:10:55 +01:00
2019-06-11 12:21:51 +02:00
2017-11-02 11:10:55 +01:00
2019-02-23 09:06:44 +01:00
2020-12-08 10:17:33 +01:00
2021-08-04 12:22:14 +02:00
2021-06-03 08:36:13 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-08-31 14:42:19 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-09-05 11:53:34 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-07-28 11:12:16 +02:00
2020-01-04 14:00:14 +01:00
2020-07-22 09:22:20 +02:00
2017-08-22 14:29:30 -07:00
2017-11-02 11:10:55 +01:00
2017-09-01 20:33:42 -07:00
2020-03-20 10:54:10 +01:00
2017-11-02 11:10:55 +01:00
2020-03-11 18:02:48 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-11-10 11:25:37 +01:00
2019-11-10 11:25:37 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-07-22 09:22:19 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-03-03 18:22:57 +01:00
2018-04-29 11:33:13 +02:00
2017-08-07 11:39:22 -07:00
2017-11-02 11:10:55 +01:00
2020-08-21 09:48:14 +02:00
2020-12-11 13:39:03 +01:00
2019-04-27 09:35:40 +02:00
2020-01-04 14:00:19 +01:00
2018-10-18 09:16:21 +02:00
2018-05-16 10:10:24 +02:00
2019-02-23 09:06:42 +01:00
2019-06-11 12:21:47 +02:00
2021-07-28 11:12:15 +02:00
2019-07-21 09:04:28 +02:00
2019-01-31 08:13:42 +01:00
2017-11-02 11:10:55 +01:00
2020-08-21 09:48:08 +02:00
2020-10-29 09:06:58 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-09-16 08:20:44 +02:00
2020-05-20 08:17:02 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-02-06 17:31:33 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-11-06 12:43:36 +01:00
2021-08-04 12:22:17 +02:00
2019-11-20 17:59:59 +01:00
2017-11-02 11:10:55 +01:00
2018-05-30 07:51:58 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-01-09 10:17:59 +01:00
2019-04-17 08:37:50 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-05-16 10:10:23 +02:00
2017-08-29 15:16:52 -07:00
2017-11-02 11:10:55 +01:00
2017-11-09 10:03:09 +09:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-10-01 03:55:47 +01:00
2021-08-26 08:37:02 -04:00
2017-11-02 11:10:55 +01:00
2017-08-07 11:39:21 -07:00
2017-11-02 11:10:55 +01:00
2021-04-16 11:57:49 +02:00
2018-05-30 07:52:01 +02:00
2020-01-27 14:46:50 +01:00
2017-11-02 11:10:55 +01:00
2018-05-30 07:52:14 +02:00
2021-03-30 14:40:12 +02:00
2019-11-06 12:43:39 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-08-25 17:10:23 -07:00
2018-04-19 08:56:16 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2021-10-06 15:05:09 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-10-25 10:37:11 +09:00
2017-08-07 14:48:48 -07:00
2021-02-03 23:22:23 +01:00
2018-12-05 19:41:10 +01:00
2018-06-26 08:06:28 +08:00
2017-11-02 11:10:55 +01:00
2017-08-29 15:16:52 -07:00
2017-11-02 11:10:55 +01:00
2018-06-26 08:06:28 +08:00
2018-03-08 22:41:10 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-10-14 09:51:12 +02:00