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
     

19 Aug, 2017

1 commit

  • name[] in cma_debugfs_add_one() can only accommodate 16 chars including
    NULL to store sprintf output. It's common for cma device name to be
    larger than 15 chars. This can cause stack corrpution. If the gcc
    stack protector is turned on, this can cause a panic due to stack
    corruption.

    Below is one example trace:

    Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in:
    ffffff8e69a75730
    Call trace:
    dump_backtrace+0x0/0x2c4
    show_stack+0x20/0x28
    dump_stack+0xb8/0xf4
    panic+0x154/0x2b0
    print_tainted+0x0/0xc0
    cma_debugfs_init+0x274/0x290
    do_one_initcall+0x5c/0x168
    kernel_init_freeable+0x1c8/0x280

    Fix the short sprintf buffer in cma_debugfs_add_one() by using
    scnprintf() instead of sprintf().

    Link: http://lkml.kernel.org/r/1502446217-21840-1-git-send-email-guptap@codeaurora.org
    Fixes: f318dd083c81 ("cma: Store a name in the cma structure")
    Signed-off-by: Prakash Gupta
    Acked-by: Laura Abbott
    Cc: Greg Kroah-Hartman
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Prakash Gupta
     

19 Apr, 2017

1 commit


25 Feb, 2017

1 commit

  • Most users of this interface just want to use it with the default
    GFP_KERNEL flags, but for cases where DMA memory is allocated it may be
    called from a different context.

    No functional change yet, just passing through the flag to the
    underlying alloc_contig_range function.

    Link: http://lkml.kernel.org/r/20170127172328.18574-2-l.stach@pengutronix.de
    Signed-off-by: Lucas Stach
    Acked-by: Vlastimil Babka
    Acked-by: Michal Hocko
    Cc: Radim Krcmar
    Cc: Catalin Marinas
    Cc: Will Deacon
    Cc: Chris Zankel
    Cc: Ralf Baechle
    Cc: Paolo Bonzini
    Cc: Alexander Graf
    Cc: Joonsoo Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Lucas Stach
     

18 Jul, 2015

2 commits

  • In CMA, 1 bit in bitmap means 1 << order_per_bits pages so size of
    bitmap is cma->count >> order_per_bits rather than just cma->count.
    This patch fixes it.

    Signed-off-by: Joonsoo Kim
    Acked-by: Michal Nazarewicz
    Cc: Sasha Levin
    Cc: Stefan Strogin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joonsoo Kim
     
  • CMA has alloc/free interface for debugging. It is intended that
    alloc/free occurs in specific CMA region, but, currently, alloc/free
    interface is on root dir due to the bug so we can't select CMA region
    where alloc/free happens.

    This patch fixes this problem by making alloc/free interface per CMA
    region.

    Signed-off-by: Joonsoo Kim
    Acked-by: Michal Nazarewicz
    Cc: Sasha Levin
    Cc: Stefan Strogin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joonsoo Kim
     

16 Apr, 2015

2 commits

  • Like EXPORT_SYMBOL(): the positioning communicates that the macro pertains
    to the immediately preceding function.

    Cc: Dmitry Safonov
    Cc: Michal Nazarewicz
    Cc: Stefan Strogin
    Cc: Marek Szyprowski
    Cc: Joonsoo Kim
    Cc: Pintu Kumar
    Cc: Weijie Yang
    Cc: Laurent Pinchart
    Cc: Vyacheslav Tyrtov
    Cc: Aleksei Mateosian
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • Here are two functions that provide interface to compute/get used size and
    size of biggest free chunk in cma region. Add that information to
    debugfs.

    [akpm@linux-foundation.org: move debug code from cma.c into cma_debug.c]
    [stefan.strogin@gmail.com: move code from cma_get_used() and cma_get_maxchunk() to cma_used_get() and cma_maxchunk_get()]
    Signed-off-by: Dmitry Safonov
    Signed-off-by: Stefan Strogin
    Acked-by: Michal Nazarewicz
    Cc: Marek Szyprowski
    Cc: Joonsoo Kim
    Cc: Pintu Kumar
    Cc: Weijie Yang
    Cc: Laurent Pinchart
    Cc: Vyacheslav Tyrtov
    Cc: Aleksei Mateosian
    Signed-off-by: Stefan Strogin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dmitry Safonov
     

15 Apr, 2015

4 commits

  • s/CONFIG_CMA_ALIGNMENT/0/, per Joonsoo

    Cc: Joonsoo Kim
    Cc: Konrad Rzeszutek Wilk
    Cc: Laura Abbott
    Cc: Marek Szyprowski
    Cc: Sasha Levin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • Provides a userspace interface to trigger a CMA release.

    Usage:

    echo [pages] > free

    This would provide testing/fuzzing access to the CMA release paths.

    [akpm@linux-foundation.org: coding-style fixes]
    [mhocko@suse.cz: fix build]
    Signed-off-by: Sasha Levin
    Acked-by: Joonsoo Kim
    Cc: Marek Szyprowski
    Cc: Laura Abbott
    Cc: Konrad Rzeszutek Wilk
    Signed-off-by: Michal Hocko
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sasha Levin
     
  • Provides a userspace interface to trigger a CMA allocation.

    Usage:

    echo [pages] > alloc

    This would provide testing/fuzzing access to the CMA allocation paths.

    Signed-off-by: Sasha Levin
    Acked-by: Joonsoo Kim
    Cc: Marek Szyprowski
    Cc: Laura Abbott
    Cc: Konrad Rzeszutek Wilk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sasha Levin
     
  • I've noticed that there is no interfaces exposed by CMA which would let me
    fuzz what's going on in there.

    This small patchset exposes some information out to userspace, plus adds
    the ability to trigger allocation and freeing from userspace.

    This patch (of 3):

    Implement a simple debugfs interface to expose information about CMA areas
    in the system.

    Useful for testing/sanity checks for CMA since it was impossible to
    previously retrieve this information in userspace.

    Signed-off-by: Sasha Levin
    Acked-by: Joonsoo Kim
    Cc: Marek Szyprowski
    Cc: Laura Abbott
    Cc: Konrad Rzeszutek Wilk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sasha Levin