1. 12 4月, 2022 17 次提交
  2. 11 4月, 2022 3 次提交
  3. 02 4月, 2022 13 次提交
  4. 30 3月, 2022 3 次提交
  5. 26 3月, 2022 4 次提交
    • Z
      livepatch/arm64: Fix incorrect endian conversion when long jump · 2b491a2e
      Zheng Yejian 提交于
      hulk inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I4ZIB2
      CVE: NA
      
      --------------------------------
      
      Kernel panic happened on 'arm64 big endian' board after calling function
      that has been live-patched. It can be reproduced as follows:
        1. Insert 'livepatch-sample.ko' to patch kernel function 'cmdline_proc_show';
        2. Enable patch by execute:
           echo 1 > /sys/kernel/livepatch/livepatch-sample/enabled
        3. Call 'cmdline_proc_show' by execute:
           cat /proc/cmdline
        4. Then we get following panic logs:
           > kernel BUG at arch/arm64/kernel/traps.c:408!
           > Internal error: Oops - BUG: 0 [#1] SMP
           > Modules linked in: dump_mem(OE) livepatch_cmdline1(OEK) hi1382_gmac(OE)
           > [last unloaded: dump_mem]
           > CPU: 3 PID: 1752 Comm: cat Session: 0 Tainted: G           OE K
           > 5.10.0+ #2
           > Hardware name: Hisilicon PhosphorHi1382 (DT)
           > pstate: 00000005 (nzcv daif -PAN -UAO -TCO BTYPE=--)
           > pc : do_undefinstr+0x23c/0x2b4
           > lr : do_undefinstr+0x5c/0x2b4
           > sp : ffffffc010ac3a80
           > x29: ffffffc010ac3a80 x28: ffffff82eb0a8000
           > x27: 0000000000000000 x26: 0000000000000001
           > x25: 0000000000000000 x24: 0000000000001000
           > x23: 0000000000000000 x22: ffffffd0e0f16000
           > x21: ffffffd0e0ae7000 x20: ffffffc010ac3b00
           > x19: 0000000000021fd6 x18: ffffffd0e04aad94
           > x17: 0000000000000000 x16: 0000000000000000
           > x15: ffffffd0e04b519c x14: 0000000000000000
           > x13: 0000000000000000 x12: 0000000000000000
           > x11: 0000000000000000 x10: 0000000000000000
           > x9 : 0000000000000000 x8 : 0000000000000000
           > x7 : 0000000000000000 x6 : ffffffd0e0f16100
           > x5 : 0000000000000000 x4 : 00000000d5300000
           > x3 : 0000000000000000 x2 : ffffffd0e0f160f0
           > x1 : ffffffd0e0f16103 x0 : 0000000000000005
           > Call trace:
           >  do_undefinstr+0x23c/0x2b4
           >  el1_undef+0x2c/0x44
           >  el1_sync_handler+0xa4/0xb0
           >  el1_sync+0x74/0x100
           >  cmdline_proc_show+0xc/0x44
           >  proc_reg_read_iter+0xb0/0xc4
           >  new_sync_read+0x10c/0x15c
           >  vfs_read+0x144/0x18c
           >  ksys_read+0x78/0xe8
           >  __arm64_sys_read+0x24/0x30
      
      We compare first 6 instructions of 'cmdline_proc_show' before and after
      patch (see below). There are 4 instructions modified, so this is case
      that offset between old and new function is out of 128M. And we found
      that instruction at 'cmdline_proc_show+0xc' seems incorrect (it expects
      to be '00021fd6').
        origin:     patched:
        --------    --------
        fd7bbea9    929ff7f0
        21d500f0    f2a91b30
        fd030091    f2d00010
        211040f9    d61f0200 <-- cmdline_proc_show+0xc (expect is '00021fd6')
        f30b00f9    f30b00f9
        f30300aa    f30300aa
      
      It is caused by an incorrect big-to-little endian conversion, and we
      correct it.
      
      Fixes: 5aa9a1a3 ("livepatch/arm64: support livepatch without ftrace")
      Signed-off-by: NZheng Yejian <zhengyejian1@huawei.com>
      Reviewed-by: NKuohai Xu <xukuohai@huawei.com>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      2b491a2e
    • W
      arm64/mpam: realign step entry when traversing rmid_transform · e79aa56b
      Wang ShaoBo 提交于
      hulk inclusion
      category: feature
      bugzilla: https://gitee.com/openeuler/kernel/issues/I4SE03
      CVE: NA
      
      ---------------------------------------------------
      
      This makes step entry aligned with step_size*step_cnt but not step_size,
      and check for alignment before traversing rmid_transform.
      
      When modifying rmid with a value not aligned with step_size*step_cnt,
      for_each_rmid_transform_point_step_from might miss next step point if
      it has been occupied in case step_cnt or step_size not equals to 1,
      which will cause the actual allocated rmid to be inconsistent with the
      expected one.
      
      Fixes: b47b9a81 ("arm64/mpam: rmid: refine allocation and release process")
      Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
      Reviewed-by: NCheng Jian <cj.chengjian@huawei.com>
      Signed-off-by: NLaibin Qiu <qiulaibin@huawei.com>
      e79aa56b
    • X
      dt-bindings: mpam: refactor device tree node structure · 880b1947
      Xingang Wang 提交于
      arm64/mpam: refactor device tree structure to support multiple
      devices
      
      ascend inclusion
      category: feature
      bugzilla:
      https://gitee.com/openeuler/kernel/issues/I49RB2
      CVE: NA
      
      ---------------------------------------------------
      
      To support multiple mpam device nodes, all nodes should be organized
      as child of the same parent nodes. This makes sure that the mpam
      discovery start and complete procedure in the right execution order.
      Add modification in the devicetree documentation to record this.
      Signed-off-by: NXingang Wang <wangxingang5@huawei.com>
      Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
      Reviewed-by: NCheng Jian <cj.chengjian@huawei.com>
      Signed-off-by: NLaibin Qiu <qiulaibin@huawei.com>
      880b1947
    • X
      arm64/mpam: refactor device tree structure to support multiple devices · 33dea90e
      Xingang Wang 提交于
      ascend inclusion
      category: feature
      bugzilla:
      https://gitee.com/openeuler/kernel/issues/I49RB2
      CVE: NA
      
      ---------------------------------------------------
      
      The process of MPAM device tree initialization is like this:
      arm_mpam_device_probe() 	// driver probe
        mpam_discovery_start()	// start discover mpam devices
          [...] 			// find and add mpam devices
        mpam_discovery_complete()   	// trigger mpam_enable
      
      When there are multiple mpam device nodes, the driver probe procedure
      will execute more than once. However, the mpam_discovery_start() and
      mpam_discovery_complete() should only run once. Besides, the start
      should run first, and the complete should run after all devices added.
      
      So we reorganize the device tree structure, so that there will be only
      one mpam device parent nodes, and the probe procedure will only run once.
      We add the child node to represent the mpam devices, and traverse and
      add all mpam devices in the middle procedure of driver probe.
      Signed-off-by: NXingang Wang <wangxingang5@huawei.com>
      Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
      Reviewed-by: NCheng Jian <cj.chengjian@huawei.com>
      Signed-off-by: NLaibin Qiu <qiulaibin@huawei.com>
      33dea90e