Skip to content
Snippets Groups Projects
  1. Mar 02, 2020
  2. Feb 21, 2020
  3. Feb 20, 2020
  4. Feb 14, 2020
    • Jason A. Donenfeld's avatar
      crypto: chacha20poly1305 - prevent integer overflow on large input · c9cc0517
      Jason A. Donenfeld authored
      
      This code assigns src_len (size_t) to sl (int), which causes problems
      when src_len is very large. Probably nobody in the kernel should be
      passing this much data to chacha20poly1305 all in one go anyway, so I
      don't think we need to change the algorithm or introduce larger types
      or anything. But we should at least error out early in this case and
      print a warning so that we get reports if this does happen and can look
      into why anybody is possibly passing it that much data or if they're
      accidently passing -1 or similar.
      
      Fixes: d95312a3 ("crypto: lib/chacha20poly1305 - reimplement crypt_from_sg() routine")
      Cc: Ard Biesheuvel <ardb@kernel.org>
      Cc: stable@vger.kernel.org # 5.5+
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Acked-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      c9cc0517
  5. Feb 10, 2020
  6. Feb 05, 2020
  7. Feb 04, 2020
  8. Feb 03, 2020
    • Masahiro Yamada's avatar
      kbuild: rename hostprogs-y/always to hostprogs/always-y · 5f2fb52f
      Masahiro Yamada authored
      
      In old days, the "host-progs" syntax was used for specifying host
      programs. It was renamed to the current "hostprogs-y" in 2004.
      
      It is typically useful in scripts/Makefile because it allows Kbuild to
      selectively compile host programs based on the kernel configuration.
      
      This commit renames like follows:
      
        always       ->  always-y
        hostprogs-y  ->  hostprogs
      
      So, scripts/Makefile will look like this:
      
        always-$(CONFIG_BUILD_BIN2C) += ...
        always-$(CONFIG_KALLSYMS)    += ...
            ...
        hostprogs := $(always-y) $(always-m)
      
      I think this makes more sense because a host program is always a host
      program, irrespective of the kernel configuration. We want to specify
      which ones to compile by CONFIG options, so always-y will be handier.
      
      The "always", "hostprogs-y", "hostprogs-m" will be kept for backward
      compatibility for a while.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      5f2fb52f
  9. Jan 31, 2020
  10. Jan 27, 2020
  11. Jan 24, 2020
  12. Jan 23, 2020
  13. Jan 22, 2020
    • Jason A. Donenfeld's avatar
      crypto: chacha20poly1305 - add back missing test vectors and test chunking · 72c79437
      Jason A. Donenfeld authored
      
      When this was originally ported, the 12-byte nonce vectors were left out
      to keep things simple. I agree that we don't need nor want a library
      interface for 12-byte nonces. But these test vectors were specially
      crafted to look at issues in the underlying primitives and related
      interactions.  Therefore, we actually want to keep around all of the
      test vectors, and simply have a helper function to test them with.
      
      Secondly, the sglist-based chunking code in the library interface is
      rather complicated, so this adds a developer-only test for ensuring that
      all the book keeping is correct, across a wide array of possibilities.
      
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      72c79437
  14. Jan 18, 2020
  15. Jan 17, 2020
    • Marco Elver's avatar
      debugobjects: Fix various data races · 35fd7a63
      Marco Elver authored
      
      The counters obj_pool_free, and obj_nr_tofree, and the flag obj_freeing are
      read locklessly outside the pool_lock critical sections. If read with plain
      accesses, this would result in data races.
      
      This is addressed as follows:
      
       * reads outside critical sections become READ_ONCE()s (pairing with
         WRITE_ONCE()s added);
      
       * writes become WRITE_ONCE()s (pairing with READ_ONCE()s added); since
         writes happen inside critical sections, only the write and not the read
         of RMWs needs to be atomic, thus WRITE_ONCE(var, var +/- X) is
         sufficient.
      
      The data races were reported by KCSAN:
      
        BUG: KCSAN: data-race in __free_object / fill_pool
      
        write to 0xffffffff8beb04f8 of 4 bytes by interrupt on cpu 1:
         __free_object+0x1ee/0x8e0 lib/debugobjects.c:404
         __debug_check_no_obj_freed+0x199/0x330 lib/debugobjects.c:969
         debug_check_no_obj_freed+0x3c/0x44 lib/debugobjects.c:994
         slab_free_hook mm/slub.c:1422 [inline]
      
        read to 0xffffffff8beb04f8 of 4 bytes by task 1 on cpu 2:
         fill_pool+0x3d/0x520 lib/debugobjects.c:135
         __debug_object_init+0x3c/0x810 lib/debugobjects.c:536
         debug_object_init lib/debugobjects.c:591 [inline]
         debug_object_activate+0x228/0x320 lib/debugobjects.c:677
         debug_rcu_head_queue kernel/rcu/rcu.h:176 [inline]
      
        BUG: KCSAN: data-race in __debug_object_init / fill_pool
      
        read to 0xffffffff8beb04f8 of 4 bytes by task 10 on cpu 6:
         fill_pool+0x3d/0x520 lib/debugobjects.c:135
         __debug_object_init+0x3c/0x810 lib/debugobjects.c:536
         debug_object_init_on_stack+0x39/0x50 lib/debugobjects.c:606
         init_timer_on_stack_key kernel/time/timer.c:742 [inline]
      
        write to 0xffffffff8beb04f8 of 4 bytes by task 1 on cpu 3:
         alloc_object lib/debugobjects.c:258 [inline]
         __debug_object_init+0x717/0x810 lib/debugobjects.c:544
         debug_object_init lib/debugobjects.c:591 [inline]
         debug_object_activate+0x228/0x320 lib/debugobjects.c:677
         debug_rcu_head_queue kernel/rcu/rcu.h:176 [inline]
      
        BUG: KCSAN: data-race in free_obj_work / free_object
      
        read to 0xffffffff9140c190 of 4 bytes by task 10 on cpu 6:
         free_object+0x4b/0xd0 lib/debugobjects.c:426
         debug_object_free+0x190/0x210 lib/debugobjects.c:824
         destroy_timer_on_stack kernel/time/timer.c:749 [inline]
      
        write to 0xffffffff9140c190 of 4 bytes by task 93 on cpu 1:
         free_obj_work+0x24f/0x480 lib/debugobjects.c:313
         process_one_work+0x454/0x8d0 kernel/workqueue.c:2264
         worker_thread+0x9a/0x780 kernel/workqueue.c:2410
      
      Reported-by: default avatarQian Cai <cai@lca.pw>
      Signed-off-by: default avatarMarco Elver <elver@google.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lore.kernel.org/r/20200116185529.11026-1-elver@google.com
      35fd7a63
    • Petr Mladek's avatar
      livepatch/samples/selftest: Use klp_shadow_alloc() API correctly · be6da984
      Petr Mladek authored
      
      The commit e91c2518 ("livepatch: Initialize shadow variables
      safely by a custom callback") leads to the following static checker
      warning:
      
        samples/livepatch/livepatch-shadow-fix1.c:86 livepatch_fix1_dummy_alloc()
        error: 'klp_shadow_alloc()' 'leak' too small (4 vs 8)
      
      It is because klp_shadow_alloc() is used a wrong way:
      
        int *leak;
        shadow_leak = klp_shadow_alloc(d, SV_LEAK, sizeof(leak), GFP_KERNEL,
      				 shadow_leak_ctor, leak);
      
      The code is supposed to store the "leak" pointer into the shadow variable.
      3rd parameter correctly passes size of the data (size of pointer). But
      the 5th parameter is wrong. It should pass pointer to the data (pointer
      to the pointer) but it passes the pointer directly.
      
      It works because shadow_leak_ctor() handle "ctor_data" as the data
      instead of pointer to the data. But it is semantically wrong and
      confusing.
      
      The same problem is also in the module used by selftests. In this case,
      "pvX" variables are introduced. They represent the data stored in
      the shadow variables.
      
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
      Acked-by: default avatarMiroslav Benes <mbenes@suse.cz>
      Reviewed-by: default avatarKamalesh Babulal <kamalesh@linux.vnet.ibm.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      be6da984
    • Petr Mladek's avatar
      livepatch/selftest: Clean up shadow variable names and type · c24c57a4
      Petr Mladek authored
      
      The shadow variable selftest is quite tricky. Especially it is problematic
      to understand what values are stored, returned, and printed.
      
      Make it easier to understand by using "int *var, **sv" variables
      consistently everywhere instead of the generic "void *", "ret",
      and "ctor_data".
      
      Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
      Acked-by: default avatarMiroslav Benes <mbenes@suse.cz>
      Reviewed-by: default avatarKamalesh Babulal <kamalesh@linux.vnet.ibm.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      c24c57a4
  16. Jan 16, 2020
Loading