lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 5 Mar 2007 12:22:44 -0800 (PST)
From:	Jim Chow <jchow@...are.com>
To:	netdev@...r.kernel.org
Subject: [PATCH/RFC] Use of uninitialized data in udp_recvmsg().

After inspection of some networking code, it seems there is a use of
uninitialized data in udp_recvmsg(),
linux-2.6.20.1/net/ipv4/udp.c:843, while testing msg->msg_flags (see
the backtrace below).  It looks like sys_recvfrom() is not
initializing msg.msg_flags and, along the path given below, msg_flags
is tested (at #0) without (necessarily) being written to.

A simple fix for this particular problem is given below.

Alternatively, udp_recvmsg() could be changed to initialize msg_flags
for its caller, since udp_recvmsg() (always? [*]) uses msg_flags as an
output argument.

In any case, I wanted to verify the bug with the networking gurus to see 
if they agree.

#0 udp_recvmsg (linux-2.6.20.1/net/ipv4/udp.c:843)
#1 sock_common_recvmsg (linux-2.6.20.1/net/core/sock.c:1617)
#2 sock_recvmsg (linux-2.6.20.1/net/socket.c:630)
#3 sys_recvfrom (linux-2.6.20.1/net/socket.c:1608)
#4 sys_socketcall (linux-2.6.20.1/net/socket.c:2007)
#5 syscall_call (linux-2.6.20.1/arch/i386/kernel/entry.S:0)

Index: linux-2.6.20.1/net/socket.c
===================================================================
--- linux-2.6.20.1.orig/net/socket.c
+++ linux-2.6.20.1/net/socket.c
@@ -1601,6 +1601,7 @@
        iov.iov_base = ubuf;
        msg.msg_name = address;
        msg.msg_namelen = MAX_SOCK_ADDR;
+       msg.msg_flags = 0;
        if (sock->file->f_flags & O_NONBLOCK)
                flags |= MSG_DONTWAIT;
        err = sock_recvmsg(sock, &msg, size, flags);


------

[*] Although do_sock_read() linux-2.6.20.1/net/socket.c:704, for one,
    seems to want to initialize msg_flags nonzero, so maybe not.

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ