17 Apr, 2019

1 commit

  • [ Upstream commit 5f074f3e192f10c9fade898b9b3b8812e3d83342 ]

    A recent optimization in Clang (r355672) lowers comparisons of the
    return value of memcmp against zero to comparisons of the return value
    of bcmp against zero. This helps some platforms that implement bcmp
    more efficiently than memcmp. glibc simply aliases bcmp to memcmp, but
    an optimized implementation is in the works.

    This results in linkage failures for all targets with Clang due to the
    undefined symbol. For now, just implement bcmp as a tailcail to memcmp
    to unbreak the build. This routine can be further optimized in the
    future.

    Other ideas discussed:

    * A weak alias was discussed, but breaks for architectures that define
    their own implementations of memcmp since aliases to declarations are
    not permitted (only definitions). Arch-specific memcmp
    implementations typically declare memcmp in C headers, but implement
    them in assembly.

    * -ffreestanding also is used sporadically throughout the kernel.

    * -fno-builtin-bcmp doesn't work when doing LTO.

    Link: https://bugs.llvm.org/show_bug.cgi?id=41035
    Link: https://code.woboq.org/userspace/glibc/string/memcmp.c.html#bcmp
    Link: https://github.com/llvm/llvm-project/commit/8e16d73346f8091461319a7dfc4ddd18eedcff13
    Link: https://github.com/ClangBuiltLinux/linux/issues/416
    Link: http://lkml.kernel.org/r/20190313211335.165605-1-ndesaulniers@google.com
    Signed-off-by: Nick Desaulniers
    Reported-by: Nathan Chancellor
    Reported-by: Adhemerval Zanella
    Suggested-by: Arnd Bergmann
    Suggested-by: James Y Knight
    Suggested-by: Masahiro Yamada
    Suggested-by: Nathan Chancellor
    Suggested-by: Rasmus Villemoes
    Acked-by: Steven Rostedt (VMware)
    Reviewed-by: Nathan Chancellor
    Tested-by: Nathan Chancellor
    Reviewed-by: Masahiro Yamada
    Reviewed-by: Andy Shevchenko
    Cc: David Laight
    Cc: Rasmus Villemoes
    Cc: Namhyung Kim
    Cc: Greg Kroah-Hartman
    Cc: Alexander Shishkin
    Cc: Dan Williams
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Nick Desaulniers
     

06 Apr, 2019

2 commits

  • [ Upstream commit de9c0d49d85dc563549972edc5589d195cd5e859 ]

    While building arm32 allyesconfig, I ran into the following errors:

    arch/arm/lib/xor-neon.c:17:2: error: You should compile this file with
    '-mfloat-abi=softfp -mfpu=neon'

    In file included from lib/raid6/neon1.c:27:
    /home/nathan/cbl/prebuilt/lib/clang/8.0.0/include/arm_neon.h:28:2:
    error: "NEON support not enabled"

    Building V=1 showed NEON_FLAGS getting passed along to Clang but
    __ARM_NEON__ was not getting defined. Ultimately, it boils down to Clang
    only defining __ARM_NEON__ when targeting armv7, rather than armv6k,
    which is the '-march' value for allyesconfig.

    >From lib/Basic/Targets/ARM.cpp in the Clang source:

    // This only gets set when Neon instructions are actually available, unlike
    // the VFP define, hence the soft float and arch check. This is subtly
    // different from gcc, we follow the intent which was that it should be set
    // when Neon instructions are actually available.
    if ((FPU & NeonFPU) && !SoftFloat && ArchVersion >= 7) {
    Builder.defineMacro("__ARM_NEON", "1");
    Builder.defineMacro("__ARM_NEON__");
    // current AArch32 NEON implementations do not support double-precision
    // floating-point even when it is present in VFP.
    Builder.defineMacro("__ARM_NEON_FP",
    "0x" + Twine::utohexstr(HW_FP & ~HW_FP_DP));
    }

    Ard Biesheuvel recommended explicitly adding '-march=armv7-a' at the
    beginning of the NEON_FLAGS definitions so that __ARM_NEON__ always gets
    definined by Clang. This doesn't functionally change anything because
    that code will only run where NEON is supported, which is implicitly
    armv7.

    Link: https://github.com/ClangBuiltLinux/linux/issues/287

    Suggested-by: Ard Biesheuvel
    Signed-off-by: Nathan Chancellor
    Acked-by: Nicolas Pitre
    Reviewed-by: Nick Desaulniers
    Reviewed-by: Stefan Agner
    Signed-off-by: Russell King
    Signed-off-by: Sasha Levin

    Nathan Chancellor
     
  • [ Upstream commit 02106f883cd745523f7766d90a739f983f19e650 ]

    Since kprobe breakpoing handler is using bsearch(), probing on this
    routine can cause recursive breakpoint problem.

    int3
    ->do_int3()
    ->ftrace_int3_handler()
    ->ftrace_location()
    ->ftrace_location_range()
    ->bsearch() -> int3

    Prohibit probing on bsearch().

    Signed-off-by: Andrea Righi
    Acked-by: Masami Hiramatsu
    Cc: Alexander Shishkin
    Cc: Arnaldo Carvalho de Melo
    Cc: Jiri Olsa
    Cc: Linus Torvalds
    Cc: Mathieu Desnoyers
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/154998813406.31052.8791425358974650922.stgit@devbox
    Signed-off-by: Ingo Molnar
    Signed-off-by: Sasha Levin

    Andrea Righi
     

03 Apr, 2019

1 commit

  • [ Upstream commit 408f13ef358aa5ad56dc6230c2c7deb92cf462b1 ]

    As it stands if a shrink is delayed because of an outstanding
    rehash, we will go into a rescheduling loop without ever doing
    the rehash.

    This patch fixes this by still carrying out the rehash and then
    rescheduling so that we can shrink after the completion of the
    rehash should it still be necessary.

    The return value of EEXIST captures this case and other cases
    (e.g., another thread expanded/rehashed the table at the same
    time) where we should still proceed with the rehash.

    Fixes: da20420f83ea ("rhashtable: Add nested tables")
    Reported-by: Josh Elsasser
    Signed-off-by: Herbert Xu
    Tested-by: Josh Elsasser
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Herbert Xu
     

24 Mar, 2019

1 commit

  • [ Upstream commit bb2ba2d75a2d673e76ddaf13a9bd30d6a8b1bb08 ]

    Fix the creation of shortcuts for which the length of the index key value
    is an exact multiple of the machine word size. The problem is that the
    code that blanks off the unused bits of the shortcut value malfunctions if
    the number of bits in the last word equals machine word size. This is due
    to the "<
    Signed-off-by: James Morris
    Signed-off-by: Sasha Levin

    David Howells
     

14 Mar, 2019

1 commit

  • [ Upstream commit db7ddeab3ce5d64c9696e70d61f45ea9909cd196 ]

    There is a copy and paste bug so we set "config->test_driver" to NULL
    twice instead of setting "config->test_fs". Smatch complains that it
    leads to a double free:

    lib/test_kmod.c:840 __kmod_config_init() warn: 'config->test_fs' double freed

    Link: http://lkml.kernel.org/r/20190121140011.GA14283@kadam
    Fixes: d9c6a72d6fa2 ("kmod: add test driver to stress test the module loader")
    Signed-off-by: Dan Carpenter
    Acked-by: Luis Chamberlain
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Dan Carpenter
     

13 Feb, 2019

2 commits

  • [ Upstream commit fc42a689c4c097859e5bd37b5ea11b60dc426df6 ]

    The test_insert_dup() function from lib/test_rhashtable.c passes a
    pointer to a stack object to rhltable_init(). Allocate the hash table
    dynamically to avoid that the following is reported with object
    debugging enabled:

    ODEBUG: object (ptrval) is on stack (ptrval), but NOT annotated.
    WARNING: CPU: 0 PID: 1 at lib/debugobjects.c:368 __debug_object_init+0x312/0x480
    Modules linked in:
    EIP: __debug_object_init+0x312/0x480
    Call Trace:
    ? debug_object_init+0x1a/0x20
    ? __init_work+0x16/0x30
    ? rhashtable_init+0x1e1/0x460
    ? sched_clock_cpu+0x57/0xe0
    ? rhltable_init+0xb/0x20
    ? test_insert_dup+0x32/0x20f
    ? trace_hardirqs_on+0x38/0xf0
    ? ida_dump+0x10/0x10
    ? jhash+0x130/0x130
    ? my_hashfn+0x30/0x30
    ? test_rht_init+0x6aa/0xab4
    ? ida_dump+0x10/0x10
    ? test_rhltable+0xc5c/0xc5c
    ? do_one_initcall+0x67/0x28e
    ? trace_hardirqs_off+0x22/0xe0
    ? restore_all_kernel+0xf/0x70
    ? trace_hardirqs_on_thunk+0xc/0x10
    ? restore_all_kernel+0xf/0x70
    ? kernel_init_freeable+0x142/0x213
    ? rest_init+0x230/0x230
    ? kernel_init+0x10/0x110
    ? schedule_tail_wrapper+0x9/0xc
    ? ret_from_fork+0x19/0x24

    Cc: Thomas Graf
    Cc: Herbert Xu
    Cc: netdev@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Bart Van Assche
    Acked-by: Herbert Xu
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Bart Van Assche
     
  • [ Upstream commit 0464ed24380905d640030d368cd84a4e4d1e15e2 ]

    Currently seq_buf_puts() will happily create a non null-terminated
    string for you in the buffer. This is particularly dangerous if the
    buffer is on the stack.

    For example:

    char buf[8];
    char secret = "secret";
    struct seq_buf s;

    seq_buf_init(&s, buf, sizeof(buf));
    seq_buf_puts(&s, "foo");
    printk("Message is %s\n", buf);

    Can result in:

    Message is fooªªªªªsecret

    We could require all users to memset() their buffer to zero before
    use. But that seems likely to be forgotten and lead to bugs.

    Instead we can change seq_buf_puts() to always leave the buffer in a
    null-terminated state.

    The only downside is that this makes the buffer 1 character smaller
    for seq_buf_puts(), but that seems like a good trade off.

    Link: http://lkml.kernel.org/r/20181019042109.8064-1-mpe@ellerman.id.au

    Acked-by: Kees Cook
    Signed-off-by: Michael Ellerman
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Sasha Levin

    Michael Ellerman
     

23 Jan, 2019

1 commit

  • commit fbfaf851902cd9293f392f3a1735e0543016d530 upstream.

    If an input number x for int_sqrt64() has the highest bit set, then
    fls64(x) is 64. (1UL << 64) is an overflow and breaks the algorithm.

    Subtracting 1 is a better guess for the initial value of m anyway and
    that's what also done in int_sqrt() implicitly [*].

    [*] Note how int_sqrt() uses __fls() with two underscores, which already
    returns the proper raw bit number.

    In contrast, int_sqrt64() used fls64(), and that returns bit numbers
    illogically starting at 1, because of error handling for the "no
    bits set" case. Will points out that he bug probably is due to a
    copy-and-paste error from the regular int_sqrt() case.

    Signed-off-by: Florian La Roche
    Acked-by: Will Deacon
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Florian La Roche
     

13 Jan, 2019

2 commits

  • commit 10fdf838e5f540beca466e9d1325999c072e5d3f upstream.

    On several arches, virt_to_phys() is in io.h

    Build fails without it:

    CC lib/test_debug_virtual.o
    lib/test_debug_virtual.c: In function 'test_debug_virtual_init':
    lib/test_debug_virtual.c:26:7: error: implicit declaration of function 'virt_to_phys' [-Werror=implicit-function-declaration]
    pa = virt_to_phys(va);
    ^

    Fixes: e4dace361552 ("lib: add test module for CONFIG_DEBUG_VIRTUAL")
    CC: stable@vger.kernel.org
    Signed-off-by: Christophe Leroy
    Reviewed-by: Kees Cook
    Signed-off-by: Michael Ellerman
    Signed-off-by: Greg Kroah-Hartman

    Christophe Leroy
     
  • commit e213574a449f7a57d4202c1869bbc7680b6b5521 upstream.

    We cannot build these files with clang as it does not allow altivec
    instructions in assembly when -msoft-float is passed.

    Jinsong Ji wrote:
    > We currently disable Altivec/VSX support when enabling soft-float. So
    > any usage of vector builtins will break.
    >
    > Enable Altivec/VSX with soft-float may need quite some clean up work, so
    > I guess this is currently a limitation.
    >
    > Removing -msoft-float will make it work (and we are lucky that no
    > floating point instructions will be generated as well).

    This is a workaround until the issue is resolved in clang.

    Link: https://bugs.llvm.org/show_bug.cgi?id=31177
    Link: https://github.com/ClangBuiltLinux/linux/issues/239
    Signed-off-by: Joel Stanley
    Reviewed-by: Nick Desaulniers
    Signed-off-by: Michael Ellerman
    Signed-off-by: Nathan Chancellor
    Signed-off-by: Greg Kroah-Hartman

    Joel Stanley
     

17 Dec, 2018

1 commit

  • [ Upstream commit 8de456cf87ba863e028c4dd01bae44255ce3d835 ]

    CONFIG_DEBUG_OBJECTS_RCU_HEAD does not play well with kmemleak due to
    recursive calls.

    fill_pool
    kmemleak_ignore
    make_black_object
    put_object
    __call_rcu (kernel/rcu/tree.c)
    debug_rcu_head_queue
    debug_object_activate
    debug_object_init
    fill_pool
    kmemleak_ignore
    make_black_object
    ...

    So add SLAB_NOLEAKTRACE to kmem_cache_create() to not register newly
    allocated debug objects at all.

    Link: http://lkml.kernel.org/r/20181126165343.2339-1-cai@gmx.us
    Signed-off-by: Qian Cai
    Suggested-by: Catalin Marinas
    Acked-by: Waiman Long
    Acked-by: Catalin Marinas
    Cc: Thomas Gleixner
    Cc: Yang Shi
    Cc: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Qian Cai
     

13 Dec, 2018

1 commit

  • [ Upstream commit 8bb0a88600f0267cfcc245d34f8c4abe8c282713 ]

    In the case where eq->fw->size > PAGE_SIZE the error return rc
    is being set to EINVAL however this is being overwritten to
    rc = req->fw->size because the error exit path via label 'out' is
    not being taken. Fix this by adding the jump to the error exit
    path 'out'.

    Detected by CoverityScan, CID#1453465 ("Unused value")

    Fixes: c92316bf8e94 ("test_firmware: add batched firmware tests")
    Signed-off-by: Colin Ian King
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Colin Ian King
     

08 Dec, 2018

1 commit

  • commit b1286ed7158e9b62787508066283ab0b8850b518 upstream.

    New versions of gcc reasonably warn about the odd pattern of

    strncpy(p, q, strlen(q));

    which really doesn't make sense: the strncpy() ends up being just a slow
    and odd way to write memcpy() in this case.

    Apparently there was a patch for this floating around earlier, but it
    got lost.

    Acked-again-by: Andy Shevchenko
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Linus Torvalds
     

06 Dec, 2018

1 commit

  • commit 5618cf031fecda63847cafd1091e7b8bd626cdb1 upstream.

    We free the misc device string twice on rmmod; fix this. Without this
    we cannot remove the module without crashing.

    Link: http://lkml.kernel.org/r/20181124050500.5257-1-mcgrof@kernel.org
    Signed-off-by: Luis Chamberlain
    Reported-by: Randy Dunlap
    Reviewed-by: Andrew Morton
    Cc: [4.12+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Luis Chamberlain
     

27 Nov, 2018

1 commit

  • [ Upstream commit 313a06e636808387822af24c507cba92703568b1 ]

    The lib/raid6/test fails to build the neon objects
    on arm64 because the correct machine type is 'aarch64'.

    Once this is correctly enabled, the neon recovery objects
    need to be added to the build.

    Reviewed-by: Ard Biesheuvel
    Signed-off-by: Jeremy Linton
    Signed-off-by: Catalin Marinas
    Signed-off-by: Sasha Levin

    Jeremy Linton
     

21 Nov, 2018

1 commit

  • commit 1c23b4108d716cc848b38532063a8aca4f86add8 upstream.

    gcc-8 complains about the prototype for this function:

    lib/ubsan.c:432:1: error: ignoring attribute 'noreturn' in declaration of a built-in function '__ubsan_handle_builtin_unreachable' because it conflicts with attribute 'const' [-Werror=attributes]

    This is actually a GCC's bug. In GCC internals
    __ubsan_handle_builtin_unreachable() declared with both 'noreturn' and
    'const' attributes instead of only 'noreturn':

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84210

    Workaround this by removing the noreturn attribute.

    [aryabinin: add information about GCC bug in changelog]
    Link: http://lkml.kernel.org/r/20181107144516.4587-1-aryabinin@virtuozzo.com
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Andrey Ryabinin
    Acked-by: Olof Johansson
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     

14 Nov, 2018

1 commit

  • [ Upstream commit 9506a7425b094d2f1d9c877ed5a78f416669269b ]

    It was found that when debug_locks was turned off because of a problem
    found by the lockdep code, the system performance could drop quite
    significantly when the lock_stat code was also configured into the
    kernel. For instance, parallel kernel build time on a 4-socket x86-64
    server nearly doubled.

    Further analysis into the cause of the slowdown traced back to the
    frequent call to debug_locks_off() from the __lock_acquired() function
    probably due to some inconsistent lockdep states with debug_locks
    off. The debug_locks_off() function did an unconditional atomic xchg
    to write a 0 value into debug_locks which had already been set to 0.
    This led to severe cacheline contention in the cacheline that held
    debug_locks. As debug_locks is being referenced in quite a few different
    places in the kernel, this greatly slow down the system performance.

    To prevent that trashing of debug_locks cacheline, lock_acquired()
    and lock_contended() now checks the state of debug_locks before
    proceeding. The debug_locks_off() function is also modified to check
    debug_locks before calling __debug_locks_off().

    Signed-off-by: Waiman Long
    Cc: Andrew Morton
    Cc: Linus Torvalds
    Cc: Paul E. McKenney
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Will Deacon
    Link: http://lkml.kernel.org/r/1539913518-15598-1-git-send-email-longman@redhat.com
    Signed-off-by: Ingo Molnar
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Waiman Long
     

16 Oct, 2018

1 commit


12 Oct, 2018

2 commits

  • Boris writes:
    "mdt: fix for 4.19-rc8

    * Fix a stack overflow in lib/bch.c"

    * tag 'mtd/fixes-for-4.19-rc8' of git://git.infradead.org/linux-mtd:
    lib/bch: fix possible stack overrun

    Greg Kroah-Hartman
     
  • The previous patch introduced very large kernel stack usage and a Makefile
    change to hide the warning about it.

    From what I can tell, a number of things went wrong here:

    - The BCH_MAX_T constant was set to the maximum value for 'n',
    not the maximum for 't', which is much smaller.

    - The stack usage is actually larger than the entire kernel stack
    on some architectures that can use 4KB stacks (m68k, sh, c6x), which
    leads to an immediate overrun.

    - The justification in the patch description claimed that nothing
    changed, however that is not the case even without the two points above:
    the configuration is machine specific, and most boards never use the
    maximum BCH_ECC_WORDS() length but instead have something much smaller.
    That maximum would only apply to machines that use both the maximum
    block size and the maximum ECC strength.

    The largest value for 't' that I could find is '32', which in turn leads
    to a 60 byte array instead of 2048 bytes. Making it '64' for future
    extension seems also worthwhile, with 120 bytes for the array. Anything
    larger won't fit into the OOB area on NAND flash.

    With that changed, the warning can be enabled again.

    Only linux-4.19+ contains the breakage, so this is only needed
    as a stable backport if it does not make it into the release.

    Fixes: 02361bc77888 ("lib/bch: Remove VLA usage")
    Reported-by: Ard Biesheuvel
    Cc: stable@vger.kernel.org
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Boris Brezillon

    Arnd Bergmann
     

11 Oct, 2018

1 commit

  • Steven writes:
    "vsprint fix:

    It was reported that trace_printk() was not reporting properly
    values that came after a dereference pointer.

    trace_printk() utilizes vbin_printf() and bstr_printf() to keep the
    overhead of tracing down. vbin_printf() does not do any conversions
    and just stors the string format and the raw arguments into the
    buffer. bstr_printf() is used to read the buffer and does the
    conversions to complete the printf() output.

    This can be troublesome with dereferenced pointers because the
    reference may be different from the time vbin_printf() is called to
    the time bstr_printf() is called. To fix this, a prior commit changed
    vbin_printf() to convert dereferenced pointers into strings and load
    the converted string into the buffer. But the change to bstr_printf()
    had an off-by-one error and didn't account for the nul character at
    the end of the string and this corrupted the rest of the values in
    the format that came after a dereferenced pointer."

    * tag 'trace-v4.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
    vsprintf: Fix off-by-one bug in bstr_printf() processing dereferenced pointers

    Greg Kroah-Hartman
     

05 Oct, 2018

1 commit

  • The functions vbin_printf() and bstr_printf() are used by trace_printk() to
    try to keep the overhead down during printing. trace_printk() uses
    vbin_printf() at the time of execution, as it only scans the fmt string to
    record the printf values into the buffer, and then uses vbin_printf() to do
    the conversions to print the string based on the format and the saved
    values in the buffer.

    This is an issue for dereferenced pointers, as before commit 841a915d20c7b,
    the processing of the pointer could happen some time after the pointer value
    was recorded (reading the trace buffer). This means the processing of the
    value at a later time could show different results, or even crash the
    system, if the pointer no longer existed.

    Commit 841a915d20c7b addressed this by processing dereferenced pointers at
    the time of execution and save the result in the ring buffer as a string.
    The bstr_printf() would then treat these pointers as normal strings, and
    print the value. But there was an off-by-one bug here, where after
    processing the argument, it move the pointer only "strlen(arg)" which made
    the arg pointer not point to the next argument in the ring buffer, but
    instead point to the nul character of the last argument. This causes any
    values after a dereferenced pointer to be corrupted.

    Cc: stable@vger.kernel.org
    Fixes: 841a915d20c7b ("vsprintf: Do not have bprintf dereference pointers")
    Reported-by: Nikolay Borisov
    Tested-by: Nikolay Borisov
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     

02 Oct, 2018

1 commit

  • This fixes a regression introduced by faa16bc404d72a5 ("lib: Use
    existing define with polynomial").

    The cleanup added a dependency on include/linux, which broke the PowerPC
    boot wrapper/decompresser when KERNEL_XZ is enabled:

    BOOTCC arch/powerpc/boot/decompress.o
    In file included from arch/powerpc/boot/../../../lib/decompress_unxz.c:233,
    from arch/powerpc/boot/decompress.c:42:
    arch/powerpc/boot/../../../lib/xz/xz_crc32.c:18:10: fatal error:
    linux/crc32poly.h: No such file or directory
    #include
    ^~~~~~~~~~~~~~~~~~~

    The powerpc decompresser is a hairy corner of the kernel. Even while building
    a 64-bit kernel it needs to build a 32-bit binary and therefore avoid including
    files from include/linux.

    This allows users of the xz library to avoid including headers from
    'include/linux/' while still achieving the cleanup of the magic number.

    Fixes: faa16bc404d72a5 ("lib: Use existing define with polynomial")
    Reported-by: Meelis Roos
    Reported-by: kbuild test robot
    Suggested-by: Christophe LEROY
    Signed-off-by: Joel Stanley
    Tested-by: Meelis Roos
    Signed-off-by: Michael Ellerman

    Joel Stanley
     

05 Sep, 2018

1 commit


03 Sep, 2018

1 commit

  • Pull core fixes from Thomas Gleixner:
    "A small set of updates for core code:

    - Prevent tracing in functions which are called from trace patching
    via stop_machine() to prevent executing half patched function trace
    entries.

    - Remove old GCC workarounds

    - Remove pointless includes of notifier.h"

    * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    objtool: Remove workaround for unreachable warnings from old GCC
    notifier: Remove notifier header file wherever not used
    watchdog: Mark watchdog touch functions as notrace

    Linus Torvalds
     

30 Aug, 2018

1 commit


28 Aug, 2018

1 commit

  • Pull networking fixes from David Miller:

    1) ICE, E1000, IGB, IXGBE, and I40E bug fixes from the Intel folks.

    2) Better fix for AB-BA deadlock in packet scheduler code, from Cong
    Wang.

    3) bpf sockmap fixes (zero sized key handling, etc.) from Daniel
    Borkmann.

    4) Send zero IPID in TCP resets and SYN-RECV state ACKs, to prevent
    attackers using it as a side-channel. From Eric Dumazet.

    5) Memory leak in mediatek bluetooth driver, from Gustavo A. R. Silva.

    6) Hook up rt->dst.input of ipv6 anycast routes properly, from Hangbin
    Liu.

    7) hns and hns3 bug fixes from Huazhong Tan.

    8) Fix RIF leak in mlxsw driver, from Ido Schimmel.

    9) iova range check fix in vhost, from Jason Wang.

    10) Fix hang in do_tcp_sendpages() with tls, from John Fastabend.

    11) More r8152 chips need to disable RX aggregation, from Kai-Heng Feng.

    12) Memory exposure in TCA_U32_SEL handling, from Kees Cook.

    13) TCP BBR congestion control fixes from Kevin Yang.

    14) hv_netvsc, ignore non-PCI devices, from Stephen Hemminger.

    15) qed driver fixes from Tomer Tayar.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (77 commits)
    net: sched: Fix memory exposure from short TCA_U32_SEL
    qed: fix spelling mistake "comparsion" -> "comparison"
    vhost: correctly check the iova range when waking virtqueue
    qlge: Fix netdev features configuration.
    net: macb: do not disable MDIO bus at open/close time
    Revert "net: stmmac: fix build failure due to missing COMMON_CLK dependency"
    net: macb: Fix regression breaking non-MDIO fixed-link PHYs
    mlxsw: spectrum_switchdev: Do not leak RIFs when removing bridge
    i40e: fix condition of WARN_ONCE for stat strings
    i40e: Fix for Tx timeouts when interface is brought up if DCB is enabled
    ixgbe: fix driver behaviour after issuing VFLR
    ixgbe: Prevent unsupported configurations with XDP
    ixgbe: Replace GFP_ATOMIC with GFP_KERNEL
    igb: Replace mdelay() with msleep() in igb_integrated_phy_loopback()
    igb: Replace GFP_ATOMIC with GFP_KERNEL in igb_sw_init()
    igb: Use an advanced ctx descriptor for launchtime
    e1000: ensure to free old tx/rx rings in set_ringparam()
    e1000: check on netif_running() before calling e1000_up()
    ixgb: use dma_zalloc_coherent instead of allocator/memset
    ice: Trivial formatting fixes
    ...

    Linus Torvalds
     

27 Aug, 2018

1 commit

  • Pull IDA updates from Matthew Wilcox:
    "A better IDA API:

    id = ida_alloc(ida, GFP_xxx);
    ida_free(ida, id);

    rather than the cumbersome ida_simple_get(), ida_simple_remove().

    The new IDA API is similar to ida_simple_get() but better named. The
    internal restructuring of the IDA code removes the bitmap
    preallocation nonsense.

    I hope the net -200 lines of code is convincing"

    * 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax: (29 commits)
    ida: Change ida_get_new_above to return the id
    ida: Remove old API
    test_ida: check_ida_destroy and check_ida_alloc
    test_ida: Convert check_ida_conv to new API
    test_ida: Move ida_check_max
    test_ida: Move ida_check_leaf
    idr-test: Convert ida_check_nomem to new API
    ida: Start new test_ida module
    target/iscsi: Allocate session IDs from an IDA
    iscsi target: fix session creation failure handling
    drm/vmwgfx: Convert to new IDA API
    dmaengine: Convert to new IDA API
    ppc: Convert vas ID allocation to new IDA API
    media: Convert entity ID allocation to new IDA API
    ppc: Convert mmu context allocation to new IDA API
    Convert net_namespace to new IDA API
    cb710: Convert to new IDA API
    rsxx: Convert to new IDA API
    osd: Convert to new IDA API
    sd: Convert to new IDA API
    ...

    Linus Torvalds
     

24 Aug, 2018

1 commit

  • The font files contain bit masks for characters in the cp437 character
    set, and comments showing what character this is supposed to be.

    This only makes sense when the terminal used to view the files is set to
    the same codepage, but all other files in the kernel now use utf-8
    encoding.

    This changes those comments to utf-8 as well, for consistency.

    Link: http://lkml.kernel.org/r/20180724111600.4158975-3-arnd@arndb.de
    Signed-off-by: Arnd Bergmann
    Cc: Greg Kroah-Hartman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     

23 Aug, 2018

7 commits

  • rhashtable_init() may fail due to -ENOMEM, thus making the entire api
    unusable. This patch removes this scenario, however unlikely. In order
    to guarantee memory allocation, this patch always ends up doing
    GFP_KERNEL|__GFP_NOFAIL for both the tbl as well as
    alloc_bucket_spinlocks().

    Upon the first table allocation failure, we shrink the size to the
    smallest value that makes sense and retry with __GFP_NOFAIL semantics.
    With the defaults, this means that from 64 buckets, we retry with only 4.
    Any later issues regarding performance due to collisions or larger table
    resizing (when more memory becomes available) is the least of our
    problems.

    Link: http://lkml.kernel.org/r/20180712185241.4017-9-manfred@colorfullife.com
    Signed-off-by: Davidlohr Bueso
    Signed-off-by: Manfred Spraul
    Acked-by: Herbert Xu
    Cc: Dmitry Vyukov
    Cc: Kees Cook
    Cc: Michael Kerrisk
    Cc: Michal Hocko
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Davidlohr Bueso
     
  • As of ce91f6ee5b3b ("mm: kvmalloc does not fallback to vmalloc for
    incompatible gfp flags") we can simplify the caller and trust kvzalloc()
    to just do the right thing. For the case of the GFP_ATOMIC context, we
    can drop the __GFP_NORETRY flag for obvious reasons, and for the
    __GFP_NOWARN case, however, it is changed such that the caller passes the
    flag instead of making bucket_table_alloc() handle it.

    This slightly changes the gfp flags passed on to nested_table_alloc() as
    it will now also use GFP_ATOMIC | __GFP_NOWARN. However, I consider this
    a positive consequence as for the same reasons we want nowarn semantics in
    bucket_table_alloc().

    [manfred@colorfullife.com: commit id extended to 12 digits, line wraps updated]
    Link: http://lkml.kernel.org/r/20180712185241.4017-8-manfred@colorfullife.com
    Signed-off-by: Davidlohr Bueso
    Signed-off-by: Manfred Spraul
    Acked-by: Michal Hocko
    Cc: Dmitry Vyukov
    Cc: Herbert Xu
    Cc: Kees Cook
    Cc: Michael Kerrisk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Davidlohr Bueso
     
  • On a big endian cpu, test_hexdump fails as follows. The logs show that
    bytes are expected in reversed order.

    [...]
    test_hexdump: Len: 24 buflen: 130 strlen: 97
    test_hexdump: Result: 97 'be32db7b 0a1893b2 70bac424 7d83349b a69c31ad 9c0face9 .2.{....p..$}.4...1.....'
    test_hexdump: Expect: 97 '7bdb32be b293180a 24c4ba70 9b34837d ad319ca6 e9ac0f9c .2.{....p..$}.4...1.....'
    test_hexdump: Len: 8 buflen: 130 strlen: 77
    test_hexdump: Result: 77 'be32db7b0a1893b2 .2.{....'
    test_hexdump: Expect: 77 'b293180a7bdb32be .2.{....'
    test_hexdump: Len: 6 buflen: 131 strlen: 87
    test_hexdump: Result: 87 'be32 db7b 0a18 .2.{..'
    test_hexdump: Expect: 87 '32be 7bdb 180a .2.{..'
    test_hexdump: Len: 24 buflen: 131 strlen: 97
    test_hexdump: Result: 97 'be32db7b 0a1893b2 70bac424 7d83349b a69c31ad 9c0face9 .2.{....p..$}.4...1.....'
    test_hexdump: Expect: 97 '7bdb32be b293180a 24c4ba70 9b34837d ad319ca6 e9ac0f9c .2.{....p..$}.4...1.....'
    test_hexdump: Len: 32 buflen: 131 strlen: 101
    test_hexdump: Result: 101 'be32db7b0a1893b2 70bac4247d83349b a69c31ad9c0face9 4cd1199943b1af0c .2.{....p..$}.4...1.....L...C...'
    test_hexdump: Expect: 101 'b293180a7bdb32be 9b34837d24c4ba70 e9ac0f9cad319ca6 0cafb1439919d14c .2.{....p..$}.4...1.....L...C...'
    test_hexdump: failed 801 out of 1184 tests

    This patch fixes it.

    Link: http://lkml.kernel.org/r/f3112437f62c2f48300535510918e8be1dceacfb.1533610877.git.christophe.leroy@c-s.fr
    Fixes: 64d1d77a44697 ("hexdump: introduce test suite")
    Signed-off-by: Christophe Leroy
    Reviewed-by: Andy Shevchenko
    Cc: Michael Ellerman
    Cc: rashmica
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christophe Leroy
     
  • It seems contributors follow the style of Kconfig entries where explicit
    'default n' is present. The default 'default' is 'n' already, thus, drop
    these lines from Kconfig to make it more clear.

    Link: http://lkml.kernel.org/r/20180719085131.79541-1-andriy.shevchenko@linux.intel.com
    Signed-off-by: Andy Shevchenko
    Acked-by: Coly Li
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Shevchenko
     
  • Patch series "add crc64 calculation as kernel library", v5.

    This patchset adds basic implementation of crc64 calculation as a Linux
    kernel library. Since bcache already does crc64 by itself, this patchset
    also modifies bcache code to use the new crc64 library routine.

    Currently bcache is the only user of crc64 calculation, another potential
    user is bcachefs which is on the way to be in mainline kernel. Therefore
    it makes sense to make crc64 calculation to be a public library.

    bcache uses crc64 as storage checksum, if a change of crc lib routines
    results an inconsistent result, the unmatched checksum may make bcache
    'think' the on-disk is corrupted, such a change should be avoided or
    detected as early as possible. Therefore a patch is being prepared which
    adds a crc test framework, to check consistency of different calculations.

    This patch (of 2):

    Add the re-write crc64 calculation routines for Linux kernel. The CRC64
    polynomical arithmetic follows ECMA-182 specification, inspired by CRC
    paper of Dr. Ross N. Williams (see
    http://www.ross.net/crc/download/crc_v3.txt) and other public domain
    implementations.

    All the changes work in this way,
    - When Linux kernel is built, host program lib/gen_crc64table.c will be
    compiled to lib/gen_crc64table and executed.
    - The output of gen_crc64table execution is an array called as lookup
    table (a.k.a POLY 0x42f0e1eba9ea369) which contain 256 64-bit long
    numbers, this table is dumped into header file lib/crc64table.h.
    - Then the header file is included by lib/crc64.c for normal 64bit crc
    calculation.
    - Function declaration of the crc64 calculation routines is placed in
    include/linux/crc64.h

    Currently bcache is the only user of crc64_be(), another potential user is
    bcachefs which is on the way to be in mainline kernel. Therefore it makes
    sense to move crc64 calculation into lib/crc64.c as public code.

    [colyli@suse.de: fix review comments from v4]
    Link: http://lkml.kernel.org/r/20180726053352.2781-2-colyli@suse.de
    Link: http://lkml.kernel.org/r/20180718165545.1622-2-colyli@suse.de
    Signed-off-by: Coly Li
    Co-developed-by: Andy Shevchenko
    Signed-off-by: Andy Shevchenko
    Reviewed-by: Hannes Reinecke
    Cc: Greg Kroah-Hartman
    Cc: Andy Shevchenko
    Cc: Michael Lyle
    Cc: Kent Overstreet
    Cc: Thomas Gleixner
    Cc: Kate Stewart
    Cc: Eric Biggers
    Cc: Randy Dunlap
    Cc: Noah Massey
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Coly Li
     
  • The pointer foo is local to the source and does not need to be
    in global scope, so make it static.

    Cleans up sparse warning:
    symbol 'foo' was not declared. Should it be static?

    Link: http://lkml.kernel.org/r/20180624112206.5722-1-colin.king@canonical.com
    Signed-off-by: Colin Ian King
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Colin Ian King
     
  • nbits == 0 is safe to be supplied to the function body, so remove
    unnecessary checks in bitmap_to_arr32() and bitmap_from_arr32().

    Link: http://lkml.kernel.org/r/20180531131914.44352-1-andriy.shevchenko@linux.intel.com
    Signed-off-by: Andy Shevchenko
    Acked-by: Yury Norov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Shevchenko
     

22 Aug, 2018

3 commits