An error occurred fetching the project authors.
  1. 01 Sep, 2020 2 commits
  2. 07 Aug, 2020 1 commit
  3. 05 Aug, 2020 1 commit
  4. 01 Aug, 2020 7 commits
  5. 24 Jul, 2020 1 commit
  6. 08 Jul, 2020 3 commits
  7. 03 Jul, 2020 1 commit
  8. 26 Jun, 2020 1 commit
  9. 08 Jun, 2020 1 commit
  10. 02 Jun, 2020 1 commit
    • Christoph Hellwig's avatar
      mm: remove the pgprot argument to __vmalloc · 88dca4ca
      Christoph Hellwig authored
      The pgprot argument to __vmalloc is always PAGE_KERNEL now, so remove it.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: Michael Kelley <mikelley@microsoft.com> [hyperv]
      Acked-by: Gao Xiang <xiang@kernel.org> [erofs]
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarWei Liu <wei.liu@kernel.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lkml.kernel.org/r/20200414131348.444715-22-hch@lst.deSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      88dca4ca
  11. 19 May, 2020 2 commits
  12. 12 May, 2020 2 commits
  13. 07 May, 2020 3 commits
    • Josh Poimboeuf's avatar
      module: Make module_enable_ro() static again · e6eff437
      Josh Poimboeuf authored
      Now that module_enable_ro() has no more external users, make it static
      again.
      Suggested-by: default avatarJessica Yu <jeyu@kernel.org>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Acked-by: default avatarJessica Yu <jeyu@kernel.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      e6eff437
    • Josh Poimboeuf's avatar
      module: Remove module_disable_ro() · 0d9fbf78
      Josh Poimboeuf authored
      module_disable_ro() has no more users.  Remove it.
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
      Acked-by: default avatarMiroslav Benes <mbenes@suse.cz>
      Acked-by: default avatarJessica Yu <jeyu@kernel.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      0d9fbf78
    • Josh Poimboeuf's avatar
      livepatch: Apply vmlinux-specific KLP relocations early · 7c8e2bdd
      Josh Poimboeuf authored
      KLP relocations are livepatch-specific relocations which are applied to
      a KLP module's text or data.  They exist for two reasons:
      
        1) Unexported symbols: replacement functions often need to access
           unexported symbols (e.g. static functions), which "normal"
           relocations don't allow.
      
        2) Late module patching: this is the ability for a KLP module to
           bypass normal module dependencies, such that the KLP module can be
           loaded *before* a to-be-patched module.  This means that
           relocations which need to access symbols in the to-be-patched
           module might need to be applied to the KLP module well after it has
           been loaded.
      
      Non-late-patched KLP relocations are applied from the KLP module's init
      function.  That usually works fine, unless the patched code wants to use
      alternatives, paravirt patching, jump tables, or some other special
      section which needs relocations.  Then we run into ordering issues and
      crashes.
      
      In order for those special sections to work properly, the KLP
      relocations should be applied *before* the special section init code
      runs, such as apply_paravirt(), apply_alternatives(), or
      jump_label_apply_nops().
      
      You might think the obvious solution would be to move the KLP relocation
      initialization earlier, but it's not necessarily that simple.  The
      problem is the above-mentioned late module patching, for which KLP
      relocations can get applied well after the KLP module is loaded.
      
      To "fix" this issue in the past, we created .klp.arch sections:
      
        .klp.arch.{module}..altinstructions
        .klp.arch.{module}..parainstructions
      
      Those sections allow KLP late module patching code to call
      apply_paravirt() and apply_alternatives() after the module-specific KLP
      relocations (.klp.rela.{module}.{section}) have been applied.
      
      But that has a lot of drawbacks, including code complexity, the need for
      arch-specific code, and the (per-arch) danger that we missed some
      special section -- for example the __jump_table section which is used
      for jump labels.
      
      It turns out there's a simpler and more functional approach.  There are
      two kinds of KLP relocation sections:
      
        1) vmlinux-specific KLP relocation sections
      
           .klp.rela.vmlinux.{sec}
      
           These are relocations (applied to the KLP module) which reference
           unexported vmlinux symbols.
      
        2) module-specific KLP relocation sections
      
           .klp.rela.{module}.{sec}:
      
           These are relocations (applied to the KLP module) which reference
           unexported or exported module symbols.
      
      Up until now, these have been treated the same.  However, they're
      inherently different.
      
      Because of late module patching, module-specific KLP relocations can be
      applied very late, thus they can create the ordering headaches described
      above.
      
      But vmlinux-specific KLP relocations don't have that problem.  There's
      nothing to prevent them from being applied earlier.  So apply them at
      the same time as normal relocations, when the KLP module is being
      loaded.
      
      This means that for vmlinux-specific KLP relocations, we no longer have
      any ordering issues.  vmlinux-referencing jump labels, alternatives, and
      paravirt patching will work automatically, without the need for the
      .klp.arch hacks.
      
      All that said, for module-specific KLP relocations, the ordering
      problems still exist and we *do* still need .klp.arch.  Or do we?  Stay
      tuned.
      Suggested-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
      Acked-by: default avatarMiroslav Benes <mbenes@suse.cz>
      Acked-by: default avatarJessica Yu <jeyu@kernel.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      7c8e2bdd
  14. 21 Apr, 2020 2 commits
  15. 17 Apr, 2020 1 commit
    • Jessica Yu's avatar
      module: break nested ARCH_HAS_STRICT_MODULE_RWX and STRICT_MODULE_RWX #ifdefs · db991af0
      Jessica Yu authored
      Various frob_* and module_{enable,disable}_* functions are defined in a
      CONFIG_ARCH_HAS_STRICT_MODULE_RWX ifdef block which also has a nested
      CONFIG_STRICT_MODULE_RWX ifdef block within it. This is unecessary and
      makes things hard to read. Not only that, this construction requires
      redundant empty stubs for module_enable_nx(). I suspect this was
      originally done for cosmetic reasons - to keep all the frob_* functions
      in the same place, and all the module_{enable,disable}_* functions right
      after, but as a result it made the code harder to read.
      
      Make this more readable by unnesting the ifdef blocks and getting rid of
      the redundant empty stubs.
      Signed-off-by: default avatarJessica Yu <jeyu@kernel.org>
      db991af0
  16. 07 Apr, 2020 1 commit
    • Alexey Dobriyan's avatar
      proc: faster open/read/close with "permanent" files · d919b33d
      Alexey Dobriyan authored
      Now that "struct proc_ops" exist we can start putting there stuff which
      could not fly with VFS "struct file_operations"...
      
      Most of fs/proc/inode.c file is dedicated to make open/read/.../close
      reliable in the event of disappearing /proc entries which usually happens
      if module is getting removed.  Files like /proc/cpuinfo which never
      disappear simply do not need such protection.
      
      Save 2 atomic ops, 1 allocation, 1 free per open/read/close sequence for such
      "permanent" files.
      
      Enable "permanent" flag for
      
      	/proc/cpuinfo
      	/proc/kmsg
      	/proc/modules
      	/proc/slabinfo
      	/proc/stat
      	/proc/sysvipc/*
      	/proc/swaps
      
      More will come once I figure out foolproof way to prevent out module
      authors from marking their stuff "permanent" for performance reasons
      when it is not.
      
      This should help with scalability: benchmark is "read /proc/cpuinfo R times
      by N threads scattered over the system".
      
      	N	R	t, s (before)	t, s (after)
      	-----------------------------------------------------
      	64	4096	1.582458	1.530502	-3.2%
      	256	4096	6.371926	6.125168	-3.9%
      	1024	4096	25.64888	24.47528	-4.6%
      
      Benchmark source:
      
      #include <chrono>
      #include <iostream>
      #include <thread>
      #include <vector>
      
      #include <sys/types.h>
      #include <sys/stat.h>
      #include <fcntl.h>
      #include <unistd.h>
      
      const int NR_CPUS = sysconf(_SC_NPROCESSORS_ONLN);
      int N;
      const char *filename;
      int R;
      
      int xxx = 0;
      
      int glue(int n)
      {
      	cpu_set_t m;
      	CPU_ZERO(&m);
      	CPU_SET(n, &m);
      	return sched_setaffinity(0, sizeof(cpu_set_t), &m);
      }
      
      void f(int n)
      {
      	glue(n % NR_CPUS);
      
      	while (*(volatile int *)&xxx == 0) {
      	}
      
      	for (int i = 0; i < R; i++) {
      		int fd = open(filename, O_RDONLY);
      		char buf[4096];
      		ssize_t rv = read(fd, buf, sizeof(buf));
      		asm volatile ("" :: "g" (rv));
      		close(fd);
      	}
      }
      
      int main(int argc, char *argv[])
      {
      	if (argc < 4) {
      		std::cerr << "usage: " << argv[0] << ' ' << "N /proc/filename R
      ";
      		return 1;
      	}
      
      	N = atoi(argv[1]);
      	filename = argv[2];
      	R = atoi(argv[3]);
      
      	for (int i = 0; i < NR_CPUS; i++) {
      		if (glue(i) == 0)
      			break;
      	}
      
      	std::vector<std::thread> T;
      	T.reserve(N);
      	for (int i = 0; i < N; i++) {
      		T.emplace_back(f, i);
      	}
      
      	auto t0 = std::chrono::system_clock::now();
      	{
      		*(volatile int *)&xxx = 1;
      		for (auto& t: T) {
      			t.join();
      		}
      	}
      	auto t1 = std::chrono::system_clock::now();
      	std::chrono::duration<double> dt = t1 - t0;
      	std::cout << dt.count() << '
      ';
      
      	return 0;
      }
      
      P.S.:
      Explicit randomization marker is added because adding non-function pointer
      will silently disable structure layout randomization.
      
      [akpm@linux-foundation.org: coding style fixes]
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Joe Perches <joe@perches.com>
      Link: http://lkml.kernel.org/r/20200222201539.GA22576@avx2Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d919b33d
  17. 17 Feb, 2020 1 commit
    • Gustavo A. R. Silva's avatar
      kernel: module: Replace zero-length array with flexible-array member · 0f742266
      Gustavo A. R. Silva authored
      The current codebase makes use of the zero-length array language
      extension to the C90 standard, but the preferred mechanism to declare
      variable-length types such as these ones is a flexible array member[1][2],
      introduced in C99:
      
      struct foo {
              int stuff;
              struct boo array[];
      };
      
      By making use of the mechanism above, we will get a compiler warning
      in case the flexible array does not occur last in the structure, which
      will help us prevent some kind of undefined behavior bugs from being
      inadvertently introduced[3] to the codebase from now on.
      
      Also, notice that, dynamic memory allocations won't be affected by
      this change:
      
      "Flexible array members have incomplete type, and so the sizeof operator
      may not be applied. As a quirk of the original implementation of
      zero-length arrays, sizeof evaluates to zero."[1]
      
      This issue was found with the help of Coccinelle.
      
      [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
      [2] https://github.com/KSPP/linux/issues/21
      [3] commit 76497732 ("cxgb3/l2t: Fix undefined behaviour")
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarJessica Yu <jeyu@kernel.org>
      0f742266
  18. 04 Feb, 2020 1 commit
  19. 20 Jan, 2020 1 commit
  20. 15 Jan, 2020 1 commit
  21. 08 Jan, 2020 1 commit
  22. 10 Dec, 2019 1 commit
  23. 09 Dec, 2019 1 commit
    • Masami Hiramatsu's avatar
      modules: lockdep: Suppress suspicious RCU usage warning · bf08949c
      Masami Hiramatsu authored
      While running kprobe module test, find_module_all() caused
      a suspicious RCU usage warning.
      
      -----
       =============================
       WARNING: suspicious RCU usage
       5.4.0-next-20191202+ #63 Not tainted
       -----------------------------
       kernel/module.c:619 RCU-list traversed in non-reader section!!
      
       other info that might help us debug this:
      
       rcu_scheduler_active = 2, debug_locks = 1
       1 lock held by rmmod/642:
        #0: ffffffff8227da80 (module_mutex){+.+.}, at: __x64_sys_delete_module+0x9a/0x230
      
       stack backtrace:
       CPU: 0 PID: 642 Comm: rmmod Not tainted 5.4.0-next-20191202+ #63
       Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014
       Call Trace:
        dump_stack+0x71/0xa0
        find_module_all+0xc1/0xd0
        __x64_sys_delete_module+0xac/0x230
        ? do_syscall_64+0x12/0x1f0
        do_syscall_64+0x50/0x1f0
        entry_SYSCALL_64_after_hwframe+0x49/0xbe
       RIP: 0033:0x4b6d49
      -----
      
      This is because list_for_each_entry_rcu(modules) is called
      without rcu_read_lock(). This is safe because the module_mutex
      is locked.
      
      Pass lockdep_is_held(&module_mutex) to the list_for_each_entry_rcu()
      to suppress this warning, This also fixes similar issue in
      mod_find() and each_symbol_section().
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarJessica Yu <jeyu@kernel.org>
      bf08949c
  24. 27 Nov, 2019 1 commit
  25. 15 Nov, 2019 1 commit
    • Konstantin Khorenko's avatar
      kernel/module.c: wakeup processes in module_wq on module unload · 5d603311
      Konstantin Khorenko authored
      Fix the race between load and unload a kernel module.
      
      sys_delete_module()
       try_stop_module()
        mod->state = _GOING
      					add_unformed_module()
      					 old = find_module_all()
      					 (old->state == _GOING =>
      					  wait_event_interruptible())
      
      					 During pre-condition
      					 finished_loading() rets 0
      					 schedule()
      					 (never gets waken up later)
       free_module()
        mod->state = _UNFORMED
         list_del_rcu(&mod->list)
         (dels mod from "modules" list)
      
      return
      
      The race above leads to modprobe hanging forever on loading
      a module.
      
      Error paths on loading module call wake_up_all(&module_wq) after
      freeing module, so let's do the same on straight module unload.
      
      Fixes: 6e6de3de ("kernel/module.c: Only return -EEXIST for modules that have finished loading")
      Reviewed-by: default avatarPrarit Bhargava <prarit@redhat.com>
      Signed-off-by: default avatarKonstantin Khorenko <khorenko@virtuozzo.com>
      Signed-off-by: default avatarJessica Yu <jeyu@kernel.org>
      5d603311
  26. 13 Nov, 2019 1 commit