lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220718192844.1805158-1-yury.norov@gmail.com>
Date:   Mon, 18 Jul 2022 12:28:28 -0700
From:   Yury Norov <yury.norov@...il.com>
To:     linux-kernel@...r.kernel.org,
        Alexander Lobakin <alexandr.lobakin@...el.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Alexey Klimov <aklimov@...hat.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Andrii Nakryiko <andrii@...nel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Ben Segall <bsegall@...gle.com>,
        Christoph Lameter <cl@...ux.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Daniel Borkmann <daniel@...earbox.net>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Dennis Zhou <dennis@...nel.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Eric Dumazet <edumazet@...gle.com>,
        Frederic Weisbecker <fweisbec@...il.com>,
        Guenter Roeck <linux@...ck-us.net>,
        Ingo Molnar <mingo@...hat.com>,
        Isabella Basso <isabbasso@...eup.net>,
        John Fastabend <john.fastabend@...il.com>,
        Josh Poimboeuf <jpoimboe@...nel.org>,
        Juergen Gross <jgross@...e.com>,
        Juri Lelli <juri.lelli@...hat.com>,
        KP Singh <kpsingh@...nel.org>,
        Kees Cook <keescook@...omium.org>,
        Martin KaFai Lau <kafai@...com>,
        Mel Gorman <mgorman@...e.de>, Miroslav Benes <mbenes@...e.cz>,
        Nathan Chancellor <nathan@...nel.org>,
        "Paul E . McKenney" <paulmck@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Randy Dunlap <rdunlap@...radead.org>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        Song Liu <songliubraving@...com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Tejun Heo <tj@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Valentin Schneider <vschneid@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Vlastimil Babka <vbabka@...e.cz>, Yonghong Song <yhs@...com>,
        Yury Norov <yury.norov@...il.com>, linux-mm@...ck.org,
        netdev@...r.kernel.org, bpf@...r.kernel.org
Subject: [PATCH 00/16] Introduce DEBUG_BITMAP config option and bitmap_check_params()

Bitmap functions are often a part of hot paths, and we can't put argument
sanity checks inside them. Sometimes wrong parameters combination cause
bug reports that are pretty hard to investigate:
https://lore.kernel.org/linux-mm/YsbpTNmDaam8pl+f@xsang-OptiPlex-9020/

And sometimes we can optimize caller code. For example, to avoid copying
of bitmap if source and destination are the same.

It's quite tricky to detect such places unless we've covered all bitmap
API calls with the parameters checker.

This series:
 - introduces bitmap_check_params() with a couple of common-used wrappers;
 - clears all bitmap warnings found for x86_64, arm64 and powerpc64 in
   boot test.

Yury Norov (16):
  lib/bitmap: add bitmap_check_params()
  lib/bitmap: don't call bitmap_set() with len == 0
  lib/test_bitmap: don't test bitmap_set if nbits == 0
  lib/test_bitmap: test test_bitmap_arr{32,64} starting from nbits == 1
  lib/test_bitmap: disable compile-time test if DEBUG_BITMAP() is
    enabled
  lib/test_bitmap: delete meaningless test for bitmap_cut
  smp: optimize smp_call_function_many_cond()
  smp: optimize smp_call_function_many_cond() for more
  irq: don't copy cpu affinity mask if source is equal to destination
  sched: optimize __set_cpus_allowed_ptr_locked()
  time: optimize tick_check_preferred()
  time: optimize tick_check_percpu()
  time: optimize tick_setup_device()
  mm/percpu: optimize pcpu_alloc_area()
  sched/topology: optimize topology_span_sane()
  lib: create CONFIG_DEBUG_BITMAP parameter

 include/linux/bitmap.h    |  95 +++++++++++++++++++++++++++
 kernel/irq/manage.c       |   3 +-
 kernel/sched/core.c       |   3 +-
 kernel/sched/topology.c   |  10 ++-
 kernel/smp.c              |  35 ++++++++--
 kernel/time/tick-common.c |  18 ++++--
 lib/Kconfig.debug         |   7 ++
 lib/bitmap.c              | 132 ++++++++++++++++++++++++++++++++++----
 lib/test_bitmap.c         |  12 ++--
 mm/percpu.c               |   3 +-
 10 files changed, 281 insertions(+), 37 deletions(-)

-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ