01 Sep, 2020

1 commit

  • CMA_MAX_NAME should be visible to CMA's users as they might need it to set
    the name of CMA areas and avoid hardcoding the size locally.
    So this patch moves CMA_MAX_NAME from local header file to include/linux
    header file and removes the hardcode in both hugetlb.c and contiguous.c.

    Signed-off-by: Barry Song
    Signed-off-by: Christoph Hellwig

    Barry Song
     

13 Aug, 2020

1 commit

  • Patch series "mm: fix the names of general cma and hugetlb cma", v2.

    The current code of CMA can only work when users pass a const string as
    name parameter. we need to fix the way to handle names in CMA. On the
    other hand, to avoid name conflicts after enabling CMA_DEBUGFS, each
    hugetlb should get a different CMA name.

    This patch (of 2):

    If users give a name saved in stack, the current code will generate magic
    pointer. if users don't give a name(NULL), kasprintf() will always return
    NULL as we are at the early stage. that means cma_init_reserved_mem()
    will return -ENOMEM if users set name parameter as NULL.

    [natechancellor@gmail.com: return cma->name directly in cma_get_name]
    Link: https://github.com/ClangBuiltLinux/linux/issues/1063
    Link: http://lkml.kernel.org/r/20200623015840.621964-1-natechancellor@gmail.com

    Signed-off-by: Barry Song
    Signed-off-by: Nathan Chancellor
    Signed-off-by: Andrew Morton
    Reviewed-by: Mike Kravetz
    Acked-by: Roman Gushchin
    Link: http://lkml.kernel.org/r/20200616223131.33828-2-song.bao.hua@hisilicon.com
    Signed-off-by: Linus Torvalds

    Barry Song
     

11 Jul, 2020

1 commit

  • debugfs_create_u32_array() allocates a small structure to wrap
    the data and size information about the array. If users ever
    try to remove the file this leads to a leak since nothing ever
    frees this wrapper.

    That said there are no upstream users of debugfs_create_u32_array()
    that'd remove a u32 array file (we only have one u32 array user in
    CMA), so there is no real bug here.

    Make callers pass a wrapper they allocated. This way the lifetime
    management of the wrapper is on the caller, and we can avoid the
    potential leak in debugfs.

    CC: Chucheng Luo
    Signed-off-by: Jakub Kicinski
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: David S. Miller

    Jakub Kicinski
     

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 Apr, 2017

1 commit


15 Aug, 2015

1 commit

  • cma_bitmap_maxno() was marked as static and not static inline, which can
    cause warnings about this function not being used if this file is included
    in a file that does not call that function, and violates the conventions
    used elsewhere. The two options are to move the function implementation
    back to mm/cma.c or make it inline here, and it's simple enough for the
    latter to make sense.

    Signed-off-by: Gregory Fong
    Cc: Joonsoo Kim
    Cc: Sasha Levin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Gregory Fong
     

15 Apr, 2015

2 commits

  • 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