10 Jan, 2019

1 commit

  • [ Upstream commit 3a0ed3e9619738067214871e9cb826fa23b2ddb9 ]

    Al Viro mentioned (Message-ID
    )
    that there is probably a race condition
    lurking in accesses of sk_stamp on 32-bit machines.

    sock->sk_stamp is of type ktime_t which is always an s64.
    On a 32 bit architecture, we might run into situations of
    unsafe access as the access to the field becomes non atomic.

    Use seqlocks for synchronization.
    This allows us to avoid using spinlocks for readers as
    readers do not need mutual exclusion.

    Another approach to solve this is to require sk_lock for all
    modifications of the timestamps. The current approach allows
    for timestamps to have their own lock: sk_stamp_lock.
    This allows for the patch to not compete with already
    existing critical sections, and side effects are limited
    to the paths in the patch.

    The addition of the new field maintains the data locality
    optimizations from
    commit 9115e8cd2a0c ("net: reorganize struct sock for better data
    locality")

    Note that all the instances of the sk_stamp accesses
    are either through the ioctl or the syscall recvmsg.

    Signed-off-by: Deepa Dinamani
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Deepa Dinamani
     

19 May, 2018

1 commit

  • [ Upstream commit 988bf7243e03ef69238381594e0334a79cef74a6 ]

    For the x32 ABI, struct timeval has two 64-bit fields. However
    the kernel currently interprets the user-space values used for
    the SO_RCVTIMEO and SO_SNDTIMEO socket options as having a pair
    of 32-bit fields.

    When the seconds portion of the requested timeout is less than 2**32,
    the seconds portion of the effective timeout is correct but the
    microseconds portion is zero. When the seconds portion of the
    requested timeout is zero and the microseconds portion is non-zero,
    the kernel interprets the timeout as zero (never timeout).

    Fix by using 64-bit time for SO_RCVTIMEO/SO_SNDTIMEO as required
    for the ABI.

    The code included below demonstrates the problem.

    Results before patch:
    $ gcc -m64 -Wall -O2 -o socktmo socktmo.c && ./socktmo
    recv time: 2.008181 seconds
    send time: 2.015985 seconds

    $ gcc -m32 -Wall -O2 -o socktmo socktmo.c && ./socktmo
    recv time: 2.016763 seconds
    send time: 2.016062 seconds

    $ gcc -mx32 -Wall -O2 -o socktmo socktmo.c && ./socktmo
    recv time: 1.007239 seconds
    send time: 1.023890 seconds

    Results after patch:
    $ gcc -m64 -O2 -Wall -o socktmo socktmo.c && ./socktmo
    recv time: 2.010062 seconds
    send time: 2.015836 seconds

    $ gcc -m32 -O2 -Wall -o socktmo socktmo.c && ./socktmo
    recv time: 2.013974 seconds
    send time: 2.015981 seconds

    $ gcc -mx32 -O2 -Wall -o socktmo socktmo.c && ./socktmo
    recv time: 2.030257 seconds
    send time: 2.013383 seconds

    #include
    #include
    #include
    #include
    #include

    void checkrc(char *str, int rc)
    {
    if (rc >= 0)
    return;

    perror(str);
    exit(1);
    }

    static char buf[1024];
    int main(int argc, char **argv)
    {
    int rc;
    int socks[2];
    struct timeval tv;
    struct timeval start, end, delta;

    rc = socketpair(AF_UNIX, SOCK_STREAM, 0, socks);
    checkrc("socketpair", rc);

    /* set timeout to 1.999999 seconds */
    tv.tv_sec = 1;
    tv.tv_usec = 999999;
    rc = setsockopt(socks[0], SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv);
    rc = setsockopt(socks[0], SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof tv);
    checkrc("setsockopt", rc);

    /* measure actual receive timeout */
    gettimeofday(&start, NULL);
    rc = recv(socks[0], buf, sizeof buf, 0);
    gettimeofday(&end, NULL);
    timersub(&end, &start, &delta);

    printf("recv time: %ld.%06ld seconds\n",
    (long)delta.tv_sec, (long)delta.tv_usec);

    /* fill send buffer */
    do {
    rc = send(socks[0], buf, sizeof buf, 0);
    } while (rc > 0);

    /* measure actual send timeout */
    gettimeofday(&start, NULL);
    rc = send(socks[0], buf, sizeof buf, 0);
    gettimeofday(&end, NULL);
    timersub(&end, &start, &delta);

    printf("send time: %ld.%06ld seconds\n",
    (long)delta.tv_sec, (long)delta.tv_usec);
    exit(0);
    }

    Fixes: 515c7af85ed9 ("x32: Use compat shims for {g,s}etsockopt")
    Reported-by: Gopal RajagopalSai
    Signed-off-by: Lance Richardson
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Lance Richardson
     

21 Sep, 2017

1 commit

  • The actual length of cmsg fetched in during the second loop
    (i.e., kcmsg - kcmsg_base) could be different from what we
    get from the first loop (i.e., kcmlen).

    The main reason is that the two get_user() calls in the two
    loops (i.e., get_user(ucmlen, &ucmsg->cmsg_len) and
    __get_user(ucmlen, &ucmsg->cmsg_len)) could cause ucmlen
    to have different values even they fetch from the same userspace
    address, as user can race to change the memory content in
    &ucmsg->cmsg_len across fetches.

    Although in the second loop, the sanity check
    if ((char *)kcmsg_base + kcmlen - (char *)kcmsg < CMSG_ALIGN(tmp))
    is inplace, it only ensures that the cmsg fetched in during the
    second loop does not exceed the length of kcmlen, but not
    necessarily equal to kcmlen. But indicated by the assignment
    kmsg->msg_controllen = kcmlen, we should enforce that.

    This patch adds this additional sanity check and ensures that
    what is recorded in kmsg->msg_controllen is the actual cmsg length.

    Signed-off-by: Meng Xu
    Signed-off-by: David S. Miller

    Meng Xu
     

05 Jul, 2017

2 commits


23 Feb, 2017

1 commit

  • Pull networking updates from David Miller:
    "Highlights:

    1) Support TX_RING in AF_PACKET TPACKET_V3 mode, from Sowmini
    Varadhan.

    2) Simplify classifier state on sk_buff in order to shrink it a bit.
    From Willem de Bruijn.

    3) Introduce SIPHASH and it's usage for secure sequence numbers and
    syncookies. From Jason A. Donenfeld.

    4) Reduce CPU usage for ICMP replies we are going to limit or
    suppress, from Jesper Dangaard Brouer.

    5) Introduce Shared Memory Communications socket layer, from Ursula
    Braun.

    6) Add RACK loss detection and allow it to actually trigger fast
    recovery instead of just assisting after other algorithms have
    triggered it. From Yuchung Cheng.

    7) Add xmit_more and BQL support to mvneta driver, from Simon Guinot.

    8) skb_cow_data avoidance in esp4 and esp6, from Steffen Klassert.

    9) Export MPLS packet stats via netlink, from Robert Shearman.

    10) Significantly improve inet port bind conflict handling, especially
    when an application is restarted and changes it's setting of
    reuseport. From Josef Bacik.

    11) Implement TX batching in vhost_net, from Jason Wang.

    12) Extend the dummy device so that VF (virtual function) features,
    such as configuration, can be more easily tested. From Phil
    Sutter.

    13) Avoid two atomic ops per page on x86 in bnx2x driver, from Eric
    Dumazet.

    14) Add new bpf MAP, implementing a longest prefix match trie. From
    Daniel Mack.

    15) Packet sample offloading support in mlxsw driver, from Yotam Gigi.

    16) Add new aquantia driver, from David VomLehn.

    17) Add bpf tracepoints, from Daniel Borkmann.

    18) Add support for port mirroring to b53 and bcm_sf2 drivers, from
    Florian Fainelli.

    19) Remove custom busy polling in many drivers, it is done in the core
    networking since 4.5 times. From Eric Dumazet.

    20) Support XDP adjust_head in virtio_net, from John Fastabend.

    21) Fix several major holes in neighbour entry confirmation, from
    Julian Anastasov.

    22) Add XDP support to bnxt_en driver, from Michael Chan.

    23) VXLAN offloads for enic driver, from Govindarajulu Varadarajan.

    24) Add IPVTAP driver (IP-VLAN based tap driver) from Sainath Grandhi.

    25) Support GRO in IPSEC protocols, from Steffen Klassert"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1764 commits)
    Revert "ath10k: Search SMBIOS for OEM board file extension"
    net: socket: fix recvmmsg not returning error from sock_error
    bnxt_en: use eth_hw_addr_random()
    bpf: fix unlocking of jited image when module ronx not set
    arch: add ARCH_HAS_SET_MEMORY config
    net: napi_watchdog() can use napi_schedule_irqoff()
    tcp: Revert "tcp: tcp_probe: use spin_lock_bh()"
    net/hsr: use eth_hw_addr_random()
    net: mvpp2: enable building on 64-bit platforms
    net: mvpp2: switch to build_skb() in the RX path
    net: mvpp2: simplify MVPP2_PRS_RI_* definitions
    net: mvpp2: fix indentation of MVPP2_EXT_GLOBAL_CTRL_DEFAULT
    net: mvpp2: remove unused register definitions
    net: mvpp2: simplify mvpp2_bm_bufs_add()
    net: mvpp2: drop useless fields in mvpp2_bm_pool and related code
    net: mvpp2: remove unused 'tx_skb' field of 'struct mvpp2_tx_queue'
    net: mvpp2: release reference to txq_cpu[] entry after unmapping
    net: mvpp2: handle too large value in mvpp2_rx_time_coal_set()
    net: mvpp2: handle too large value handling in mvpp2_rx_pkts_coal_set()
    net: mvpp2: remove useless arguments in mvpp2_rx_{pkts, time}_coal_set
    ...

    Linus Torvalds
     

22 Feb, 2017

1 commit

  • Pull audit updates from Paul Moore:
    "The audit changes for v4.11 are relatively small compared to what we
    did for v4.10, both in terms of size and impact.

    - two patches from Steve tweak the formatting for some of the audit
    records to make them more consistent with other audit records.

    - three patches from Richard record the name of a module on module
    load, fix the logging of sockaddr information when using
    socketcall() on 32-bit systems, and add the ability to reset
    audit's lost record counter.

    - my lone patch just fixes an annoying style nit that I was reminded
    about by one of Richard's patches.

    All these patches pass our test suite"

    * 'stable-4.11' of git://git.infradead.org/users/pcmoore/audit:
    audit: remove unnecessary curly braces from switch/case statements
    audit: log module name on init_module
    audit: log 32-bit socketcalls
    audit: add feature audit_lost reset
    audit: Make AUDIT_ANOM_ABEND event normalized
    audit: Make AUDIT_KERNEL event conform to the specification

    Linus Torvalds
     

19 Jan, 2017

1 commit

  • 32-bit socketcalls were not being logged by audit on x86_64 systems.
    Log them. This is basically a duplicate of the call from
    net/socket.c:sys_socketcall(), but it addresses the impedance mismatch
    between 32-bit userspace process and 64-bit kernel audit.

    See: https://github.com/linux-audit/audit-kernel/issues/14

    Signed-off-by: Richard Guy Briggs
    Acked-by: David S. Miller
    Signed-off-by: Paul Moore

    Richard Guy Briggs
     

05 Jan, 2017

2 commits


25 Dec, 2016

1 commit


10 Jun, 2016

1 commit

  • Socket option PACKET_FANOUT_DATA takes a struct sock_fprog as argument
    if PACKET_FANOUT has mode PACKET_FANOUT_CBPF. This structure contains
    a pointer into user memory. If userland is 32-bit and kernel is 64-bit
    the two disagree about the layout of struct sock_fprog.

    Add compat setsockopt support to convert a 32-bit compat_sock_fprog to
    a 64-bit sock_fprog. This is analogous to compat_sock_fprog support for
    SO_REUSEPORT added in commit 1957598840f4 ("soreuseport: add compat
    case for setsockopt SO_ATTACH_REUSEPORT_CBPF").

    Reported-by: Daniel Borkmann
    Signed-off-by: Willem de Bruijn
    Acked-by: Daniel Borkmann
    Signed-off-by: David S. Miller

    Willem de Bruijn
     

07 Jun, 2016

1 commit


09 Apr, 2015

1 commit


24 Mar, 2015

1 commit


21 Mar, 2015

2 commits

  • Conflicts:
    drivers/net/ethernet/emulex/benet/be_main.c
    net/core/sysctl_net_core.c
    net/ipv4/inet_diag.c

    The be_main.c conflict resolution was really tricky. The conflict
    hunks generated by GIT were very unhelpful, to say the least. It
    split functions in half and moved them around, when the real actual
    conflict only existed solely inside of one function, that being
    be_map_pci_bars().

    So instead, to resolve this, I checked out be_main.c from the top
    of net-next, then I applied the be_main.c changes from 'net' since
    the last time I merged. And this worked beautifully.

    The inet_diag.c and sysctl_net_core.c conflicts were simple
    overlapping changes, and were easily to resolve.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Commit db31c55a6fb2 (net: clamp ->msg_namelen instead of returning an
    error) introduced the clamping of msg_namelen when the unsigned value
    was larger than sizeof(struct sockaddr_storage). This caused a
    msg_namelen of -1 to be valid. The native code was subsequently fixed by
    commit dbb490b96584 (net: socket: error on a negative msg_namelen).

    In addition, the native code sets msg_namelen to 0 when msg_name is
    NULL. This was done in commit (6a2a2b3ae075 net:socket: set msg_namelen
    to 0 if msg_name is passed as NULL in msghdr struct from userland) and
    subsequently updated by 08adb7dabd48 (fold verify_iovec() into
    copy_msghdr_from_user()).

    This patch brings the get_compat_msghdr() in line with
    copy_msghdr_from_user().

    Fixes: db31c55a6fb2 (net: clamp ->msg_namelen instead of returning an error)
    Cc: David S. Miller
    Cc: Dan Carpenter
    Signed-off-by: Catalin Marinas
    Signed-off-by: David S. Miller

    Catalin Marinas
     

04 Mar, 2015

1 commit


24 Feb, 2015

1 commit

  • With commit a7526eb5d06b (net: Unbreak compat_sys_{send,recv}msg), the
    MSG_CMSG_COMPAT flag is blocked at the compat syscall entry points,
    changing the kernel compat behaviour from the one before the commit it
    was trying to fix (1be374a0518a, net: Block MSG_CMSG_COMPAT in
    send(m)msg and recv(m)msg).

    On 32-bit kernels (!CONFIG_COMPAT), MSG_CMSG_COMPAT is 0 and the native
    32-bit sys_sendmsg() allows flag 0x80000000 to be set (it is ignored by
    the kernel). However, on a 64-bit kernel, the compat ABI is different
    with commit a7526eb5d06b.

    This patch changes the compat_sys_{send,recv}msg behaviour to the one
    prior to commit 1be374a0518a.

    The problem was found running 32-bit LTP (sendmsg01) binary on an arm64
    kernel. Arguably, LTP should not pass 0xffffffff as flags to sendmsg()
    but the general rule is not to break user ABI (even when the user
    behaviour is not entirely sane).

    Fixes: a7526eb5d06b (net: Unbreak compat_sys_{send,recv}msg)
    Cc: Andy Lutomirski
    Cc: David S. Miller
    Signed-off-by: Catalin Marinas
    Signed-off-by: David S. Miller

    Catalin Marinas
     

23 Feb, 2015

1 commit


10 Dec, 2014

1 commit

  • Note that the code _using_ ->msg_iter at that point will be very
    unhappy with anything other than unshifted iovec-backed iov_iter.
    We still need to convert users to proper primitives.

    Signed-off-by: Al Viro

    Al Viro
     

20 Nov, 2014

3 commits

  • ... and do the same on the compat side of things.

    Signed-off-by: Al Viro

    Al Viro
     
  • use {compat_,}rw_copy_check_uvector(). As the result, we are
    guaranteed that all iovecs seen in ->msg_iov by ->sendmsg()
    and ->recvmsg() will pass access_ok().

    Signed-off-by: Al Viro

    Al Viro
     
  • Kernel-side struct msghdr is (currently) using the same layout as
    userland one, but it's not a one-to-one copy - even without considering
    32bit compat issues, we have msg_iov, msg_name and msg_control copied
    to kernel[1]. It's fairly localized, so we get away with a few functions
    where that knowledge is needed (and we could shrink that set even
    more). Pretty much everything deals with the kernel-side variant and
    the few places that want userland one just use a bunch of force-casts
    to paper over the differences.

    The thing is, kernel-side definition of struct msghdr is *not* exposed
    in include/uapi - libc doesn't see it, etc. So we can add struct user_msghdr,
    with proper annotations and let the few places that ever deal with those
    beasts use it for userland pointers. Saner typechecking aside, that will
    allow to change the layout of kernel-side msghdr - e.g. replace
    msg_iov/msg_iovlen there with struct iov_iter, getting rid of the need
    to modify the iovec as we copy data to/from it, etc.

    We could introduce kernel_msghdr instead, but that would create much more
    noise - the absolute majority of the instances would need to have the
    type switched to kernel_msghdr and definition of struct msghdr in
    include/linux/socket.h is not going to be seen by userland anyway.

    This commit just introduces user_msghdr and switches the few places that
    are dealing with userland-side msghdr to it.

    [1] actually, it's even trickier than that - we copy msg_control for
    sendmsg, but keep the userland address on recvmsg.

    Signed-off-by: Al Viro

    Al Viro
     

30 Jul, 2014

1 commit

  • Sasha's report:
    > While fuzzing with trinity inside a KVM tools guest running the latest -next
    > kernel with the KASAN patchset, I've stumbled on the following spew:
    >
    > [ 4448.949424] ==================================================================
    > [ 4448.951737] AddressSanitizer: user-memory-access on address 0
    > [ 4448.952988] Read of size 2 by thread T19638:
    > [ 4448.954510] CPU: 28 PID: 19638 Comm: trinity-c76 Not tainted 3.16.0-rc4-next-20140711-sasha-00046-g07d3099-dirty #813
    > [ 4448.956823] ffff88046d86ca40 0000000000000000 ffff880082f37e78 ffff880082f37a40
    > [ 4448.958233] ffffffffb6e47068 ffff880082f37a68 ffff880082f37a58 ffffffffb242708d
    > [ 4448.959552] 0000000000000000 ffff880082f37a88 ffffffffb24255b1 0000000000000000
    > [ 4448.961266] Call Trace:
    > [ 4448.963158] dump_stack (lib/dump_stack.c:52)
    > [ 4448.964244] kasan_report_user_access (mm/kasan/report.c:184)
    > [ 4448.965507] __asan_load2 (mm/kasan/kasan.c:352)
    > [ 4448.966482] ? netlink_sendmsg (net/netlink/af_netlink.c:2339)
    > [ 4448.967541] netlink_sendmsg (net/netlink/af_netlink.c:2339)
    > [ 4448.968537] ? get_parent_ip (kernel/sched/core.c:2555)
    > [ 4448.970103] sock_sendmsg (net/socket.c:654)
    > [ 4448.971584] ? might_fault (mm/memory.c:3741)
    > [ 4448.972526] ? might_fault (./arch/x86/include/asm/current.h:14 mm/memory.c:3740)
    > [ 4448.973596] ? verify_iovec (net/core/iovec.c:64)
    > [ 4448.974522] ___sys_sendmsg (net/socket.c:2096)
    > [ 4448.975797] ? put_lock_stats.isra.13 (./arch/x86/include/asm/preempt.h:98 kernel/locking/lockdep.c:254)
    > [ 4448.977030] ? lock_release_holdtime (kernel/locking/lockdep.c:273)
    > [ 4448.978197] ? lock_release_non_nested (kernel/locking/lockdep.c:3434 (discriminator 1))
    > [ 4448.979346] ? check_chain_key (kernel/locking/lockdep.c:2188)
    > [ 4448.980535] __sys_sendmmsg (net/socket.c:2181)
    > [ 4448.981592] ? trace_hardirqs_on_caller (kernel/locking/lockdep.c:2600)
    > [ 4448.982773] ? trace_hardirqs_on (kernel/locking/lockdep.c:2607)
    > [ 4448.984458] ? syscall_trace_enter (arch/x86/kernel/ptrace.c:1500 (discriminator 2))
    > [ 4448.985621] ? trace_hardirqs_on_caller (kernel/locking/lockdep.c:2600)
    > [ 4448.986754] SyS_sendmmsg (net/socket.c:2201)
    > [ 4448.987708] tracesys (arch/x86/kernel/entry_64.S:542)
    > [ 4448.988929] ==================================================================

    This reports means that we've come to netlink_sendmsg() with msg->msg_name == NULL and msg->msg_namelen > 0.

    After this report there was no usual "Unable to handle kernel NULL pointer dereference"
    and this gave me a clue that address 0 is mapped and contains valid socket address structure in it.

    This bug was introduced in f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
    (net: rework recvmsg handler msg_name and msg_namelen logic).
    Commit message states that:
    "Set msg->msg_name = NULL if user specified a NULL in msg_name but had a
    non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't
    affect sendto as it would bail out earlier while trying to copy-in the
    address."
    But in fact this affects sendto when address 0 is mapped and contains
    socket address structure in it. In such case copy-in address will succeed,
    verify_iovec() function will successfully exit with msg->msg_namelen > 0
    and msg->msg_name == NULL.

    This patch fixes it by setting msg_namelen to 0 if msg_name == NULL.

    Cc: Hannes Frederic Sowa
    Cc: Eric Dumazet
    Cc:
    Reported-by: Sasha Levin
    Signed-off-by: Andrey Ryabinin
    Acked-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Andrey Ryabinin
     

06 Mar, 2014

2 commits


31 Jan, 2014

1 commit

  • The x32 case for the recvmsg() timout handling is broken:

    asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
    unsigned int vlen, unsigned int flags,
    struct compat_timespec __user *timeout)
    {
    int datagrams;
    struct timespec ktspec;

    if (flags & MSG_CMSG_COMPAT)
    return -EINVAL;

    if (COMPAT_USE_64BIT_TIME)
    return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
    flags | MSG_CMSG_COMPAT,
    (struct timespec *) timeout);
    ...

    The timeout pointer parameter is provided by userland (hence the __user
    annotation) but for x32 syscalls it's simply cast to a kernel pointer
    and is passed to __sys_recvmmsg which will eventually directly
    dereference it for both reading and writing. Other callers to
    __sys_recvmmsg properly copy from userland to the kernel first.

    The bug was introduced by commit ee4fa23c4bfc ("compat: Use
    COMPAT_USE_64BIT_TIME in net/compat.c") and should affect all kernels
    since 3.4 (and perhaps vendor kernels if they backported x32 support
    along with this code).

    Note that CONFIG_X86_X32_ABI gets enabled at build time and only if
    CONFIG_X86_X32 is enabled and ld can build x32 executables.

    Other uses of COMPAT_USE_64BIT_TIME seem fine.

    This addresses CVE-2014-0038.

    Signed-off-by: PaX Team
    Signed-off-by: H. Peter Anvin
    Cc: # v3.4+
    Signed-off-by: Linus Torvalds

    PaX Team
     

30 Nov, 2013

1 commit

  • If kmsg->msg_namelen > sizeof(struct sockaddr_storage) then in the
    original code that would lead to memory corruption in the kernel if you
    had audit configured. If you didn't have audit configured it was
    harmless.

    There are some programs such as beta versions of Ruby which use too
    large of a buffer and returning an error code breaks them. We should
    clamp the ->msg_namelen value instead.

    Fixes: 1661bf364ae9 ("net: heap overflow in __audit_sockaddr()")
    Reported-by: Eric Wong
    Signed-off-by: Dan Carpenter
    Tested-by: Eric Wong
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Dan Carpenter
     

21 Nov, 2013

1 commit


04 Oct, 2013

1 commit

  • We need to cap ->msg_namelen or it leads to a buffer overflow when we
    to the memcpy() in __audit_sockaddr(). It requires CAP_AUDIT_CONTROL to
    exploit this bug.

    The call tree is:
    ___sys_recvmsg()
    move_addr_to_user()
    audit_sockaddr()
    __audit_sockaddr()

    Reported-by: Jüri Aedla
    Signed-off-by: Dan Carpenter
    Signed-off-by: David S. Miller

    Dan Carpenter
     

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
     

27 Sep, 2012

1 commit


23 Jul, 2012

1 commit

  • In net/compat.c::put_cmsg_compat() we may assign 'data' the address of
    either the 'ctv' or 'cts' local variables inside the 'if
    (!COMPAT_USE_64BIT_TIME)' branch.

    Those variables go out of scope at the end of the 'if' statement, so
    when we use 'data' further down in 'copy_to_user(CMSG_COMPAT_DATA(cm),
    data, cmlen - sizeof(struct compat_cmsghdr))' there's no telling what
    it may be refering to - not good.

    Fix the problem by simply giving 'ctv' and 'cts' function scope.

    Signed-off-by: Jesper Juhl
    Signed-off-by: David S. Miller

    Jesper Juhl
     

22 May, 2012

1 commit

  • Pull security subsystem updates from James Morris:
    "New notable features:
    - The seccomp work from Will Drewry
    - PR_{GET,SET}_NO_NEW_PRIVS from Andy Lutomirski
    - Longer security labels for Smack from Casey Schaufler
    - Additional ptrace restriction modes for Yama by Kees Cook"

    Fix up trivial context conflicts in arch/x86/Kconfig and include/linux/filter.h

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (65 commits)
    apparmor: fix long path failure due to disconnected path
    apparmor: fix profile lookup for unconfined
    ima: fix filename hint to reflect script interpreter name
    KEYS: Don't check for NULL key pointer in key_validate()
    Smack: allow for significantly longer Smack labels v4
    gfp flags for security_inode_alloc()?
    Smack: recursive tramsmute
    Yama: replace capable() with ns_capable()
    TOMOYO: Accept manager programs which do not start with / .
    KEYS: Add invalidation support
    KEYS: Do LRU discard in full keyrings
    KEYS: Permit in-place link replacement in keyring list
    KEYS: Perform RCU synchronisation on keys prior to key destruction
    KEYS: Announce key type (un)registration
    KEYS: Reorganise keys Makefile
    KEYS: Move the key config into security/keys/Kconfig
    KEYS: Use the compat keyctl() syscall wrapper on Sparc64 for Sparc32 compat
    Yama: remove an unused variable
    samples/seccomp: fix dependencies on arch macros
    Yama: add additional ptrace scopes
    ...

    Linus Torvalds
     

16 Apr, 2012

1 commit


14 Apr, 2012

1 commit

  • Any other users of bpf_*_filter that take a struct sock_fprog from
    userspace will need to be able to also accept a compat_sock_fprog
    if the arch supports compat calls. This change allows the existing
    compat_sock_fprog be shared.

    Signed-off-by: Will Drewry
    Acked-by: Serge Hallyn
    Acked-by: Eric Dumazet
    Acked-by: Eric Paris

    v18: tasered by the apostrophe police
    v14: rebase/nochanges
    v13: rebase on to 88ebdda6159ffc15699f204c33feb3e431bf9bdc
    v12: rebase on to linux-next
    v11: introduction
    Signed-off-by: James Morris

    Will Drewry
     

30 Mar, 2012

1 commit

  • Pull x32 support for x86-64 from Ingo Molnar:
    "This tree introduces the X32 binary format and execution mode for x86:
    32-bit data space binaries using 64-bit instructions and 64-bit kernel
    syscalls.

    This allows applications whose working set fits into a 32 bits address
    space to make use of 64-bit instructions while using a 32-bit address
    space with shorter pointers, more compressed data structures, etc."

    Fix up trivial context conflicts in arch/x86/{Kconfig,vdso/vma.c}

    * 'x86-x32-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (71 commits)
    x32: Fix alignment fail in struct compat_siginfo
    x32: Fix stupid ia32/x32 inversion in the siginfo format
    x32: Add ptrace for x32
    x32: Switch to a 64-bit clock_t
    x32: Provide separate is_ia32_task() and is_x32_task() predicates
    x86, mtrr: Use explicit sizing and padding for the 64-bit ioctls
    x86/x32: Fix the binutils auto-detect
    x32: Warn and disable rather than error if binutils too old
    x32: Only clear TIF_X32 flag once
    x32: Make sure TS_COMPAT is cleared for x32 tasks
    fs: Remove missed ->fds_bits from cessation use of fd_set structs internally
    fs: Fix close_on_exec pointer in alloc_fdtable
    x32: Drop non-__vdso weak symbols from the x32 VDSO
    x32: Fix coding style violations in the x32 VDSO code
    x32: Add x32 VDSO support
    x32: Allow x32 to be configured
    x32: If configured, add x32 system calls to system call tables
    x32: Handle process creation
    x32: Signal-related system calls
    x86: Add #ifdef CONFIG_COMPAT to
    ...

    Linus Torvalds
     

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
     

21 Feb, 2012

1 commit