1. 12 5月, 2023 4 次提交
  2. 11 5月, 2023 7 次提交
    • O
      !437 [openEuler-1.0-LTS] USB: HCD: Fix URB giveback issue in tasklet function · 951bd644
      openeuler-ci-bot 提交于
      Merge Pull Request from: @leoliu-oc 
       
      Backport USB bugfix patch from linux mainline.
      commit 26c6c2f8 upstream.
      
      Issue
      https://gitee.com/openeuler/kernel/issues/I62VRB
      
      Test
      FIO/Iometer test: 
      Set Block size to 4k and randomly read in libaio mode to test for keyboard and mouse jamming.
      During the FIO/Iometer performance test, there will be no jamming of the mouse and keyboard.
      
      Knowe Issue
      N/A
      
      Default config change
      N/A 
       
      Link:https://gitee.com/openeuler/kernel/pulls/437 
      
      Reviewed-by: Zheng Zengkai <zhengzengkai@huawei.com> 
      Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com> 
      951bd644
    • L
      openeuler_defconfig: Add configuration items for zhaoxin · 7a9fe891
      leoliu-oc 提交于
      zhaoxin inclusion
      category: other
      bugzilla: https://gitee.com/openeuler/kernel/issues/I722EJ
      CVE: NA
      
      ----------------------------------------------------------------
      
      Set the default configuration for the Zhaoxin CPUs.
      Signed-off-by: Nleoliu-oc <leoliu-oc@zhaoxin.com>
      7a9fe891
    • R
      bluetooth: Perform careful capability checks in hci_sock_ioctl() · 63055a9f
      Ruihan Li 提交于
      mainline inclusion
      from mainline-v6.4-rc1
      commit 25c150ac
      category: bugfix
      bugzilla: https://gitee.com/src-openeuler/kernel/issues/I6WHKQ
      CVE: CVE-2023-2002
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=25c150ac103a4ebeed0319994c742a90634ddf18
      
      ----------------------------------------
      
      Previously, capability was checked using capable(), which verified that the
      caller of the ioctl system call had the required capability. In addition,
      the result of the check would be stored in the HCI_SOCK_TRUSTED flag,
      making it persistent for the socket.
      
      However, malicious programs can abuse this approach by deliberately sharing
      an HCI socket with a privileged task. The HCI socket will be marked as
      trusted when the privileged task occasionally makes an ioctl call.
      
      This problem can be solved by using sk_capable() to check capability, which
      ensures that not only the current task but also the socket opener has the
      specified capability, thus reducing the risk of privilege escalation
      through the previously identified vulnerability.
      
      Cc: stable@vger.kernel.org
      Fixes: f81f5b2d ("Bluetooth: Send control open and close messages for HCI raw sockets")
      Signed-off-by: NRuihan Li <lrh2000@pku.edu.cn>
      Signed-off-by: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: NZiyang Xuan <william.xuanziyang@huawei.com>
      Reviewed-by: NLiu Jian <liujian56@huawei.com>
      Reviewed-by: NWang Weiyang <wangweiyang2@huawei.com>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      63055a9f
    • H
      netrom: Fix use-after-free caused by accept on already connected socket · 768851b2
      Hyunwoo Kim 提交于
      stable inclusion
      from stable-v4.19.273
      commit 2c1984d101978e979783bdb2376eb6eca9f8f627
      category: bugfix
      bugzilla: https://gitee.com/src-openeuler/kernel/issues/I70OFF
      CVE: CVE-2023-32269
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2c1984d101978e979783bdb2376eb6eca9f8f627
      
      --------------------------------
      
      [ Upstream commit 61179292 ]
      
      If you call listen() and accept() on an already connect()ed
      AF_NETROM socket, accept() can successfully connect.
      This is because when the peer socket sends data to sendmsg,
      the skb with its own sk stored in the connected socket's
      sk->sk_receive_queue is connected, and nr_accept() dequeues
      the skb waiting in the sk->sk_receive_queue.
      
      As a result, nr_accept() allocates and returns a sock with
      the sk of the parent AF_NETROM socket.
      
      And here use-after-free can happen through complex race conditions:
      ```
                        cpu0                                                     cpu1
                                                                     1. socket_2 = socket(AF_NETROM)
                                                                              .
                                                                              .
                                                                        listen(socket_2)
                                                                        accepted_socket = accept(socket_2)
             2. socket_1 = socket(AF_NETROM)
                  nr_create()    // sk refcount : 1
                connect(socket_1)
                                                                     3. write(accepted_socket)
                                                                          nr_sendmsg()
                                                                          nr_output()
                                                                          nr_kick()
                                                                          nr_send_iframe()
                                                                          nr_transmit_buffer()
                                                                          nr_route_frame()
                                                                          nr_loopback_queue()
                                                                          nr_loopback_timer()
                                                                          nr_rx_frame()
                                                                          nr_process_rx_frame(sk, skb);    // sk : socket_1's sk
                                                                          nr_state3_machine()
                                                                          nr_queue_rx_frame()
                                                                          sock_queue_rcv_skb()
                                                                          sock_queue_rcv_skb_reason()
                                                                          __sock_queue_rcv_skb()
                                                                          __skb_queue_tail(list, skb);    // list : socket_1's sk->sk_receive_queue
             4. listen(socket_1)
                  nr_listen()
                uaf_socket = accept(socket_1)
                  nr_accept()
                  skb_dequeue(&sk->sk_receive_queue);
                                                                     5. close(accepted_socket)
                                                                          nr_release()
                                                                          nr_write_internal(sk, NR_DISCREQ)
                                                                          nr_transmit_buffer()    // NR_DISCREQ
                                                                          nr_route_frame()
                                                                          nr_loopback_queue()
                                                                          nr_loopback_timer()
                                                                          nr_rx_frame()    // sk : socket_1's sk
                                                                          nr_process_rx_frame()  // NR_STATE_3
                                                                          nr_state3_machine()    // NR_DISCREQ
                                                                          nr_disconnect()
                                                                          nr_sk(sk)->state = NR_STATE_0;
             6. close(socket_1)    // sk refcount : 3
                  nr_release()    // NR_STATE_0
                  sock_put(sk);    // sk refcount : 0
                  sk_free(sk);
                close(uaf_socket)
                  nr_release()
                  sock_hold(sk);    // UAF
      ```
      
      KASAN report by syzbot:
      ```
      BUG: KASAN: use-after-free in nr_release+0x66/0x460 net/netrom/af_netrom.c:520
      Write of size 4 at addr ffff8880235d8080 by task syz-executor564/5128
      
      Call Trace:
       <TASK>
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
       print_address_description mm/kasan/report.c:306 [inline]
       print_report+0x15e/0x461 mm/kasan/report.c:417
       kasan_report+0xbf/0x1f0 mm/kasan/report.c:517
       check_region_inline mm/kasan/generic.c:183 [inline]
       kasan_check_range+0x141/0x190 mm/kasan/generic.c:189
       instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
       atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:116 [inline]
       __refcount_add include/linux/refcount.h:193 [inline]
       __refcount_inc include/linux/refcount.h:250 [inline]
       refcount_inc include/linux/refcount.h:267 [inline]
       sock_hold include/net/sock.h:775 [inline]
       nr_release+0x66/0x460 net/netrom/af_netrom.c:520
       __sock_release+0xcd/0x280 net/socket.c:650
       sock_close+0x1c/0x20 net/socket.c:1365
       __fput+0x27c/0xa90 fs/file_table.c:320
       task_work_run+0x16f/0x270 kernel/task_work.c:179
       exit_task_work include/linux/task_work.h:38 [inline]
       do_exit+0xaa8/0x2950 kernel/exit.c:867
       do_group_exit+0xd4/0x2a0 kernel/exit.c:1012
       get_signal+0x21c3/0x2450 kernel/signal.c:2859
       arch_do_signal_or_restart+0x79/0x5c0 arch/x86/kernel/signal.c:306
       exit_to_user_mode_loop kernel/entry/common.c:168 [inline]
       exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:203
       __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
       syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:296
       do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      RIP: 0033:0x7f6c19e3c9b9
      Code: Unable to access opcode bytes at 0x7f6c19e3c98f.
      RSP: 002b:00007fffd4ba2ce8 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
      RAX: 0000000000000116 RBX: 0000000000000003 RCX: 00007f6c19e3c9b9
      RDX: 0000000000000318 RSI: 00000000200bd000 RDI: 0000000000000006
      RBP: 0000000000000003 R08: 000000000000000d R09: 000000000000000d
      R10: 0000000000000000 R11: 0000000000000246 R12: 000055555566a2c0
      R13: 0000000000000011 R14: 0000000000000000 R15: 0000000000000000
       </TASK>
      
      Allocated by task 5128:
       kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
       kasan_set_track+0x25/0x30 mm/kasan/common.c:52
       ____kasan_kmalloc mm/kasan/common.c:371 [inline]
       ____kasan_kmalloc mm/kasan/common.c:330 [inline]
       __kasan_kmalloc+0xa3/0xb0 mm/kasan/common.c:380
       kasan_kmalloc include/linux/kasan.h:211 [inline]
       __do_kmalloc_node mm/slab_common.c:968 [inline]
       __kmalloc+0x5a/0xd0 mm/slab_common.c:981
       kmalloc include/linux/slab.h:584 [inline]
       sk_prot_alloc+0x140/0x290 net/core/sock.c:2038
       sk_alloc+0x3a/0x7a0 net/core/sock.c:2091
       nr_create+0xb6/0x5f0 net/netrom/af_netrom.c:433
       __sock_create+0x359/0x790 net/socket.c:1515
       sock_create net/socket.c:1566 [inline]
       __sys_socket_create net/socket.c:1603 [inline]
       __sys_socket_create net/socket.c:1588 [inline]
       __sys_socket+0x133/0x250 net/socket.c:1636
       __do_sys_socket net/socket.c:1649 [inline]
       __se_sys_socket net/socket.c:1647 [inline]
       __x64_sys_socket+0x73/0xb0 net/socket.c:1647
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Freed by task 5128:
       kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
       kasan_set_track+0x25/0x30 mm/kasan/common.c:52
       kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:518
       ____kasan_slab_free mm/kasan/common.c:236 [inline]
       ____kasan_slab_free+0x13b/0x1a0 mm/kasan/common.c:200
       kasan_slab_free include/linux/kasan.h:177 [inline]
       __cache_free mm/slab.c:3394 [inline]
       __do_kmem_cache_free mm/slab.c:3580 [inline]
       __kmem_cache_free+0xcd/0x3b0 mm/slab.c:3587
       sk_prot_free net/core/sock.c:2074 [inline]
       __sk_destruct+0x5df/0x750 net/core/sock.c:2166
       sk_destruct net/core/sock.c:2181 [inline]
       __sk_free+0x175/0x460 net/core/sock.c:2192
       sk_free+0x7c/0xa0 net/core/sock.c:2203
       sock_put include/net/sock.h:1991 [inline]
       nr_release+0x39e/0x460 net/netrom/af_netrom.c:554
       __sock_release+0xcd/0x280 net/socket.c:650
       sock_close+0x1c/0x20 net/socket.c:1365
       __fput+0x27c/0xa90 fs/file_table.c:320
       task_work_run+0x16f/0x270 kernel/task_work.c:179
       exit_task_work include/linux/task_work.h:38 [inline]
       do_exit+0xaa8/0x2950 kernel/exit.c:867
       do_group_exit+0xd4/0x2a0 kernel/exit.c:1012
       get_signal+0x21c3/0x2450 kernel/signal.c:2859
       arch_do_signal_or_restart+0x79/0x5c0 arch/x86/kernel/signal.c:306
       exit_to_user_mode_loop kernel/entry/common.c:168 [inline]
       exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:203
       __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
       syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:296
       do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      ```
      
      To fix this issue, nr_listen() returns -EINVAL for sockets that
      successfully nr_connect().
      
      Reported-by: syzbot+caa188bdfc1eeafeb418@syzkaller.appspotmail.com
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: NHyunwoo Kim <v4bel@theori.io>
      Reviewed-by: NKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NZiyang Xuan <william.xuanziyang@huawei.com>
      Reviewed-by: NLiu Jian <liujian56@huawei.com>
      Reviewed-by: NXiu Jianfeng <xiujianfeng@huawei.com>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      768851b2
    • O
      !689 Fix compile error in allyesconfigs · 802a6328
      openeuler-ci-bot 提交于
      Merge Pull Request from: @aspiresky01 
       
      When using allyesconfig to configure the kernel, errors may occur during the linking process when making. 
       
      Link:https://gitee.com/openeuler/kernel/pulls/689 
      
      Reviewed-by: Chiqijun <chiqijun@huawei.com> 
      Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com> 
      802a6328
    • O
      !441 [openEuler-1.0-LTS] Add support for Zhaoxin SM3 and SM4 instruction · e87dfde7
      openeuler-ci-bot 提交于
      Merge Pull Request from: @leoliu-oc 
       
      Include 2 patches:
      1. Driver for Zhaoxin GMI SM3 Secure Hash algorithm
      This SM3 algorithm driver is developed to support the SM3 instruction, making user develop their applications with both high performance and high security.
      
      2. Driver for Zhaoxin GMI SM4 Block Cipher Algorithm
      This SM4 algorithm driver is developed to support the SM4 instruction, making user develop their applications with both high performance and high security.
      
      Issue
      https://gitee.com/openeuler/kernel/issues/I6J50I
      
      Test
      N/A
      
      Knowe Issue
      N/A
      
      Introduced config change
      CONFIG_CRYPTO_DEV_ZHAOXIN_SM3=m
      CONFIG_CRYPTO_DEV_ZHAOXIN_SM4=m 
       
      Link:https://gitee.com/openeuler/kernel/pulls/441 
      
      Reviewed-by: Zheng Zengkai <zhengzengkai@huawei.com> 
      Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com> 
      e87dfde7
    • O
      !438 [openEuler-1.0-LTS] Add Zhaoxin I2C driver · ad79acb3
      openeuler-ci-bot 提交于
      Merge Pull Request from: @leoliu-oc 
       
      Zhaoxin I2C Linux driver support all bidirectional bus protocols speed
      specified in the I2C Specification 7.0. The speed mode listed in the
      followed table.
      
      |   Speed Name    |           Description                |
      | Standard-mode   | Bit rate up to 100 kbit/s            |
      | Fast-mode       | Bit rate up to 400 kbit/s.(default)  |
      | Fast-mode Plus  | Bit rate up to 1 Mbit/s              |
      | High-speed mode | Bit rate up to 3.4 Mbit/s.           |
      
      Issue
      https://gitee.com/openeuler/kernel/issues/I6J3EV
      
      Test
      N/A
      
      Knowe Issue
      N/A
      
      Introduced config change
      CONFIG_I2C_ZHAOXIN=m 
       
      Link:https://gitee.com/openeuler/kernel/pulls/438 
      
      Reviewed-by: Zheng Zengkai <zhengzengkai@huawei.com> 
      Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com> 
      ad79acb3
  3. 10 5月, 2023 3 次提交
  4. 09 5月, 2023 8 次提交
  5. 08 5月, 2023 18 次提交
    • O
      !433 [openEuler-1.0-LTS] Add support of turbo boost control interface for Zhaoxin CPUs · 93ad695d
      openeuler-ci-bot 提交于
      Merge Pull Request from: @leoliu-oc 
       
      For recent Zhaoxin platforms, the turbo boost can be dynamically enabled or disabled,
      so add boost control interface support for Zhaoxin CPUs when acpi_cpufreq driver is in use.
      
      Issue
      https://gitee.com/openeuler/kernel/issues/I6J28W
      
      Test
      N/A
      
      Knowe Issue
      N/A
      
      Default config change
      N/A 
       
      Link:https://gitee.com/openeuler/kernel/pulls/433 
      
      Reviewed-by: Zheng Zengkai <zhengzengkai@huawei.com> 
      Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com> 
      93ad695d
    • O
      !431 [openEuler-1.0-LTS] Add Zhaoxin rng driver · c529a17c
      openeuler-ci-bot 提交于
      Merge Pull Request from: @leoliu-oc 
       
      This driver provides kernel-side support for the Random Number Generator hardware
      found on Zhaoxin based motherboards.
      
      Issue
      https://gitee.com/openeuler/kernel/issues/I6J139
      
      Test
      N/A
      
      Knowe Issue
      N/A
      
      Default config change
      N/A
       
       
      Link:https://gitee.com/openeuler/kernel/pulls/431 
      
      Reviewed-by: Zheng Zengkai <zhengzengkai@huawei.com> 
      Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com> 
      c529a17c
    • Z
      ipv6: Fix an uninit variable access bug in __ip6_make_skb() · dfe264f8
      Ziyang Xuan 提交于
      stable inclusion
      from stable-v4.19.281
      commit f394f690a30a5ec0413c62777a058eaf3d6e10d5
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I715PM
      CVE: NA
      
      --------------------------------
      
      [ Upstream commit ea30388b ]
      
      Syzbot reported a bug as following:
      
      =====================================================
      BUG: KMSAN: uninit-value in arch_atomic64_inc arch/x86/include/asm/atomic64_64.h:88 [inline]
      BUG: KMSAN: uninit-value in arch_atomic_long_inc include/linux/atomic/atomic-long.h:161 [inline]
      BUG: KMSAN: uninit-value in atomic_long_inc include/linux/atomic/atomic-instrumented.h:1429 [inline]
      BUG: KMSAN: uninit-value in __ip6_make_skb+0x2f37/0x30f0 net/ipv6/ip6_output.c:1956
       arch_atomic64_inc arch/x86/include/asm/atomic64_64.h:88 [inline]
       arch_atomic_long_inc include/linux/atomic/atomic-long.h:161 [inline]
       atomic_long_inc include/linux/atomic/atomic-instrumented.h:1429 [inline]
       __ip6_make_skb+0x2f37/0x30f0 net/ipv6/ip6_output.c:1956
       ip6_finish_skb include/net/ipv6.h:1122 [inline]
       ip6_push_pending_frames+0x10e/0x550 net/ipv6/ip6_output.c:1987
       rawv6_push_pending_frames+0xb12/0xb90 net/ipv6/raw.c:579
       rawv6_sendmsg+0x297e/0x2e60 net/ipv6/raw.c:922
       inet_sendmsg+0x101/0x180 net/ipv4/af_inet.c:827
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg net/socket.c:734 [inline]
       ____sys_sendmsg+0xa8e/0xe70 net/socket.c:2476
       ___sys_sendmsg+0x2a1/0x3f0 net/socket.c:2530
       __sys_sendmsg net/socket.c:2559 [inline]
       __do_sys_sendmsg net/socket.c:2568 [inline]
       __se_sys_sendmsg net/socket.c:2566 [inline]
       __x64_sys_sendmsg+0x367/0x540 net/socket.c:2566
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Uninit was created at:
       slab_post_alloc_hook mm/slab.h:766 [inline]
       slab_alloc_node mm/slub.c:3452 [inline]
       __kmem_cache_alloc_node+0x71f/0xce0 mm/slub.c:3491
       __do_kmalloc_node mm/slab_common.c:967 [inline]
       __kmalloc_node_track_caller+0x114/0x3b0 mm/slab_common.c:988
       kmalloc_reserve net/core/skbuff.c:492 [inline]
       __alloc_skb+0x3af/0x8f0 net/core/skbuff.c:565
       alloc_skb include/linux/skbuff.h:1270 [inline]
       __ip6_append_data+0x51c1/0x6bb0 net/ipv6/ip6_output.c:1684
       ip6_append_data+0x411/0x580 net/ipv6/ip6_output.c:1854
       rawv6_sendmsg+0x2882/0x2e60 net/ipv6/raw.c:915
       inet_sendmsg+0x101/0x180 net/ipv4/af_inet.c:827
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg net/socket.c:734 [inline]
       ____sys_sendmsg+0xa8e/0xe70 net/socket.c:2476
       ___sys_sendmsg+0x2a1/0x3f0 net/socket.c:2530
       __sys_sendmsg net/socket.c:2559 [inline]
       __do_sys_sendmsg net/socket.c:2568 [inline]
       __se_sys_sendmsg net/socket.c:2566 [inline]
       __x64_sys_sendmsg+0x367/0x540 net/socket.c:2566
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      It is because icmp6hdr does not in skb linear region under the scenario
      of SOCK_RAW socket. Access icmp6_hdr(skb)->icmp6_type directly will
      trigger the uninit variable access bug.
      
      Use a local variable icmp6_type to carry the correct value in different
      scenarios.
      
      Fixes: 14878f75 ("[IPV6]: Add ICMPMsgStats MIB (RFC 4293) [rev 2]")
      Reported-by: syzbot+8257f4dcef79de670baf@syzkaller.appspotmail.com
      Link: https://syzkaller.appspot.com/bug?id=3d605ec1d0a7f2a269a1a6936ac7f2b85975ee9cSigned-off-by: NZiyang Xuan <william.xuanziyang@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      dfe264f8
    • W
      cgroup/cpuset: Wake up cpuset_attach_wq tasks in cpuset_cancel_attach() · f2f214e0
      Waiman Long 提交于
      stable inclusion
      from stable-v4.19.281
      commit 30e138e23f43f566b6df87bba51e4d97930671fd
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I715PM
      CVE: NA
      
      --------------------------------
      
      commit ba9182a8 upstream.
      
      After a successful cpuset_can_attach() call which increments the
      attach_in_progress flag, either cpuset_cancel_attach() or cpuset_attach()
      will be called later. In cpuset_attach(), tasks in cpuset_attach_wq,
      if present, will be woken up at the end. That is not the case in
      cpuset_cancel_attach(). So missed wakeup is possible if the attach
      operation is somehow cancelled. Fix that by doing the wakeup in
      cpuset_cancel_attach() as well.
      
      Fixes: e44193d3 ("cpuset: let hotplug propagation work wait for task attaching")
      Signed-off-by: NWaiman Long <longman@redhat.com>
      Reviewed-by: NMichal Koutný <mkoutny@suse.com>
      Cc: stable@vger.kernel.org # v3.11+
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      f2f214e0
    • R
      verify_pefile: relax wrapper length check · 091d8aae
      Robbie Harwood 提交于
      stable inclusion
      from stable-v4.19.281
      commit 96acda7332d7f7f9b71e440d387ddebfe564e2f7
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I715PM
      CVE: NA
      
      --------------------------------
      
      [ Upstream commit 4fc5c74d ]
      
      The PE Format Specification (section "The Attribute Certificate Table
      (Image Only)") states that `dwLength` is to be rounded up to 8-byte
      alignment when used for traversal.  Therefore, the field is not required
      to be an 8-byte multiple in the first place.
      
      Accordingly, pesign has not performed this alignment since version
      0.110.  This causes kexec failure on pesign'd binaries with "PEFILE:
      Signature wrapper len wrong".  Update the comment and relax the check.
      Signed-off-by: NRobbie Harwood <rharwood@redhat.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      cc: Jarkko Sakkinen <jarkko@kernel.org>
      cc: Eric Biederman <ebiederm@xmission.com>
      cc: Herbert Xu <herbert@gondor.apana.org.au>
      cc: keyrings@vger.kernel.org
      cc: linux-crypto@vger.kernel.org
      cc: kexec@lists.infradead.org
      Link: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#the-attribute-certificate-table-image-only
      Link: https://github.com/rhboot/pesign
      Link: https://lore.kernel.org/r/20230220171254.592347-2-rharwood@redhat.com/ # v2
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      091d8aae
    • E
      udp6: fix potential access to stale information · a0b7ac46
      Eric Dumazet 提交于
      stable inclusion
      from stable-v4.19.281
      commit 0638f2b9b220ac33e4657010dd0a130ed0cde7df
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I715PM
      CVE: NA
      
      --------------------------------
      
      [ Upstream commit 1c5950fc ]
      
      lena wang reported an issue caused by udpv6_sendmsg()
      mangling msg->msg_name and msg->msg_namelen, which
      are later read from ____sys_sendmsg() :
      
      	/*
      	 * If this is sendmmsg() and sending to current destination address was
      	 * successful, remember it.
      	 */
      	if (used_address && err >= 0) {
      		used_address->name_len = msg_sys->msg_namelen;
      		if (msg_sys->msg_name)
      			memcpy(&used_address->name, msg_sys->msg_name,
      			       used_address->name_len);
      	}
      
      udpv6_sendmsg() wants to pretend the remote address family
      is AF_INET in order to call udp_sendmsg().
      
      A fix would be to modify the address in-place, instead
      of using a local variable, but this could have other side effects.
      
      Instead, restore initial values before we return from udpv6_sendmsg().
      
      Fixes: c71d8ebe ("net: Fix security_socket_sendmsg() bypass problem.")
      Reported-by: Nlena wang <lena.wang@mediatek.com>
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Reviewed-by: NMaciej Żenczykowski <maze@google.com>
      Link: https://lore.kernel.org/r/20230412130308.1202254-1-edumazet@google.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      a0b7ac46
    • R
      mm/swap: fix swap_info_struct race between swapoff and get_swap_pages() · 72aa5504
      Rongwei Wang 提交于
      stable inclusion
      from stable-v4.19.281
      commit a55f268abdb74ac5633b75a09fefb58458e9d2a2
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I715PM
      CVE: NA
      
      --------------------------------
      
      commit 6fe7d6b9 upstream.
      
      The si->lock must be held when deleting the si from the available list.
      Otherwise, another thread can re-add the si to the available list, which
      can lead to memory corruption.  The only place we have found where this
      happens is in the swapoff path.  This case can be described as below:
      
      core 0                       core 1
      swapoff
      
      del_from_avail_list(si)      waiting
      
      try lock si->lock            acquire swap_avail_lock
                                   and re-add si into
                                   swap_avail_head
      
      acquire si->lock but missing si already being added again, and continuing
      to clear SWP_WRITEOK, etc.
      
      It can be easily found that a massive warning messages can be triggered
      inside get_swap_pages() by some special cases, for example, we call
      madvise(MADV_PAGEOUT) on blocks of touched memory concurrently, meanwhile,
      run much swapon-swapoff operations (e.g.  stress-ng-swap).
      
      However, in the worst case, panic can be caused by the above scene.  In
      swapoff(), the memory used by si could be kept in swap_info[] after
      turning off a swap.  This means memory corruption will not be caused
      immediately until allocated and reset for a new swap in the swapon path.
      A panic message caused: (with CONFIG_PLIST_DEBUG enabled)
      
      ------------[ cut here ]------------
      top: 00000000e58a3003, n: 0000000013e75cda, p: 000000008cd4451a
      prev: 0000000035b1e58a, n: 000000008cd4451a, p: 000000002150ee8d
      next: 000000008cd4451a, n: 000000008cd4451a, p: 000000008cd4451a
      WARNING: CPU: 21 PID: 1843 at lib/plist.c:60 plist_check_prev_next_node+0x50/0x70
      Modules linked in: rfkill(E) crct10dif_ce(E)...
      CPU: 21 PID: 1843 Comm: stress-ng Kdump: ... 5.10.134+
      Hardware name: Alibaba Cloud ECS, BIOS 0.0.0 02/06/2015
      pstate: 60400005 (nZCv daif +PAN -UAO -TCO BTYPE=--)
      pc : plist_check_prev_next_node+0x50/0x70
      lr : plist_check_prev_next_node+0x50/0x70
      sp : ffff0018009d3c30
      x29: ffff0018009d3c40 x28: ffff800011b32a98
      x27: 0000000000000000 x26: ffff001803908000
      x25: ffff8000128ea088 x24: ffff800011b32a48
      x23: 0000000000000028 x22: ffff001800875c00
      x21: ffff800010f9e520 x20: ffff001800875c00
      x19: ffff001800fdc6e0 x18: 0000000000000030
      x17: 0000000000000000 x16: 0000000000000000
      x15: 0736076307640766 x14: 0730073007380731
      x13: 0736076307640766 x12: 0730073007380731
      x11: 000000000004058d x10: 0000000085a85b76
      x9 : ffff8000101436e4 x8 : ffff800011c8ce08
      x7 : 0000000000000000 x6 : 0000000000000001
      x5 : ffff0017df9ed338 x4 : 0000000000000001
      x3 : ffff8017ce62a000 x2 : ffff0017df9ed340
      x1 : 0000000000000000 x0 : 0000000000000000
      Call trace:
       plist_check_prev_next_node+0x50/0x70
       plist_check_head+0x80/0xf0
       plist_add+0x28/0x140
       add_to_avail_list+0x9c/0xf0
       _enable_swap_info+0x78/0xb4
       __do_sys_swapon+0x918/0xa10
       __arm64_sys_swapon+0x20/0x30
       el0_svc_common+0x8c/0x220
       do_el0_svc+0x2c/0x90
       el0_svc+0x1c/0x30
       el0_sync_handler+0xa8/0xb0
       el0_sync+0x148/0x180
      irq event stamp: 2082270
      
      Now, si->lock locked before calling 'del_from_avail_list()' to make sure
      other thread see the si had been deleted and SWP_WRITEOK cleared together,
      will not reinsert again.
      
      This problem exists in versions after stable 5.10.y.
      
      Link: https://lkml.kernel.org/r/20230404154716.23058-1-rongwei.wang@linux.alibaba.com
      Fixes: a2468cc9 ("swap: choose swap device according to numa node")
      Tested-by: NYongchen Yin <wb-yyc939293@alibaba-inc.com>
      Signed-off-by: NRongwei Wang <rongwei.wang@linux.alibaba.com>
      Cc: Bagas Sanjaya <bagasdotme@gmail.com>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Aaron Lu <aaron.lu@intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      72aa5504
    • J
      ftrace: Mark get_lock_parent_ip() __always_inline · 10bbeae8
      John Keeping 提交于
      stable inclusion
      from stable-v4.19.281
      commit 51ba3ee276a8f3e3b0b588526ebd8e9a9331aa2f
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I715PM
      CVE: NA
      
      --------------------------------
      
      commit ea65b418 upstream.
      
      If the compiler decides not to inline this function then preemption
      tracing will always show an IP inside the preemption disabling path and
      never the function actually calling preempt_{enable,disable}.
      
      Link: https://lore.kernel.org/linux-trace-kernel/20230327173647.1690849-1-john@metanate.com
      
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: stable@vger.kernel.org
      Fixes: f904f582 ("sched/debug: Fix preempt_disable_ip recording for preempt_disable()")
      Signed-off-by: NJohn Keeping <john@metanate.com>
      Signed-off-by: NSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      10bbeae8
    • K
      perf/core: Fix the same task check in perf_event_set_output · 45d428d0
      Kan Liang 提交于
      stable inclusion
      from stable-v4.19.281
      commit c1412fcad345d0c63874068a556cb1c03b87abb5
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I715PM
      CVE: NA
      
      --------------------------------
      
      [ Upstream commit 24d3ae2f ]
      
      The same task check in perf_event_set_output has some potential issues
      for some usages.
      
      For the current perf code, there is a problem if using of
      perf_event_open() to have multiple samples getting into the same mmap’d
      memory when they are both attached to the same process.
      https://lore.kernel.org/all/92645262-D319-4068-9C44-2409EF44888E@gmail.com/
      Because the event->ctx is not ready when the perf_event_set_output() is
      invoked in the perf_event_open().
      
      Besides the above issue, before the commit bd275681 ("perf: Rewrite
      core context handling"), perf record can errors out when sampling with
      a hardware event and a software event as below.
       $ perf record -e cycles,dummy --per-thread ls
       failed to mmap with 22 (Invalid argument)
      That's because that prior to the commit a hardware event and a software
      event are from different task context.
      
      The problem should be a long time issue since commit c3f00c70
      ("perk: Separate find_get_context() from event initialization").
      
      The task struct is stored in the event->hw.target for each per-thread
      event. It is a more reliable way to determine whether two events are
      attached to the same task.
      
      The event->hw.target was also introduced several years ago by the
      commit 50f16a8b ("perf: Remove type specific target pointers"). It
      can not only be used to fix the issue with the current code, but also
      back port to fix the issues with an older kernel.
      
      Note: The event->hw.target was introduced later than commit
      c3f00c70. The patch may cannot be applied between the commit
      c3f00c70 and commit 50f16a8b. Anybody that wants to back-port
      this at that period may have to find other solutions.
      
      Fixes: c3f00c70 ("perf: Separate find_get_context() from event initialization")
      Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: NZhengjun Xing <zhengjun.xing@linux.intel.com>
      Link: https://lkml.kernel.org/r/20230322202449.512091-1-kan.liang@linux.intel.comSigned-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      45d428d0
    • J
      net: don't let netpoll invoke NAPI if in xmit context · 4f4f55aa
      Jakub Kicinski 提交于
      stable inclusion
      from stable-v4.19.281
      commit be71c3c75a488ca1594a98df0754094179ec8146
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I715PM
      CVE: NA
      
      --------------------------------
      
      [ Upstream commit 275b471e ]
      
      Commit 0db3dc73 ("[NETPOLL]: tx lock deadlock fix") narrowed
      down the region under netif_tx_trylock() inside netpoll_send_skb().
      (At that point in time netif_tx_trylock() would lock all queues of
      the device.) Taking the tx lock was problematic because driver's
      cleanup method may take the same lock. So the change made us hold
      the xmit lock only around xmit, and expected the driver to take
      care of locking within ->ndo_poll_controller().
      
      Unfortunately this only works if netpoll isn't itself called with
      the xmit lock already held. Netpoll code is careful and uses
      trylock(). The drivers, however, may be using plain lock().
      Printing while holding the xmit lock is going to result in rare
      deadlocks.
      
      Luckily we record the xmit lock owners, so we can scan all the queues,
      the same way we scan NAPI owners. If any of the xmit locks is held
      by the local CPU we better not attempt any polling.
      
      It would be nice if we could narrow down the check to only the NAPIs
      and the queue we're trying to use. I don't see a way to do that now.
      Reported-by: NRoman Gushchin <roman.gushchin@linux.dev>
      Fixes: 0db3dc73 ("[NETPOLL]: tx lock deadlock fix")
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      Reviewed-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      4f4f55aa
    • E
      icmp: guard against too small mtu · d4d35e45
      Eric Dumazet 提交于
      stable inclusion
      from stable-v4.19.281
      commit 824bc1fd2ec3d389c372bc885170f1943642d010
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I715PM
      CVE: NA
      
      --------------------------------
      
      [ Upstream commit 7d63b671 ]
      
      syzbot was able to trigger a panic [1] in icmp_glue_bits(), or
      more exactly in skb_copy_and_csum_bits()
      
      There is no repro yet, but I think the issue is that syzbot
      manages to lower device mtu to a small value, fooling __icmp_send()
      
      __icmp_send() must make sure there is enough room for the
      packet to include at least the headers.
      
      We might in the future refactor skb_copy_and_csum_bits() and its
      callers to no longer crash when something bad happens.
      
      [1]
      kernel BUG at net/core/skbuff.c:3343 !
      invalid opcode: 0000 [#1] PREEMPT SMP KASAN
      CPU: 0 PID: 15766 Comm: syz-executor.0 Not tainted 6.3.0-rc4-syzkaller-00039-gffe78bbd #0
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014
      RIP: 0010:skb_copy_and_csum_bits+0x798/0x860 net/core/skbuff.c:3343
      Code: f0 c1 c8 08 41 89 c6 e9 73 ff ff ff e8 61 48 d4 f9 e9 41 fd ff ff 48 8b 7c 24 48 e8 52 48 d4 f9 e9 c3 fc ff ff e8 c8 27 84 f9 <0f> 0b 48 89 44 24 28 e8 3c 48 d4 f9 48 8b 44 24 28 e9 9d fb ff ff
      RSP: 0018:ffffc90000007620 EFLAGS: 00010246
      RAX: 0000000000000000 RBX: 00000000000001e8 RCX: 0000000000000100
      RDX: ffff8880276f6280 RSI: ffffffff87fdd138 RDI: 0000000000000005
      RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000000
      R10: 00000000000001e8 R11: 0000000000000001 R12: 000000000000003c
      R13: 0000000000000000 R14: ffff888028244868 R15: 0000000000000b0e
      FS: 00007fbc81f1c700(0000) GS:ffff88802ca00000(0000) knlGS:0000000000000000
      CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000001b2df43000 CR3: 00000000744db000 CR4: 0000000000150ef0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
      <IRQ>
      icmp_glue_bits+0x7b/0x210 net/ipv4/icmp.c:353
      __ip_append_data+0x1d1b/0x39f0 net/ipv4/ip_output.c:1161
      ip_append_data net/ipv4/ip_output.c:1343 [inline]
      ip_append_data+0x115/0x1a0 net/ipv4/ip_output.c:1322
      icmp_push_reply+0xa8/0x440 net/ipv4/icmp.c:370
      __icmp_send+0xb80/0x1430 net/ipv4/icmp.c:765
      ipv4_send_dest_unreach net/ipv4/route.c:1239 [inline]
      ipv4_link_failure+0x5a9/0x9e0 net/ipv4/route.c:1246
      dst_link_failure include/net/dst.h:423 [inline]
      arp_error_report+0xcb/0x1c0 net/ipv4/arp.c:296
      neigh_invalidate+0x20d/0x560 net/core/neighbour.c:1079
      neigh_timer_handler+0xc77/0xff0 net/core/neighbour.c:1166
      call_timer_fn+0x1a0/0x580 kernel/time/timer.c:1700
      expire_timers+0x29b/0x4b0 kernel/time/timer.c:1751
      __run_timers kernel/time/timer.c:2022 [inline]
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Reported-by: syzbot+d373d60fddbdc915e666@syzkaller.appspotmail.com
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20230330174502.1915328-1-edumazet@google.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      d4d35e45
    • L
      sched_getaffinity: don't assume 'cpumask_size()' is fully initialized · e7b1f698
      Linus Torvalds 提交于
      stable inclusion
      from stable-v4.19.280
      commit 178ff87d2a0c2d3d74081e1c2efbb33b3487267d
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I715PM
      CVE: NA
      
      --------------------------------
      
      [ Upstream commit 6015b1ac ]
      
      The getaffinity() system call uses 'cpumask_size()' to decide how big
      the CPU mask is - so far so good.  It is indeed the allocation size of a
      cpumask.
      
      But the code also assumes that the whole allocation is initialized
      without actually doing so itself.  That's wrong, because we might have
      fixed-size allocations (making copying and clearing more efficient), but
      not all of it is then necessarily used if 'nr_cpu_ids' is smaller.
      
      Having checked other users of 'cpumask_size()', they all seem to be ok,
      either using it purely for the allocation size, or explicitly zeroing
      the cpumask before using the size in bytes to copy it.
      
      See for example the ublk_ctrl_get_queue_affinity() function that uses
      the proper 'zalloc_cpumask_var()' to make sure that the whole mask is
      cleared, whether the storage is on the stack or if it was an external
      allocation.
      
      Fix this by just zeroing the allocation before using it.  Do the same
      for the compat version of sched_getaffinity(), which had the same logic.
      
      Also, for consistency, make sched_getaffinity() use 'cpumask_bits()' to
      access the bits.  For a cpumask_var_t, it ends up being a pointer to the
      same data either way, but it's just a good idea to treat it like you
      would a 'cpumask_t'.  The compat case already did that.
      Reported-by: NRyan Roberts <ryan.roberts@arm.com>
      Link: https://lore.kernel.org/lkml/7d026744-6bd6-6827-0471-b5e8eae0be3f@arm.com/
      Cc: Yury Norov <yury.norov@gmail.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      e7b1f698
    • J
      dm stats: check for and propagate alloc_percpu failure · ad628dad
      Jiasheng Jiang 提交于
      stable inclusion
      from stable-v4.19.280
      commit 0d96bd507ed7e7d565b6d53ebd3874686f123b2e
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I715PM
      CVE: NA
      
      --------------------------------
      
      commit d3aa3e06 upstream.
      
      Check alloc_precpu()'s return value and return an error from
      dm_stats_init() if it fails. Update alloc_dev() to fail if
      dm_stats_init() does.
      
      Otherwise, a NULL pointer dereference will occur in dm_stats_cleanup()
      even if dm-stats isn't being actively used.
      
      Fixes: fd2ed4d2 ("dm: add statistics support")
      Cc: stable@vger.kernel.org
      Signed-off-by: NJiasheng Jiang <jiasheng@iscas.ac.cn>
      Signed-off-by: NMike Snitzer <snitzer@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      ad628dad
    • C
      dm thin: fix deadlock when swapping to thin device · 571b0419
      Coly Li 提交于
      stable inclusion
      from stable-v4.19.280
      commit 84e13235e08941ce37aa9ee238b6dd007170f0fc
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I715PM
      CVE: NA
      
      --------------------------------
      
      commit 9bbf5fee upstream.
      
      This is an already known issue that dm-thin volume cannot be used as
      swap, otherwise a deadlock may happen when dm-thin internal memory
      demand triggers swap I/O on the dm-thin volume itself.
      
      But thanks to commit a666e5c0 ("dm: fix deadlock when swapping to
      encrypted device"), the limit_swap_bios target flag can also be used
      for dm-thin to avoid the recursive I/O when it is used as swap.
      
      Fix is to simply set ti->limit_swap_bios to true in both pool_ctr()
      and thin_ctr().
      
      In my test, I create a dm-thin volume /dev/vg/swap and use it as swap
      device. Then I run fio on another dm-thin volume /dev/vg/main and use
      large --blocksize to trigger swap I/O onto /dev/vg/swap.
      
      The following fio command line is used in my test,
        fio --name recursive-swap-io --lockmem 1 --iodepth 128 \
           --ioengine libaio --filename /dev/vg/main --rw randrw \
          --blocksize 1M --numjobs 32 --time_based --runtime=12h
      
      Without this fix, the whole system can be locked up within 15 seconds.
      
      With this fix, there is no any deadlock or hung task observed after
      2 hours of running fio.
      
      Furthermore, if blocksize is changed from 1M to 128M, after around 30
      seconds fio has no visible I/O, and the out-of-memory killer message
      shows up in kernel message. After around 20 minutes all fio processes
      are killed and the whole system is back to being alive.
      
      This is exactly what is expected when recursive I/O happens on dm-thin
      volume when it is used as swap.
      
      Depends-on: a666e5c0 ("dm: fix deadlock when swapping to encrypted device")
      Cc: stable@vger.kernel.org
      Signed-off-by: NColy Li <colyli@suse.de>
      Acked-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      571b0419
    • Y
      genirq: introduce handle_fasteoi_edge_irq for phytium · 94b461f6
      Yipeng Zou 提交于
      hulk inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6WPFT
      CVE: NA
      
      --------------------------------
      
      Since we fix the issue that irq may lose in gic-v3.
      
      It also needs fixed in phytium platform.
      Signed-off-by: NYipeng Zou <zouyipeng@huawei.com>
      Reviewed-by: NZhang Jianhua <chris.zjh@huawei.com>
      Reviewed-by: NLiao Chang <liaochang1@huawei.com>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      94b461f6
    • Y
      genirq: introduce handle_fasteoi_edge_irq flow handler · a95cc4da
      Yipeng Zou 提交于
      hulk inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6WPFT
      CVE: NA
      
      --------------------------------
      
      Recently, We have a LPI migration issue on the ARM SMP platform.
      
      For example, NIC device generates MSI and sends LPI to CPU0 via ITS,
      meanwhile irqbalance running on CPU1 set irq affinity of NIC to CPU1,
      the next interrupt will be sent to CPU2, due to the state of irq is
      still in progress, kernel does not end up performing irq handler on
      CPU2, which results in some userland service timeouts, the sequence
      of events is shown as follows:
      
      NIC                     CPU0                    CPU1
      
      Generate IRQ#1          READ_IAR
                              Lock irq_desc
                              Set IRQD_IN_PROGRESS
                              Unlock irq_desc
                                                      Lock irq_desc
                                                      Change LPI Affinity
                                                      Unlock irq_desc
                              Call irq_handler
      Generate IRQ#2
                                                      READ_IAR
                                                      Lock irq_desc
                                                      Check IRQD_IN_PROGRESS
                                                      Unlock irq_desc
                                                      Return from interrupt#2
                              Lock irq_desc
                              Clear IRQD_IN_PROGRESS
                              Unlock irq_desc
                              return from interrupt#1
      
      For this scenario, The IRQ#2 will be lost. This does cause some exceptions.
      
      For further information, see [1].
      
      This patch introduced a new flow handler which combines fasteoi and edge
      type as a workaround.
      An additional loop will be executed if the IRQS_PENDING has been setup.
      
      Fixes: cc2d3216 ("irqchip: GICv3: ITS command queue")
      Signed-off-by: NYipeng Zou <zouyipeng@huawei.com>
      Reviewed-by: NZhang Jianhua <chris.zjh@huawei.com>
      Reviewed-by: NLiao Chang <liaochang1@huawei.com>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      a95cc4da
    • Y
      Revert "genirq: Remove irqd_irq_disabled in __irq_move_irq" · 109f327d
      Yipeng Zou 提交于
      hulk inclusion
      category: feature
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6WPFT
      CVE: NA
      
      --------------------------------
      
      This reverts commit 2e149805.
      Signed-off-by: NYipeng Zou <zouyipeng@huawei.com>
      Reviewed-by: NZhang Jianhua <chris.zjh@huawei.com>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      109f327d
    • Y
      Revert "config: enbale irq pending config for openeuler" · 57640b7f
      Yipeng Zou 提交于
      hulk inclusion
      category: feature
      bugzilla: https://gitee.com/openeuler/kernel/issues/I6WPFT
      CVE: NA
      
      --------------------------------
      
      This reverts commit eca55c5a.
      Signed-off-by: NYipeng Zou <zouyipeng@huawei.com>
      Reviewed-by: NZhang Jianhua <chris.zjh@huawei.com>
      Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
      57640b7f