Netlink receives say they came from the kernel
recvfrom and recvmsg on a netlink socket reported no sender address. GLib's network monitor converts the sender with g_socket_address_to_native to check it is the kernel (port id 0) before believing a message, and with nothing there it failed an assertion -- Epiphany, and anything else watching the network through GIO, aborted at start. Every message on a netlink socket here does come from the kernel, so that is what is reported: a sockaddr_nl with port id 0 and no groups, as getsockname already says. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
parent
4743df8c4a
commit
73dcea7496
1 changed files with 23 additions and 0 deletions
|
|
@ -596,6 +596,20 @@ SYSCALL_DEFINE(recvfrom)
|
||||||
cap = alen;
|
cap = alen;
|
||||||
if (cap > 0 && copy_to_user(uaddr, &sa, (uint64)cap) < 0)
|
if (cap > 0 && copy_to_user(uaddr, &sa, (uint64)cap) < 0)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
} else if (sock_domain(s) == AF_NETLINK) {
|
||||||
|
// Everything on a netlink socket here comes from the kernel: port id
|
||||||
|
// 0, no groups. GLib's network monitor checks exactly that before it
|
||||||
|
// believes a message, and with no address at all it hit an assertion
|
||||||
|
// and every GNOME program that watches the network aborted.
|
||||||
|
uint16 nl[6] = { AF_NETLINK, 0, 0, 0, 0, 0 };
|
||||||
|
alen = (int)sizeof(nl);
|
||||||
|
int cap = alen;
|
||||||
|
if (ulenp && get_user(cap, ulenp) < 0)
|
||||||
|
return -EFAULT;
|
||||||
|
if (cap > alen)
|
||||||
|
cap = alen;
|
||||||
|
if (cap > 0 && copy_to_user(uaddr, nl, (uint64)cap) < 0)
|
||||||
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ulenp && copy_to_user(ulenp, &alen, sizeof(alen)) < 0)
|
if (ulenp && copy_to_user(ulenp, &alen, sizeof(alen)) < 0)
|
||||||
|
|
@ -1185,6 +1199,15 @@ SYSCALL_DEFINE(recvmsg)
|
||||||
alen = m.msg_namelen;
|
alen = m.msg_namelen;
|
||||||
if (alen && copy_to_user((addr_t)m.msg_name, &sa, alen) < 0)
|
if (alen && copy_to_user((addr_t)m.msg_name, &sa, alen) < 0)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
} else if (sock_domain(s) == AF_NETLINK) {
|
||||||
|
// The kernel, as in recvfrom above.
|
||||||
|
uint16 nl[6] = { AF_NETLINK, 0, 0, 0, 0, 0 };
|
||||||
|
alen = (uint32)sizeof(nl);
|
||||||
|
if (alen > m.msg_namelen)
|
||||||
|
alen = m.msg_namelen;
|
||||||
|
if (alen && copy_to_user((addr_t)m.msg_name, nl, alen) < 0)
|
||||||
|
return -EFAULT;
|
||||||
|
alen = (uint32)sizeof(nl);
|
||||||
}
|
}
|
||||||
if (copy_to_user(umsg + __builtin_offsetof(struct msghdr, msg_namelen),
|
if (copy_to_user(umsg + __builtin_offsetof(struct msghdr, msg_namelen),
|
||||||
&alen, sizeof(alen)) < 0)
|
&alen, sizeof(alen)) < 0)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue