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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230414050836.1984746-1-mcgrof@kernel.org>
Date:   Thu, 13 Apr 2023 22:08:32 -0700
From:   Luis Chamberlain <mcgrof@...nel.org>
To:     david@...hat.com, patches@...ts.linux.dev,
        linux-modules@...r.kernel.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, pmladek@...e.com,
        petr.pavlu@...e.com, prarit@...hat.com,
        torvalds@...ux-foundation.org, gregkh@...uxfoundation.org,
        rafael@...nel.org
Cc:     christophe.leroy@...roup.eu, tglx@...utronix.de,
        peterz@...radead.org, song@...nel.org, rppt@...nel.org,
        dave@...olabs.net, willy@...radead.org, vbabka@...e.cz,
        mhocko@...e.com, dave.hansen@...ux.intel.com,
        colin.i.king@...il.com, jim.cromie@...il.com,
        catalin.marinas@....com, jbaron@...mai.com,
        rick.p.edgecombe@...el.com, mcgrof@...nel.org
Subject: [PATCH v3 0/4] module: avoid userspace pressure on unwanted allocations

This v3 series follows up on the second iteration of these patches [0]. This
and other pending changes are avaiable on 20230413-module-alloc-opts
branch [1] which is based on modules-next.

Changes on this v3:

  o Catalin Marinas suggested we just use kmemleak_not_leak() for both
    ELF allocations even if its init stuff.
  o Considerable amount of effort went into trying to see if there's
    relationship with CPU count and wasted virtual memory allocations.
    The new module debugfs counters helped with creating this evaluation.
    The result of that put me on a path to then add even more debugging
    facilities to rule out and identify the culprits. In the end I have
    patches now which can get this down to 0 bytes wasted. The patch
    in this series which helps reduce the allocations has a graph
    showing the findings of the relationship between wasted virtual
    memory allocations and CPU count all during boot. It is insanity
    that the graph has to go into gigabytes of wasted virtual memory all
    at boot.
  o To help folks compare apples to apples I've put the stats debug
    patch *prior* to the one that helps with allocations. This way folks
    can see for themselves what the results look like.
  o Enhanced the statistics a bit more and added an example with 255 CPUs.
  o Went with atomic_long and casting for the debugs big counters.
  o Rolled in the patch that moved a helper as David suggested.
  o Minor fixes reported by 0-day
  o Added tags for Reviews, etc.

[0] https://lkml.kernel.org/r/20230405022702.753323-1-mcgrof@kernel.org
[1] https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/log/?h=20230413-module-alloc-opts

Luis Chamberlain (4):
  module: fix kmemleak annotations for non init ELF sections
  module: extract patient module check into helper
  module: add debug stats to help identify memory pressure
  module: avoid allocation if module is already present and ready

 Documentation/core-api/kernel-api.rst |  22 +-
 kernel/module/Kconfig                 |  37 +++
 kernel/module/Makefile                |   1 +
 kernel/module/decompress.c            |   4 +
 kernel/module/internal.h              |  74 +++++
 kernel/module/main.c                  | 194 ++++++++----
 kernel/module/stats.c                 | 432 ++++++++++++++++++++++++++
 kernel/module/tracking.c              |   7 +-
 8 files changed, 703 insertions(+), 68 deletions(-)
 create mode 100644 kernel/module/stats.c

-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ