UBUNTU: SAUCE: apparmor4.0.0 [92/90]: fix address mapping for recvfrom

BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2061851

Receive message cases are failing with an EINVAL error this is due
to the address may not be available for the receive case, but being
indicated with an addrlen of 0 not a null addr.

From a mediation pov this is fine, the address just can not be used
as part of an acceptance criteria. However the address lookup is being
done during the setup and the consistency check is failing.

Since it isn't required don't do the address verification check at
all, and leave that to other parts of the kernel. Treat any bad
address as unavailable.

Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 3ba61903d684a84a4a028dc9a9e2b18cdc2a3e4e
https://git.launchpad.net/~apparmor-dev/ubuntu-kernel-next)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
This commit is contained in:
John Johansen
2024-04-16 08:07:14 -07:00
committed by Paolo Pisati
parent b7f2bbbe3b
commit 6f8f4acfbe
+1 -3
View File
@@ -103,14 +103,12 @@ static int map_addr(struct sockaddr *addr, int addrlen, u16 raw_port,
AA_BUG(!maddr);
maddr->addrtype = addrtype;
if (!addr) {
if (!addr || addrlen < offsetofend(struct sockaddr, sa_family)) {
maddr->addrp = NULL;
maddr->port = 0;
maddr->len = 0;
return 0;
}
if (addrlen < offsetofend(struct sockaddr, sa_family))
return -EINVAL;
/*
* its possibly to have sk->sk_family == PF_INET6 and