[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <426367E2313C2449837CD2DE46E7EAF90710DEB1@SN2PRD0310MB382.namprd03.prod.outlook.com>
Date: Thu, 7 Jun 2012 12:38:33 +0000
From: KY Srinivasan <kys@...rosoft.com>
To: Marcus Meissner <meissner@...e.de>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"dan.carpenter@...cle.com" <dan.carpenter@...cle.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
"jkosina@...e.cz" <jkosina@...e.cz>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"stable@...nel.org" <stable@...nel.org>
CC: Sebastian Krahmer <krahmer@...e.de>, Olaf Hering <ohering@...e.de>
Subject: RE: [PATCH] tools/hv: Check the source of netlink messages to be
the kernel
> -----Original Message-----
> From: Marcus Meissner [mailto:meissner@...e.de]
> Sent: Thursday, June 07, 2012 5:08 AM
> To: gregkh@...uxfoundation.org; KY Srinivasan; dan.carpenter@...cle.com;
> Haiyang Zhang; jkosina@...e.cz; linux-kernel@...r.kernel.org;
> stable@...nel.org
> Cc: Marcus Meissner; Sebastian Krahmer; Olaf Hering
> Subject: [PATCH] tools/hv: Check the source of netlink messages to be the kernel
>
> Hi,
>
> The hyper-v userspace helper daemon receives and handles netlink
> messages. It assumes them to be from the kernel, but does not check
> that.
>
> This patch adds this checking (nl_pid == 0).
>
> CVE-2012-2669
>
> Ciao, Marcus
>
> Signed-off-by: Marcus Meissner <meissner@...e.de>
> Signed-off-by: Sebastian Krahmer <krahmer@...e.de>
> Signed-off-by: Olaf Hering <ohering@...e.de>
Olaf already posted this patch and I signed off on it.
Regards,
K. Y
> ---
> tools/hv/hv_kvp_daemon.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
> index 146fd61..f0566c8 100644
> --- a/tools/hv/hv_kvp_daemon.c
> +++ b/tools/hv/hv_kvp_daemon.c
> @@ -701,14 +701,16 @@ int main(void)
> pfd.fd = fd;
>
> while (1) {
> + struct sockaddr *addr_p = (struct sockaddr *) &addr;
> + socklen_t addr_l = sizeof(addr);
> pfd.events = POLLIN;
> pfd.revents = 0;
> poll(&pfd, 1, -1);
>
> - len = recv(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0);
> + len = recvfrom(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0,
> addr_p, &addr_l);
>
> - if (len < 0) {
> - syslog(LOG_ERR, "recv failed; error:%d", len);
> + if (len < 0 || addr.nl_pid) {
> + syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s",
> addr.nl_pid, errno, strerror(errno));
> close(fd);
> return -1;
> }
> --
> 1.7.9.2
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists