chiark / gitweb /
rtnl: recv_message - don't enforce sender uid
authorTom Gundersen <teg@jklm.no>
Mon, 29 Dec 2014 01:18:21 +0000 (02:18 +0100)
committerTom Gundersen <teg@jklm.no>
Mon, 29 Dec 2014 01:20:04 +0000 (02:20 +0100)
All we care about is that the kernel (pid==0) sent the message. Verifying the sender uid
seems to break when using userns.

Reported by Stéphane Graber.

src/libsystemd/sd-rtnl/rtnl-message.c

index 640c0ea93eadf34f451ef9ce3a492923ccef122f..36eb9f5b395d5837367b89a8400097061bf58de0 100644 (file)
@@ -1363,10 +1363,10 @@ static int socket_recv_message(int fd, struct iovec *iov, uint32_t *_group, bool
                         struct ucred *ucred = (void *)CMSG_DATA(cmsg);
 
                         /* from the kernel */
                         struct ucred *ucred = (void *)CMSG_DATA(cmsg);
 
                         /* from the kernel */
-                        if (ucred->uid == 0 && ucred->pid == 0)
+                        if (ucred->pid == 0)
                                 auth = true;
                         else
                                 auth = true;
                         else
-                                log_debug("rtnl: ignoring message from uid %u pid %u", ucred->uid, ucred->pid);
+                                log_debug("rtnl: ignoring message from pid %u", ucred->pid);
                 } else if (cmsg->cmsg_level == SOL_NETLINK &&
                            cmsg->cmsg_type == NETLINK_PKTINFO &&
                            cmsg->cmsg_len == CMSG_LEN(sizeof(struct nl_pktinfo))) {
                 } else if (cmsg->cmsg_level == SOL_NETLINK &&
                            cmsg->cmsg_type == NETLINK_PKTINFO &&
                            cmsg->cmsg_len == CMSG_LEN(sizeof(struct nl_pktinfo))) {