Kuniyuki Iwashima
42f298c06b
af_unix: Link struct unix_edge when queuing skb.
...
Just before queuing skb with inflight fds, we call scm_stat_add(),
which is a good place to set up the preallocated struct unix_vertex
and struct unix_edge in UNIXCB(skb).fp.
Then, we call unix_add_edges() and construct the directed graph
as follows:
1. Set the inflight socket's unix_sock to unix_edge.predecessor.
2. Set the receiver's unix_sock to unix_edge.successor.
3. Set the preallocated vertex to inflight socket's unix_sock.vertex.
4. Link inflight socket's unix_vertex.entry to unix_unvisited_vertices.
5. Link unix_edge.vertex_entry to the inflight socket's unix_vertex.edges.
Let's say we pass the fd of AF_UNIX socket A to B and the fd of B
to C. The graph looks like this:
+-------------------------+
| unix_unvisited_vertices | <-------------------------.
+-------------------------+ |
+ |
| +--------------+ +--------------+ | +--------------+
| | unix_sock A | <---. .---> | unix_sock B | <-|-. .---> | unix_sock C |
| +--------------+ | | +--------------+ | | | +--------------+
| .-+ | vertex | | | .-+ | vertex | | | | | vertex |
| | +--------------+ | | | +--------------+ | | | +--------------+
| | | | | | | |
| | +--------------+ | | | +--------------+ | | |
| '-> | unix_vertex | | | '-> | unix_vertex | | | |
| +--------------+ | | +--------------+ | | |
`---> | entry | +---------> | entry | +-' | |
|--------------| | | |--------------| | |
| edges | <-. | | | edges | <-. | |
+--------------+ | | | +--------------+ | | |
| | | | | |
.----------------------' | | .----------------------' | |
| | | | | |
| +--------------+ | | | +--------------+ | |
| | unix_edge | | | | | unix_edge | | |
| +--------------+ | | | +--------------+ | |
`-> | vertex_entry | | | `-> | vertex_entry | | |
|--------------| | | |--------------| | |
| predecessor | +---' | | predecessor | +---' |
|--------------| | |--------------| |
| successor | +-----' | successor | +-----'
+--------------+ +--------------+
Henceforth, we denote such a graph as A -> B (-> C).
Now, we can express all inflight fd graphs that do not contain
embryo sockets. We will support the particular case later.
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Link: https://lore.kernel.org/r/20240325202425.60930-4-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-03-29 08:27:50 -07:00
..
2023-12-15 11:01:27 +00:00
2024-03-26 15:37:24 +01:00
2023-10-28 11:29:27 +01:00
2023-11-18 18:42:37 -08:00
2024-03-29 09:46:39 +00:00
2024-03-07 21:12:41 -08:00
2023-12-29 08:43:59 +00:00
2024-02-06 11:45:53 +01:00
2022-12-12 15:18:25 -08:00
2024-01-07 15:16:19 +00:00
2024-03-19 14:24:07 -07:00
2023-09-15 10:40:04 +01:00
2023-08-02 10:09:32 +01:00
2022-12-25 13:38:09 -08:00
2022-10-28 20:13:54 -07:00
2024-03-07 21:12:42 -08:00
2024-03-07 21:12:41 -08:00
2024-02-27 16:27:17 -07:00
2024-03-07 21:12:41 -08:00
2024-03-07 21:12:42 -08:00
2024-02-14 11:20:13 +00:00
2023-08-18 16:05:26 +02:00
2022-10-12 10:45:51 +02:00
2024-03-07 21:12:41 -08:00
2023-12-08 10:37:43 +00:00
2024-02-12 12:17:03 +00:00
2024-03-07 21:12:41 -08:00
2024-03-08 10:23:26 +00:00
2023-07-07 09:16:52 +01:00
2023-10-16 16:36:53 -07:00
2024-03-07 21:13:25 -08:00
2024-03-07 21:13:25 -08:00
2024-03-07 21:13:26 -08:00
2023-06-15 08:21:11 +01:00
2023-07-27 20:33:16 -07:00
2023-11-28 15:48:39 +01:00
2024-03-07 10:29:36 -08:00
2024-03-11 13:01:15 -07:00
2023-12-27 14:34:52 +00:00
2024-01-19 21:13:25 -08:00
2024-03-07 20:48:22 -08:00
2024-03-29 08:27:50 -07:00
2023-10-28 11:29:27 +01:00
2024-03-28 18:30:40 -07:00
2024-02-21 17:15:23 +01:00
2024-01-23 15:13:55 +01:00
2023-12-13 16:32:28 -08:00
2022-10-25 11:35:16 +02:00
2024-03-25 14:46:59 +00:00
2023-12-15 10:48:51 +00:00
2024-03-07 21:12:43 -08:00
2023-11-18 18:42:37 -08:00
2022-12-12 15:04:39 -08:00
2022-11-01 21:14:39 -07:00
2024-03-07 21:12:42 -08:00