02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

02 Aug, 2017

1 commit

  • Generalize strparser from more than just being used in conjunction
    with read_sock. strparser will also be used in the send path with
    zero proxy. The primary change is to create strp_process function
    that performs the critical processing on skbs. The documentation
    is also updated to reflect the new uses.

    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert
     

01 Jul, 2017

1 commit

  • refcount_t type and corresponding API should be
    used instead of atomic_t when the variable is used as
    a reference counter. This allows to avoid accidental
    refcounter overflows that might lead to use-after-free
    situations.

    Signed-off-by: Elena Reshetova
    Signed-off-by: Hans Liljestrand
    Signed-off-by: Kees Cook
    Signed-off-by: David Windsor
    Signed-off-by: David S. Miller

    Reshetova, Elena
     

24 Aug, 2016

1 commit

  • Lock the lower socket in kcm_unattach. Release during call to strp_done
    since that function cancels the RX timers and work queue with sync.

    Also added some status information in psock reporting.

    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert
     

18 Aug, 2016

1 commit

  • Adapt KCM to use the stream parser. This mostly involves removing
    the RX handling and setting up the strparser using the interface.

    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert
     

26 Jul, 2016

1 commit


23 Jun, 2016

1 commit

  • Every open of /proc/net/kcm leaks 16 bytes of memory as is reported by
    kmemleak:
    unreferenced object 0xffff88059c0e3458 (size 192):
    comm "cat", pid 1401, jiffies 4294935742 (age 310.720s)
    hex dump (first 32 bytes):
    28 45 71 96 05 88 ff ff 00 10 00 00 00 00 00 00 (Eq.............
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    backtrace:
    [] kmem_cache_alloc_trace+0x16e/0x230
    [] seq_open+0x79/0x1d0
    [] kcm_seq_open+0x0/0x30 [kcm]
    [] seq_open+0x79/0x1d0
    [] __seq_open_private+0x2f/0xa0
    [] seq_open_net+0x38/0xa0
    ...

    It is caused by a missing free in the ->release path. So fix it by
    providing seq_release_net as the ->release method.

    Signed-off-by: Jiri Slaby
    Fixes: cd6e111bf5 (kcm: Add statistics and proc interfaces)
    Cc: "David S. Miller"
    Cc: Tom Herbert
    Cc: netdev@vger.kernel.org
    Signed-off-by: David S. Miller

    Jiri Slaby
     

10 Mar, 2016

3 commits

  • This patch adds receive timeout for message assembly on the attached TCP
    sockets. The timeout is set when a new messages is started and the whole
    message has not been received by TCP (not in the receive queue). If the
    completely message is subsequently received the timer is cancelled, if the
    timer expires the RX side is aborted.

    The timeout value is taken from the socket timeout (SO_RCVTIMEO) that is
    set on a TCP socket (i.e. set by get sockopt before attaching a TCP socket
    to KCM.

    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert
     
  • Message assembly is performed on the TCP socket. This is logically
    equivalent of an application that performs a peek on the socket to find
    out how much memory is needed for a receive buffer. The receive socket
    buffer also provides the maximum message size which is checked.

    The receive algorithm is something like:

    1) Receive the first skbuf for a message (or skbufs if multiple are
    needed to determine message length).
    2) Check the message length against the number of bytes in the TCP
    receive queue (tcp_inq()).
    - If all the bytes of the message are in the queue (incluing the
    skbuf received), then proceed with message assembly (it should
    complete with the tcp_read_sock)
    - Else, mark the psock with the number of bytes needed to
    complete the message.
    3) In TCP data ready function, if the psock indicates that we are
    waiting for the rest of the bytes of a messages, check the number
    of queued bytes against that.
    - If there are still not enough bytes for the message, just
    return
    - Else, clear the waiting bytes and proceed to receive the
    skbufs. The message should now be received in one
    tcp_read_sock

    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert
     
  • This patch adds various counters for KCM. These include counters for
    messages and bytes received or sent, as well as counters for number of
    attached/unattached TCP sockets and other error or edge events.

    The statistics are exposed via a proc interface. /proc/net/kcm provides
    statistics per KCM socket and per psock (attached TCP sockets).
    /proc/net/kcm_stats provides aggregate statistics.

    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert