08 Aug, 2013

1 commit


21 Jun, 2013

1 commit


07 Jun, 2013

1 commit

  • I broke them in this commit:

    commit 1be374a0518a288147c6a7398792583200a67261
    Author: Andy Lutomirski
    Date: Wed May 22 14:07:44 2013 -0700

    net: Block MSG_CMSG_COMPAT in send(m)msg and recv(m)msg

    This patch adds __sys_sendmsg and __sys_sendmsg as common helpers that accept
    MSG_CMSG_COMPAT and blocks MSG_CMSG_COMPAT at the syscall entrypoints. It
    also reverts some unnecessary checks in sys_socketcall.

    Apparently I was suffering from underscore blindness the first time around.

    Signed-off-by: Andy Lutomirski
    Tested-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Andy Lutomirski
     

20 May, 2013

1 commit

  • ERROR: "memcpy_fromiovec" [drivers/vhost/vhost_scsi.ko] undefined!

    That function is only present with CONFIG_NET. Turns out that
    crypto/algif_skcipher.c also uses that outside net, but it actually
    needs sockets anyway.

    In addition, commit 6d4f0139d642c45411a47879325891ce2a7c164a added
    CONFIG_NET dependency to CONFIG_VMCI for memcpy_toiovec, so hoist
    that function and revert that commit too.

    socket.h already includes uio.h, so no callers need updating; trying
    only broke things fo x86_64 randconfig (thanks Fengguang!).

    Reported-by: Randy Dunlap
    Acked-by: David S. Miller
    Acked-by: Michael S. Tsirkin
    Signed-off-by: Rusty Russell

    Rusty Russell
     

11 Mar, 2013

1 commit

  • Some LLCP services (e.g. the validation ones) require some control over
    the LLCP link parameters like the receive window (RW) or the MIU extension
    (MIUX). This can only be done through socket options.

    Signed-off-by: Samuel Ortiz

    Samuel Ortiz
     

11 Feb, 2013

1 commit

  • VM Sockets allows communication between virtual machines and the hypervisor.
    User level applications both in a virtual machine and on the host can use the
    VM Sockets API, which facilitates fast and efficient communication between
    guest virtual machines and their host. A socket address family, designed to be
    compatible with UDP and TCP at the interface level, is provided.

    Today, VM Sockets is used by various VMware Tools components inside the guest
    for zero-config, network-less access to VMware host services. In addition to
    this, VMware's users are using VM Sockets for various applications, where
    network access of the virtual machine is restricted or non-existent. Examples
    of this are VMs communicating with device proxies for proprietary hardware
    running as host applications and automated testing of applications running
    within virtual machines.

    The VMware VM Sockets are similar to other socket types, like Berkeley UNIX
    socket interface. The VM Sockets module supports both connection-oriented
    stream sockets like TCP, and connectionless datagram sockets like UDP. The VM
    Sockets protocol family is defined as "AF_VSOCK" and the socket operations
    split for SOCK_DGRAM and SOCK_STREAM.

    For additional information about the use of VM Sockets, please refer to the
    VM Sockets Programming Guide available at:

    https://www.vmware.com/support/developer/vmci-sdk/

    Signed-off-by: George Zhang
    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Andy king
    Signed-off-by: David S. Miller

    Andy King
     

13 Oct, 2012

1 commit


20 Jul, 2012

1 commit

  • sendmsg() (or sendto()) with MSG_FASTOPEN is a combo of connect(2)
    and write(2). The application should replace connect() with it to
    send data in the opening SYN packet.

    For blocking socket, sendmsg() blocks until all the data are buffered
    locally and the handshake is completed like connect() call. It
    returns similar errno like connect() if the TCP handshake fails.

    For non-blocking socket, it returns the number of bytes queued (and
    transmitted in the SYN-data packet) if cookie is available. If cookie
    is not available, it transmits a data-less SYN packet with Fast Open
    cookie request option and returns -EINPROGRESS like connect().

    Using MSG_FASTOPEN on connecting or connected socket will result in
    simlar errno like repeating connect() calls. Therefore the application
    should only use this flag on new sockets.

    The buffer size of sendmsg() is independent of the MSS of the connection.

    Signed-off-by: Yuchung Cheng
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Yuchung Cheng
     

16 Apr, 2012

1 commit


06 Apr, 2012

1 commit

  • commit 2f533844242 (tcp: allow splice() to build full TSO packets) added
    a regression for splice() calls using SPLICE_F_MORE.

    We need to call tcp_flush() at the end of the last page processed in
    tcp_sendpages(), or else transmits can be deferred and future sends
    stall.

    Add a new internal flag, MSG_SENDPAGE_NOTLAST, acting like MSG_MORE, but
    with different semantic.

    For all sendpage() providers, its a transparent change. Only
    sock_sendpage() and tcp_sendpages() can differentiate the two different
    flags provided by pipe_to_sendpage()

    Reported-by: Tom Herbert
    Cc: Nandita Dukkipati
    Cc: Neal Cardwell
    Cc: Tom Herbert
    Cc: Yuchung Cheng
    Cc: H.K. Jerry Chu
    Cc: Maciej Żenczykowski
    Cc: Mahesh Bandewar
    Cc: Ilpo Järvinen
    Signed-off-by: Eric Dumazet com>
    Signed-off-by: David S. Miller

    Eric Dumazet
     

12 Mar, 2012

1 commit

  • The following 4 functions:
    move_addr_to_kernel
    move_addr_to_user
    verify_iovec
    verify_compat_iovec
    are always effectively called with a sockaddr_storage.

    Make this explicit by changing their signature.

    This removes a large number of casts from sockaddr_storage to sockaddr.

    Signed-off-by: Maciej Żenczykowski
    Signed-off-by: David S. Miller

    Maciej Żenczykowski
     

08 Aug, 2011

1 commit

  • Currently userland will barf when including linux/netlink.h unless it
    precisely includes sys/socket.h first. The issue is where the
    definition of "sa_family_t" comes from.

    We've been back and forth on how to fix this issue in the past, see:

    http://thread.gmane.org/gmane.linux.debian.devel.bugs.general/622621
    http://thread.gmane.org/gmane.linux.network/143380

    Ben Hutchings suggested we take a hint from how we handle the
    sockaddr_storage type. First we define a "__kernel_sa_family_t"
    to linux/socket.h that is always defined.

    Then if __KERNEL__ is defined, we also define "sa_family_t" as
    equal to "__kernel_sa_family_t".

    Then in places like linux/netlink.h we use __kernel_sa_family_t
    in user visible datastructures.

    Reported-by: Michel Machado
    Signed-off-by: David S. Miller

    David S. Miller
     

06 Jul, 2011

1 commit


06 May, 2011

1 commit

  • This patch adds a multiple message send syscall and is the send
    version of the existing recvmmsg syscall. This is heavily
    based on the patch by Arnaldo that added recvmmsg.

    I wrote a microbenchmark to test the performance gains of using
    this new syscall:

    http://ozlabs.org/~anton/junkcode/sendmmsg_test.c

    The test was run on a ppc64 box with a 10 Gbit network card. The
    benchmark can send both UDP and RAW ethernet packets.

    64B UDP

    batch pkts/sec
    1 804570
    2 872800 (+ 8 %)
    4 916556 (+14 %)
    8 939712 (+17 %)
    16 952688 (+18 %)
    32 956448 (+19 %)
    64 964800 (+20 %)

    64B raw socket

    batch pkts/sec
    1 1201449
    2 1350028 (+12 %)
    4 1461416 (+22 %)
    8 1513080 (+26 %)
    16 1541216 (+28 %)
    32 1553440 (+29 %)
    64 1557888 (+30 %)

    We see a 20% improvement in throughput on UDP send and 30%
    on raw socket send.

    [ Add sparc syscall entries. -DaveM ]

    Signed-off-by: Anton Blanchard
    Signed-off-by: David S. Miller

    Anton Blanchard
     

31 Mar, 2011

1 commit


14 Jan, 2011

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (46 commits)
    hwrng: via_rng - Fix memory scribbling on some CPUs
    crypto: padlock - Move padlock.h into include/crypto
    hwrng: via_rng - Fix asm constraints
    crypto: n2 - use __devexit not __exit in n2_unregister_algs
    crypto: mark crypto workqueues CPU_INTENSIVE
    crypto: mv_cesa - dont return PTR_ERR() of wrong pointer
    crypto: ripemd - Set module author and update email address
    crypto: omap-sham - backlog handling fix
    crypto: gf128mul - Remove experimental tag
    crypto: af_alg - fix af_alg memory_allocated data type
    crypto: aesni-intel - Fixed build with binutils 2.16
    crypto: af_alg - Make sure sk_security is initialized on accept()ed sockets
    net: Add missing lockdep class names for af_alg
    include: Install linux/if_alg.h for user-space crypto API
    crypto: omap-aes - checkpatch --file warning fixes
    crypto: omap-aes - initialize aes module once per request
    crypto: omap-aes - unnecessary code removed
    crypto: omap-aes - error handling implementation improved
    crypto: omap-aes - redundant locking is removed
    crypto: omap-aes - DMA initialization fixes for OMAP off mode
    ...

    Linus Torvalds
     

07 Jan, 2011

1 commit


19 Nov, 2010

1 commit

  • This patch adds the socket family/level macros for the yet-to-be-born
    AF_ALG family. The AF_ALG family provides the user-space interface
    for the kernel crypto API.

    Signed-off-by: Herbert Xu
    Acked-by: David S. Miller

    Herbert Xu
     

29 Oct, 2010

1 commit

  • This helps protect us from overflow issues down in the
    individual protocol sendmsg/recvmsg handlers. Once
    we hit INT_MAX we truncate out the rest of the iovec
    by setting the iov_len members to zero.

    This works because:

    1) For SOCK_STREAM and SOCK_SEQPACKET sockets, partial
    writes are allowed and the application will just continue
    with another write to send the rest of the data.

    2) For datagram oriented sockets, where there must be a
    one-to-one correspondance between write() calls and
    packets on the wire, INT_MAX is going to be far larger
    than the packet size limit the protocol is going to
    check for and signal with -EMSGSIZE.

    Based upon a patch by Linus Torvalds.

    Signed-off-by: David S. Miller

    David S. Miller
     

21 Oct, 2010

1 commit


28 Sep, 2010

1 commit

  • Fixes kernel bugzilla #16603

    tcp_sendmsg() truncates iov_len to an 'int' which a 4GB write to write
    zero bytes, for example.

    There is also the problem higher up of how verify_iovec() works. It
    wants to prevent the total length from looking like an error return
    value.

    However it does this using 'int', but syscalls return 'long' (and
    thus signed 64-bit on 64-bit machines). So it could trigger
    false-positives on 64-bit as written. So fix it to use 'long'.

    Reported-by: Olaf Bonorden
    Reported-by: Daniel Büse
    Reported-by: Andrew Morton
    Signed-off-by: David S. Miller

    David S. Miller
     

17 Jun, 2010

1 commit

  • To keep the coming code clear and to allow both the sock
    code and the scm code to share the logic introduce a
    fuction to translate from struct cred to struct ucred.

    Signed-off-by: Eric W. Biederman
    Acked-by: Pavel Emelyanov
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

07 Apr, 2010

1 commit


31 Mar, 2010

1 commit


27 Mar, 2010

1 commit

  • Add new flag MSG_WAITFORONE for the recvmmsg() syscall.
    When this flag is specified for a blocking socket, recvmmsg()
    will only block until at least 1 packet is available. The
    default behavior is to block until all vlen packets are
    available. This flag has no effect on non-blocking sockets
    or when used in combination with MSG_DONTWAIT.

    Signed-off-by: Brandon L Black
    Acked-by: Ulrich Drepper
    Acked-by: Eric Dumazet
    Acked-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Brandon L Black
     

29 Oct, 2009

1 commit

  • proto_ops->getname implies copying protocol specific data
    into storage unit (particulary to __kernel_sockaddr_storage).
    So when we implement new protocol support we should keep such
    a detail in mind (which is easy to forget about).

    Lets introduce DECLARE_SOCKADDR helper which check if
    storage unit is not overfowed at build time.

    Eventually inet_getname is switched to use DECLARE_SOCKADDR
    (to show example of usage).

    Signed-off-by: Cyrill Gorcunov
    Signed-off-by: David S. Miller

    Cyrill Gorcunov
     

13 Oct, 2009

1 commit

  • Meaning receive multiple messages, reducing the number of syscalls and
    net stack entry/exit operations.

    Next patches will introduce mechanisms where protocols that want to
    optimize this operation will provide an unlocked_recvmsg operation.

    This takes into account comments made by:

    . Paul Moore: sock_recvmsg is called only for the first datagram,
    sock_recvmsg_nosec is used for the rest.

    . Caitlin Bestler: recvmmsg now has a struct timespec timeout, that
    works in the same fashion as the ppoll one.

    If the underlying protocol returns a datagram with MSG_OOB set, this
    will make recvmmsg return right away with as many datagrams (+ the OOB
    one) it has received so far.

    . Rémi Denis-Courmont & Steven Whitehouse: If we receive N < vlen
    datagrams and then recvmsg returns an error, recvmmsg will return
    the successfully received datagrams, store the error and return it
    in the next call.

    This paves the way for a subsequent optimization, sk_prot->unlocked_recvmsg,
    where we will be able to acquire the lock only at batch start and end, not at
    every underlying recvmsg call.

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     

05 Oct, 2009

1 commit

  • The following user-space program fails to compile:

    #include
    #include
    int main() { return 0; }

    The reason is that tests __GLIBC__ to decide whether it
    should define various structures and macros that are now defined for
    user-space by , but __GLIBC__ is not defined if no libc
    headers have yet been included.

    It seems safe to drop support for libc 5 now.

    Signed-off-by: Ben Hutchings
    Signed-off-by: Bastian Blank
    Signed-off-by: David S. Miller

    Ben Hutchings
     

09 Jun, 2009

1 commit


23 Apr, 2009

1 commit


21 Apr, 2009

2 commits

  • aio_write gets const struct iovec * but tun_chr_aio_write casts this to struct
    iovec * and modifies the iovec. As a result, attempts to use io_submit
    to send packets to a tun device fail with weird errors such as EINVAL.

    Since tun is the only user of skb_copy_datagram_from_iovec, we can
    fix this simply by changing the later so that it does not
    touch the iovec passed to it.

    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: David S. Miller

    Michael S. Tsirkin
     
  • There's an skb_copy_datagram_iovec() to copy out of a paged skb,
    but it modifies the iovec, and does not support starting
    at an offset in the destination. We want both in tun.c, so let's
    add the function.

    It's a carbon copy of skb_copy_datagram_iovec() with enough changes to
    be annoying.

    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: David S. Miller

    Michael S. Tsirkin
     

27 Mar, 2009

1 commit

  • …el/git/tip/linux-2.6-tip

    * 'header-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (50 commits)
    x86: headers cleanup - setup.h
    emu101k1.h: fix duplicate include of <linux/types.h>
    compiler-gcc4: conditionalize #error on __KERNEL__
    remove __KERNEL_STRICT_NAMES
    make netfilter use strict integer types
    make drm headers use strict integer types
    make MTD headers use strict integer types
    make most exported headers use strict integer types
    make exported headers use strict posix types
    unconditionally include asm/types.h from linux/types.h
    make linux/types.h as assembly safe
    Neither asm/types.h nor linux/types.h is required for arch/ia64/include/asm/fpu.h
    headers_check fix cleanup: linux/reiserfs_fs.h
    headers_check fix cleanup: linux/nubus.h
    headers_check fix cleanup: linux/coda_psdev.h
    headers_check fix: x86, setup.h
    headers_check fix: x86, prctl.h
    headers_check fix: linux/reinserfs_fs.h
    headers_check fix: linux/socket.h
    headers_check fix: linux/nubus.h
    ...

    Manually fix trivial conflicts in:
    include/linux/netfilter/xt_limit.h
    include/linux/netfilter/xt_statistic.h

    Linus Torvalds
     

27 Feb, 2009

1 commit


03 Feb, 2009

1 commit


06 Oct, 2008

1 commit


23 Sep, 2008

1 commit


27 Jul, 2008

1 commit


20 Jul, 2008

1 commit


29 Jan, 2008

1 commit