1. 23 5月, 2022 1 次提交
  2. 26 11月, 2021 1 次提交
  3. 12 10月, 2021 1 次提交
  4. 04 6月, 2021 2 次提交
    • D
      livepatch/core: Revert module_enable_ro and module_disable_ro · f440d90f
      Dong Kai 提交于
      hulk inclusion
      category: feature
      bugzilla: 51921
      CVE: NA
      
      ---------------------------
      
      After commit d556e1be ("livepatch: Remove module_disable_ro() usage")
      and commit 0d9fbf78 ("module: Remove module_disable_ro()") and
      commit e6eff437 ("module: Make module_enable_ro() static again") merged,
      the module_disable_ro is removed and module_enable_ro is make static.
      
      It's ok for x86/ppc platform because the livepatch module relocation is
      done by text poke func which internally modify the text addr by remap
      to high virtaddr which has write permission.
      
      However for arm/arm64 platform, it's apply_relocate[_add] still directly
      modify the text code so we should change the module text permission before
      relocation. Otherwise it will lead to following problem:
      
        Unable to handle kernel write to read-only memory at virtual address ffff800008a95288
        Mem abort info:
        ESR = 0x9600004f
        EC = 0x25: DABT (current EL), IL = 32 bits
        SET = 0, FnV = 0
        EA = 0, S1PTW = 0
        Data abort info:
        ISV = 0, ISS = 0x0000004f
        CM = 0, WnR = 1
        swapper pgtable: 4k pages, 48-bit VAs, pgdp=000000004133c000
        [ffff800008a95288] pgd=00000000bdfff003, p4d=00000000bdfff003, pud=00000000bdffe003,
      		     pmd=0000000080ce7003, pte=0040000080d5d783
        Internal error: Oops: 9600004f [#1] PREEMPT SMP
        Modules linked in: livepatch_testmod_drv(OK+) testmod_drv(O)
        CPU: 0 PID: 139 Comm: insmod Tainted: G           O  K   5.10.0-01131-gf6b4602e09b2-dirty #35
        Hardware name: linux,dummy-virt (DT)
        pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--)
        pc : reloc_insn_imm+0x54/0x78
        lr : reloc_insn_imm+0x50/0x78
        sp : ffff800011cf3910
        ...
        Call trace:
         reloc_insn_imm+0x54/0x78
         apply_relocate_add+0x464/0x680
         klp_apply_section_relocs+0x11c/0x148
         klp_enable_patch+0x338/0x998
         patch_init+0x338/0x1000 [livepatch_testmod_drv]
         do_one_initcall+0x60/0x1d8
         do_init_module+0x58/0x1e0
         load_module+0x1fb4/0x2688
         __do_sys_finit_module+0xc0/0x128
         __arm64_sys_finit_module+0x20/0x30
         do_el0_svc+0x84/0x1b0
         el0_svc+0x14/0x20
         el0_sync_handler+0x90/0xc8
         el0_sync+0x158/0x180
         Code: 2a0503e0 9ad42a73 97d6a499 91000673 (b90002a0)
         ---[ end trace 67dd2ef1203ed335 ]---
      
      Though the permission change is not necessary to x86/ppc platform, consider
      that the jump_label_register api may modify the text code either, we just
      put the change handle here instead of putting it in arch-specific relocate.
      
      Besides, the jump_label_module_nb callback called in jump_label_register
      also maybe need motify the module code either, it sort and swap the jump
      entries if necessary. So just disable ro before jump_label handling and
      restore it back.
      Signed-off-by: NDong Kai <dongkai11@huawei.com>
      Signed-off-by: NYe Weihua <yeweihua4@huawei.com>
      Reviewed-by: NYang Jihong <yangjihong1@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      f440d90f
    • C
      livepatch/core: Support jump_label · cd79d861
      Cheng Jian 提交于
      hulk inclusion
      category: feature
      bugzilla: 51921
      CVE: NA
      
      -----------------------------------------------
      
      The kpatch-build processes the __jump_table special section,
      and only the jump_lable used by the changed functions will be
      included in __jump_table section, and the livepatch should
      process the tracepoint again after the dynamic relocation.
      
      NOTE: adding new tracepoints definition is not supported.
      Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
      Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
      Signed-off-by: NDong Kai <dongkai11@huawei.com>
      Signed-off-by: NYe Weihua <yeweihua4@huawei.com>
      Reviewed-by: NYang Jihong <yangjihong1@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      cd79d861
  5. 13 4月, 2021 3 次提交
  6. 09 4月, 2021 1 次提交
  7. 18 1月, 2021 2 次提交
  8. 13 10月, 2020 1 次提交
    • D
      module: statically initialize init section freeing data · fdf09ab8
      Daniel Jordan 提交于
      Corentin hit the following workqueue warning when running with
      CRYPTO_MANAGER_EXTRA_TESTS:
      
        WARNING: CPU: 2 PID: 147 at kernel/workqueue.c:1473 __queue_work+0x3b8/0x3d0
        Modules linked in: ghash_generic
        CPU: 2 PID: 147 Comm: modprobe Not tainted
            5.6.0-rc1-next-20200214-00068-g166c9264f0b1-dirty #545
        Hardware name: Pine H64 model A (DT)
        pc : __queue_work+0x3b8/0x3d0
        Call trace:
         __queue_work+0x3b8/0x3d0
         queue_work_on+0x6c/0x90
         do_init_module+0x188/0x1f0
         load_module+0x1d00/0x22b0
      
      I wasn't able to reproduce on x86 or rpi 3b+.
      
      This is
      
        WARN_ON(!list_empty(&work->entry))
      
      from __queue_work(), and it happens because the init_free_wq work item
      isn't initialized in time for a crypto test that requests the gcm
      module.  Some crypto tests were recently moved earlier in boot as
      explained in commit c4741b23 ("crypto: run initcalls for generic
      implementations earlier"), which went into mainline less than two weeks
      before the Fixes commit.
      
      Avoid the warning by statically initializing init_free_wq and the
      corresponding llist.
      
      Link: https://lore.kernel.org/lkml/20200217204803.GA13479@Red/
      Fixes: 1a7b7d92 ("modules: Use vmalloc special flag")
      Reported-by: NCorentin Labbe <clabbe.montjoie@gmail.com>
      Tested-by: NCorentin Labbe <clabbe.montjoie@gmail.com>
      Tested-on: sun50i-h6-pine-h64
      Tested-on: imx8mn-ddr4-evk
      Tested-on: sun50i-a64-bananapi-m64
      Reviewed-by: NEric Biggers <ebiggers@google.com>
      Signed-off-by: NDaniel Jordan <daniel.m.jordan@oracle.com>
      Signed-off-by: NJessica Yu <jeyu@kernel.org>
      fdf09ab8
  9. 05 10月, 2020 7 次提交
  10. 02 9月, 2020 1 次提交
    • Q
      module: Add more error message for failed kernel module loading · 14721add
      Qu Wenruo 提交于
      When kernel module loading failed, user space only get one of the
      following error messages:
      
      - ENOEXEC
        This is the most confusing one. From corrupted ELF header to bad
        WRITE|EXEC flags check introduced by in module_enforce_rwx_sections()
        all returns this error number.
      
      - EPERM
        This is for blacklisted modules. But mod doesn't do extra explain
        on this error either.
      
      - ENOMEM
        The only error which needs no explain.
      
      This means, if a user got "Exec format error" from modprobe, it provides
      no meaningful way for the user to debug, and will take extra time
      communicating to get extra info.
      
      So this patch will add extra error messages for -ENOEXEC and -EPERM
      errors, allowing user to do better debugging and reporting.
      Reviewed-by: NLucas De Marchi <lucas.demarchi@intel.com>
      Signed-off-by: NQu Wenruo <wqu@suse.com>
      Signed-off-by: NJessica Yu <jeyu@kernel.org>
      14721add
  11. 01 9月, 2020 2 次提交
  12. 08 8月, 2020 1 次提交
  13. 05 8月, 2020 1 次提交
  14. 01 8月, 2020 7 次提交
  15. 24 7月, 2020 1 次提交
  16. 09 7月, 2020 3 次提交
  17. 04 7月, 2020 1 次提交
  18. 26 6月, 2020 1 次提交
  19. 09 6月, 2020 1 次提交
  20. 03 6月, 2020 1 次提交
    • C
      mm: remove the pgprot argument to __vmalloc · 88dca4ca
      Christoph Hellwig 提交于
      The pgprot argument to __vmalloc is always PAGE_KERNEL now, so remove it.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: Michael Kelley <mikelley@microsoft.com> [hyperv]
      Acked-by: Gao Xiang <xiang@kernel.org> [erofs]
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NWei 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: NLinus Torvalds <torvalds@linux-foundation.org>
      88dca4ca
  21. 19 5月, 2020 1 次提交