diff options
| author | Matthieu Buffet <matthieu@buffet.re> | 2025-10-27 20:07:26 +0100 |
|---|---|---|
| committer | Mickaël Salaün <mic@digikod.net> | 2025-12-26 20:38:56 +0100 |
| commit | e4d82cbce2258f454634307fdabf33aa46b61ab0 (patch) | |
| tree | deca7cd4c887f8672fde80d9f9821b2d44e02e63 /tools/lib/python | |
| parent | 552dbf47a85c3b0eea1d7984ce3794b8d9b20e94 (diff) | |
landlock: Fix TCP handling of short AF_UNSPEC addresses
current_check_access_socket() treats AF_UNSPEC addresses as
AF_INET ones, and only later adds special case handling to
allow connect(AF_UNSPEC), and on IPv4 sockets
bind(AF_UNSPEC+INADDR_ANY).
This would be fine except AF_UNSPEC addresses can be as
short as a bare AF_UNSPEC sa_family_t field, and nothing
more. The AF_INET code path incorrectly enforces a length of
sizeof(struct sockaddr_in) instead.
Move AF_UNSPEC edge case handling up inside the switch-case,
before the address is (potentially incorrectly) treated as
AF_INET.
Fixes: fff69fb03dde ("landlock: Support network rules with TCP bind and connect")
Signed-off-by: Matthieu Buffet <matthieu@buffet.re>
Link: https://lore.kernel.org/r/20251027190726.626244-4-matthieu@buffet.re
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
