diff options
| author | Michail Andreas Michalopoulos <mike.michalo@gmail.com> | 2026-10-20 16:00:30 +0200 |
|---|---|---|
| committer | John Johansen <john.johansen@canonical.com> | 2026-10-29 08:28:03 -0700 |
| commit | 4890a8b1a9df880dd188adb8b8e8fab107ad69d9 (patch) | |
| tree | 4bfc8b1ef5effdfec5ddec01a7e25ab5787b0f0b /scripts/Makefile.thinlto | |
| parent | 049760746597cfd054c181fe850531be3c1e7358 (diff) | |
| download | linux-4890a8b1a9df880dd188adb8b8e8fab107ad69d9.tar.gz linux-4890a8b1a9df880dd188adb8b8e8fab107ad69d9.zip | |
apparmor: check address length before reading AF_UNSPEC bind address
bind_map_addr() handles AF_UNSPEC on an IPv4 socket by reading
addr4->sin_addr.s_addr to check for INADDR_ANY. At that point the only
length check done is addrlen >= offsetofend(struct sockaddr, sa_family),
i.e. 2 bytes, while sin_addr sits at offset 4. move_addr_to_kernel()
copies only addrlen bytes into the on-stack sockaddr_storage, so a
bind() with a short AF_UNSPEC address makes AppArmor branch on bytes the
caller never supplied.
Depending on those bytes, a confined task gets -EAFNOSUPPORT instead of
the -EINVAL that inet_bind_sk() returns for the same request. Kernels
built with CONFIG_INIT_STACK_ALL_ZERO read zeroes and happen to behave
correctly.
Check the length first, as inet_bind_sk() does, and as the AF_INET6
case above already does for inet6_bind_sk().
Fixes: 89ac6aa752ec ("apparmor: push inet mediation into profile callbacks, and improve auditing")
Assisted-by: LLM
Signed-off-by: Michail Andreas Michalopoulos <mike.michalo@gmail.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
