Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random freezes after kernel update #10

Closed
AAnzel opened this issue Apr 18, 2020 · 6 comments
Closed

Random freezes after kernel update #10

AAnzel opened this issue Apr 18, 2020 · 6 comments

Comments

@AAnzel
Copy link

AAnzel commented Apr 18, 2020

As stated in the title. Reboots do not fix the issue. When playing music in the background and system freezes, music continues playing but everything else becomes unresponsive. Mouse movement is possible while the system is frozen but UI is not responsive for a few seconds. After it unfreezes, all mouse and keyboard actions that were done during the "frozen time" appear as nothing has happend. One could also say that system lags occasionally.

Info:

Linux pop-os 5.3.0-7648-generic #41~1586789791~19.10~9593806-Ubuntu SMP Mon Apr 13 17:50:40 UTC  x86_64 x86_64 x86_64 GNU/Linux

Edit_1: Is there any other information that I should append?
Edit_2: Added more details.

@jackpot51
Copy link
Member

What is the output of dmesg?

Are you on a system with NVIDIA graphics? If so, what is the output of nvidia-smi?

@AAnzel
Copy link
Author

AAnzel commented Apr 21, 2020

dmesg output:

[    0.000000] microcode: microcode updated early to revision 0xd6, date = 2019-10-03
[    0.000000] Linux version 5.3.0-7648-generic (buildd@lcy01-amd64-016) (gcc version 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2)) #41~1586789791~19.10~9593806-Ubuntu SMP Mon Apr 13 17:50:40 UTC  (Ubuntu 5.3.0-7648.41~1586789791~19.10~9593806-generic 5.3.18)
[    0.000000] Command line: initrd=\EFI\Pop_OS-b8794c54-f87a-4ec4-a530-6d9ab292b3ef\initrd.img root=UUID=b8794c54-f87a-4ec4-a530-6d9ab292b3ef ro quiet loglevel=0 systemd.show_status=false splash
[    0.000000] KERNEL supported cpus:
[    0.000000]   Intel GenuineIntel
[    0.000000]   AMD AuthenticAMD
[    0.000000]   Hygon HygonGenuine
[    0.000000]   Centaur CentaurHauls
[    0.000000]   zhaoxin   Shanghai  
[    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x008: 'MPX bounds registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x010: 'MPX CSR'
[    0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
[    0.000000] x86/fpu: xstate_offset[3]:  832, xstate_sizes[3]:   64
[    0.000000] x86/fpu: xstate_offset[4]:  896, xstate_sizes[4]:   64
[    0.000000] x86/fpu: Enabled xstate features 0x1f, context size is 960 bytes, using 'compacted' format.
[    0.000000] BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x0000000000057fff] usable
[    0.000000] BIOS-e820: [mem 0x0000000000058000-0x0000000000058fff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000059000-0x0000000000085fff] usable
[    0.000000] BIOS-e820: [mem 0x0000000000086000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000005e4dcfff] usable
[    0.000000] BIOS-e820: [mem 0x000000005e4dd000-0x000000005e4ddfff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x000000005e4de000-0x000000005e507fff] reserved
[    0.000000] BIOS-e820: [mem 0x000000005e508000-0x000000007377dfff] usable
[    0.000000] BIOS-e820: [mem 0x000000007377e000-0x0000000075f7dfff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000075f7e000-0x0000000077f7dfff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x0000000077f7e000-0x0000000077ffdfff] ACPI data
[    0.000000] BIOS-e820: [mem 0x0000000077ffe000-0x0000000077ffefff] usable
[    0.000000] BIOS-e820: [mem 0x0000000077fff000-0x00000000780fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000079000000-0x000000007c7fffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000e0000000-0x00000000efffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fd000000-0x00000000fe7fffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000feb00000-0x00000000feb03fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fed00000-0x00000000fed00fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fed10000-0x00000000fed19fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fed84000-0x00000000fed84fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000ffa00000-0x00000000ffffffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x00000004827fffff] usable
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] e820: update [mem 0x5a6a4018-0x5a6b4057] usable ==> usable
[    0.000000] e820: update [mem 0x5a6a4018-0x5a6b4057] usable ==> usable
[    0.000000] e820: update [mem 0x5a69b018-0x5a6a3e57] usable ==> usable
[    0.000000] e820: update [mem 0x5a69b018-0x5a6a3e57] usable ==> usable
[    0.000000] extended physical RAM map:
[    0.000000] reserve setup_data: [mem 0x0000000000000000-0x0000000000057fff] usable
[    0.000000] reserve setup_data: [mem 0x0000000000058000-0x0000000000058fff] reserved
[    0.000000] reserve setup_data: [mem 0x0000000000059000-0x0000000000085fff] usable
[    0.000000] reserve setup_data: [mem 0x0000000000086000-0x00000000000fffff] reserved
[    0.000000] reserve setup_data: [mem 0x0000000000100000-0x000000005a69b017] usable
[    0.000000] reserve setup_data: [mem 0x000000005a69b018-0x000000005a6a3e57] usable
[    0.000000] reserve setup_data: [mem 0x000000005a6a3e58-0x000000005a6a4017] usable
[    0.000000] reserve setup_data: [mem 0x000000005a6a4018-0x000000005a6b4057] usable
[    0.000000] reserve setup_data: [mem 0x000000005a6b4058-0x000000005e4dcfff] usable
[    0.000000] reserve setup_data: [mem 0x000000005e4dd000-0x000000005e4ddfff] ACPI NVS
[    0.000000] reserve setup_data: [mem 0x000000005e4de000-0x000000005e507fff] reserved
[    0.000000] reserve setup_data: [mem 0x000000005e508000-0x000000007377dfff] usable
[    0.000000] reserve setup_data: [mem 0x000000007377e000-0x0000000075f7dfff] reserved
[    0.000000] reserve setup_data: [mem 0x0000000075f7e000-0x0000000077f7dfff] ACPI NVS
[    0.000000] reserve setup_data: [mem 0x0000000077f7e000-0x0000000077ffdfff] ACPI data
[    0.000000] reserve setup_data: [mem 0x0000000077ffe000-0x0000000077ffefff] usable
[    0.000000] reserve setup_data: [mem 0x0000000077fff000-0x00000000780fffff] reserved
[    0.000000] reserve setup_data: [mem 0x0000000079000000-0x000000007c7fffff] reserved
[    0.000000] reserve setup_data: [mem 0x00000000e0000000-0x00000000efffffff] reserved
[    0.000000] reserve setup_data: [mem 0x00000000fd000000-0x00000000fe7fffff] reserved
[    0.000000] reserve setup_data: [mem 0x00000000feb00000-0x00000000feb03fff] reserved
[    0.000000] reserve setup_data: [mem 0x00000000fec00000-0x00000000fec00fff] reserved
[    0.000000] reserve setup_data: [mem 0x00000000fed00000-0x00000000fed00fff] reserved
[    0.000000] reserve setup_data: [mem 0x00000000fed10000-0x00000000fed19fff] reserved
[    0.000000] reserve setup_data: [mem 0x00000000fed84000-0x00000000fed84fff] reserved
[    0.000000] reserve setup_data: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
[    0.000000] reserve setup_data: [mem 0x00000000ffa00000-0x00000000ffffffff] reserved
[    0.000000] reserve setup_data: [mem 0x0000000100000000-0x00000004827fffff] usable
[    0.000000] efi: EFI v2.40 by INSYDE Corp.
[    0.000000] efi:  SMBIOS=0x73cec000  ESRT=0x73ceab18  ACPI 2.0=0x77ffd014  TPMEventLog=0x5e5a4018 
[    0.000000] secureboot: Secure boot disabled
[    0.000000] SMBIOS 2.8 present.
[    0.000000] DMI: HP HP Pavilion Notebook/80A4, BIOS F.91 08/20/2019
[    0.000000] tsc: Detected 2600.000 MHz processor
[    0.000812] tsc: Detected 2599.992 MHz TSC
[    0.000812] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
[    0.000814] e820: remove [mem 0x000a0000-0x000fffff] usable
[    0.000823] last_pfn = 0x482800 max_arch_pfn = 0x400000000
[    0.000828] MTRR default type: uncachable
[    0.000829] MTRR fixed ranges enabled:
[    0.000830]   00000-9FFFF write-back
[    0.000831]   A0000-BFFFF uncachable
[    0.000832]   C0000-FFFFF write-protect
[    0.000833] MTRR variable ranges enabled:
[    0.000835]   0 base 0000000000 mask 7800000000 write-back
[    0.000836]   1 base 0077FFF000 mask 7FFFFFF000 uncachable
[    0.000837]   2 base 0078000000 mask 7FF8000000 uncachable
[    0.000838]   3 base 0080000000 mask 7F80000000 uncachable
[    0.000838]   4 disabled
[    0.000839]   5 disabled
[    0.000839]   6 disabled
[    0.000840]   7 disabled
[    0.000840]   8 disabled
[    0.000841]   9 disabled
[    0.001272] x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WP  UC- WT  
[    0.001443] total RAM covered: 30591M
[    0.001594]  gran_size: 64K 	chunk_size: 64K 	num_reg: 10  	lose cover RAM: 29361148K
[    0.001596]  gran_size: 64K 	chunk_size: 128K 	num_reg: 8  	lose cover RAM: 60K
[    0.001597]  gran_size: 64K 	chunk_size: 256K 	num_reg: 8  	lose cover RAM: 60K
[    0.001598]  gran_size: 64K 	chunk_size: 512K 	num_reg: 8  	lose cover RAM: 60K
[    0.001599]  gran_size: 64K 	chunk_size: 1M 	num_reg: 8  	lose cover RAM: 60K
[    0.001600]  gran_size: 64K 	chunk_size: 2M 	num_reg: 8  	lose cover RAM: 60K
[    0.001601]  gran_size: 64K 	chunk_size: 4M 	num_reg: 8  	lose cover RAM: 60K
[    0.001602]  gran_size: 64K 	chunk_size: 8M 	num_reg: 8  	lose cover RAM: 60K
[    0.001603]  gran_size: 64K 	chunk_size: 16M 	num_reg: 8  	lose cover RAM: 60K
[    0.001604]  gran_size: 64K 	chunk_size: 32M 	num_reg: 8  	lose cover RAM: 60K
[    0.001605]  gran_size: 64K 	chunk_size: 64M 	num_reg: 8  	lose cover RAM: 60K
[    0.001606]  gran_size: 64K 	chunk_size: 128M 	num_reg: 8  	lose cover RAM: 60K
[    0.001607]  gran_size: 64K 	chunk_size: 256M 	num_reg: 6  	lose cover RAM: 60K
[    0.001608]  gran_size: 64K 	chunk_size: 512M 	num_reg: 6  	lose cover RAM: 60K
[    0.001609]  gran_size: 64K 	chunk_size: 1G 	num_reg: 6  	lose cover RAM: 60K
[    0.001610]  gran_size: 64K 	chunk_size: 2G 	num_reg: 6  	lose cover RAM: 60K
[    0.001611]  gran_size: 128K 	chunk_size: 128K 	num_reg: 10  	lose cover RAM: 29361148K
[    0.001612]  gran_size: 128K 	chunk_size: 256K 	num_reg: 8  	lose cover RAM: 124K
[    0.001613]  gran_size: 128K 	chunk_size: 512K 	num_reg: 8  	lose cover RAM: 124K
[    0.001614]  gran_size: 128K 	chunk_size: 1M 	num_reg: 8  	lose cover RAM: 124K
[    0.001615]  gran_size: 128K 	chunk_size: 2M 	num_reg: 8  	lose cover RAM: 124K
[    0.001616]  gran_size: 128K 	chunk_size: 4M 	num_reg: 8  	lose cover RAM: 124K
[    0.001617]  gran_size: 128K 	chunk_size: 8M 	num_reg: 8  	lose cover RAM: 124K
[    0.001618]  gran_size: 128K 	chunk_size: 16M 	num_reg: 8  	lose cover RAM: 124K
[    0.001619]  gran_size: 128K 	chunk_size: 32M 	num_reg: 8  	lose cover RAM: 124K
[    0.001620]  gran_size: 128K 	chunk_size: 64M 	num_reg: 8  	lose cover RAM: 124K
[    0.001621]  gran_size: 128K 	chunk_size: 128M 	num_reg: 8  	lose cover RAM: 124K
[    0.001622]  gran_size: 128K 	chunk_size: 256M 	num_reg: 6  	lose cover RAM: 124K
[    0.001623]  gran_size: 128K 	chunk_size: 512M 	num_reg: 6  	lose cover RAM: 124K
[    0.001624]  gran_size: 128K 	chunk_size: 1G 	num_reg: 6  	lose cover RAM: 124K
[    0.001625]  gran_size: 128K 	chunk_size: 2G 	num_reg: 6  	lose cover RAM: 124K
[    0.001626]  gran_size: 256K 	chunk_size: 256K 	num_reg: 10  	lose cover RAM: 29361148K
[    0.001627]  gran_size: 256K 	chunk_size: 512K 	num_reg: 8  	lose cover RAM: 252K
[    0.001628]  gran_size: 256K 	chunk_size: 1M 	num_reg: 8  	lose cover RAM: 252K
[    0.001629]  gran_size: 256K 	chunk_size: 2M 	num_reg: 8  	lose cover RAM: 252K
[    0.001630]  gran_size: 256K 	chunk_size: 4M 	num_reg: 8  	lose cover RAM: 252K
[    0.001631]  gran_size: 256K 	chunk_size: 8M 	num_reg: 8  	lose cover RAM: 252K
[    0.001632]  gran_size: 256K 	chunk_size: 16M 	num_reg: 8  	lose cover RAM: 252K
[    0.001633]  gran_size: 256K 	chunk_size: 32M 	num_reg: 8  	lose cover RAM: 252K
[    0.001634]  gran_size: 256K 	chunk_size: 64M 	num_reg: 8  	lose cover RAM: 252K
[    0.001635]  gran_size: 256K 	chunk_size: 128M 	num_reg: 8  	lose cover RAM: 252K
[    0.001636]  gran_size: 256K 	chunk_size: 256M 	num_reg: 6  	lose cover RAM: 252K
[    0.001637]  gran_size: 256K 	chunk_size: 512M 	num_reg: 6  	lose cover RAM: 252K
[    0.001638]  gran_size: 256K 	chunk_size: 1G 	num_reg: 6  	lose cover RAM: 252K
[    0.001639]  gran_size: 256K 	chunk_size: 2G 	num_reg: 6  	lose cover RAM: 252K
[    0.001640]  gran_size: 512K 	chunk_size: 512K 	num_reg: 10  	lose cover RAM: 29361148K
[    0.001641]  gran_size: 512K 	chunk_size: 1M 	num_reg: 8  	lose cover RAM: 508K
[    0.001642]  gran_size: 512K 	chunk_size: 2M 	num_reg: 8  	lose cover RAM: 508K
[    0.001643]  gran_size: 512K 	chunk_size: 4M 	num_reg: 8  	lose cover RAM: 508K
[    0.001643]  gran_size: 512K 	chunk_size: 8M 	num_reg: 8  	lose cover RAM: 508K
[    0.001644]  gran_size: 512K 	chunk_size: 16M 	num_reg: 8  	lose cover RAM: 508K
[    0.001645]  gran_size: 512K 	chunk_size: 32M 	num_reg: 8  	lose cover RAM: 508K
[    0.001646]  gran_size: 512K 	chunk_size: 64M 	num_reg: 8  	lose cover RAM: 508K
[    0.001647]  gran_size: 512K 	chunk_size: 128M 	num_reg: 8  	lose cover RAM: 508K
[    0.001648]  gran_size: 512K 	chunk_size: 256M 	num_reg: 6  	lose cover RAM: 508K
[    0.001649]  gran_size: 512K 	chunk_size: 512M 	num_reg: 6  	lose cover RAM: 508K
[    0.001650]  gran_size: 512K 	chunk_size: 1G 	num_reg: 6  	lose cover RAM: 508K
[    0.001651]  gran_size: 512K 	chunk_size: 2G 	num_reg: 6  	lose cover RAM: 508K
[    0.001652]  gran_size: 1M 	chunk_size: 1M 	num_reg: 10  	lose cover RAM: 29361148K
[    0.001653]  gran_size: 1M 	chunk_size: 2M 	num_reg: 8  	lose cover RAM: 1020K
[    0.001654]  gran_size: 1M 	chunk_size: 4M 	num_reg: 8  	lose cover RAM: 1020K
[    0.001655]  gran_size: 1M 	chunk_size: 8M 	num_reg: 8  	lose cover RAM: 1020K
[    0.001656]  gran_size: 1M 	chunk_size: 16M 	num_reg: 8  	lose cover RAM: 1020K
[    0.001657]  gran_size: 1M 	chunk_size: 32M 	num_reg: 8  	lose cover RAM: 1020K
[    0.001658]  gran_size: 1M 	chunk_size: 64M 	num_reg: 8  	lose cover RAM: 1020K
[    0.001659]  gran_size: 1M 	chunk_size: 128M 	num_reg: 8  	lose cover RAM: 1020K
[    0.001660]  gran_size: 1M 	chunk_size: 256M 	num_reg: 6  	lose cover RAM: 1020K
[    0.001661]  gran_size: 1M 	chunk_size: 512M 	num_reg: 6  	lose cover RAM: 1020K
[    0.001662]  gran_size: 1M 	chunk_size: 1G 	num_reg: 6  	lose cover RAM: 1020K
[    0.001663]  gran_size: 1M 	chunk_size: 2G 	num_reg: 6  	lose cover RAM: 1020K
[    0.001664]  gran_size: 2M 	chunk_size: 2M 	num_reg: 10  	lose cover RAM: 25167868K
[    0.001665]  gran_size: 2M 	chunk_size: 4M 	num_reg: 8  	lose cover RAM: 2044K
[    0.001666]  gran_size: 2M 	chunk_size: 8M 	num_reg: 8  	lose cover RAM: 2044K
[    0.001667]  gran_size: 2M 	chunk_size: 16M 	num_reg: 8  	lose cover RAM: 2044K
[    0.001668]  gran_size: 2M 	chunk_size: 32M 	num_reg: 8  	lose cover RAM: 2044K
[    0.001669]  gran_size: 2M 	chunk_size: 64M 	num_reg: 8  	lose cover RAM: 2044K
[    0.001670]  gran_size: 2M 	chunk_size: 128M 	num_reg: 8  	lose cover RAM: 2044K
[    0.001671]  gran_size: 2M 	chunk_size: 256M 	num_reg: 6  	lose cover RAM: 2044K
[    0.001672]  gran_size: 2M 	chunk_size: 512M 	num_reg: 6  	lose cover RAM: 2044K
[    0.001673]  gran_size: 2M 	chunk_size: 1G 	num_reg: 6  	lose cover RAM: 2044K
[    0.001674]  gran_size: 2M 	chunk_size: 2G 	num_reg: 6  	lose cover RAM: 2044K
[    0.001675]  gran_size: 4M 	chunk_size: 4M 	num_reg: 10  	lose cover RAM: 16781308K
[    0.001676]  gran_size: 4M 	chunk_size: 8M 	num_reg: 8  	lose cover RAM: 4092K
[    0.001677]  gran_size: 4M 	chunk_size: 16M 	num_reg: 8  	lose cover RAM: 4092K
[    0.001677]  gran_size: 4M 	chunk_size: 32M 	num_reg: 8  	lose cover RAM: 4092K
[    0.001678]  gran_size: 4M 	chunk_size: 64M 	num_reg: 8  	lose cover RAM: 4092K
[    0.001679]  gran_size: 4M 	chunk_size: 128M 	num_reg: 8  	lose cover RAM: 4092K
[    0.001680]  gran_size: 4M 	chunk_size: 256M 	num_reg: 6  	lose cover RAM: 4092K
[    0.001681]  gran_size: 4M 	chunk_size: 512M 	num_reg: 6  	lose cover RAM: 4092K
[    0.001682]  gran_size: 4M 	chunk_size: 1G 	num_reg: 6  	lose cover RAM: 4092K
[    0.001683]  gran_size: 4M 	chunk_size: 2G 	num_reg: 6  	lose cover RAM: 4092K
[    0.001684]  gran_size: 8M 	chunk_size: 8M 	num_reg: 10  	lose cover RAM: 8188K
[    0.001685]  gran_size: 8M 	chunk_size: 16M 	num_reg: 8  	lose cover RAM: 8188K
[    0.001686]  gran_size: 8M 	chunk_size: 32M 	num_reg: 8  	lose cover RAM: 8188K
[    0.001687]  gran_size: 8M 	chunk_size: 64M 	num_reg: 8  	lose cover RAM: 8188K
[    0.001688]  gran_size: 8M 	chunk_size: 128M 	num_reg: 8  	lose cover RAM: 8188K
[    0.001689]  gran_size: 8M 	chunk_size: 256M 	num_reg: 6  	lose cover RAM: 8188K
[    0.001690]  gran_size: 8M 	chunk_size: 512M 	num_reg: 6  	lose cover RAM: 8188K
[    0.001691]  gran_size: 8M 	chunk_size: 1G 	num_reg: 6  	lose cover RAM: 8188K
[    0.001692]  gran_size: 8M 	chunk_size: 2G 	num_reg: 6  	lose cover RAM: 8188K
[    0.001693]  gran_size: 16M 	chunk_size: 16M 	num_reg: 9  	lose cover RAM: 16380K
[    0.001694]  gran_size: 16M 	chunk_size: 32M 	num_reg: 8  	lose cover RAM: 16380K
[    0.001695]  gran_size: 16M 	chunk_size: 64M 	num_reg: 8  	lose cover RAM: 16380K
[    0.001696]  gran_size: 16M 	chunk_size: 128M 	num_reg: 8  	lose cover RAM: 16380K
[    0.001697]  gran_size: 16M 	chunk_size: 256M 	num_reg: 6  	lose cover RAM: 16380K
[    0.001698]  gran_size: 16M 	chunk_size: 512M 	num_reg: 6  	lose cover RAM: 16380K
[    0.001699]  gran_size: 16M 	chunk_size: 1G 	num_reg: 6  	lose cover RAM: 16380K
[    0.001700]  gran_size: 16M 	chunk_size: 2G 	num_reg: 6  	lose cover RAM: 16380K
[    0.001701]  gran_size: 32M 	chunk_size: 32M 	num_reg: 8  	lose cover RAM: 32764K
[    0.001702]  gran_size: 32M 	chunk_size: 64M 	num_reg: 8  	lose cover RAM: 32764K
[    0.001703]  gran_size: 32M 	chunk_size: 128M 	num_reg: 8  	lose cover RAM: 32764K
[    0.001704]  gran_size: 32M 	chunk_size: 256M 	num_reg: 6  	lose cover RAM: 32764K
[    0.001705]  gran_size: 32M 	chunk_size: 512M 	num_reg: 6  	lose cover RAM: 32764K
[    0.001706]  gran_size: 32M 	chunk_size: 1G 	num_reg: 6  	lose cover RAM: 32764K
[    0.001707]  gran_size: 32M 	chunk_size: 2G 	num_reg: 6  	lose cover RAM: 32764K
[    0.001708]  gran_size: 64M 	chunk_size: 64M 	num_reg: 7  	lose cover RAM: 65532K
[    0.001709]  gran_size: 64M 	chunk_size: 128M 	num_reg: 8  	lose cover RAM: 65532K
[    0.001710]  gran_size: 64M 	chunk_size: 256M 	num_reg: 6  	lose cover RAM: 65532K
[    0.001711]  gran_size: 64M 	chunk_size: 512M 	num_reg: 6  	lose cover RAM: 65532K
[    0.001712]  gran_size: 64M 	chunk_size: 1G 	num_reg: 6  	lose cover RAM: 65532K
[    0.001713]  gran_size: 64M 	chunk_size: 2G 	num_reg: 6  	lose cover RAM: 65532K
[    0.001714]  gran_size: 128M 	chunk_size: 128M 	num_reg: 6  	lose cover RAM: 131068K
[    0.001715]  gran_size: 128M 	chunk_size: 256M 	num_reg: 6  	lose cover RAM: 131068K
[    0.001716]  gran_size: 128M 	chunk_size: 512M 	num_reg: 5  	lose cover RAM: 131068K
[    0.001717]  gran_size: 128M 	chunk_size: 1G 	num_reg: 5  	lose cover RAM: 131068K
[    0.001718]  gran_size: 128M 	chunk_size: 2G 	num_reg: 5  	lose cover RAM: 131068K
[    0.001719]  gran_size: 256M 	chunk_size: 256M 	num_reg: 6  	lose cover RAM: 131068K
[    0.001720]  gran_size: 256M 	chunk_size: 512M 	num_reg: 5  	lose cover RAM: 131068K
[    0.001721]  gran_size: 256M 	chunk_size: 1G 	num_reg: 5  	lose cover RAM: 131068K
[    0.001722]  gran_size: 256M 	chunk_size: 2G 	num_reg: 5  	lose cover RAM: 131068K
[    0.001723]  gran_size: 512M 	chunk_size: 512M 	num_reg: 5  	lose cover RAM: 393212K
[    0.001724]  gran_size: 512M 	chunk_size: 1G 	num_reg: 5  	lose cover RAM: 393212K
[    0.001725]  gran_size: 512M 	chunk_size: 2G 	num_reg: 5  	lose cover RAM: 393212K
[    0.001726]  gran_size: 1G 	chunk_size: 1G 	num_reg: 4  	lose cover RAM: 917500K
[    0.001727]  gran_size: 1G 	chunk_size: 2G 	num_reg: 4  	lose cover RAM: 917500K
[    0.001728]  gran_size: 2G 	chunk_size: 2G 	num_reg: 3  	lose cover RAM: 1966076K
[    0.001729] mtrr_cleanup: can not find optimal value
[    0.001729] please specify mtrr_gran_size/mtrr_chunk_size
[    0.001733] e820: update [mem 0x77fff000-0xffffffff] usable ==> reserved
[    0.001737] last_pfn = 0x77fff max_arch_pfn = 0x400000000
[    0.012101] esrt: Reserving ESRT space from 0x0000000073ceab18 to 0x0000000073ceab50.
[    0.012110] check: Scanning 1 areas for low memory corruption
[    0.012115] Using GB pages for direct mapping
[    0.012117] BRK [0x1ad201000, 0x1ad201fff] PGTABLE
[    0.012119] BRK [0x1ad202000, 0x1ad202fff] PGTABLE
[    0.012120] BRK [0x1ad203000, 0x1ad203fff] PGTABLE
[    0.012203] BRK [0x1ad204000, 0x1ad204fff] PGTABLE
[    0.012205] BRK [0x1ad205000, 0x1ad205fff] PGTABLE
[    0.012517] BRK [0x1ad206000, 0x1ad206fff] PGTABLE
[    0.012583] BRK [0x1ad207000, 0x1ad207fff] PGTABLE
[    0.012777] BRK [0x1ad208000, 0x1ad208fff] PGTABLE
[    0.012853] BRK [0x1ad209000, 0x1ad209fff] PGTABLE
[    0.012953] RAMDISK: [mem 0x6d769000-0x73241fff]
[    0.012963] ACPI: Early table checksum verification disabled
[    0.012966] ACPI: RSDP 0x0000000077FFD014 000024 (v02 HPQOEM)
[    0.012970] ACPI: XSDT 0x0000000077FDA188 000104 (v01 HPQOEM SLIC-MPC 00000000 HP   01000013)
[    0.012977] ACPI: FACP 0x0000000077FDF000 00010C (v05 HPQOEM SLIC-MPC 00000000 HP   00040000)
[    0.012982] ACPI: DSDT 0x0000000077FC0000 01901D (v02 HPQOEM 80A4     00000000 ACPI 00040000)
[    0.012986] ACPI: FACS 0x0000000077F69000 000040
[    0.012988] ACPI: TCPA 0x0000000077FFC000 000032 (v02 HPQOEM 80A4     00000000 HP   00040000)
[    0.012992] ACPI: UEFI 0x0000000077FFB000 000236 (v01 HPQOEM 80A4     00000001 HP   00040000)
[    0.012995] ACPI: UEFI 0x0000000077FFA000 000042 (v01 HPQOEM 80A4     00000002 HP   00040000)
[    0.012998] ACPI: SSDT 0x0000000077FF9000 0004B7 (v02 HPQOEM 80A4     00001000 ACPI 00040000)
[    0.013001] ACPI: SSDT 0x0000000077FF8000 00004B (v02 HPQOEM 80A4     00003000 ACPI 00040000)
[    0.013004] ACPI: TPM2 0x0000000077FF7000 000034 (v03 HPQOEM 80A4     00000000 HP   00040000)
[    0.013007] ACPI: SSDT 0x0000000077FF0000 006A90 (v01 HPQOEM 80A4     00001000 ACPI 00040000)
[    0.013010] ACPI: MSDM 0x0000000077FEF000 000055 (v03 HPQOEM SLIC-MPC 00000001 HP   00040000)
[    0.013013] ACPI: SSDT 0x0000000077FEA000 004E60 (v02 HPQOEM 80A4     00003000 ACPI 00040000)
[    0.013017] ACPI: SSDT 0x0000000077FE6000 003514 (v02 HPQOEM 80A4     00001000 ACPI 00040000)
[    0.013020] ACPI: DBGP 0x0000000077FE5000 000034 (v01 HPQOEM 80A4     00000001 HP   00040000)
[    0.013023] ACPI: DBG2 0x0000000077FE4000 000054 (v00 HPQOEM 80A4     00000000 HP   00040000)
[    0.013026] ACPI: ASF! 0x0000000077FE3000 0000A5 (v32 HPQOEM 80A4     00000001 HP   00040000)
[    0.013029] ACPI: ASPT 0x0000000077FE2000 000034 (v07 HPQOEM 80A4     00000001 HP   00040000)
[    0.013032] ACPI: BOOT 0x0000000077FE1000 000028 (v01 HPQOEM 80A4     00000001 HP   00040000)
[    0.013035] ACPI: DBGP 0x0000000077FE0000 000034 (v01 HPQOEM 80A4     00000001 HP   00040000)
[    0.013038] ACPI: HPET 0x0000000077FDE000 000038 (v01 HPQOEM 80A4     00000001 HP   00040000)
[    0.013041] ACPI: LPIT 0x0000000077FDD000 000094 (v01 HPQOEM 80A4     00000000 HP   00040000)
[    0.013044] ACPI: APIC 0x0000000077FDC000 0000BC (v03 HPQOEM 80A4     00000001 HP   00040000)
[    0.013047] ACPI: MCFG 0x0000000077FDB000 00003C (v01 HPQOEM 80A4     00000001 HP   00040000)
[    0.013050] ACPI: SSDT 0x0000000077FBF000 0002D4 (v01 HPQOEM 80A4     00000000 ACPI 00040000)
[    0.013054] ACPI: SSDT 0x0000000077FBC000 002BAE (v02 HPQOEM 80A4     00001000 ACPI 00040000)
[    0.013057] ACPI: SSDT 0x0000000077FBB000 000E80 (v02 HPQOEM 80A4     00003000 ACPI 00040000)
[    0.013060] ACPI: SSDT 0x0000000077FB7000 00377D (v01 HPQOEM 80A4     00001000 ACPI 00040000)
[    0.013063] ACPI: DMAR 0x0000000077FB6000 0000A8 (v01 HPQOEM 80A4     00000001 HP   00040000)
[    0.013066] ACPI: FPDT 0x0000000077FB5000 000044 (v01 HPQOEM SLIC-MPC 00000002 HP   00040000)
[    0.013069] ACPI: BGRT 0x0000000077FB4000 000038 (v01 HPQOEM 80A4     00000001 HP   00040000)
[    0.013078] ACPI: Local APIC address 0xfee00000
[    0.013273] No NUMA configuration found
[    0.013274] Faking a node at [mem 0x0000000000000000-0x00000004827fffff]
[    0.013286] NODE_DATA(0) allocated [mem 0x4827d5000-0x4827fffff]
[    0.013529] Zone ranges:
[    0.013530]   DMA      [mem 0x0000000000001000-0x0000000000ffffff]
[    0.013531]   DMA32    [mem 0x0000000001000000-0x00000000ffffffff]
[    0.013532]   Normal   [mem 0x0000000100000000-0x00000004827fffff]
[    0.013533]   Device   empty
[    0.013534] Movable zone start for each node
[    0.013538] Early memory node ranges
[    0.013539]   node   0: [mem 0x0000000000001000-0x0000000000057fff]
[    0.013540]   node   0: [mem 0x0000000000059000-0x0000000000085fff]
[    0.013541]   node   0: [mem 0x0000000000100000-0x000000005e4dcfff]
[    0.013542]   node   0: [mem 0x000000005e508000-0x000000007377dfff]
[    0.013543]   node   0: [mem 0x0000000077ffe000-0x0000000077ffefff]
[    0.013543]   node   0: [mem 0x0000000100000000-0x00000004827fffff]
[    0.013991] Zeroed struct page in unavailable ranges: 41256 pages
[    0.013992] Initmem setup node 0 [mem 0x0000000000001000-0x00000004827fffff]
[    0.013994] On node 0 totalpages: 4153048
[    0.013995]   DMA zone: 64 pages used for memmap
[    0.013995]   DMA zone: 21 pages reserved
[    0.013996]   DMA zone: 3972 pages, LIFO batch:0
[    0.014075]   DMA32 zone: 7326 pages used for memmap
[    0.014076]   DMA32 zone: 468820 pages, LIFO batch:63
[    0.025606]   Normal zone: 57504 pages used for memmap
[    0.025606]   Normal zone: 3680256 pages, LIFO batch:63
[    0.081537] Reserving Intel graphics memory at [mem 0x7a800000-0x7c7fffff]
[    0.081717] ACPI: PM-Timer IO Port: 0x1808
[    0.081718] ACPI: Local APIC address 0xfee00000
[    0.081726] ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
[    0.081727] ACPI: LAPIC_NMI (acpi_id[0x02] high edge lint[0x1])
[    0.081728] ACPI: LAPIC_NMI (acpi_id[0x03] high edge lint[0x1])
[    0.081728] ACPI: LAPIC_NMI (acpi_id[0x04] high edge lint[0x1])
[    0.081729] ACPI: LAPIC_NMI (acpi_id[0x05] high edge lint[0x1])
[    0.081730] ACPI: LAPIC_NMI (acpi_id[0x06] high edge lint[0x1])
[    0.081730] ACPI: LAPIC_NMI (acpi_id[0x07] high edge lint[0x1])
[    0.081731] ACPI: LAPIC_NMI (acpi_id[0x08] high edge lint[0x1])
[    0.081758] IOAPIC[0]: apic_id 2, version 32, address 0xfec00000, GSI 0-119
[    0.081760] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.081762] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.081763] ACPI: IRQ0 used by override.
[    0.081764] ACPI: IRQ9 used by override.
[    0.081767] Using ACPI (MADT) for SMP configuration information
[    0.081768] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.081775] e820: update [mem 0x64cdc000-0x64cfbfff] usable ==> reserved
[    0.081786] smpboot: Allowing 4 CPUs, 0 hotplug CPUs
[    0.081813] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
[    0.081815] PM: Registered nosave memory: [mem 0x00058000-0x00058fff]
[    0.081817] PM: Registered nosave memory: [mem 0x00086000-0x000fffff]
[    0.081819] PM: Registered nosave memory: [mem 0x5a69b000-0x5a69bfff]
[    0.081820] PM: Registered nosave memory: [mem 0x5a6a3000-0x5a6a3fff]
[    0.081821] PM: Registered nosave memory: [mem 0x5a6a4000-0x5a6a4fff]
[    0.081823] PM: Registered nosave memory: [mem 0x5a6b4000-0x5a6b4fff]
[    0.081825] PM: Registered nosave memory: [mem 0x5e4dd000-0x5e4ddfff]
[    0.081826] PM: Registered nosave memory: [mem 0x5e4de000-0x5e507fff]
[    0.081828] PM: Registered nosave memory: [mem 0x64cdc000-0x64cfbfff]
[    0.081829] PM: Registered nosave memory: [mem 0x7377e000-0x75f7dfff]
[    0.081830] PM: Registered nosave memory: [mem 0x75f7e000-0x77f7dfff]
[    0.081831] PM: Registered nosave memory: [mem 0x77f7e000-0x77ffdfff]
[    0.081833] PM: Registered nosave memory: [mem 0x77fff000-0x780fffff]
[    0.081833] PM: Registered nosave memory: [mem 0x78100000-0x78ffffff]
[    0.081834] PM: Registered nosave memory: [mem 0x79000000-0x7c7fffff]
[    0.081835] PM: Registered nosave memory: [mem 0x7c800000-0xdfffffff]
[    0.081835] PM: Registered nosave memory: [mem 0xe0000000-0xefffffff]
[    0.081836] PM: Registered nosave memory: [mem 0xf0000000-0xfcffffff]
[    0.081836] PM: Registered nosave memory: [mem 0xfd000000-0xfe7fffff]
[    0.081837] PM: Registered nosave memory: [mem 0xfe800000-0xfeafffff]
[    0.081837] PM: Registered nosave memory: [mem 0xfeb00000-0xfeb03fff]
[    0.081838] PM: Registered nosave memory: [mem 0xfeb04000-0xfebfffff]
[    0.081839] PM: Registered nosave memory: [mem 0xfec00000-0xfec00fff]
[    0.081839] PM: Registered nosave memory: [mem 0xfec01000-0xfecfffff]
[    0.081840] PM: Registered nosave memory: [mem 0xfed00000-0xfed00fff]
[    0.081840] PM: Registered nosave memory: [mem 0xfed01000-0xfed0ffff]
[    0.081841] PM: Registered nosave memory: [mem 0xfed10000-0xfed19fff]
[    0.081842] PM: Registered nosave memory: [mem 0xfed1a000-0xfed83fff]
[    0.081842] PM: Registered nosave memory: [mem 0xfed84000-0xfed84fff]
[    0.081843] PM: Registered nosave memory: [mem 0xfed85000-0xfedfffff]
[    0.081843] PM: Registered nosave memory: [mem 0xfee00000-0xfee00fff]
[    0.081844] PM: Registered nosave memory: [mem 0xfee01000-0xff9fffff]
[    0.081844] PM: Registered nosave memory: [mem 0xffa00000-0xffffffff]
[    0.081846] [mem 0x7c800000-0xdfffffff] available for PCI devices
[    0.081847] Booting paravirtualized kernel on bare hardware
[    0.081851] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645519600211568 ns
[    0.081859] setup_percpu: NR_CPUS:8192 nr_cpumask_bits:4 nr_cpu_ids:4 nr_node_ids:1
[    0.082056] percpu: Embedded 54 pages/cpu s184320 r8192 d28672 u524288
[    0.082064] pcpu-alloc: s184320 r8192 d28672 u524288 alloc=1*2097152
[    0.082065] pcpu-alloc: [0] 0 1 2 3 
[    0.082099] Built 1 zonelists, mobility grouping on.  Total pages: 4088133
[    0.082100] Policy zone: Normal
[    0.082101] Kernel command line: initrd=\EFI\Pop_OS-b8794c54-f87a-4ec4-a530-6d9ab292b3ef\initrd.img root=UUID=b8794c54-f87a-4ec4-a530-6d9ab292b3ef ro quiet loglevel=0 systemd.show_status=false splash
[    0.083274] Dentry cache hash table entries: 2097152 (order: 12, 16777216 bytes, linear)
[    0.083802] Inode-cache hash table entries: 1048576 (order: 11, 8388608 bytes, linear)
[    0.083864] mem auto-init: stack:off, heap alloc:on, heap free:off
[    0.088145] Calgary: detecting Calgary via BIOS EBDA area
[    0.088147] Calgary: Unable to locate Rio Grande table in EBDA - bailing!
[    0.137157] Memory: 16078684K/16612192K available (14339K kernel code, 2387K rwdata, 4728K rodata, 2676K init, 5044K bss, 533508K reserved, 0K cma-reserved)
[    0.137302] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.137313] Kernel/User page tables isolation: enabled
[    0.137346] ftrace: allocating 43602 entries in 171 pages
[    0.158119] rcu: Hierarchical RCU implementation.
[    0.158121] rcu: 	RCU restricting CPUs from NR_CPUS=8192 to nr_cpu_ids=4.
[    0.158122] 	Tasks RCU enabled.
[    0.158123] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.158123] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.162043] NR_IRQS: 524544, nr_irqs: 1024, preallocated irqs: 16
[    0.162425] random: crng done (trusting CPU's manufacturer)
[    0.162460] Console: colour dummy device 80x25
[    0.162468] printk: console [tty0] enabled
[    0.162485] ACPI: Core revision 20190703
[    0.162865] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635855245 ns
[    0.162933] APIC: Switch to symmetric I/O mode setup
[    0.162935] DMAR: Host address width 39
[    0.162937] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
[    0.162943] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap 1c0000c40660462 ecap 7e3ff0505e
[    0.162944] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
[    0.162948] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008c40660462 ecap f050da
[    0.162949] DMAR: RMRR base: 0x00000075ea9000 end: 0x00000075ec8fff
[    0.162950] DMAR: RMRR base: 0x0000007a000000 end: 0x0000007c7fffff
[    0.162952] DMAR-IR: IOAPIC id 2 under DRHD base  0xfed91000 IOMMU 1
[    0.162953] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
[    0.162954] DMAR-IR: x2apic is disabled because BIOS sets x2apic opt out bit.
[    0.162955] DMAR-IR: Use 'intremap=no_x2apic_optout' to override the BIOS setting.
[    0.164628] DMAR-IR: Enabled IRQ remapping in xapic mode
[    0.164629] x2apic: IRQ remapping doesn't support X2APIC mode
[    0.168705] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.186834] clocksource: tsc-early: mask: 0xffffffffffffffff max_cycles: 0x257a34a6eea, max_idle_ns: 440795264358 ns
[    0.186838] Calibrating delay loop (skipped), value calculated using timer frequency.. 5199.98 BogoMIPS (lpj=10399968)
[    0.186841] pid_max: default: 32768 minimum: 301
[    0.190632] LSM: Security Framework initializing
[    0.190645] Yama: becoming mindful.
[    0.190676] AppArmor: AppArmor initialized
[    0.190739] Mount-cache hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.190765] Mountpoint-cache hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.190966] *** VALIDATE proc ***
[    0.191019] *** VALIDATE cgroup1 ***
[    0.191020] *** VALIDATE cgroup2 ***
[    0.191083] mce: CPU0: Thermal monitoring enabled (TM1)
[    0.191102] process: using mwait in idle threads
[    0.191105] Last level iTLB entries: 4KB 64, 2MB 8, 4MB 8
[    0.191106] Last level dTLB entries: 4KB 64, 2MB 0, 4MB 0, 1GB 4
[    0.191110] Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization
[    0.191111] Spectre V2 : Mitigation: Full generic retpoline
[    0.191112] Spectre V2 : Spectre v2 / SpectreRSB mitigation: Filling RSB on context switch
[    0.191113] Spectre V2 : Enabling Restricted Speculation for firmware calls
[    0.191114] Spectre V2 : mitigation: Enabling conditional Indirect Branch Prediction Barrier
[    0.191115] Spectre V2 : User space: Mitigation: STIBP via seccomp and prctl
[    0.191116] Speculative Store Bypass: Mitigation: Speculative Store Bypass disabled via prctl and seccomp
[    0.191120] MDS: Mitigation: Clear CPU buffers
[    0.191432] Freeing SMP alternatives memory: 36K
[    0.194938] TSC deadline timer enabled
[    0.194942] smpboot: CPU0: Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz (family: 0x6, model: 0x4e, stepping: 0x3)
[    0.195084] Performance Events: PEBS fmt3+, Skylake events, 32-deep LBR, full-width counters, Intel PMU driver.
[    0.195091] ... version:                4
[    0.195091] ... bit width:              48
[    0.195092] ... generic registers:      4
[    0.195093] ... value mask:             0000ffffffffffff
[    0.195093] ... max period:             00007fffffffffff
[    0.195094] ... fixed-purpose events:   3
[    0.195094] ... event mask:             000000070000000f
[    0.195139] rcu: Hierarchical SRCU implementation.
[    0.196169] NMI watchdog: Enabled. Permanently consumes one hw-PMU counter.
[    0.196228] smp: Bringing up secondary CPUs ...
[    0.196323] x86: Booting SMP configuration:
[    0.196324] .... node  #0, CPUs:      #1 #2
[    0.199595] MDS CPU bug present and SMT on, data leak possible. See https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/mds.html for more details.
[    0.199595]  #3
[    0.199595] smp: Brought up 1 node, 4 CPUs
[    0.199595] smpboot: Max logical packages: 1
[    0.199595] smpboot: Total of 4 processors activated (20799.93 BogoMIPS)
[    0.202852] devtmpfs: initialized
[    0.202896] x86/mm: Memory block size: 128MB
[    0.204756] PM: Registering ACPI NVS region [mem 0x5e4dd000-0x5e4ddfff] (4096 bytes)
[    0.204756] PM: Registering ACPI NVS region [mem 0x75f7e000-0x77f7dfff] (33554432 bytes)
[    0.204756] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.204756] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.204756] pinctrl core: initialized pinctrl subsystem
[    0.204756] PM: RTC time: 07:16:13, date: 2020-04-21
[    0.204756] NET: Registered protocol family 16
[    0.204756] audit: initializing netlink subsys (disabled)
[    0.204756] audit: type=2000 audit(1587453372.040:1): state=initialized audit_enabled=0 res=1
[    0.204756] EISA bus registered
[    0.204756] cpuidle: using governor ladder
[    0.204756] cpuidle: using governor menu
[    0.204756] Simple Boot Flag at 0x44 set to 0x1
[    0.204756] KVM setup pv remote TLB flush
[    0.204756] ACPI FADT declares the system doesn't support PCIe ASPM, so disable it
[    0.204756] ACPI: bus type PCI registered
[    0.204756] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
[    0.204756] PCI: MMCONFIG for domain 0000 [bus 00-ff] at [mem 0xe0000000-0xefffffff] (base 0xe0000000)
[    0.204756] PCI: MMCONFIG at [mem 0xe0000000-0xefffffff] reserved in E820
[    0.204756] pmd_set_huge: Cannot satisfy [mem 0xe0000000-0xe0200000] with a huge-page mapping due to MTRR override.
[    0.204756] PCI: Using configuration type 1 for base access
[    0.207589] ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
[    0.208369] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[    0.208369] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.210936] ACPI: Added _OSI(Module Device)
[    0.210937] ACPI: Added _OSI(Processor Device)
[    0.210938] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.210939] ACPI: Added _OSI(Processor Aggregator Device)
[    0.210940] ACPI: Added _OSI(Linux-Dell-Video)
[    0.210941] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[    0.210942] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)
[    0.262847] ACPI: 10 ACPI AML tables successfully acquired and loaded
[    0.266535] ACPI: [Firmware Bug]: BIOS _OSI(Linux) query ignored
[    0.270843] ACPI: Dynamic OEM Table Load:
[    0.270862] ACPI: SSDT 0xFFFF89296F94F000 00066E (v02 PmRef  Cpu0Ist  00003000 INTL 20130117)
[    0.272921] ACPI: \_PR_.CPU0: _OSC native thermal LVT Acked
[    0.274474] ACPI: Dynamic OEM Table Load:
[    0.274484] ACPI: SSDT 0xFFFF89296F47C000 00037F (v02 PmRef  Cpu0Cst  00003001 INTL 20130117)
[    0.276400] ACPI: Dynamic OEM Table Load:
[    0.276408] ACPI: SSDT 0xFFFF89296F51F000 00008E (v02 PmRef  Cpu0Hwp  00003000 INTL 20130117)
[    0.278143] ACPI: Dynamic OEM Table Load:
[    0.278150] ACPI: SSDT 0xFFFF89296F566600 000130 (v02 PmRef  HwpLvt   00003000 INTL 20130117)
[    0.280817] ACPI: Dynamic OEM Table Load:
[    0.280827] ACPI: SSDT 0xFFFF89296F948000 0005AA (v02 PmRef  ApIst    00003000 INTL 20130117)
[    0.283041] ACPI: Dynamic OEM Table Load:
[    0.283049] ACPI: SSDT 0xFFFF89296F567600 000119 (v02 PmRef  ApHwp    00003000 INTL 20130117)
[    0.284925] ACPI: Dynamic OEM Table Load:
[    0.284932] ACPI: SSDT 0xFFFF89296F566200 000119 (v02 PmRef  ApCst    00003000 INTL 20130117)
[    0.289349] ACPI: EC: EC started
[    0.289350] ACPI: EC: interrupt blocked
[    0.440628] ACPI: \_SB_.PCI0.LPCB.EC0_: Used as first EC
[    0.440630] ACPI: \_SB_.PCI0.LPCB.EC0_: GPE=0x17, EC_CMD/EC_SC=0x66, EC_DATA=0x62
[    0.440631] ACPI: \_SB_.PCI0.LPCB.EC0_: Boot DSDT EC used to handle transactions
[    0.440631] ACPI: Interpreter enabled
[    0.440690] ACPI: (supports S0 S3 S4 S5)
[    0.440691] ACPI: Using IOAPIC for interrupt routing
[    0.440742] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    0.441319] ACPI: Enabled 8 GPEs in block 00 to 7F
[    0.451884] ACPI: Power Resource [PC01] (on)
[    0.455691] ACPI BIOS Error (bug): \_SB.PCI0.RP07.PXSX._DSW: Insufficient arguments - ASL declared 1, ACPI requires 3 (20190703/nsarguments-152)
[    0.456522] ACPI BIOS Error (bug): \_SB.PCI0.RP09.PXSX._DSW: Insufficient arguments - ASL declared 1, ACPI requires 3 (20190703/nsarguments-152)
[    0.466590] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-fe])
[    0.466598] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI HPX-Type3]
[    0.470419] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug SHPCHotplug PME AER PCIeCapability LTR]
[    0.470420] acpi PNP0A08:00: FADT indicates ASPM is unsupported, using BIOS configuration
[    0.472943] PCI host bridge to bus 0000:00
[    0.472945] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
[    0.472947] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
[    0.472948] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window]
[    0.472949] pci_bus 0000:00: root bus resource [mem 0x000c0000-0x000c3fff window]
[    0.472951] pci_bus 0000:00: root bus resource [mem 0x000c4000-0x000c7fff window]
[    0.472952] pci_bus 0000:00: root bus resource [mem 0x000c8000-0x000cbfff window]
[    0.472953] pci_bus 0000:00: root bus resource [mem 0x000cc000-0x000cffff window]
[    0.472954] pci_bus 0000:00: root bus resource [mem 0x000d0000-0x000d3fff window]
[    0.472955] pci_bus 0000:00: root bus resource [mem 0x000d4000-0x000d7fff window]
[    0.472956] pci_bus 0000:00: root bus resource [mem 0x000d8000-0x000dbfff window]
[    0.472957] pci_bus 0000:00: root bus resource [mem 0x000dc000-0x000dffff window]
[    0.472958] pci_bus 0000:00: root bus resource [mem 0x7c800000-0xdfffffff window]
[    0.472960] pci_bus 0000:00: root bus resource [mem 0xfd000000-0xfe7fffff window]
[    0.472961] pci_bus 0000:00: root bus resource [bus 00-fe]
[    0.472974] pci 0000:00:00.0: [8086:1904] type 00 class 0x060000
[    0.473986] pci 0000:00:02.0: [8086:1916] type 00 class 0x030000
[    0.474000] pci 0000:00:02.0: reg 0x10: [mem 0x92000000-0x92ffffff 64bit]
[    0.474008] pci 0000:00:02.0: reg 0x18: [mem 0xa0000000-0xafffffff 64bit pref]
[    0.474013] pci 0000:00:02.0: reg 0x20: [io  0x5000-0x503f]
[    0.474032] pci 0000:00:02.0: BAR 2: assigned to efifb
[    0.475061] pci 0000:00:04.0: [8086:1903] type 00 class 0x118000
[    0.475077] pci 0000:00:04.0: reg 0x10: [mem 0x94320000-0x94327fff 64bit]
[    0.476192] pci 0000:00:14.0: [8086:9d2f] type 00 class 0x0c0330
[    0.476218] pci 0000:00:14.0: reg 0x10: [mem 0x94300000-0x9430ffff 64bit]
[    0.476297] pci 0000:00:14.0: PME# supported from D3hot D3cold
[    0.477331] pci 0000:00:14.2: [8086:9d31] type 00 class 0x118000
[    0.477356] pci 0000:00:14.2: reg 0x10: [mem 0x94332000-0x94332fff 64bit]
[    0.478416] pci 0000:00:16.0: [8086:9d3a] type 00 class 0x078000
[    0.478446] pci 0000:00:16.0: reg 0x10: [mem 0x94333000-0x94333fff 64bit]
[    0.478530] pci 0000:00:16.0: PME# supported from D3hot
[    0.479579] pci 0000:00:17.0: [8086:9d03] type 00 class 0x010601
[    0.479601] pci 0000:00:17.0: reg 0x10: [mem 0x94330000-0x94331fff]
[    0.479610] pci 0000:00:17.0: reg 0x14: [mem 0x94336000-0x943360ff]
[    0.479618] pci 0000:00:17.0: reg 0x18: [io  0x5080-0x5087]
[    0.479627] pci 0000:00:17.0: reg 0x1c: [io  0x5088-0x508b]
[    0.479636] pci 0000:00:17.0: reg 0x20: [io  0x5060-0x507f]
[    0.479644] pci 0000:00:17.0: reg 0x24: [mem 0x94334000-0x943347ff]
[    0.479695] pci 0000:00:17.0: PME# supported from D3hot
[    0.480735] pci 0000:00:1c.0: [8086:9d10] type 01 class 0x060400
[    0.480832] pci 0000:00:1c.0: PME# supported from D0 D3hot D3cold
[    0.481930] pci 0000:00:1c.4: [8086:9d14] type 01 class 0x060400
[    0.482957] pci 0000:00:1c.4: PME# supported from D0 D3hot D3cold
[    0.484035] pci 0000:00:1c.5: [8086:9d15] type 01 class 0x060400
[    0.484128] pci 0000:00:1c.5: PME# supported from D0 D3hot D3cold
[    0.485220] pci 0000:00:1d.0: [8086:9d18] type 01 class 0x060400
[    0.485313] pci 0000:00:1d.0: PME# supported from D0 D3hot D3cold
[    0.486420] pci 0000:00:1f.0: [8086:9d48] type 00 class 0x060100
[    0.487566] pci 0000:00:1f.2: [8086:9d21] type 00 class 0x058000
[    0.487585] pci 0000:00:1f.2: reg 0x10: [mem 0x9432c000-0x9432ffff]
[    0.488664] pci 0000:00:1f.3: [8086:9d70] type 00 class 0x040300
[    0.488696] pci 0000:00:1f.3: reg 0x10: [mem 0x94328000-0x9432bfff 64bit]
[    0.488733] pci 0000:00:1f.3: reg 0x20: [mem 0x94310000-0x9431ffff 64bit]
[    0.488791] pci 0000:00:1f.3: PME# supported from D3hot D3cold
[    0.489884] pci 0000:00:1f.4: [8086:9d23] type 00 class 0x0c0500
[    0.489945] pci 0000:00:1f.4: reg 0x10: [mem 0x94335000-0x943350ff 64bit]
[    0.490016] pci 0000:00:1f.4: reg 0x20: [io  0x5040-0x505f]
[    0.491174] pci 0000:01:00.0: [10de:1347] type 00 class 0x030200
[    0.491201] pci 0000:01:00.0: reg 0x10: [mem 0x93000000-0x93ffffff]
[    0.491215] pci 0000:01:00.0: reg 0x14: [mem 0x80000000-0x8fffffff 64bit pref]
[    0.491229] pci 0000:01:00.0: reg 0x1c: [mem 0x90000000-0x91ffffff 64bit pref]
[    0.491239] pci 0000:01:00.0: reg 0x24: [io  0x4000-0x407f]
[    0.491248] pci 0000:01:00.0: reg 0x30: [mem 0xfff80000-0xffffffff pref]
[    0.491270] pci 0000:01:00.0: Enabling HDA controller
[    0.491473] pci 0000:00:1c.0: PCI bridge to [bus 01]
[    0.491476] pci 0000:00:1c.0:   bridge window [io  0x4000-0x4fff]
[    0.491479] pci 0000:00:1c.0:   bridge window [mem 0x93000000-0x93ffffff]
[    0.491484] pci 0000:00:1c.0:   bridge window [mem 0x80000000-0x91ffffff 64bit pref]
[    0.491551] pci 0000:02:00.0: [10ec:522a] type 00 class 0xff0000
[    0.491583] pci 0000:02:00.0: reg 0x10: [mem 0x94200000-0x94200fff]
[    0.491738] pci 0000:02:00.0: supports D1 D2
[    0.491740] pci 0000:02:00.0: PME# supported from D1 D2 D3hot D3cold
[    0.491945] pci 0000:00:1c.4: PCI bridge to [bus 02]
[    0.491950] pci 0000:00:1c.4:   bridge window [mem 0x94200000-0x942fffff]
[    0.492256] pci 0000:03:00.0: [8086:3165] type 00 class 0x028000
[    0.492358] pci 0000:03:00.0: reg 0x10: [mem 0x94100000-0x94101fff 64bit]
[    0.492807] pci 0000:03:00.0: PME# supported from D0 D3hot D3cold
[    0.493421] pci 0000:00:1c.5: PCI bridge to [bus 03]
[    0.493426] pci 0000:00:1c.5:   bridge window [mem 0x94100000-0x941fffff]
[    0.493495] pci 0000:04:00.0: [10ec:8136] type 00 class 0x020000
[    0.493528] pci 0000:04:00.0: reg 0x10: [io  0x3000-0x30ff]
[    0.493558] pci 0000:04:00.0: reg 0x18: [mem 0x94004000-0x94004fff 64bit]
[    0.493577] pci 0000:04:00.0: reg 0x20: [mem 0x94000000-0x94003fff 64bit]
[    0.493692] pci 0000:04:00.0: supports D1 D2
[    0.493693] pci 0000:04:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[    0.493910] pci 0000:00:1d.0: PCI bridge to [bus 04]
[    0.493913] pci 0000:00:1d.0:   bridge window [io  0x3000-0x3fff]
[    0.493916] pci 0000:00:1d.0:   bridge window [mem 0x94000000-0x940fffff]
[    0.496517] ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.496599] ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 5 6 *10 11 12 14 15)
[    0.496679] ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.496759] ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.496838] ACPI: PCI Interrupt Link [LNKE] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.496916] ACPI: PCI Interrupt Link [LNKF] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.496995] ACPI: PCI Interrupt Link [LNKG] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.497076] ACPI: PCI Interrupt Link [LNKH] (IRQs 3 4 5 6 10 *11 12 14 15)
[    0.497434] platform MSFT0101:00: failed to claim resource 1: [mem 0xfed40000-0xfed40fff]
[    0.497437] acpi MSFT0101:00: platform device creation failed: -16
[    0.497887] ACPI: EC: interrupt unblocked
[    0.497907] ACPI: EC: event unblocked
[    0.497921] ACPI: \_SB_.PCI0.LPCB.EC0_: GPE=0x17, EC_CMD/EC_SC=0x66, EC_DATA=0x62
[    0.497922] ACPI: \_SB_.PCI0.LPCB.EC0_: Boot DSDT EC used to handle transactions and events
[    0.498002] SCSI subsystem initialized
[    0.498002] libata version 3.00 loaded.
[    0.498002] pci 0000:00:02.0: vgaarb: setting as boot VGA device
[    0.498002] pci 0000:00:02.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
[    0.498002] pci 0000:00:02.0: vgaarb: bridge control possible
[    0.498002] vgaarb: loaded
[    0.498002] ACPI: bus type USB registered
[    0.498002] usbcore: registered new interface driver usbfs
[    0.498002] usbcore: registered new interface driver hub
[    0.498002] usbcore: registered new device driver usb
[    0.498002] pps_core: LinuxPPS API ver. 1 registered
[    0.498002] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.498002] PTP clock support registered
[    0.498002] EDAC MC: Ver: 3.0.0
[    0.498002] Registered efivars operations
[    0.498002] PCI: Using ACPI for IRQ routing
[    0.523478] PCI: pci_cache_line_size set to 64 bytes
[    0.523818] e820: reserve RAM buffer [mem 0x00058000-0x0005ffff]
[    0.523820] e820: reserve RAM buffer [mem 0x00086000-0x0008ffff]
[    0.523821] e820: reserve RAM buffer [mem 0x5a69b018-0x5bffffff]
[    0.523822] e820: reserve RAM buffer [mem 0x5a6a4018-0x5bffffff]
[    0.523822] e820: reserve RAM buffer [mem 0x5e4dd000-0x5fffffff]
[    0.523823] e820: reserve RAM buffer [mem 0x64cdc000-0x67ffffff]
[    0.523824] e820: reserve RAM buffer [mem 0x7377e000-0x73ffffff]
[    0.523825] e820: reserve RAM buffer [mem 0x77fff000-0x77ffffff]
[    0.523826] e820: reserve RAM buffer [mem 0x482800000-0x483ffffff]
[    0.523948] NetLabel: Initializing
[    0.523949] NetLabel:  domain hash size = 128
[    0.523950] NetLabel:  protocols = UNLABELED CIPSOv4 CALIPSO
[    0.523965] NetLabel:  unlabeled traffic allowed by default
[    0.527608] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0, 0, 0, 0, 0, 0
[    0.527612] hpet0: 8 comparators, 64-bit 24.000000 MHz counter
[    0.530856] clocksource: Switched to clocksource tsc-early
[    0.544628] VFS: Disk quotas dquot_6.6.0
[    0.544644] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.544676] *** VALIDATE hugetlbfs ***
[    0.544765] AppArmor: AppArmor Filesystem Enabled
[    0.544796] pnp: PnP ACPI init
[    0.545790] system 00:00: [mem 0xfd000000-0xfdabffff] has been reserved
[    0.545792] system 00:00: [mem 0xfdad0000-0xfdadffff] has been reserved
[    0.545794] system 00:00: [mem 0xfdb00000-0xfdffffff] has been reserved
[    0.545795] system 00:00: [mem 0xfe000000-0xfe01ffff] has been reserved
[    0.545796] system 00:00: [mem 0xfe036000-0xfe03bfff] has been reserved
[    0.545798] system 00:00: [mem 0xfe03d000-0xfe3fffff] has been reserved
[    0.545799] system 00:00: [mem 0xfe410000-0xfe7fffff] has been reserved
[    0.545805] system 00:00: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.546238] system 00:01: [io  0x2000-0x20fe] has been reserved
[    0.546241] system 00:01: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.546532] system 00:02: [io  0x0680-0x069f] has been reserved
[    0.546534] system 00:02: [io  0xffff] has been reserved
[    0.546535] system 00:02: [io  0xffff] has been reserved
[    0.546537] system 00:02: [io  0xffff] has been reserved
[    0.546538] system 00:02: [io  0x1800-0x18fe] has been reserved
[    0.546539] system 00:02: [io  0x164e-0x164f] has been reserved
[    0.546541] system 00:02: [io  0x0454-0x0457] has been reserved
[    0.546542] system 00:02: [io  0x0380-0x0387] has been reserved
[    0.546546] system 00:02: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.546681] pnp 00:03: Plug and Play ACPI device, IDs PNP0b00 (active)
[    0.546719] pnp 00:04: Plug and Play ACPI device, IDs HPQ8001 PNP0303 (active)
[    0.546751] pnp 00:05: Plug and Play ACPI device, IDs SYN1ef2 SYN1e00 SYN0002 PNP0f13 (active)
[    0.547366] system 00:06: [mem 0xfed10000-0xfed17fff] has been reserved
[    0.547368] system 00:06: [mem 0xfed18000-0xfed18fff] has been reserved
[    0.547369] system 00:06: [mem 0xfed19000-0xfed19fff] has been reserved
[    0.547370] system 00:06: [mem 0xe0000000-0xefffffff] has been reserved
[    0.547372] system 00:06: [mem 0xfed20000-0xfed3ffff] has been reserved
[    0.547373] system 00:06: [mem 0xfed90000-0xfed93fff] could not be reserved
[    0.547375] system 00:06: [mem 0xfed45000-0xfed8ffff] could not be reserved
[    0.547377] system 00:06: [mem 0xff000000-0xffffffff] could not be reserved
[    0.547378] system 00:06: [mem 0xfee00000-0xfeefffff] could not be reserved
[    0.547380] system 00:06: [mem 0x7c800000-0x7c81ffff] has been reserved
[    0.547383] system 00:06: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.548253] pnp: PnP ACPI: found 7 devices
[    0.549624] thermal_sys: Registered thermal governor 'fair_share'
[    0.549625] thermal_sys: Registered thermal governor 'bang_bang'
[    0.549626] thermal_sys: Registered thermal governor 'step_wise'
[    0.549626] thermal_sys: Registered thermal governor 'user_space'
[    0.549627] thermal_sys: Registered thermal governor 'power_allocator'
[    0.554123] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
[    0.554158] pci 0000:01:00.0: can't claim BAR 6 [mem 0xfff80000-0xffffffff pref]: no compatible bridge window
[    0.554164] pci 0000:00:1c.4: bridge window [io  0x1000-0x0fff] to [bus 02] add_size 1000
[    0.554166] pci 0000:00:1c.4: bridge window [mem 0x00100000-0x000fffff 64bit pref] to [bus 02] add_size 200000 add_align 100000
[    0.554182] pci 0000:00:1c.4: BAR 15: assigned [mem 0x7c900000-0x7cafffff 64bit pref]
[    0.554185] pci 0000:00:1c.4: BAR 13: assigned [io  0x6000-0x6fff]
[    0.554189] pci 0000:01:00.0: BAR 6: no space for [mem size 0x00080000 pref]
[    0.554191] pci 0000:01:00.0: BAR 6: failed to assign [mem size 0x00080000 pref]
[    0.554192] pci 0000:00:1c.0: PCI bridge to [bus 01]
[    0.554195] pci 0000:00:1c.0:   bridge window [io  0x4000-0x4fff]
[    0.554199] pci 0000:00:1c.0:   bridge window [mem 0x93000000-0x93ffffff]
[    0.554202] pci 0000:00:1c.0:   bridge window [mem 0x80000000-0x91ffffff 64bit pref]
[    0.554207] pci 0000:00:1c.4: PCI bridge to [bus 02]
[    0.554209] pci 0000:00:1c.4:   bridge window [io  0x6000-0x6fff]
[    0.554213] pci 0000:00:1c.4:   bridge window [mem 0x94200000-0x942fffff]
[    0.554216] pci 0000:00:1c.4:   bridge window [mem 0x7c900000-0x7cafffff 64bit pref]
[    0.554220] pci 0000:00:1c.5: PCI bridge to [bus 03]
[    0.554224] pci 0000:00:1c.5:   bridge window [mem 0x94100000-0x941fffff]
[    0.554231] pci 0000:00:1d.0: PCI bridge to [bus 04]
[    0.554233] pci 0000:00:1d.0:   bridge window [io  0x3000-0x3fff]
[    0.554237] pci 0000:00:1d.0:   bridge window [mem 0x94000000-0x940fffff]
[    0.554244] pci_bus 0000:00: resource 4 [io  0x0000-0x0cf7 window]
[    0.554246] pci_bus 0000:00: resource 5 [io  0x0d00-0xffff window]
[    0.554247] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff window]
[    0.554248] pci_bus 0000:00: resource 7 [mem 0x000c0000-0x000c3fff window]
[    0.554249] pci_bus 0000:00: resource 8 [mem 0x000c4000-0x000c7fff window]
[    0.554250] pci_bus 0000:00: resource 9 [mem 0x000c8000-0x000cbfff window]
[    0.554251] pci_bus 0000:00: resource 10 [mem 0x000cc000-0x000cffff window]
[    0.554253] pci_bus 0000:00: resource 11 [mem 0x000d0000-0x000d3fff window]
[    0.554254] pci_bus 0000:00: resource 12 [mem 0x000d4000-0x000d7fff window]
[    0.554255] pci_bus 0000:00: resource 13 [mem 0x000d8000-0x000dbfff window]
[    0.554256] pci_bus 0000:00: resource 14 [mem 0x000dc000-0x000dffff window]
[    0.554257] pci_bus 0000:00: resource 15 [mem 0x7c800000-0xdfffffff window]
[    0.554258] pci_bus 0000:00: resource 16 [mem 0xfd000000-0xfe7fffff window]
[    0.554260] pci_bus 0000:01: resource 0 [io  0x4000-0x4fff]
[    0.554261] pci_bus 0000:01: resource 1 [mem 0x93000000-0x93ffffff]
[    0.554262] pci_bus 0000:01: resource 2 [mem 0x80000000-0x91ffffff 64bit pref]
[    0.554263] pci_bus 0000:02: resource 0 [io  0x6000-0x6fff]
[    0.554265] pci_bus 0000:02: resource 1 [mem 0x94200000-0x942fffff]
[    0.554266] pci_bus 0000:02: resource 2 [mem 0x7c900000-0x7cafffff 64bit pref]
[    0.554267] pci_bus 0000:03: resource 1 [mem 0x94100000-0x941fffff]
[    0.554268] pci_bus 0000:04: resource 0 [io  0x3000-0x3fff]
[    0.554269] pci_bus 0000:04: resource 1 [mem 0x94000000-0x940fffff]
[    0.554434] NET: Registered protocol family 2
[    0.554587] tcp_listen_portaddr_hash hash table entries: 8192 (order: 5, 131072 bytes, linear)
[    0.554680] TCP established hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.554900] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes, linear)
[    0.554986] TCP: Hash tables configured (established 131072 bind 65536)
[    0.555047] UDP hash table entries: 8192 (order: 6, 262144 bytes, linear)
[    0.555098] UDP-Lite hash table entries: 8192 (order: 6, 262144 bytes, linear)
[    0.555198] NET: Registered protocol family 1
[    0.555205] NET: Registered protocol family 44
[    0.555217] pci 0000:00:02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
[    0.557095] PCI: CLS 64 bytes, default 64
[    0.557135] Trying to unpack rootfs image as initramfs...
[    0.799865] Freeing initrd memory: 93028K
[    0.814897] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[    0.814899] software IO TLB: mapped [mem 0x69769000-0x6d769000] (64MB)
[    0.815115] check: Scanning for low memory corruption every 60 seconds
[    0.817259] Initialise system trusted keyrings
[    0.817269] Key type blacklist registered
[    0.817300] workingset: timestamp_bits=36 max_order=22 bucket_order=0
[    0.818753] zbud: loaded
[    0.819169] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.819326] fuse: init (API version 7.31)
[    0.819437] Platform Keyring initialized
[    0.824892] Key type asymmetric registered
[    0.824893] Asymmetric key parser 'x509' registered
[    0.824905] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 244)
[    0.824943] io scheduler mq-deadline registered
[    0.825337] pcieport 0000:00:1c.0: PME: Signaling with IRQ 122
[    0.825399] pcieport 0000:00:1c.0: AER: enabled with IRQ 122
[    0.825662] pcieport 0000:00:1c.4: PME: Signaling with IRQ 123
[    0.825723] pcieport 0000:00:1c.4: AER: enabled with IRQ 123
[    0.825746] pcieport 0000:00:1c.4: pciehp: Slot #4 AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug+ Surprise+ Interlock- NoCompl+ LLActRep+
[    0.826019] pcieport 0000:00:1c.5: PME: Signaling with IRQ 124
[    0.826071] pcieport 0000:00:1c.5: AER: enabled with IRQ 124
[    0.826312] pcieport 0000:00:1d.0: PME: Signaling with IRQ 125
[    0.826363] pcieport 0000:00:1d.0: AER: enabled with IRQ 125
[    0.826431] shpchp: Standard Hot Plug PCI Controller Driver version: 0.4
[    0.826497] efifb: probing for efifb
[    0.826534] efifb: showing boot graphics
[    0.827279] efifb: framebuffer at 0xa0000000, using 8100k, total 8100k
[    0.827280] efifb: mode is 1920x1080x32, linelength=7680, pages=1
[    0.827281] efifb: scrolling: redraw
[    0.827282] efifb: Truecolor: size=8:8:8:8, shift=24:16:8:0
[    0.827330] fbcon: Deferring console take-over
[    0.827331] fb0: EFI VGA frame buffer device
[    0.827338] intel_idle: MWAIT substates: 0x11142120
[    0.827339] intel_idle: v0.4.1 model 0x4E
[    0.827594] intel_idle: lapic_timer_reliable_states 0xffffffff
[    0.828128] ACPI: AC Adapter [ADP1] (off-line)
[    0.828203] input: Lid Switch as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input0
[    0.828209] ACPI: Lid Switch [LID0]
[    0.828238] input: Power Button as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input1
[    0.828244] ACPI: Power Button [PWRB]
[    0.828275] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input2
[    0.828287] ACPI: Power Button [PWRF]
[    0.834540] [Firmware Bug]: Invalid critical threshold (0)
[    0.839204] thermal LNXTHERM:00: registered as thermal_zone0
[    0.839205] ACPI: Thermal Zone [TZ01] (58 C)
[    0.839454] Serial: 8250/16550 driver, 32 ports, IRQ sharing enabled
[    0.843585] Linux agpgart interface v0.103
[    0.909910] battery: ACPI: Battery Slot [BAT0] (battery present)
[    0.913170] loop: module loaded
[    0.913375] libphy: Fixed MDIO Bus: probed
[    0.913376] tun: Universal TUN/TAP device driver, 1.6
[    0.913420] PPP generic driver version 2.4.2
[    0.913469] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.913475] ehci-pci: EHCI PCI platform driver
[    0.913488] ehci-platform: EHCI generic platform driver
[    0.913498] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.913500] ohci-pci: OHCI PCI platform driver
[    0.913509] ohci-platform: OHCI generic platform driver
[    0.913516] uhci_hcd: USB Universal Host Controller Interface driver
[    0.913746] xhci_hcd 0000:00:14.0: xHCI Host Controller
[    0.913753] xhci_hcd 0000:00:14.0: new USB bus registered, assigned bus number 1
[    0.914831] xhci_hcd 0000:00:14.0: hcc params 0x200077c1 hci version 0x100 quirks 0x0000000081109810
[    0.914931] xhci_hcd 0000:00:14.0: cache line size of 64 is not supported
[    0.915129] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.03
[    0.915130] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.915131] usb usb1: Product: xHCI Host Controller
[    0.915133] usb usb1: Manufacturer: Linux 5.3.0-7648-generic xhci-hcd
[    0.915134] usb usb1: SerialNumber: 0000:00:14.0
[    0.915261] hub 1-0:1.0: USB hub found
[    0.915276] hub 1-0:1.0: 12 ports detected
[    0.916633] xhci_hcd 0000:00:14.0: xHCI Host Controller
[    0.916636] xhci_hcd 0000:00:14.0: new USB bus registered, assigned bus number 2
[    0.916639] xhci_hcd 0000:00:14.0: Host supports USB 3.0 SuperSpeed
[    0.916674] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.03
[    0.916676] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.916677] usb usb2: Product: xHCI Host Controller
[    0.916678] usb usb2: Manufacturer: Linux 5.3.0-7648-generic xhci-hcd
[    0.916679] usb usb2: SerialNumber: 0000:00:14.0
[    0.916795] hub 2-0:1.0: USB hub found
[    0.916805] hub 2-0:1.0: 6 ports detected
[    0.918018] i8042: PNP: PS/2 Controller [PNP0303:PS2K,PNP0f13:PS2M] at 0x60,0x64 irq 1,12
[    0.924940] serio: i8042 KBD port at 0x60,0x64 irq 1
[    0.924943] serio: i8042 AUX port at 0x60,0x64 irq 12
[    0.925112] mousedev: PS/2 mouse device common for all mice
[    0.925398] rtc_cmos 00:03: RTC can wake from S4
[    0.925895] rtc_cmos 00:03: registered as rtc0
[    0.925908] rtc_cmos 00:03: alarms up to one month, y3k, 242 bytes nvram, hpet irqs
[    0.925913] i2c /dev entries driver
[    0.925964] device-mapper: uevent: version 1.0.3
[    0.926059] device-mapper: ioctl: 4.40.0-ioctl (2019-01-18) initialised: dm-devel@redhat.com
[    0.926078] platform eisa.0: Probing EISA bus 0
[    0.926080] platform eisa.0: EISA: Cannot allocate resource for mainboard
[    0.926082] platform eisa.0: Cannot allocate resource for EISA slot 1
[    0.926083] platform eisa.0: Cannot allocate resource for EISA slot 2
[    0.926084] platform eisa.0: Cannot allocate resource for EISA slot 3
[    0.926085] platform eisa.0: Cannot allocate resource for EISA slot 4
[    0.926086] platform eisa.0: Cannot allocate resource for EISA slot 5
[    0.926087] platform eisa.0: Cannot allocate resource for EISA slot 6
[    0.926088] platform eisa.0: Cannot allocate resource for EISA slot 7
[    0.926089] platform eisa.0: Cannot allocate resource for EISA slot 8
[    0.926090] platform eisa.0: EISA: Detected 0 cards
[    0.926093] intel_pstate: Intel P-state driver initializing
[    0.926417] intel_pstate: HWP enabled
[    0.926444] ledtrig-cpu: registered to indicate activity on CPUs
[    0.926446] EFI Variables Facility v0.08 2004-May-17
[    0.968697] intel_pmc_core intel_pmc_core.0:  initialized
[    0.968876] NET: Registered protocol family 10
[    0.976108] Segment Routing with IPv6
[    0.976142] NET: Registered protocol family 17
[    0.976187] Key type dns_resolver registered
[    0.976557] RAS: Correctable Errors collector initialized.
[    0.976639] microcode: sig=0x406e3, pf=0x80, revision=0xd6
[    0.976775] microcode: Microcode Update Driver: v2.2.
[    0.976792] sched_clock: Marking stable (976303354, 469598)->(1328190520, -351417568)
[    0.977012] registered taskstats version 1
[    0.977018] Loading compiled-in X.509 certificates
[    0.978637] Loaded X.509 cert 'Build time autogenerated kernel key: ba5c8a28696fecc2a89772bef1734c4cb36d1e0b'
[    0.978663] zswap: loaded using pool lzo/zbud
[    0.985919] Key type big_key registered
[    0.985924] Key type trusted registered
[    0.989536] Key type encrypted registered
[    0.989546] AppArmor: AppArmor sha1 policy hashing enabled
[    0.991502] integrity: Loading X.509 certificate: UEFI:db
[    0.991534] integrity: Loaded X.509 cert 'Microsoft Windows Production PCA 2011: a92902398e16c49778cd90f99e4f9ae17c55af53'
[    0.991535] integrity: Loading X.509 certificate: UEFI:db
[    0.991554] integrity: Loaded X.509 cert 'Microsoft Corporation UEFI CA 2011: 13adbf4309bd82709c8cd54f316ed522988a1bd4'
[    0.991554] integrity: Loading X.509 certificate: UEFI:db
[    0.991568] integrity: Loaded X.509 cert 'Hewlett-Packard Company: HP UEFI Secure Boot 2013 DB key: 1d7cf2c2b92673f69c8ee1ec7063967ab9b62bec'
[    0.993495] ima: Allocated hash algorithm: sha1
[    1.000832] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input3
[    1.171046] No architecture policies found
[    1.171058] evm: Initialising EVM extended attributes:
[    1.171059] evm: security.selinux
[    1.171059] evm: security.SMACK64
[    1.171060] evm: security.SMACK64EXEC
[    1.171060] evm: security.SMACK64TRANSMUTE
[    1.171060] evm: security.SMACK64MMAP
[    1.171061] evm: security.apparmor
[    1.171061] evm: security.ima
[    1.171061] evm: security.capability
[    1.171062] evm: HMAC attrs: 0x1
[    1.172184] PM:   Magic number: 0:27:269
[    1.172228] memory memory139: hash matches
[    1.172371] rtc_cmos 00:03: setting system clock to 2020-04-21T07:16:14 UTC (1587453374)
[    1.173524] Freeing unused decrypted memory: 2040K
[    1.173906] Freeing unused kernel image memory: 2676K
[    1.173957] Write protecting the kernel read-only data: 22528k
[    1.174375] Freeing unused kernel image memory: 2008K
[    1.174549] Freeing unused kernel image memory: 1416K
[    1.183695] x86/mm: Checked W+X mappings: passed, no W+X pages found.
[    1.183696] x86/mm: Checking user space page tables
[    1.192110] x86/mm: Checked W+X mappings: passed, no W+X pages found.
[    1.192112] Run /init as init process
[    1.250868] usb 1-3: new high-speed USB device number 2 using xhci_hcd
[    1.258745] wmi_bus wmi_bus-PNP0C14:00: WQ data block query control method not found
[    1.258748] wmi_bus wmi_bus-PNP0C14:00: WQ data block query control method not found
[    1.258750] wmi_bus wmi_bus-PNP0C14:00: WQ data block query control method not found
[    1.258752] wmi_bus wmi_bus-PNP0C14:00: WQ data block query control method not found
[    1.258971] wmi_bus wmi_bus-PNP0C14:01: WQBC data block query control method not found
[    1.258995] wmi_bus wmi_bus-PNP0C14:01: WQBJ data block query control method not found
[    1.274456] ahci 0000:00:17.0: version 3.0
[    1.274680] ahci 0000:00:17.0: AHCI 0001.0301 32 slots 3 ports 6 Gbps 0x7 impl SATA mode
[    1.274682] ahci 0000:00:17.0: flags: 64bit ncq pm led clo only pio slum part deso sadm sds apst 
[    1.276701] scsi host0: ahci
[    1.279079] scsi host1: ahci
[    1.279233] i801_smbus 0000:00:1f.4: SPD Write Disable is set
[    1.279280] i801_smbus 0000:00:1f.4: SMBus using PCI interrupt
[    1.281858] r8169 0000:04:00.0: can't disable ASPM; OS doesn't have ASPM control
[    1.282935] scsi host2: ahci
[    1.282983] ata1: SATA max UDMA/133 abar m2048@0x94334000 port 0x94334100 irq 127
[    1.282985] ata2: SATA max UDMA/133 abar m2048@0x94334000 port 0x94334180 irq 127
[    1.282986] ata3: SATA max UDMA/133 abar m2048@0x94334000 port 0x94334200 irq 127
[    1.293267] libphy: r8169: probed
[    1.293459] r8169 0000:04:00.0 eth0: RTL8107e, b0:5a:da:d1:d3:f1, XID 541, IRQ 129
[    1.293657] cryptd: max_cpu_qlen set to 1000
[    1.296612] usb 1-3: New USB device found, idVendor=0bda, idProduct=57eb, bcdDevice= 0.03
[    1.296614] usb 1-3: New USB device strings: Mfr=3, Product=1, SerialNumber=2
[    1.296616] usb 1-3: Product: HP Truevision HD
[    1.296617] usb 1-3: Manufacturer: Generic
[    1.296618] usb 1-3: SerialNumber: �DFKFE019I9N4W3
[    1.310054] r8169 0000:04:00.0 eno1: renamed from eth0
[    1.318945] AVX2 version of gcm_enc/dec engaged.
[    1.318946] AES CTR mode by8 optimization enabled
[    1.357112] checking generic (a0000000 7e9000) vs hw (a0000000 10000000)
[    1.357113] fb0: switching to inteldrmfb from EFI VGA
[    1.357174] i915 0000:00:02.0: vgaarb: deactivate vga console
[    1.358553] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    1.358554] [drm] Driver supports precise vblank timestamp query.
[    1.359254] i915 0000:00:02.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=io+mem:owns=io+mem
[    1.359858] [drm] Finished loading DMC firmware i915/skl_dmc_ver1_27.bin (v1.27)
[    1.382861] [drm] Initialized i915 1.6.0 20190619 for 0000:00:02.0 on minor 0
[    1.385616] ACPI: Video Device [GFX0] (multi-head: yes  rom: no  post: no)
[    1.385960] input: Video Bus as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/LNXVIDEO:00/input/input6
[    1.386063] [Firmware Bug]: ACPI(PXSX) defines _DOD but not _DOS
[    1.386072] ACPI: Video Device [PXSX] (multi-head: yes  rom: yes  post: no)
[    1.386094] input: Video Bus as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:37/LNXVIDEO:01/input/input7
[    1.390812] fbcon: i915drmfb (fb0) is primary device
[    1.390813] fbcon: Deferring console take-over
[    1.390815] i915 0000:00:02.0: fb0: i915drmfb frame buffer device
[    1.426934] usb 1-7: new full-speed USB device number 3 using xhci_hcd
[    1.577018] usb 1-7: New USB device found, idVendor=8087, idProduct=0a2a, bcdDevice= 0.01
[    1.577019] usb 1-7: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    1.599635] ata3: SATA link down (SStatus 4 SControl 300)
[    1.599657] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[    1.599674] ata2: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[    1.600513] ata1.00: supports DRM functions and may not be fully accessible
[    1.600572] ata1.00: ATA-10: CT250MX500SSD1, M3CR023, max UDMA/133
[    1.600573] ata1.00: 488397168 sectors, multi 1: LBA48 NCQ (depth 32), AA
[    1.601981] ata1.00: supports DRM functions and may not be fully accessible
[    1.602812] ata1.00: configured for UDMA/133
[    1.605966] ata2.00: LPM support broken, forcing max_power
[    1.605978] ata2.00: ATA-9: ST1000LM024 HN-M101MBB, 2BA30002, max UDMA/133
[    1.605979] ata2.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 32)
[    1.612400] ata2.00: LPM support broken, forcing max_power
[    1.612413] ata2.00: configured for UDMA/133
[    1.613065] ahci 0000:00:17.0: port does not support device sleep
[    1.613427] scsi 0:0:0:0: Direct-Access     ATA      CT250MX500SSD1   023  PQ: 0 ANSI: 5
[    1.613896] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    1.613917] sd 0:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/233 GiB)
[    1.613928] sd 0:0:0:0: [sda] Write Protect is off
[    1.613930] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    1.613944] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    1.616277]  sda: sda1 sda2 sda3 sda4
[    1.616880] sd 0:0:0:0: [sda] supports TCG Opal
[    1.616882] sd 0:0:0:0: [sda] Attached SCSI disk
[    1.622800] scsi 1:0:0:0: Direct-Access     ATA      ST1000LM024 HN-M 0002 PQ: 0 ANSI: 5
[    1.622928] sd 1:0:0:0: Attached scsi generic sg1 type 0
[    1.623006] sd 1:0:0:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
[    1.623008] sd 1:0:0:0: [sdb] 4096-byte physical blocks
[    1.623020] sd 1:0:0:0: [sdb] Write Protect is off
[    1.623021] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[    1.623038] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    1.684265]  sdb: sdb1
[    1.684671] sd 1:0:0:0: [sdb] Attached SCSI disk
[    1.826942] tsc: Refined TSC clocksource calibration: 2592.008 MHz
[    1.826946] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x255cbea3061, max_idle_ns: 440795313801 ns
[    1.826990] clocksource: Switched to clocksource tsc
[    1.957705] system76_acpi: loading out-of-tree module taints kernel.
[    1.957721] system76_acpi: module verification failed: signature and/or required key missing - tainting kernel
[    1.959771] system76: Model does not utilize this driver
[    2.005439] usbcore: registered new interface driver system76-io
[    2.062878] raid6: avx2x4   gen() 30416 MB/s
[    2.110878] raid6: avx2x4   xor() 19041 MB/s
[    2.154757] psmouse serio1: synaptics: queried max coordinates: x [..5656], y [..4712]
[    2.158877] raid6: avx2x2   gen() 27174 MB/s
[    2.194319] psmouse serio1: synaptics: queried min coordinates: x [1326..], y [1200..]
[    2.194323] psmouse serio1: synaptics: Your touchpad (PNP: SYN1ef2 SYN1e00 SYN0002 PNP0f13) says it can support a different bus. If i2c-hid and hid-rmi are not used, you might want to try setting psmouse.synaptics_intertouch to 1 and report this to linux-input@vger.kernel.org.
[    2.206882] raid6: avx2x2   xor() 16724 MB/s
[    2.254877] raid6: avx2x1   gen() 22022 MB/s
[    2.271349] psmouse serio1: synaptics: Touchpad model: 1, fw: 8.1, id: 0x1e2b1, caps: 0xd00123/0x840300/0x12e800/0x0, board id: 2997, fw id: 1665536
[    2.302883] raid6: avx2x1   xor() 15423 MB/s
[    2.320473] input: SynPS/2 Synaptics TouchPad as /devices/platform/i8042/serio1/input/input5
[    2.350890] raid6: sse2x4   gen() 12624 MB/s
[    2.398888] raid6: sse2x4   xor()  7988 MB/s
[    2.446889] raid6: sse2x2   gen() 11074 MB/s
[    2.494890] raid6: sse2x2   xor()  7416 MB/s
[    2.542890] raid6: sse2x1   gen()  9813 MB/s
[    2.590890] raid6: sse2x1   xor()  5601 MB/s
[    2.590891] raid6: using algorithm avx2x4 gen() 30416 MB/s
[    2.590891] raid6: .... xor() 19041 MB/s, rmw enabled
[    2.590892] raid6: using avx2x2 recovery algorithm
[    2.592206] xor: automatically using best checksumming function   avx       
[    2.592917] async_tx: api initialized (async)
[    2.786793] EXT4-fs (sda3): mounted filesystem with ordered data mode. Opts: (null)
[    2.988229] systemd[1]: Inserted module 'autofs4'
[    3.080759] systemd[1]: systemd 242 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid)
[    3.099276] systemd[1]: Detected architecture x86-64.
[    3.102882] systemd[1]: Set hostname to <pop-os>.
[    3.103410] systemd[1]: Failed to bump fs.file-max, ignoring: Invalid argument
[    3.186247] systemd[1]: /lib/systemd/system/dbus.socket:4: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file accordingly.
[    3.225852] systemd[1]: Listening on Syslog Socket.
[    3.225932] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[    3.226013] systemd[1]: Listening on Journal Socket.
[    3.226026] systemd[1]: Reached target Remote File Systems.
[    3.226035] systemd[1]: Reached target User and Group Name Lookups.
[    3.242897] EXT4-fs (sda3): re-mounted. Opts: errors=remount-ro
[    3.297294] lp: driver loaded but no devices found
[    3.322874] ppdev: user-space parallel port driver
[    3.701521] systemd-journald[426]: Received request to flush runtime journal from PID 1
[    3.708288] input: HP Wireless hotkeys as /devices/virtual/input/input8
[    3.736218] hp_accel: laptop model unknown, using default axes configuration
[    3.744144] lis3lv02d: 8 bits 3DC sensor found
[    3.771016] input: ST LIS3LV02DL Accelerometer as /devices/platform/lis3lv02d/input/input9
[    3.791927] mei_me 0000:00:16.0: enabling device (0000 -> 0002)
[    3.804387] intel_rapl_common: Found RAPL domain package
[    3.804388] intel_rapl_common: Found RAPL domain dram
[    3.815655] proc_thermal 0000:00:04.0: Creating sysfs group for PROC_THERMAL_PCI
[    3.853501] input: HP WMI hotkeys as /devices/virtual/input/input10
[    3.879412] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    3.887955] RAPL PMU: API unit is 2^-32 Joules, 4 fixed counters, 655360 ms ovfl timer
[    3.887957] RAPL PMU: hw unit of domain pp0-core 2^-14 Joules
[    3.887958] RAPL PMU: hw unit of domain package 2^-14 Joules
[    3.887958] RAPL PMU: hw unit of domain dram 2^-14 Joules
[    3.887959] RAPL PMU: hw unit of domain pp1-gpu 2^-14 Joules
[    3.888468] mc: Linux media interface: v0.10
[    3.893932] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    3.922713] videodev: Linux video capture interface: v2.00
[    3.926707] Bluetooth: Core ver 2.22
[    3.926726] NET: Registered protocol family 31
[    3.926727] Bluetooth: HCI device and connection manager initialized
[    3.926732] Bluetooth: HCI socket layer initialized
[    3.926734] Bluetooth: L2CAP socket layer initialized
[    3.926737] Bluetooth: SCO socket layer initialized
[    3.958608] Intel(R) Wireless WiFi driver for Linux
[    3.958609] Copyright(c) 2003- 2015 Intel Corporation
[    3.980388] iwlwifi 0000:03:00.0: Found debug destination: EXTERNAL_DRAM
[    3.980391] iwlwifi 0000:03:00.0: Found debug configuration: 0
[    3.980634] iwlwifi 0000:03:00.0: loaded firmware version 29.1654887522.0 op_mode iwlmvm
[    3.983339] kvm: disabled by bios
[    4.028048] usbcore: registered new interface driver btusb
[    4.029135] kvm: disabled by bios
[    4.049567] Bluetooth: hci0: read Intel version: 370810011003110e00
[    4.050681] Bluetooth: hci0: Intel Bluetooth firmware file: intel/ibt-hw-37.8.10-fw-1.10.3.11.e.bseq
[    4.084925] kvm: disabled by bios
[    4.090468] iwlwifi 0000:03:00.0: Detected Intel(R) Dual Band Wireless AC 3165, REV=0x210
[    4.104257] iwlwifi 0000:03:00.0: Applying debug destination EXTERNAL_DRAM
[    4.104780] iwlwifi 0000:03:00.0: Allocated 0x00400000 bytes for firmware monitor.
[    4.109458] uvcvideo: Found UVC 1.00 device HP Truevision HD (0bda:57eb)
[    4.113264] iwlwifi 0000:03:00.0: base HW address: dc:53:60:47:94:ba
[    4.126625] uvcvideo 1-3:1.0: Entity type for entity Extension 4 was not initialized!
[    4.126628] uvcvideo 1-3:1.0: Entity type for entity Processing 2 was not initialized!
[    4.126630] uvcvideo 1-3:1.0: Entity type for entity Camera 1 was not initialized!
[    4.126715] input: HP Truevision HD: HP Truevision as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/input/input11
[    4.126798] usbcore: registered new interface driver uvcvideo
[    4.126799] USB Video Class driver (1.1.1)
[    4.129757] kvm: disabled by bios
[    4.129775] intel_rapl_common: Found RAPL domain package
[    4.129776] intel_rapl_common: Found RAPL domain core
[    4.129777] intel_rapl_common: Found RAPL domain uncore
[    4.129778] intel_rapl_common: Found RAPL domain dram
[    4.183345] ieee80211 phy0: Selected rate control algorithm 'iwl-mvm-rs'
[    4.184189] thermal thermal_zone5: failed to read out thermal zone (-61)
[    4.229500] iwlwifi 0000:03:00.0 wlo1: renamed from wlan0
[    4.245552] Bluetooth: hci0: unexpected event for opcode 0xfc2f
[    4.263372] Bluetooth: hci0: Intel firmware patch completed and activated
[    4.276468] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    4.304217] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC3241: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker
[    4.304219] snd_hda_codec_realtek hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    4.304220] snd_hda_codec_realtek hdaudioC0D0:    hp_outs=1 (0x15/0x0/0x0/0x0/0x0)
[    4.304221] snd_hda_codec_realtek hdaudioC0D0:    mono: mono_out=0x0
[    4.304221] snd_hda_codec_realtek hdaudioC0D0:    inputs:
[    4.304222] snd_hda_codec_realtek hdaudioC0D0:      Mic=0x1a
[    4.304223] snd_hda_codec_realtek hdaudioC0D0:      Internal Mic=0x12
[    4.359615] input: HDA Intel PCH Mic as /devices/pci0000:00/0000:00:1f.3/sound/card0/input12
[    4.359653] input: HDA Intel PCH Headphone as /devices/pci0000:00/0000:00:1f.3/sound/card0/input13
[    4.359689] input: HDA Intel PCH HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input14
[    4.359727] input: HDA Intel PCH HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input15
[    4.359758] input: HDA Intel PCH HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input16
[    4.359790] input: HDA Intel PCH HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input17
[    4.359821] input: HDA Intel PCH HDMI/DP,pcm=10 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input18
[    4.470456] FAT-fs (sda2): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[    4.472882] FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[    4.532799] audit: type=1400 audit(1587453377.854:2): apparmor="STATUS" operation="profile_load" profile="unconfined" name="libreoffice-senddoc" pid=829 comm="apparmor_parser"
[    4.533889] audit: type=1400 audit(1587453377.854:3): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/sbin/cups-browsed" pid=827 comm="apparmor_parser"
[    4.541096] audit: type=1400 audit(1587453377.862:4): apparmor="STATUS" operation="profile_load" profile="unconfined" name="libreoffice-xpdfimport" pid=833 comm="apparmor_parser"
[    4.544548] audit: type=1400 audit(1587453377.866:5): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/lib/cups/backend/cups-pdf" pid=828 comm="apparmor_parser"
[    4.544551] audit: type=1400 audit(1587453377.866:6): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/sbin/cupsd" pid=828 comm="apparmor_parser"
[    4.544553] audit: type=1400 audit(1587453377.866:7): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/sbin/cupsd//third_party" pid=828 comm="apparmor_parser"
[    4.551241] audit: type=1400 audit(1587453377.874:8): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/sbin/tcpdump" pid=837 comm="apparmor_parser"
[    4.554343] audit: type=1400 audit(1587453377.874:9): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/man" pid=838 comm="apparmor_parser"
[    4.554347] audit: type=1400 audit(1587453377.874:10): apparmor="STATUS" operation="profile_load" profile="unconfined" name="man_filter" pid=838 comm="apparmor_parser"
[    4.560930] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)
[    4.710957] Adding 4193784k swap on /dev/mapper/cryptswap.  Priority:-2 extents:1 across:4193784k SSFS
[    5.168094] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    5.168096] Bluetooth: BNEP filters: protocol multicast
[    5.168099] Bluetooth: BNEP socket layer initialized
[    5.794678] Generic Realtek PHY r8169-400:00: attached PHY driver [Generic Realtek PHY] (mii_bus:phy_addr=r8169-400:00, irq=IGNORE)
[    5.908141] r8169 0000:04:00.0 eno1: Link is Down
[    5.925796] iwlwifi 0000:03:00.0: Applying debug destination EXTERNAL_DRAM
[    6.014468] iwlwifi 0000:03:00.0: Applying debug destination EXTERNAL_DRAM
[    6.015848] iwlwifi 0000:03:00.0: FW already configured (0) - re-configuring
[    8.724584] rfkill: input handler disabled
[    9.752381] wlo1: authenticate with b0:be:76:de:6e:60
[    9.759628] wlo1: send auth to b0:be:76:de:6e:60 (try 1/3)
[    9.762807] wlo1: authenticated
[    9.766886] wlo1: associate with b0:be:76:de:6e:60 (try 1/3)
[    9.777593] wlo1: RX AssocResp from b0:be:76:de:6e:60 (capab=0x411 status=0 aid=3)
[    9.780052] wlo1: associated
[    9.901576] IPv6: ADDRCONF(NETDEV_CHANGE): wlo1: link becomes ready
[   16.956072] rfkill: input handler enabled
[   18.180399] Bluetooth: RFCOMM TTY layer initialized
[   18.180404] Bluetooth: RFCOMM socket layer initialized
[   18.180408] Bluetooth: RFCOMM ver 1.11
[   23.120779] rfkill: input handler disabled
[   27.409198] atkbd serio0: Unknown key pressed (translated set 2, code 0xab on isa0060/serio0).
[   27.409209] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
[   27.506332] atkbd serio0: Unknown key released (translated set 2, code 0xab on isa0060/serio0).
[   27.506335] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
[   27.873427] atkbd serio0: Unknown key pressed (translated set 2, code 0xab on isa0060/serio0).
[   27.873436] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
[   27.951815] atkbd serio0: Unknown key released (translated set 2, code 0xab on isa0060/serio0).
[   27.951817] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
[   28.277087] atkbd serio0: Unknown key pressed (translated set 2, code 0xab on isa0060/serio0).
[   28.277099] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
[   28.310389] atkbd serio0: Unknown key released (translated set 2, code 0xab on isa0060/serio0).
[   28.310397] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
[   28.454036] atkbd serio0: Unknown key pressed (translated set 2, code 0xab on isa0060/serio0).
[   28.454045] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
[   28.506791] atkbd serio0: Unknown key released (translated set 2, code 0xab on isa0060/serio0).
[   28.506795] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
[   28.626190] atkbd serio0: Unknown key pressed (translated set 2, code 0xab on isa0060/serio0).
[   28.626199] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
[   28.670165] atkbd serio0: Unknown key released (translated set 2, code 0xab on isa0060/serio0).
[   28.670169] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
[   28.788269] atkbd serio0: Unknown key pressed (translated set 2, code 0xab on isa0060/serio0).
[   28.788280] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
[   28.857332] atkbd serio0: Unknown key released (translated set 2, code 0xab on isa0060/serio0).
[   28.857334] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
[   28.985378] atkbd serio0: Unknown key pressed (translated set 2, code 0xab on isa0060/serio0).
[   28.985380] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
[   29.062637] atkbd serio0: Unknown key released (translated set 2, code 0xab on isa0060/serio0).
[   29.062641] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
[   30.074465] atkbd serio0: Unknown key pressed (translated set 2, code 0xab on isa0060/serio0).
[   30.074473] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
[   30.174625] atkbd serio0: Unknown key released (translated set 2, code 0xab on isa0060/serio0).
[   30.174627] atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.

I am on a system (laptop) with dual graphics, and I only use the integrated (Intel) graphics. Should I switch to the Nvidia and get the nvidia-smi output, or that is not necessary?

@jackpot51
Copy link
Member

Do these freezes happen if you switch to NVIDIA graphics?

@AAnzel
Copy link
Author

AAnzel commented Apr 22, 2020

I used the system with Nvidia graphics for some time and there were no freezes whatsoever. I guess the problem happens only when using Intel graphics.

nvidia-smi output:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.64       Driver Version: 440.64       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce 940M        Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   36C    P0    N/A /  N/A |    361MiB /  2004MiB |     17%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1130      G   /usr/lib/xorg/Xorg                            23MiB |
|    0      1526      G   /usr/lib/xorg/Xorg                            95MiB |
|    0      1757      G   /usr/bin/gnome-shell                          98MiB |
|    0      2210      G   ...AAAAAAAAAAAACAAAAAAAAAA= --shared-files    97MiB |
+-----------------------------------------------------------------------------+

lscpu output:

Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   39 bits physical, 48 bits virtual
CPU(s):                          4
On-line CPU(s) list:             0-3
Thread(s) per core:              2
Core(s) per socket:              2
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           78
Model name:                      Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
Stepping:                        3
CPU MHz:                         400.008
CPU max MHz:                     3100.0000
CPU min MHz:                     400.0000
BogoMIPS:                        5199.98
Virtualization:                  VT-x
L1d cache:                       64 KiB
L1i cache:                       64 KiB
L2 cache:                        512 KiB
L3 cache:                        4 MiB
NUMA node0 CPU(s):               0-3
Vulnerability Itlb multihit:     KVM: Vulnerable
Vulnerability L1tf:              Mitigation; PTE Inversion
Vulnerability Mds:               Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown:          Mitigation; PTI
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via pr
                                 ctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user poin
                                 ter sanitization
Vulnerability Spectre v2:        Mitigation; Full generic retpoline, IBPB conditional
                                 , IBRS_FW, STIBP conditional, RSB filling
Vulnerability Tsx async abort:   Not affected
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
                                  mca cmov pat pse36 clflush dts acpi mmx fxsr sse ss
                                 e2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constan
                                 t_tsc art arch_perfmon pebs bts rep_good nopl xtopol
                                 ogy nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes6
                                 4 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtp
                                 r pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_de
                                 adline_timer aes xsave avx f16c rdrand lahf_lm abm 3
                                 dnowprefetch cpuid_fault epb invpcid_single pti ssbd
                                  ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vp
                                 id ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 er
                                 ms invpcid mpx rdseed adx smap clflushopt intel_pt x
                                 saveopt xsavec xgetbv1 xsaves dtherm ida arat pln pt
                                 s hwp hwp_notify hwp_act_window hwp_epp md_clear flu
                                 sh_l1d

@argosatcore
Copy link

argosatcore commented May 2, 2020

Hello, I had this very same condition while using Intel's integrated graphics on my laptop (an Acer Nitro 5 with an Intel i7-7700 HQ, an Intel HD Graphics 630 and an Nvidia GTX 1050 graphics card running Pop!_OS 19.10). However, the bug was no longer present when I disabled Conky's daemonization as a background process. Today I have used my laptop all day long without Conky and had no freezing issues at all. I'm no very sure about what causes this, but I hope that this helps to shed some light on the bug. I include here my Conky's configuration:

-- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
Conky, a system monitor, based on torsmo

Any original torsmo code is licensed under the BSD license

All code written since the fork of torsmo is licensed under the GPL

Please see COPYING for details

Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
Copyright (c) 2005-2012 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
All rights reserved.

This program is free software: you can distribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
]]

conky.config = {
		alignment = 'middle_middle',
    background = false,
    border_width = 1,
    cpu_avg_samples = 2,
	default_color = 'white',
    default_outline_color = 'white',
    default_shade_color = 'white',
    double_buffer = true,
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,
    font = 'SourceCodePro:size=13',
    gap_x = 5, 
    gap_y = 25,
    minimum_height = 5,
	minimum_width = 5,
    net_avg_samples = 2,
    out_to_console = false,
    out_to_stderr = false,
    extra_newline = false,
    own_window_argb_visual = true,
	own_window_argb_value = 125,
    own_window = true,
    own_window_class = 'Conky',
    own_window_transparent = false,
    own_window_type = 'desktop',
    stippled_borders = 0,
    update_interval = 1.0,
    uppercase = false,
    use_spacer = 'none',
    use_xft = true,
    show_graph_scale = false,
    show_graph_range = false,
    temperature_unit = celcius
}

conky.text = [[
${font :weight=Light:size=34}${color   white}${alignc}Argos Linux\
${color}

${font SourceCodePro:weight=Light:size=50}${color   white}\
${alignc}${time %H:%M}\
${font}${color}

${font SourceCodePro:weight=Light:size=28}${color   white}\
${voffset 30}\
${alignc}${execi 300 LANG=${template9} LC_TIME=${template9} date +"%A, %B %d"}\
${font}${color}

${color   white}Uptime:$color $uptime
${color   white}CPU Usage:$color $cpu% ${cpubar 4}
${color   white}Battery Percent:$color ${battery_percent BAT1}% ${battery_bar 4 BAT1}
${color   white}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}
${color   white}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}

${color   white}CPU Package Temperature: $color ${hwmon 4 temp 1}°C
${color   white}CPU Core 0: $color ${hwmon 4 temp 2}°C
${color   white}CPU Core 1: $color ${hwmon 4 temp 3}°C
${color   white}CPU Core 2: $color ${hwmon 4 temp 4}°C
${color   white}CPU Core 3: $color ${hwmon 4 temp 5}°C

${color   white}File systems:
 / $color${fs_used /}/${fs_size /} ${fs_bar 6 /}

${color   white}Processes:$color $processes  ${color   white}Running:$color $running_processes

${color   white}Name              PID   CPU%   MEM%
${color   white}${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color   white}${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color   white}${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color   white}${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
]]

@AAnzel
Copy link
Author

AAnzel commented May 2, 2020

I also had conky in the background. However, I am now on 20.04 and the problem is gone.

jackpot51 pushed a commit that referenced this issue Sep 4, 2020
BugLink: https://bugs.launchpad.net/bugs/1893048

[ Upstream commit b0f3b87 ]

https://bugzilla.kernel.org/show_bug.cgi?id=208565

PID: 257    TASK: ecdd0000  CPU: 0   COMMAND: "init"
  #0 [<c0b420ec>] (__schedule) from [<c0b423c8>]
  #1 [<c0b423c8>] (schedule) from [<c0b459d4>]
  #2 [<c0b459d4>] (rwsem_down_read_failed) from [<c0b44fa0>]
  #3 [<c0b44fa0>] (down_read) from [<c044233c>]
  #4 [<c044233c>] (f2fs_truncate_blocks) from [<c0442890>]
  #5 [<c0442890>] (f2fs_truncate) from [<c044d408>]
  #6 [<c044d408>] (f2fs_evict_inode) from [<c030be18>]
  #7 [<c030be18>] (evict) from [<c030a558>]
  #8 [<c030a558>] (iput) from [<c047c600>]
  #9 [<c047c600>] (f2fs_sync_node_pages) from [<c0465414>]
 #10 [<c0465414>] (f2fs_write_checkpoint) from [<c04575f4>]
 #11 [<c04575f4>] (f2fs_sync_fs) from [<c0441918>]
 #12 [<c0441918>] (f2fs_do_sync_file) from [<c0441098>]
 #13 [<c0441098>] (f2fs_sync_file) from [<c0323fa0>]
 #14 [<c0323fa0>] (vfs_fsync_range) from [<c0324294>]
 #15 [<c0324294>] (do_fsync) from [<c0324014>]
 #16 [<c0324014>] (sys_fsync) from [<c0108bc0>]

This can be caused by flush_dirty_inode() in f2fs_sync_node_pages() where
iput() requires f2fs_lock_op() again resulting in livelock.

Reported-by: Zhiguo Niu <Zhiguo.Niu@unisoc.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
jackpot51 pushed a commit that referenced this issue Oct 19, 2020
BugLink: https://bugs.launchpad.net/bugs/1896795

[ Upstream commit 22fe5a2 ]

The aliases were never released causing the following leaks:

  Indirect leak of 1224 byte(s) in 9 object(s) allocated from:
    #0 0x7feefb830628 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x107628)
    #1 0x56332c8f1b62 in __perf_pmu__new_alias util/pmu.c:322
    #2 0x56332c8f401f in pmu_add_cpu_aliases_map util/pmu.c:778
    #3 0x56332c792ce9 in __test__pmu_event_aliases tests/pmu-events.c:295
    #4 0x56332c792ce9 in test_aliases tests/pmu-events.c:367
    #5 0x56332c76a09b in run_test tests/builtin-test.c:410
    #6 0x56332c76a09b in test_and_print tests/builtin-test.c:440
    #7 0x56332c76ce69 in __cmd_test tests/builtin-test.c:695
    #8 0x56332c76ce69 in cmd_test tests/builtin-test.c:807
    #9 0x56332c7d2214 in run_builtin /home/namhyung/project/linux/tools/perf/perf.c:312
    #10 0x56332c6701a8 in handle_internal_command /home/namhyung/project/linux/tools/perf/perf.c:364
    #11 0x56332c6701a8 in run_argv /home/namhyung/project/linux/tools/perf/perf.c:408
    #12 0x56332c6701a8 in main /home/namhyung/project/linux/tools/perf/perf.c:538
    #13 0x7feefb359cc9 in __libc_start_main ../csu/libc-start.c:308

Fixes: 956a783 ("perf test: Test pmu-events aliases")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: John Garry <john.garry@huawei.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20200915031819.386559-11-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
jackpot51 pushed a commit that referenced this issue Oct 19, 2020
BugLink: https://bugs.launchpad.net/bugs/1896795

[ Upstream commit b12eea5 ]

The evsel->unit borrows a pointer of pmu event or alias instead of
owns a string.  But tool event (duration_time) passes a result of
strdup() caused a leak.

It was found by ASAN during metric test:

  Direct leak of 210 byte(s) in 70 object(s) allocated from:
    #0 0x7fe366fca0b5 in strdup (/lib/x86_64-linux-gnu/libasan.so.5+0x920b5)
    #1 0x559fbbcc6ea3 in add_event_tool util/parse-events.c:414
    #2 0x559fbbcc6ea3 in parse_events_add_tool util/parse-events.c:1414
    #3 0x559fbbd8474d in parse_events_parse util/parse-events.y:439
    #4 0x559fbbcc95da in parse_events__scanner util/parse-events.c:2096
    #5 0x559fbbcc95da in __parse_events util/parse-events.c:2141
    #6 0x559fbbc28555 in check_parse_id tests/pmu-events.c:406
    #7 0x559fbbc28555 in check_parse_id tests/pmu-events.c:393
    #8 0x559fbbc28555 in check_parse_cpu tests/pmu-events.c:415
    #9 0x559fbbc28555 in test_parsing tests/pmu-events.c:498
    #10 0x559fbbc0109b in run_test tests/builtin-test.c:410
    #11 0x559fbbc0109b in test_and_print tests/builtin-test.c:440
    #12 0x559fbbc03e69 in __cmd_test tests/builtin-test.c:695
    #13 0x559fbbc03e69 in cmd_test tests/builtin-test.c:807
    #14 0x559fbbc691f4 in run_builtin /home/namhyung/project/linux/tools/perf/perf.c:312
    #15 0x559fbbb071a8 in handle_internal_command /home/namhyung/project/linux/tools/perf/perf.c:364
    #16 0x559fbbb071a8 in run_argv /home/namhyung/project/linux/tools/perf/perf.c:408
    #17 0x559fbbb071a8 in main /home/namhyung/project/linux/tools/perf/perf.c:538
    #18 0x7fe366b68cc9 in __libc_start_main ../csu/libc-start.c:308

Fixes: f0fbb11 ("perf stat: Implement duration_time as a proper event")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20200915031819.386559-6-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
jackpot51 pushed a commit that referenced this issue Oct 19, 2020
BugLink: https://bugs.launchpad.net/bugs/1896795

[ Upstream commit d26383d ]

The following leaks were detected by ASAN:

  Indirect leak of 360 byte(s) in 9 object(s) allocated from:
    #0 0x7fecc305180e in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10780e)
    #1 0x560578f6dce5 in perf_pmu__new_format util/pmu.c:1333
    #2 0x560578f752fc in perf_pmu_parse util/pmu.y:59
    #3 0x560578f6a8b7 in perf_pmu__format_parse util/pmu.c:73
    #4 0x560578e07045 in test__pmu tests/pmu.c:155
    #5 0x560578de109b in run_test tests/builtin-test.c:410
    #6 0x560578de109b in test_and_print tests/builtin-test.c:440
    #7 0x560578de401a in __cmd_test tests/builtin-test.c:661
    #8 0x560578de401a in cmd_test tests/builtin-test.c:807
    #9 0x560578e49354 in run_builtin /home/namhyung/project/linux/tools/perf/perf.c:312
    #10 0x560578ce71a8 in handle_internal_command /home/namhyung/project/linux/tools/perf/perf.c:364
    #11 0x560578ce71a8 in run_argv /home/namhyung/project/linux/tools/perf/perf.c:408
    #12 0x560578ce71a8 in main /home/namhyung/project/linux/tools/perf/perf.c:538
    #13 0x7fecc2b7acc9 in __libc_start_main ../csu/libc-start.c:308

Fixes: cff7f95 ("perf tests: Move pmu tests into separate object")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20200915031819.386559-12-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
jackpot51 pushed a commit that referenced this issue Jun 22, 2021
BugLink: https://bugs.launchpad.net/bugs/1926368

commit 90bd070 upstream.

The following deadlock is detected:

  truncate -> setattr path is waiting for pending direct IO to be done (inode->i_dio_count become zero) with inode->i_rwsem held (down_write).

  PID: 14827  TASK: ffff881686a9af80  CPU: 20  COMMAND: "ora_p005_hrltd9"
   #0  __schedule at ffffffff818667cc
   #1  schedule at ffffffff81866de6
   #2  inode_dio_wait at ffffffff812a2d04
   #3  ocfs2_setattr at ffffffffc05f322e [ocfs2]
   #4  notify_change at ffffffff812a5a09
   #5  do_truncate at ffffffff812808f5
   #6  do_sys_ftruncate.constprop.18 at ffffffff81280cf2
   #7  sys_ftruncate at ffffffff81280d8e
   #8  do_syscall_64 at ffffffff81003949
   #9  entry_SYSCALL_64_after_hwframe at ffffffff81a001ad

dio completion path is going to complete one direct IO (decrement
inode->i_dio_count), but before that it hung at locking inode->i_rwsem:

   #0  __schedule+700 at ffffffff818667cc
   #1  schedule+54 at ffffffff81866de6
   #2  rwsem_down_write_failed+536 at ffffffff8186aa28
   #3  call_rwsem_down_write_failed+23 at ffffffff8185a1b7
   #4  down_write+45 at ffffffff81869c9d
   #5  ocfs2_dio_end_io_write+180 at ffffffffc05d5444 [ocfs2]
   #6  ocfs2_dio_end_io+85 at ffffffffc05d5a85 [ocfs2]
   #7  dio_complete+140 at ffffffff812c873c
   #8  dio_aio_complete_work+25 at ffffffff812c89f9
   #9  process_one_work+361 at ffffffff810b1889
  #10  worker_thread+77 at ffffffff810b233d
  #11  kthread+261 at ffffffff810b7fd5
  #12  ret_from_fork+62 at ffffffff81a0035e

Thus above forms ABBA deadlock.  The same deadlock was mentioned in
upstream commit 28f5a8a ("ocfs2: should wait dio before inode lock
in ocfs2_setattr()").  It seems that that commit only removed the
cluster lock (the victim of above dead lock) from the ABBA deadlock
party.

End-user visible effects: Process hang in truncate -> ocfs2_setattr path
and other processes hang at ocfs2_dio_end_io_write path.

This is to fix the deadlock itself.  It removes inode_lock() call from
dio completion path to remove the deadlock and add ip_alloc_sem lock in
setattr path to synchronize the inode modifications.

[wen.gang.wang@oracle.com: remove the "had_alloc_lock" as suggested]
  Link: https://lkml.kernel.org/r/20210402171344.1605-1-wen.gang.wang@oracle.com

Link: https://lkml.kernel.org/r/20210331203654.3911-1-wen.gang.wang@oracle.com
Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
jackpot51 pushed a commit that referenced this issue Jun 22, 2021
BugLink: https://bugs.launchpad.net/bugs/1929455

[ Upstream commit 1748696 ]

Commit eab2404 ("Bluetooth: Add BT_PHY socket option") added a
dependency between socket lock and hci_dev->lock that could lead to
deadlock.

It turns out that hci_conn_get_phy() is not in any way relying on hdev
being immutable during the runtime of this function, neither does it even
look at any of the members of hdev, and as such there is no need to hold
that lock.

This fixes the lockdep splat below:

 ======================================================
 WARNING: possible circular locking dependency detected
 5.12.0-rc1-00026-g73d464503354 #10 Not tainted
 ------------------------------------------------------
 bluetoothd/1118 is trying to acquire lock:
 ffff8f078383c078 (&hdev->lock){+.+.}-{3:3}, at: hci_conn_get_phy+0x1c/0x150 [bluetooth]

 but task is already holding lock:
 ffff8f07e831d920 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}, at: l2cap_sock_getsockopt+0x8b/0x610

 which lock already depends on the new lock.

 the existing dependency chain (in reverse order) is:

 -> #3 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}:
        lock_sock_nested+0x72/0xa0
        l2cap_sock_ready_cb+0x18/0x70 [bluetooth]
        l2cap_config_rsp+0x27a/0x520 [bluetooth]
        l2cap_sig_channel+0x658/0x1330 [bluetooth]
        l2cap_recv_frame+0x1ba/0x310 [bluetooth]
        hci_rx_work+0x1cc/0x640 [bluetooth]
        process_one_work+0x244/0x5f0
        worker_thread+0x3c/0x380
        kthread+0x13e/0x160
        ret_from_fork+0x22/0x30

 -> #2 (&chan->lock#2/1){+.+.}-{3:3}:
        __mutex_lock+0xa3/0xa10
        l2cap_chan_connect+0x33a/0x940 [bluetooth]
        l2cap_sock_connect+0x141/0x2a0 [bluetooth]
        __sys_connect+0x9b/0xc0
        __x64_sys_connect+0x16/0x20
        do_syscall_64+0x33/0x80
        entry_SYSCALL_64_after_hwframe+0x44/0xae

 -> #1 (&conn->chan_lock){+.+.}-{3:3}:
        __mutex_lock+0xa3/0xa10
        l2cap_chan_connect+0x322/0x940 [bluetooth]
        l2cap_sock_connect+0x141/0x2a0 [bluetooth]
        __sys_connect+0x9b/0xc0
        __x64_sys_connect+0x16/0x20
        do_syscall_64+0x33/0x80
        entry_SYSCALL_64_after_hwframe+0x44/0xae

 -> #0 (&hdev->lock){+.+.}-{3:3}:
        __lock_acquire+0x147a/0x1a50
        lock_acquire+0x277/0x3d0
        __mutex_lock+0xa3/0xa10
        hci_conn_get_phy+0x1c/0x150 [bluetooth]
        l2cap_sock_getsockopt+0x5a9/0x610 [bluetooth]
        __sys_getsockopt+0xcc/0x200
        __x64_sys_getsockopt+0x20/0x30
        do_syscall_64+0x33/0x80
        entry_SYSCALL_64_after_hwframe+0x44/0xae

 other info that might help us debug this:

 Chain exists of:
   &hdev->lock --> &chan->lock#2/1 --> sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP

  Possible unsafe locking scenario:

        CPU0                    CPU1
        ----                    ----
   lock(sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP);
                                lock(&chan->lock#2/1);
                                lock(sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP);
   lock(&hdev->lock);

  *** DEADLOCK ***

 1 lock held by bluetoothd/1118:
  #0: ffff8f07e831d920 (sk_lock-AF_BLUETOOTH-BTPROTO_L2CAP){+.+.}-{0:0}, at: l2cap_sock_getsockopt+0x8b/0x610 [bluetooth]

 stack backtrace:
 CPU: 3 PID: 1118 Comm: bluetoothd Not tainted 5.12.0-rc1-00026-g73d464503354 #10
 Hardware name: LENOVO 20K5S22R00/20K5S22R00, BIOS R0IET38W (1.16 ) 05/31/2017
 Call Trace:
  dump_stack+0x7f/0xa1
  check_noncircular+0x105/0x120
  ? __lock_acquire+0x147a/0x1a50
  __lock_acquire+0x147a/0x1a50
  lock_acquire+0x277/0x3d0
  ? hci_conn_get_phy+0x1c/0x150 [bluetooth]
  ? __lock_acquire+0x2e1/0x1a50
  ? lock_is_held_type+0xb4/0x120
  ? hci_conn_get_phy+0x1c/0x150 [bluetooth]
  __mutex_lock+0xa3/0xa10
  ? hci_conn_get_phy+0x1c/0x150 [bluetooth]
  ? lock_acquire+0x277/0x3d0
  ? mark_held_locks+0x49/0x70
  ? mark_held_locks+0x49/0x70
  ? hci_conn_get_phy+0x1c/0x150 [bluetooth]
  hci_conn_get_phy+0x1c/0x150 [bluetooth]
  l2cap_sock_getsockopt+0x5a9/0x610 [bluetooth]
  __sys_getsockopt+0xcc/0x200
  __x64_sys_getsockopt+0x20/0x30
  do_syscall_64+0x33/0x80
  entry_SYSCALL_64_after_hwframe+0x44/0xae
 RIP: 0033:0x7fb73df33eee
 Code: 48 8b 0d 85 0f 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 49 89 ca b8 37 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 52 0f 0c 00 f7 d8 64 89 01 48
 RSP: 002b:00007fffcfbbbf08 EFLAGS: 00000203 ORIG_RAX: 0000000000000037
 RAX: ffffffffffffffda RBX: 0000000000000019 RCX: 00007fb73df33eee
 RDX: 000000000000000e RSI: 0000000000000112 RDI: 0000000000000018
 RBP: 0000000000000000 R08: 00007fffcfbbbf44 R09: 0000000000000000
 R10: 00007fffcfbbbf3c R11: 0000000000000203 R12: 0000000000000000
 R13: 0000000000000018 R14: 0000000000000000 R15: 0000556fcefc70d0

Fixes: eab2404 ("Bluetooth: Add BT_PHY socket option")
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
jackpot51 pushed a commit that referenced this issue Sep 24, 2021
commit 57f0ff0 upstream.

It's later supposed to be either a correct address or NULL. Without the
initialization, it may contain an undefined value which results in the
following segmentation fault:

  # perf top --sort comm -g --ignore-callees=do_idle

terminates with:

  #0  0x00007ffff56b7685 in __strlen_avx2 () from /lib64/libc.so.6
  #1  0x00007ffff55e3802 in strdup () from /lib64/libc.so.6
  #2  0x00005555558cb139 in hist_entry__init (callchain_size=<optimized out>, sample_self=true, template=0x7fffde7fb110, he=0x7fffd801c250) at util/hist.c:489
  #3  hist_entry__new (template=template@entry=0x7fffde7fb110, sample_self=sample_self@entry=true) at util/hist.c:564
  #4  0x00005555558cb4ba in hists__findnew_entry (hists=hists@entry=0x5555561d9e38, entry=entry@entry=0x7fffde7fb110, al=al@entry=0x7fffde7fb420,
      sample_self=sample_self@entry=true) at util/hist.c:657
  #5  0x00005555558cba1b in __hists__add_entry (hists=hists@entry=0x5555561d9e38, al=0x7fffde7fb420, sym_parent=<optimized out>, bi=bi@entry=0x0, mi=mi@entry=0x0,
      sample=sample@entry=0x7fffde7fb4b0, sample_self=true, ops=0x0, block_info=0x0) at util/hist.c:288
  #6  0x00005555558cbb70 in hists__add_entry (sample_self=true, sample=0x7fffde7fb4b0, mi=0x0, bi=0x0, sym_parent=<optimized out>, al=<optimized out>, hists=0x5555561d9e38)
      at util/hist.c:1056
  #7  iter_add_single_cumulative_entry (iter=0x7fffde7fb460, al=<optimized out>) at util/hist.c:1056
  #8  0x00005555558cc8a4 in hist_entry_iter__add (iter=iter@entry=0x7fffde7fb460, al=al@entry=0x7fffde7fb420, max_stack_depth=<optimized out>, arg=arg@entry=0x7fffffff7db0)
      at util/hist.c:1231
  #9  0x00005555557cdc9a in perf_event__process_sample (machine=<optimized out>, sample=0x7fffde7fb4b0, evsel=<optimized out>, event=<optimized out>, tool=0x7fffffff7db0)
      at builtin-top.c:842
  #10 deliver_event (qe=<optimized out>, qevent=<optimized out>) at builtin-top.c:1202
  #11 0x00005555558a9318 in do_flush (show_progress=false, oe=0x7fffffff80e0) at util/ordered-events.c:244
  #12 __ordered_events__flush (oe=oe@entry=0x7fffffff80e0, how=how@entry=OE_FLUSH__TOP, timestamp=timestamp@entry=0) at util/ordered-events.c:323
  #13 0x00005555558a9789 in __ordered_events__flush (timestamp=<optimized out>, how=<optimized out>, oe=<optimized out>) at util/ordered-events.c:339
  #14 ordered_events__flush (how=OE_FLUSH__TOP, oe=0x7fffffff80e0) at util/ordered-events.c:341
  #15 ordered_events__flush (oe=oe@entry=0x7fffffff80e0, how=how@entry=OE_FLUSH__TOP) at util/ordered-events.c:339
  #16 0x00005555557cd631 in process_thread (arg=0x7fffffff7db0) at builtin-top.c:1114
  #17 0x00007ffff7bb817a in start_thread () from /lib64/libpthread.so.0
  #18 0x00007ffff5656dc3 in clone () from /lib64/libc.so.6

If you look at the frame #2, the code is:

488	 if (he->srcline) {
489          he->srcline = strdup(he->srcline);
490          if (he->srcline == NULL)
491              goto err_rawdata;
492	 }

If he->srcline is not NULL (it is not NULL if it is uninitialized rubbish),
it gets strdupped and strdupping a rubbish random string causes the problem.

Also, if you look at the commit 1fb7d06, it adds the srcline property
into the struct, but not initializing it everywhere needed.

Committer notes:

Now I see, when using --ignore-callees=do_idle we end up here at line
2189 in add_callchain_ip():

2181         if (al.sym != NULL) {
2182                 if (perf_hpp_list.parent && !*parent &&
2183                     symbol__match_regex(al.sym, &parent_regex))
2184                         *parent = al.sym;
2185                 else if (have_ignore_callees && root_al &&
2186                   symbol__match_regex(al.sym, &ignore_callees_regex)) {
2187                         /* Treat this symbol as the root,
2188                            forgetting its callees. */
2189                         *root_al = al;
2190                         callchain_cursor_reset(cursor);
2191                 }
2192         }

And the al that doesn't have the ->srcline field initialized will be
copied to the root_al, so then, back to:

1211 int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al,
1212                          int max_stack_depth, void *arg)
1213 {
1214         int err, err2;
1215         struct map *alm = NULL;
1216
1217         if (al)
1218                 alm = map__get(al->map);
1219
1220         err = sample__resolve_callchain(iter->sample, &callchain_cursor, &iter->parent,
1221                                         iter->evsel, al, max_stack_depth);
1222         if (err) {
1223                 map__put(alm);
1224                 return err;
1225         }
1226
1227         err = iter->ops->prepare_entry(iter, al);
1228         if (err)
1229                 goto out;
1230
1231         err = iter->ops->add_single_entry(iter, al);
1232         if (err)
1233                 goto out;
1234

That al at line 1221 is what hist_entry_iter__add() (called from
sample__resolve_callchain()) saw as 'root_al', and then:

        iter->ops->add_single_entry(iter, al);

will go on with al->srcline with a bogus value, I'll add the above
sequence to the cset and apply, thanks!

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
CC: Milian Wolff <milian.wolff@kdab.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Fixes: 1fb7d06 ("perf report Use srcline from callchain for hist entries")
Link: https //lore.kernel.org/r/20210719145332.29747-1-mpetlan@redhat.com
Reported-by: Juri Lelli <jlelli@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
jackpot51 pushed a commit that referenced this issue Sep 30, 2021
[ Upstream commit aba5dae ]

FD uses xyarray__entry that may return NULL if an index is out of
bounds. If NULL is returned then a segv happens as FD unconditionally
dereferences the pointer. This was happening in a case of with perf
iostat as shown below. The fix is to make FD an "int*" rather than an
int and handle the NULL case as either invalid input or a closed fd.

  $ sudo gdb --args perf stat --iostat  list
  ...
  Breakpoint 1, perf_evsel__alloc_fd (evsel=0x5555560951a0, ncpus=1, nthreads=1) at evsel.c:50
  50      {
  (gdb) bt
   #0  perf_evsel__alloc_fd (evsel=0x5555560951a0, ncpus=1, nthreads=1) at evsel.c:50
   #1  0x000055555585c188 in evsel__open_cpu (evsel=0x5555560951a0, cpus=0x555556093410,
      threads=0x555556086fb0, start_cpu=0, end_cpu=1) at util/evsel.c:1792
   #2  0x000055555585cfb2 in evsel__open (evsel=0x5555560951a0, cpus=0x0, threads=0x555556086fb0)
      at util/evsel.c:2045
   #3  0x000055555585d0db in evsel__open_per_thread (evsel=0x5555560951a0, threads=0x555556086fb0)
      at util/evsel.c:2065
   #4  0x00005555558ece64 in create_perf_stat_counter (evsel=0x5555560951a0,
      config=0x555555c34700 <stat_config>, target=0x555555c2f1c0 <target>, cpu=0) at util/stat.c:590
   #5  0x000055555578e927 in __run_perf_stat (argc=1, argv=0x7fffffffe4a0, run_idx=0)
      at builtin-stat.c:833
   #6  0x000055555578f3c6 in run_perf_stat (argc=1, argv=0x7fffffffe4a0, run_idx=0)
      at builtin-stat.c:1048
   #7  0x0000555555792ee5 in cmd_stat (argc=1, argv=0x7fffffffe4a0) at builtin-stat.c:2534
   #8  0x0000555555835ed3 in run_builtin (p=0x555555c3f540 <commands+288>, argc=3,
      argv=0x7fffffffe4a0) at perf.c:313
   #9  0x0000555555836154 in handle_internal_command (argc=3, argv=0x7fffffffe4a0) at perf.c:365
   #10 0x000055555583629f in run_argv (argcp=0x7fffffffe2ec, argv=0x7fffffffe2e0) at perf.c:409
   #11 0x0000555555836692 in main (argc=3, argv=0x7fffffffe4a0) at perf.c:539
  ...
  (gdb) c
  Continuing.
  Error:
  The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (uncore_iio_0/event=0x83,umask=0x04,ch_mask=0xF,fc_mask=0x07/).
  /bin/dmesg | grep -i perf may provide additional information.

  Program received signal SIGSEGV, Segmentation fault.
  0x00005555559b03ea in perf_evsel__close_fd_cpu (evsel=0x5555560951a0, cpu=1) at evsel.c:166
  166                     if (FD(evsel, cpu, thread) >= 0)

v3. fixes a bug in perf_evsel__run_ioctl where the sense of a branch was
    backward.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20210918054440.2350466-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
jackpot51 pushed a commit that referenced this issue Feb 7, 2022
commit fdc1223 upstream.

If the string passed into qcom_pil_info_store() isn't as long as
PIL_RELOC_NAME_LEN we'll try to copy the string assuming the length is
PIL_RELOC_NAME_LEN to the io space and go beyond the bounds of the
string. Let's only copy as many byes as the string is long, ignoring the
NUL terminator.

This fixes the following KASAN error:

 BUG: KASAN: global-out-of-bounds in __memcpy_toio+0x124/0x140
 Read of size 1 at addr ffffffd35086e386 by task rmtfs/2392

 CPU: 2 PID: 2392 Comm: rmtfs Tainted: G        W         5.16.0-rc1-lockdep+ #10
 Hardware name: Google Lazor (rev3+) with KB Backlight (DT)
 Call trace:
  dump_backtrace+0x0/0x410
  show_stack+0x24/0x30
  dump_stack_lvl+0x7c/0xa0
  print_address_description+0x78/0x2bc
  kasan_report+0x160/0x1a0
  __asan_report_load1_noabort+0x44/0x50
  __memcpy_toio+0x124/0x140
  qcom_pil_info_store+0x298/0x358 [qcom_pil_info]
  q6v5_start+0xdf0/0x12e0 [qcom_q6v5_mss]
  rproc_start+0x178/0x3a0
  rproc_boot+0x5f0/0xb90
  state_store+0x78/0x1bc
  dev_attr_store+0x70/0x90
  sysfs_kf_write+0xf4/0x118
  kernfs_fop_write_iter+0x208/0x300
  vfs_write+0x55c/0x804
  ksys_pwrite64+0xc8/0x134
  __arm64_compat_sys_aarch32_pwrite64+0xc4/0xdc
  invoke_syscall+0x78/0x20c
  el0_svc_common+0x11c/0x1f0
  do_el0_svc_compat+0x50/0x60
  el0_svc_compat+0x5c/0xec
  el0t_32_sync_handler+0xc0/0xf0
  el0t_32_sync+0x1a4/0x1a8

 The buggy address belongs to the variable:
  .str.59+0x6/0xffffffffffffec80 [qcom_q6v5_mss]

 Memory state around the buggy address:
  ffffffd35086e280: 00 00 00 00 02 f9 f9 f9 f9 f9 f9 f9 00 00 00 00
  ffffffd35086e300: 00 02 f9 f9 f9 f9 f9 f9 00 00 00 06 f9 f9 f9 f9
 >ffffffd35086e380: 06 f9 f9 f9 05 f9 f9 f9 00 00 00 00 00 06 f9 f9
                    ^
  ffffffd35086e400: f9 f9 f9 f9 01 f9 f9 f9 04 f9 f9 f9 00 00 01 f9
  ffffffd35086e480: f9 f9 f9 f9 00 00 00 00 00 00 00 01 f9 f9 f9 f9

Fixes: 549b67d ("remoteproc: qcom: Introduce helper to store pil info in IMEM")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20211117065454.4142936-1-swboyd@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
jackpot51 pushed a commit that referenced this issue Feb 7, 2022
[ Upstream commit 767c94c ]

With CONFIG_LOCKDEP=y and CONFIG_DEBUG_SPINLOCK=y, lockdep reports
below warning:

[  166.059415] ============================================
[  166.059416] WARNING: possible recursive locking detected
[  166.059418] 5.15.0-wt-ath+ #10 Tainted: G        W  O
[  166.059420] --------------------------------------------
[  166.059421] kworker/0:2/116 is trying to acquire lock:
[  166.059423] ffff9905f2083160 (&srng->lock){+.-.}-{2:2}, at: ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k]
[  166.059440]
               but task is already holding lock:
[  166.059442] ffff9905f2083230 (&srng->lock){+.-.}-{2:2}, at: ath11k_dp_process_reo_status+0x95/0x2d0 [ath11k]
[  166.059491]
               other info that might help us debug this:
[  166.059492]  Possible unsafe locking scenario:

[  166.059493]        CPU0
[  166.059494]        ----
[  166.059495]   lock(&srng->lock);
[  166.059498]   lock(&srng->lock);
[  166.059500]
                *** DEADLOCK ***

[  166.059501]  May be due to missing lock nesting notation

[  166.059502] 3 locks held by kworker/0:2/116:
[  166.059504]  #0: ffff9905c0081548 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x1f6/0x660
[  166.059511]  #1: ffff9d2400a5fe68 ((debug_obj_work).work){+.+.}-{0:0}, at: process_one_work+0x1f6/0x660
[  166.059517]  #2: ffff9905f2083230 (&srng->lock){+.-.}-{2:2}, at: ath11k_dp_process_reo_status+0x95/0x2d0 [ath11k]
[  166.059532]
               stack backtrace:
[  166.059534] CPU: 0 PID: 116 Comm: kworker/0:2 Kdump: loaded Tainted: G        W  O      5.15.0-wt-ath+ #10
[  166.059537] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0059.2019.1112.1124 11/12/2019
[  166.059539] Workqueue: events free_obj_work
[  166.059543] Call Trace:
[  166.059545]  <IRQ>
[  166.059547]  dump_stack_lvl+0x56/0x7b
[  166.059552]  __lock_acquire+0xb9a/0x1a50
[  166.059556]  lock_acquire+0x1e2/0x330
[  166.059560]  ? ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k]
[  166.059571]  _raw_spin_lock_bh+0x33/0x70
[  166.059574]  ? ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k]
[  166.059584]  ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k]
[  166.059594]  ath11k_dp_tx_send_reo_cmd+0x3f/0x130 [ath11k]
[  166.059605]  ath11k_dp_rx_tid_del_func+0x221/0x370 [ath11k]
[  166.059618]  ath11k_dp_process_reo_status+0x22f/0x2d0 [ath11k]
[  166.059632]  ? ath11k_dp_service_srng+0x2ea/0x2f0 [ath11k]
[  166.059643]  ath11k_dp_service_srng+0x2ea/0x2f0 [ath11k]
[  166.059655]  ath11k_pci_ext_grp_napi_poll+0x1c/0x70 [ath11k_pci]
[  166.059659]  __napi_poll+0x28/0x230
[  166.059664]  net_rx_action+0x285/0x310
[  166.059668]  __do_softirq+0xe6/0x4d2
[  166.059672]  irq_exit_rcu+0xd2/0xf0
[  166.059675]  common_interrupt+0xa5/0xc0
[  166.059678]  </IRQ>
[  166.059679]  <TASK>
[  166.059680]  asm_common_interrupt+0x1e/0x40
[  166.059683] RIP: 0010:_raw_spin_unlock_irqrestore+0x38/0x70
[  166.059686] Code: 83 c7 18 e8 2a 95 43 ff 48 89 ef e8 22 d2 43 ff 81 e3 00 02 00 00 75 25 9c 58 f6 c4 02 75 2d 48 85 db 74 01 fb bf 01 00 00 00 <e8> 63 2e 40 ff 65 8b 05 8c 59 97 5c 85 c0 74 0a 5b 5d c3 e8 00 6a
[  166.059689] RSP: 0018:ffff9d2400a5fca0 EFLAGS: 00000206
[  166.059692] RAX: 0000000000000002 RBX: 0000000000000200 RCX: 0000000000000006
[  166.059694] RDX: 0000000000000000 RSI: ffffffffa404879b RDI: 0000000000000001
[  166.059696] RBP: ffff9905c0053000 R08: 0000000000000001 R09: 0000000000000001
[  166.059698] R10: ffff9d2400a5fc50 R11: 0000000000000001 R12: ffffe186c41e2840
[  166.059700] R13: 0000000000000001 R14: ffff9905c78a1c68 R15: 0000000000000001
[  166.059704]  free_debug_processing+0x257/0x3d0
[  166.059708]  ? free_obj_work+0x1f5/0x250
[  166.059712]  __slab_free+0x374/0x5a0
[  166.059718]  ? kmem_cache_free+0x2e1/0x370
[  166.059721]  ? free_obj_work+0x1f5/0x250
[  166.059724]  kmem_cache_free+0x2e1/0x370
[  166.059727]  free_obj_work+0x1f5/0x250
[  166.059731]  process_one_work+0x28b/0x660
[  166.059735]  ? process_one_work+0x660/0x660
[  166.059738]  worker_thread+0x37/0x390
[  166.059741]  ? process_one_work+0x660/0x660
[  166.059743]  kthread+0x176/0x1a0
[  166.059746]  ? set_kthread_struct+0x40/0x40
[  166.059749]  ret_from_fork+0x22/0x30
[  166.059754]  </TASK>

Since these two lockes are both initialized in ath11k_hal_srng_setup,
they are assigned with the same key. As a result lockdep suspects that
the task is trying to acquire the same lock (due to same key) while
already holding it, and thus reports the DEADLOCK warning. However as
they are different spinlock instances, the warning is false positive.

On the other hand, even no dead lock indeed, this is a major issue for
upstream regression testing as it disables lockdep functionality.

Fix it by assigning separate lock class key for each srng->lock.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20211209011949.151472-1-quic_bqiang@quicinc.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
jackpot51 pushed a commit that referenced this issue Feb 28, 2022
commit fdc1223 upstream.

If the string passed into qcom_pil_info_store() isn't as long as
PIL_RELOC_NAME_LEN we'll try to copy the string assuming the length is
PIL_RELOC_NAME_LEN to the io space and go beyond the bounds of the
string. Let's only copy as many byes as the string is long, ignoring the
NUL terminator.

This fixes the following KASAN error:

 BUG: KASAN: global-out-of-bounds in __memcpy_toio+0x124/0x140
 Read of size 1 at addr ffffffd35086e386 by task rmtfs/2392

 CPU: 2 PID: 2392 Comm: rmtfs Tainted: G        W         5.16.0-rc1-lockdep+ #10
 Hardware name: Google Lazor (rev3+) with KB Backlight (DT)
 Call trace:
  dump_backtrace+0x0/0x410
  show_stack+0x24/0x30
  dump_stack_lvl+0x7c/0xa0
  print_address_description+0x78/0x2bc
  kasan_report+0x160/0x1a0
  __asan_report_load1_noabort+0x44/0x50
  __memcpy_toio+0x124/0x140
  qcom_pil_info_store+0x298/0x358 [qcom_pil_info]
  q6v5_start+0xdf0/0x12e0 [qcom_q6v5_mss]
  rproc_start+0x178/0x3a0
  rproc_boot+0x5f0/0xb90
  state_store+0x78/0x1bc
  dev_attr_store+0x70/0x90
  sysfs_kf_write+0xf4/0x118
  kernfs_fop_write_iter+0x208/0x300
  vfs_write+0x55c/0x804
  ksys_pwrite64+0xc8/0x134
  __arm64_compat_sys_aarch32_pwrite64+0xc4/0xdc
  invoke_syscall+0x78/0x20c
  el0_svc_common+0x11c/0x1f0
  do_el0_svc_compat+0x50/0x60
  el0_svc_compat+0x5c/0xec
  el0t_32_sync_handler+0xc0/0xf0
  el0t_32_sync+0x1a4/0x1a8

 The buggy address belongs to the variable:
  .str.59+0x6/0xffffffffffffec80 [qcom_q6v5_mss]

 Memory state around the buggy address:
  ffffffd35086e280: 00 00 00 00 02 f9 f9 f9 f9 f9 f9 f9 00 00 00 00
  ffffffd35086e300: 00 02 f9 f9 f9 f9 f9 f9 00 00 00 06 f9 f9 f9 f9
 >ffffffd35086e380: 06 f9 f9 f9 05 f9 f9 f9 00 00 00 00 00 06 f9 f9
                    ^
  ffffffd35086e400: f9 f9 f9 f9 01 f9 f9 f9 04 f9 f9 f9 00 00 01 f9
  ffffffd35086e480: f9 f9 f9 f9 00 00 00 00 00 00 00 01 f9 f9 f9 f9

Fixes: 549b67d ("remoteproc: qcom: Introduce helper to store pil info in IMEM")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20211117065454.4142936-1-swboyd@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
jackpot51 pushed a commit that referenced this issue Feb 28, 2022
[ Upstream commit 767c94c ]

With CONFIG_LOCKDEP=y and CONFIG_DEBUG_SPINLOCK=y, lockdep reports
below warning:

[  166.059415] ============================================
[  166.059416] WARNING: possible recursive locking detected
[  166.059418] 5.15.0-wt-ath+ #10 Tainted: G        W  O
[  166.059420] --------------------------------------------
[  166.059421] kworker/0:2/116 is trying to acquire lock:
[  166.059423] ffff9905f2083160 (&srng->lock){+.-.}-{2:2}, at: ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k]
[  166.059440]
               but task is already holding lock:
[  166.059442] ffff9905f2083230 (&srng->lock){+.-.}-{2:2}, at: ath11k_dp_process_reo_status+0x95/0x2d0 [ath11k]
[  166.059491]
               other info that might help us debug this:
[  166.059492]  Possible unsafe locking scenario:

[  166.059493]        CPU0
[  166.059494]        ----
[  166.059495]   lock(&srng->lock);
[  166.059498]   lock(&srng->lock);
[  166.059500]
                *** DEADLOCK ***

[  166.059501]  May be due to missing lock nesting notation

[  166.059502] 3 locks held by kworker/0:2/116:
[  166.059504]  #0: ffff9905c0081548 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x1f6/0x660
[  166.059511]  #1: ffff9d2400a5fe68 ((debug_obj_work).work){+.+.}-{0:0}, at: process_one_work+0x1f6/0x660
[  166.059517]  #2: ffff9905f2083230 (&srng->lock){+.-.}-{2:2}, at: ath11k_dp_process_reo_status+0x95/0x2d0 [ath11k]
[  166.059532]
               stack backtrace:
[  166.059534] CPU: 0 PID: 116 Comm: kworker/0:2 Kdump: loaded Tainted: G        W  O      5.15.0-wt-ath+ #10
[  166.059537] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0059.2019.1112.1124 11/12/2019
[  166.059539] Workqueue: events free_obj_work
[  166.059543] Call Trace:
[  166.059545]  <IRQ>
[  166.059547]  dump_stack_lvl+0x56/0x7b
[  166.059552]  __lock_acquire+0xb9a/0x1a50
[  166.059556]  lock_acquire+0x1e2/0x330
[  166.059560]  ? ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k]
[  166.059571]  _raw_spin_lock_bh+0x33/0x70
[  166.059574]  ? ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k]
[  166.059584]  ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k]
[  166.059594]  ath11k_dp_tx_send_reo_cmd+0x3f/0x130 [ath11k]
[  166.059605]  ath11k_dp_rx_tid_del_func+0x221/0x370 [ath11k]
[  166.059618]  ath11k_dp_process_reo_status+0x22f/0x2d0 [ath11k]
[  166.059632]  ? ath11k_dp_service_srng+0x2ea/0x2f0 [ath11k]
[  166.059643]  ath11k_dp_service_srng+0x2ea/0x2f0 [ath11k]
[  166.059655]  ath11k_pci_ext_grp_napi_poll+0x1c/0x70 [ath11k_pci]
[  166.059659]  __napi_poll+0x28/0x230
[  166.059664]  net_rx_action+0x285/0x310
[  166.059668]  __do_softirq+0xe6/0x4d2
[  166.059672]  irq_exit_rcu+0xd2/0xf0
[  166.059675]  common_interrupt+0xa5/0xc0
[  166.059678]  </IRQ>
[  166.059679]  <TASK>
[  166.059680]  asm_common_interrupt+0x1e/0x40
[  166.059683] RIP: 0010:_raw_spin_unlock_irqrestore+0x38/0x70
[  166.059686] Code: 83 c7 18 e8 2a 95 43 ff 48 89 ef e8 22 d2 43 ff 81 e3 00 02 00 00 75 25 9c 58 f6 c4 02 75 2d 48 85 db 74 01 fb bf 01 00 00 00 <e8> 63 2e 40 ff 65 8b 05 8c 59 97 5c 85 c0 74 0a 5b 5d c3 e8 00 6a
[  166.059689] RSP: 0018:ffff9d2400a5fca0 EFLAGS: 00000206
[  166.059692] RAX: 0000000000000002 RBX: 0000000000000200 RCX: 0000000000000006
[  166.059694] RDX: 0000000000000000 RSI: ffffffffa404879b RDI: 0000000000000001
[  166.059696] RBP: ffff9905c0053000 R08: 0000000000000001 R09: 0000000000000001
[  166.059698] R10: ffff9d2400a5fc50 R11: 0000000000000001 R12: ffffe186c41e2840
[  166.059700] R13: 0000000000000001 R14: ffff9905c78a1c68 R15: 0000000000000001
[  166.059704]  free_debug_processing+0x257/0x3d0
[  166.059708]  ? free_obj_work+0x1f5/0x250
[  166.059712]  __slab_free+0x374/0x5a0
[  166.059718]  ? kmem_cache_free+0x2e1/0x370
[  166.059721]  ? free_obj_work+0x1f5/0x250
[  166.059724]  kmem_cache_free+0x2e1/0x370
[  166.059727]  free_obj_work+0x1f5/0x250
[  166.059731]  process_one_work+0x28b/0x660
[  166.059735]  ? process_one_work+0x660/0x660
[  166.059738]  worker_thread+0x37/0x390
[  166.059741]  ? process_one_work+0x660/0x660
[  166.059743]  kthread+0x176/0x1a0
[  166.059746]  ? set_kthread_struct+0x40/0x40
[  166.059749]  ret_from_fork+0x22/0x30
[  166.059754]  </TASK>

Since these two lockes are both initialized in ath11k_hal_srng_setup,
they are assigned with the same key. As a result lockdep suspects that
the task is trying to acquire the same lock (due to same key) while
already holding it, and thus reports the DEADLOCK warning. However as
they are different spinlock instances, the warning is false positive.

On the other hand, even no dead lock indeed, this is a major issue for
upstream regression testing as it disables lockdep functionality.

Fix it by assigning separate lock class key for each srng->lock.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20211209011949.151472-1-quic_bqiang@quicinc.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
jackpot51 pushed a commit that referenced this issue Mar 18, 2022
[ Upstream commit 4224cfd ]

When bringing down the netdevice or system shutdown, a panic can be
triggered while accessing the sysfs path because the device is already
removed.

    [  755.549084] mlx5_core 0000:12:00.1: Shutdown was called
    [  756.404455] mlx5_core 0000:12:00.0: Shutdown was called
    ...
    [  757.937260] BUG: unable to handle kernel NULL pointer dereference at           (null)
    [  758.031397] IP: [<ffffffff8ee11acb>] dma_pool_alloc+0x1ab/0x280

    crash> bt
    ...
    PID: 12649  TASK: ffff8924108f2100  CPU: 1   COMMAND: "amsd"
    ...
     #9 [ffff89240e1a38b0] page_fault at ffffffff8f38c778
        [exception RIP: dma_pool_alloc+0x1ab]
        RIP: ffffffff8ee11acb  RSP: ffff89240e1a3968  RFLAGS: 00010046
        RAX: 0000000000000246  RBX: ffff89243d874100  RCX: 0000000000001000
        RDX: 0000000000000000  RSI: 0000000000000246  RDI: ffff89243d874090
        RBP: ffff89240e1a39c0   R8: 000000000001f080   R9: ffff8905ffc03c00
        R10: ffffffffc04680d4  R11: ffffffff8edde9fd  R12: 00000000000080d0
        R13: ffff89243d874090  R14: ffff89243d874080  R15: 0000000000000000
        ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
    #10 [ffff89240e1a39c8] mlx5_alloc_cmd_msg at ffffffffc04680f3 [mlx5_core]
    #11 [ffff89240e1a3a18] cmd_exec at ffffffffc046ad62 [mlx5_core]
    #12 [ffff89240e1a3ab8] mlx5_cmd_exec at ffffffffc046b4fb [mlx5_core]
    #13 [ffff89240e1a3ae8] mlx5_core_access_reg at ffffffffc0475434 [mlx5_core]
    #14 [ffff89240e1a3b40] mlx5e_get_fec_caps at ffffffffc04a7348 [mlx5_core]
    #15 [ffff89240e1a3bb0] get_fec_supported_advertised at ffffffffc04992bf [mlx5_core]
    #16 [ffff89240e1a3c08] mlx5e_get_link_ksettings at ffffffffc049ab36 [mlx5_core]
    #17 [ffff89240e1a3ce8] __ethtool_get_link_ksettings at ffffffff8f25db46
    #18 [ffff89240e1a3d48] speed_show at ffffffff8f277208
    #19 [ffff89240e1a3dd8] dev_attr_show at ffffffff8f0b70e3
    #20 [ffff89240e1a3df8] sysfs_kf_seq_show at ffffffff8eedbedf
    #21 [ffff89240e1a3e18] kernfs_seq_show at ffffffff8eeda596
    #22 [ffff89240e1a3e28] seq_read at ffffffff8ee76d10
    #23 [ffff89240e1a3e98] kernfs_fop_read at ffffffff8eedaef5
    #24 [ffff89240e1a3ed8] vfs_read at ffffffff8ee4e3ff
    #25 [ffff89240e1a3f08] sys_read at ffffffff8ee4f27f
    #26 [ffff89240e1a3f50] system_call_fastpath at ffffffff8f395f92

    crash> net_device.state ffff89443b0c0000
      state = 0x5  (__LINK_STATE_START| __LINK_STATE_NOCARRIER)

To prevent this scenario, we also make sure that the netdevice is present.

Signed-off-by: suresh kumar <suresh2514@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
jackpot51 pushed a commit that referenced this issue Apr 8, 2022
[ Upstream commit fe2640b ]

In remove_phb_dynamic() we use &phb->io_resource, after we've called
device_unregister(&host_bridge->dev). But the unregister may have freed
phb, because pcibios_free_controller_deferred() is the release function
for the host_bridge.

If there are no outstanding references when we call device_unregister()
then phb will be freed out from under us.

This has gone mainly unnoticed, but with slub_debug and page_poison
enabled it can lead to a crash:

  PID: 7574   TASK: c0000000d492cb80  CPU: 13  COMMAND: "drmgr"
   #0 [c0000000e4f075a0] crash_kexec at c00000000027d7dc
   #1 [c0000000e4f075d0] oops_end at c000000000029608
   #2 [c0000000e4f07650] __bad_page_fault at c0000000000904b4
   #3 [c0000000e4f076c0] do_bad_slb_fault at c00000000009a5a8
   #4 [c0000000e4f076f0] data_access_slb_common_virt at c000000000008b30
   Data SLB Access [380] exception frame:
   R0:  c000000000167250    R1:  c0000000e4f07a00    R2:  c000000002a46100
   R3:  c000000002b39ce8    R4:  00000000000000c0    R5:  00000000000000a9
   R6:  3894674d000000c0    R7:  0000000000000000    R8:  00000000000000ff
   R9:  0000000000000100    R10: 6b6b6b6b6b6b6b6b    R11: 0000000000008000
   R12: c00000000023da80    R13: c0000009ffd38b00    R14: 0000000000000000
   R15: 000000011c87f0f0    R16: 0000000000000006    R17: 0000000000000003
   R18: 0000000000000002    R19: 0000000000000004    R20: 0000000000000005
   R21: 000000011c87ede8    R22: 000000011c87c5a8    R23: 000000011c87d3a0
   R24: 0000000000000000    R25: 0000000000000001    R26: c0000000e4f07cc8
   R27: c00000004d1cc400    R28: c0080000031d00e8    R29: c00000004d23d800
   R30: c00000004d1d2400    R31: c00000004d1d2540
   NIP: c000000000167258    MSR: 8000000000009033    OR3: c000000000e9f474
   CTR: 0000000000000000    LR:  c000000000167250    XER: 0000000020040003
   CCR: 0000000024088420    MQ:  0000000000000000    DAR: 6b6b6b6b6b6b6ba3
   DSISR: c0000000e4f07920     Syscall Result: fffffffffffffff2
   [NIP  : release_resource+56]
   [LR   : release_resource+48]
   #5 [c0000000e4f07a00] release_resource at c000000000167258  (unreliable)
   #6 [c0000000e4f07a30] remove_phb_dynamic at c000000000105648
   #7 [c0000000e4f07ab0] dlpar_remove_slot at c0080000031a09e8 [rpadlpar_io]
   #8 [c0000000e4f07b50] remove_slot_store at c0080000031a0b9c [rpadlpar_io]
   #9 [c0000000e4f07be0] kobj_attr_store at c000000000817d8c
  #10 [c0000000e4f07c00] sysfs_kf_write at c00000000063e504
  #11 [c0000000e4f07c20] kernfs_fop_write_iter at c00000000063d868
  #12 [c0000000e4f07c70] new_sync_write at c00000000054339c
  #13 [c0000000e4f07d10] vfs_write at c000000000546624
  #14 [c0000000e4f07d60] ksys_write at c0000000005469f4
  #15 [c0000000e4f07db0] system_call_exception at c000000000030840
  #16 [c0000000e4f07e10] system_call_vectored_common at c00000000000c168

To avoid it, we can take a reference to the host_bridge->dev until we're
done using phb. Then when we drop the reference the phb will be freed.

Fixes: 2dd9c11 ("powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)")
Reported-by: David Dai <zdai@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Tested-by: Sachin Sant <sachinp@linux.ibm.com>
Link: https://lore.kernel.org/r/20220318034219.1188008-1-mpe@ellerman.id.au
Signed-off-by: Sasha Levin <sashal@kernel.org>
jackpot51 pushed a commit that referenced this issue Apr 11, 2022
[ Upstream commit fe2640b ]

In remove_phb_dynamic() we use &phb->io_resource, after we've called
device_unregister(&host_bridge->dev). But the unregister may have freed
phb, because pcibios_free_controller_deferred() is the release function
for the host_bridge.

If there are no outstanding references when we call device_unregister()
then phb will be freed out from under us.

This has gone mainly unnoticed, but with slub_debug and page_poison
enabled it can lead to a crash:

  PID: 7574   TASK: c0000000d492cb80  CPU: 13  COMMAND: "drmgr"
   #0 [c0000000e4f075a0] crash_kexec at c00000000027d7dc
   #1 [c0000000e4f075d0] oops_end at c000000000029608
   #2 [c0000000e4f07650] __bad_page_fault at c0000000000904b4
   #3 [c0000000e4f076c0] do_bad_slb_fault at c00000000009a5a8
   #4 [c0000000e4f076f0] data_access_slb_common_virt at c000000000008b30
   Data SLB Access [380] exception frame:
   R0:  c000000000167250    R1:  c0000000e4f07a00    R2:  c000000002a46100
   R3:  c000000002b39ce8    R4:  00000000000000c0    R5:  00000000000000a9
   R6:  3894674d000000c0    R7:  0000000000000000    R8:  00000000000000ff
   R9:  0000000000000100    R10: 6b6b6b6b6b6b6b6b    R11: 0000000000008000
   R12: c00000000023da80    R13: c0000009ffd38b00    R14: 0000000000000000
   R15: 000000011c87f0f0    R16: 0000000000000006    R17: 0000000000000003
   R18: 0000000000000002    R19: 0000000000000004    R20: 0000000000000005
   R21: 000000011c87ede8    R22: 000000011c87c5a8    R23: 000000011c87d3a0
   R24: 0000000000000000    R25: 0000000000000001    R26: c0000000e4f07cc8
   R27: c00000004d1cc400    R28: c0080000031d00e8    R29: c00000004d23d800
   R30: c00000004d1d2400    R31: c00000004d1d2540
   NIP: c000000000167258    MSR: 8000000000009033    OR3: c000000000e9f474
   CTR: 0000000000000000    LR:  c000000000167250    XER: 0000000020040003
   CCR: 0000000024088420    MQ:  0000000000000000    DAR: 6b6b6b6b6b6b6ba3
   DSISR: c0000000e4f07920     Syscall Result: fffffffffffffff2
   [NIP  : release_resource+56]
   [LR   : release_resource+48]
   #5 [c0000000e4f07a00] release_resource at c000000000167258  (unreliable)
   #6 [c0000000e4f07a30] remove_phb_dynamic at c000000000105648
   #7 [c0000000e4f07ab0] dlpar_remove_slot at c0080000031a09e8 [rpadlpar_io]
   #8 [c0000000e4f07b50] remove_slot_store at c0080000031a0b9c [rpadlpar_io]
   #9 [c0000000e4f07be0] kobj_attr_store at c000000000817d8c
  #10 [c0000000e4f07c00] sysfs_kf_write at c00000000063e504
  #11 [c0000000e4f07c20] kernfs_fop_write_iter at c00000000063d868
  #12 [c0000000e4f07c70] new_sync_write at c00000000054339c
  #13 [c0000000e4f07d10] vfs_write at c000000000546624
  #14 [c0000000e4f07d60] ksys_write at c0000000005469f4
  #15 [c0000000e4f07db0] system_call_exception at c000000000030840
  #16 [c0000000e4f07e10] system_call_vectored_common at c00000000000c168

To avoid it, we can take a reference to the host_bridge->dev until we're
done using phb. Then when we drop the reference the phb will be freed.

Fixes: 2dd9c11 ("powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb)")
Reported-by: David Dai <zdai@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Tested-by: Sachin Sant <sachinp@linux.ibm.com>
Link: https://lore.kernel.org/r/20220318034219.1188008-1-mpe@ellerman.id.au
Signed-off-by: Sasha Levin <sashal@kernel.org>
jackpot51 pushed a commit that referenced this issue May 2, 2022
commit 41f1008 upstream.

Either mount(2) or automount might not have server->origin_fullpath
set yet while refresh_cache_worker() is attempting to refresh DFS
referrals.  Add missing NULL check and locking around it.

This fixes bellow crash:

[ 1070.276835] general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN NOPTI
[ 1070.277676] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
[ 1070.278219] CPU: 1 PID: 8506 Comm: kworker/u8:1 Not tainted 5.18.0-rc3 #10
[ 1070.278701] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.15.0-0-g2dd4b9b-rebuilt.opensuse.org 04/01/2014
[ 1070.279495] Workqueue: cifs-dfscache refresh_cache_worker [cifs]
[ 1070.280044] RIP: 0010:strcasecmp+0x34/0x150
[ 1070.280359] Code: 00 00 00 fc ff df 41 54 55 48 89 fd 53 48 83 ec 10 eb 03 4c 89 fe 48 89 ef 48 83 c5 01 48 89 f8 48 89 fa 48 c1 e8 03 83 e2 07 <42> 0f b6 04 28 38 d0 7f 08 84 c0 0f 85 bc 00 00 00 0f b6 45 ff 44
[ 1070.281729] RSP: 0018:ffffc90008367958 EFLAGS: 00010246
[ 1070.282114] RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000000000
[ 1070.282691] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[ 1070.283273] RBP: 0000000000000001 R08: 0000000000000000 R09: ffffffff873eda27
[ 1070.283857] R10: ffffc900083679a0 R11: 0000000000000001 R12: ffff88812624c000
[ 1070.284436] R13: dffffc0000000000 R14: ffff88810e6e9a88 R15: ffff888119bb9000
[ 1070.284990] FS:  0000000000000000(0000) GS:ffff888151200000(0000) knlGS:0000000000000000
[ 1070.285625] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1070.286100] CR2: 0000561a4d922418 CR3: 000000010aecc000 CR4: 0000000000350ee0
[ 1070.286683] Call Trace:
[ 1070.286890]  <TASK>
[ 1070.287070]  refresh_cache_worker+0x895/0xd20 [cifs]
[ 1070.287475]  ? __refresh_tcon.isra.0+0xfb0/0xfb0 [cifs]
[ 1070.287905]  ? __lock_acquire+0xcd1/0x6960
[ 1070.288247]  ? is_dynamic_key+0x1a0/0x1a0
[ 1070.288591]  ? lockdep_hardirqs_on_prepare+0x410/0x410
[ 1070.289012]  ? lock_downgrade+0x6f0/0x6f0
[ 1070.289318]  process_one_work+0x7bd/0x12d0
[ 1070.289637]  ? worker_thread+0x160/0xec0
[ 1070.289970]  ? pwq_dec_nr_in_flight+0x230/0x230
[ 1070.290318]  ? _raw_spin_lock_irq+0x5e/0x90
[ 1070.290619]  worker_thread+0x5ac/0xec0
[ 1070.290891]  ? process_one_work+0x12d0/0x12d0
[ 1070.291199]  kthread+0x2a5/0x350
[ 1070.291430]  ? kthread_complete_and_exit+0x20/0x20
[ 1070.291770]  ret_from_fork+0x22/0x30
[ 1070.292050]  </TASK>
[ 1070.292223] Modules linked in: bpfilter cifs cifs_arc4 cifs_md4
[ 1070.292765] ---[ end trace 0000000000000000 ]---
[ 1070.293108] RIP: 0010:strcasecmp+0x34/0x150
[ 1070.293471] Code: 00 00 00 fc ff df 41 54 55 48 89 fd 53 48 83 ec 10 eb 03 4c 89 fe 48 89 ef 48 83 c5 01 48 89 f8 48 89 fa 48 c1 e8 03 83 e2 07 <42> 0f b6 04 28 38 d0 7f 08 84 c0 0f 85 bc 00 00 00 0f b6 45 ff 44
[ 1070.297718] RSP: 0018:ffffc90008367958 EFLAGS: 00010246
[ 1070.298622] RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000000000
[ 1070.299428] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[ 1070.300296] RBP: 0000000000000001 R08: 0000000000000000 R09: ffffffff873eda27
[ 1070.301204] R10: ffffc900083679a0 R11: 0000000000000001 R12: ffff88812624c000
[ 1070.301932] R13: dffffc0000000000 R14: ffff88810e6e9a88 R15: ffff888119bb9000
[ 1070.302645] FS:  0000000000000000(0000) GS:ffff888151200000(0000) knlGS:0000000000000000
[ 1070.303462] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1070.304131] CR2: 0000561a4d922418 CR3: 000000010aecc000 CR4: 0000000000350ee0
[ 1070.305004] Kernel panic - not syncing: Fatal exception
[ 1070.305711] Kernel Offset: disabled
[ 1070.305971] ---[ end Kernel panic - not syncing: Fatal exception ]---

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Cc: stable@vger.kernel.org
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
jackpot51 pushed a commit that referenced this issue Jun 3, 2022
[ Upstream commit 4503cc7 ]

Do not allow to write timestamps on RX rings if PF is being configured.
When PF is being configured RX rings can be freed or rebuilt. If at the
same time timestamps are updated, the kernel will crash by dereferencing
null RX ring pointer.

PID: 1449   TASK: ff187d28ed658040  CPU: 34  COMMAND: "ice-ptp-0000:51"
 #0 [ff1966a94a713bb0] machine_kexec at ffffffff9d05a0be
 #1 [ff1966a94a713c08] __crash_kexec at ffffffff9d192e9d
 #2 [ff1966a94a713cd0] crash_kexec at ffffffff9d1941bd
 #3 [ff1966a94a713ce8] oops_end at ffffffff9d01bd54
 #4 [ff1966a94a713d08] no_context at ffffffff9d06bda4
 #5 [ff1966a94a713d60] __bad_area_nosemaphore at ffffffff9d06c10c
 #6 [ff1966a94a713da8] do_page_fault at ffffffff9d06cae4
 #7 [ff1966a94a713de0] page_fault at ffffffff9da0107e
    [exception RIP: ice_ptp_update_cached_phctime+91]
    RIP: ffffffffc076db8b  RSP: ff1966a94a713e98  RFLAGS: 00010246
    RAX: 16e3db9c6b7ccae4  RBX: ff187d269dd3c180  RCX: ff187d269cd4d018
    RDX: 0000000000000000  RSI: 0000000000000000  RDI: 0000000000000000
    RBP: ff187d269cfcc644   R8: ff187d339b9641b0   R9: 0000000000000000
    R10: 0000000000000002  R11: 0000000000000000  R12: ff187d269cfcc648
    R13: ffffffff9f128784  R14: ffffffff9d101b70  R15: ff187d269cfcc640
    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
 #8 [ff1966a94a713ea0] ice_ptp_periodic_work at ffffffffc076dbef [ice]
 #9 [ff1966a94a713ee0] kthread_worker_fn at ffffffff9d101c1b
 #10 [ff1966a94a713f10] kthread at ffffffff9d101b4d
 #11 [ff1966a94a713f50] ret_from_fork at ffffffff9da0023f

Fixes: 77a7811 ("ice: enable receive hardware timestamping")
Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Reviewed-by: Michal Schmidt <mschmidt@redhat.com>
Tested-by: Dave Cain <dcain@redhat.com>
Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
jackpot51 pushed a commit that referenced this issue Jun 14, 2022
[ Upstream commit ad25f5c ]

There's a locking issue with the per-netns list of calls in rxrpc.  The
pieces of code that add and remove a call from the list use write_lock()
and the calls procfile uses read_lock() to access it.  However, the timer
callback function may trigger a removal by trying to queue a call for
processing and finding that it's already queued - at which point it has a
spare refcount that it has to do something with.  Unfortunately, if it puts
the call and this reduces the refcount to 0, the call will be removed from
the list.  Unfortunately, since the _bh variants of the locking functions
aren't used, this can deadlock.

================================
WARNING: inconsistent lock state
5.18.0-rc3-build4+ #10 Not tainted
--------------------------------
inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
ksoftirqd/2/25 [HC0[0]:SC1[1]:HE1:SE0] takes:
ffff888107ac4038 (&rxnet->call_lock){+.?.}-{2:2}, at: rxrpc_put_call+0x103/0x14b
{SOFTIRQ-ON-W} state was registered at:
...
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&rxnet->call_lock);
  <Interrupt>
    lock(&rxnet->call_lock);

 *** DEADLOCK ***

1 lock held by ksoftirqd/2/25:
 #0: ffff8881008ffdb0 ((&call->timer)){+.-.}-{0:0}, at: call_timer_fn+0x5/0x23d

Changes
=======
ver #2)
 - Changed to using list_next_rcu() rather than rcu_dereference() directly.

Fixes: 17926a7 ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
jackpot51 pushed a commit that referenced this issue Jun 14, 2022
[ Upstream commit 391e982 ]

It is trivial to craft a module to trigger OOB access in this line:

	if (info->secstrings[strhdr->sh_size - 1] != '\0') {

BUG: unable to handle page fault for address: ffffc90000aa0fff
PGD 100000067 P4D 100000067 PUD 100066067 PMD 10436f067 PTE 0
Oops: 0000 [#1] PREEMPT SMP PTI
CPU: 7 PID: 1215 Comm: insmod Not tainted 5.18.0-rc5-00007-g9bf578647087-dirty #10
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-4.fc34 04/01/2014
RIP: 0010:load_module+0x19b/0x2391

Fixes: ec2a295 ("module: harden ELF info handling")
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
[rebased patch onto modules-next]
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
jackpot51 pushed a commit that referenced this issue Jun 14, 2022
[ Upstream commit 6b9dbed ]

pty_write() invokes kmalloc() which may invoke a normal printk() to print
failure message.  This can cause a deadlock in the scenario reported by
syz-bot below:

       CPU0              CPU1                    CPU2
       ----              ----                    ----
                         lock(console_owner);
                                                 lock(&port_lock_key);
  lock(&port->lock);
                         lock(&port_lock_key);
                                                 lock(&port->lock);
  lock(console_owner);

As commit dbdda84 ("printk: Add console owner and waiter logic to
load balance console writes") said, such deadlock can be prevented by
using printk_deferred() in kmalloc() (which is invoked in the section
guarded by the port->lock).  But there are too many printk() on the
kmalloc() path, and kmalloc() can be called from anywhere, so changing
printk() to printk_deferred() is too complicated and inelegant.

Therefore, this patch chooses to specify __GFP_NOWARN to kmalloc(), so
that printk() will not be called, and this deadlock problem can be
avoided.

Syzbot reported the following lockdep error:

======================================================
WARNING: possible circular locking dependency detected
5.4.143-00237-g08ccc19a-dirty #10 Not tainted
------------------------------------------------------
syz-executor.4/29420 is trying to acquire lock:
ffffffff8aedb2a0 (console_owner){....}-{0:0}, at: console_trylock_spinning kernel/printk/printk.c:1752 [inline]
ffffffff8aedb2a0 (console_owner){....}-{0:0}, at: vprintk_emit+0x2ca/0x470 kernel/printk/printk.c:2023

but task is already holding lock:
ffff8880119c9158 (&port->lock){-.-.}-{2:2}, at: pty_write+0xf4/0x1f0 drivers/tty/pty.c:120

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #2 (&port->lock){-.-.}-{2:2}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x35/0x50 kernel/locking/spinlock.c:159
       tty_port_tty_get drivers/tty/tty_port.c:288 [inline]          		<-- lock(&port->lock);
       tty_port_default_wakeup+0x1d/0xb0 drivers/tty/tty_port.c:47
       serial8250_tx_chars+0x530/0xa80 drivers/tty/serial/8250/8250_port.c:1767
       serial8250_handle_irq.part.0+0x31f/0x3d0 drivers/tty/serial/8250/8250_port.c:1854
       serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1827 [inline] 	<-- lock(&port_lock_key);
       serial8250_default_handle_irq+0xb2/0x220 drivers/tty/serial/8250/8250_port.c:1870
       serial8250_interrupt+0xfd/0x200 drivers/tty/serial/8250/8250_core.c:126
       __handle_irq_event_percpu+0x109/0xa50 kernel/irq/handle.c:156
       [...]

-> #1 (&port_lock_key){-.-.}-{2:2}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x35/0x50 kernel/locking/spinlock.c:159
       serial8250_console_write+0x184/0xa40 drivers/tty/serial/8250/8250_port.c:3198
										<-- lock(&port_lock_key);
       call_console_drivers kernel/printk/printk.c:1819 [inline]
       console_unlock+0x8cb/0xd00 kernel/printk/printk.c:2504
       vprintk_emit+0x1b5/0x470 kernel/printk/printk.c:2024			<-- lock(console_owner);
       vprintk_func+0x8d/0x250 kernel/printk/printk_safe.c:394
       printk+0xba/0xed kernel/printk/printk.c:2084
       register_console+0x8b3/0xc10 kernel/printk/printk.c:2829
       univ8250_console_init+0x3a/0x46 drivers/tty/serial/8250/8250_core.c:681
       console_init+0x49d/0x6d3 kernel/printk/printk.c:2915
       start_kernel+0x5e9/0x879 init/main.c:713
       secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:241

-> #0 (console_owner){....}-{0:0}:
       [...]
       lock_acquire+0x127/0x340 kernel/locking/lockdep.c:4734
       console_trylock_spinning kernel/printk/printk.c:1773 [inline]		<-- lock(console_owner);
       vprintk_emit+0x307/0x470 kernel/printk/printk.c:2023
       vprintk_func+0x8d/0x250 kernel/printk/printk_safe.c:394
       printk+0xba/0xed kernel/printk/printk.c:2084
       fail_dump lib/fault-inject.c:45 [inline]
       should_fail+0x67b/0x7c0 lib/fault-inject.c:144
       __should_failslab+0x152/0x1c0 mm/failslab.c:33
       should_failslab+0x5/0x10 mm/slab_common.c:1224
       slab_pre_alloc_hook mm/slab.h:468 [inline]
       slab_alloc_node mm/slub.c:2723 [inline]
       slab_alloc mm/slub.c:2807 [inline]
       __kmalloc+0x72/0x300 mm/slub.c:3871
       kmalloc include/linux/slab.h:582 [inline]
       tty_buffer_alloc+0x23f/0x2a0 drivers/tty/tty_buffer.c:175
       __tty_buffer_request_room+0x156/0x2a0 drivers/tty/tty_buffer.c:273
       tty_insert_flip_string_fixed_flag+0x93/0x250 drivers/tty/tty_buffer.c:318
       tty_insert_flip_string include/linux/tty_flip.h:37 [inline]
       pty_write+0x126/0x1f0 drivers/tty/pty.c:122				<-- lock(&port->lock);
       n_tty_write+0xa7a/0xfc0 drivers/tty/n_tty.c:2356
       do_tty_write drivers/tty/tty_io.c:961 [inline]
       tty_write+0x512/0x930 drivers/tty/tty_io.c:1045
       __vfs_write+0x76/0x100 fs/read_write.c:494
       [...]

other info that might help us debug this:

Chain exists of:
  console_owner --> &port_lock_key --> &port->lock

Link: https://lkml.kernel.org/r/20220511061951.1114-2-zhengqi.arch@bytedance.com
Link: https://lkml.kernel.org/r/20220510113809.80626-2-zhengqi.arch@bytedance.com
Fixes: b6da31b ("tty: Fix data race in tty_insert_flip_string_fixed_flag")
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
Acked-by: Jiri Slaby <jirislaby@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
jackpot51 pushed a commit that referenced this issue Jun 16, 2022
[ Upstream commit ad25f5c ]

There's a locking issue with the per-netns list of calls in rxrpc.  The
pieces of code that add and remove a call from the list use write_lock()
and the calls procfile uses read_lock() to access it.  However, the timer
callback function may trigger a removal by trying to queue a call for
processing and finding that it's already queued - at which point it has a
spare refcount that it has to do something with.  Unfortunately, if it puts
the call and this reduces the refcount to 0, the call will be removed from
the list.  Unfortunately, since the _bh variants of the locking functions
aren't used, this can deadlock.

================================
WARNING: inconsistent lock state
5.18.0-rc3-build4+ #10 Not tainted
--------------------------------
inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
ksoftirqd/2/25 [HC0[0]:SC1[1]:HE1:SE0] takes:
ffff888107ac4038 (&rxnet->call_lock){+.?.}-{2:2}, at: rxrpc_put_call+0x103/0x14b
{SOFTIRQ-ON-W} state was registered at:
...
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&rxnet->call_lock);
  <Interrupt>
    lock(&rxnet->call_lock);

 *** DEADLOCK ***

1 lock held by ksoftirqd/2/25:
 #0: ffff8881008ffdb0 ((&call->timer)){+.-.}-{0:0}, at: call_timer_fn+0x5/0x23d

Changes
=======
ver #2)
 - Changed to using list_next_rcu() rather than rcu_dereference() directly.

Fixes: 17926a7 ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
jackpot51 pushed a commit that referenced this issue Jun 16, 2022
[ Upstream commit 391e982 ]

It is trivial to craft a module to trigger OOB access in this line:

	if (info->secstrings[strhdr->sh_size - 1] != '\0') {

BUG: unable to handle page fault for address: ffffc90000aa0fff
PGD 100000067 P4D 100000067 PUD 100066067 PMD 10436f067 PTE 0
Oops: 0000 [#1] PREEMPT SMP PTI
CPU: 7 PID: 1215 Comm: insmod Not tainted 5.18.0-rc5-00007-g9bf578647087-dirty #10
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-4.fc34 04/01/2014
RIP: 0010:load_module+0x19b/0x2391

Fixes: ec2a295 ("module: harden ELF info handling")
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
[rebased patch onto modules-next]
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
jackpot51 pushed a commit that referenced this issue Jun 16, 2022
[ Upstream commit 6b9dbed ]

pty_write() invokes kmalloc() which may invoke a normal printk() to print
failure message.  This can cause a deadlock in the scenario reported by
syz-bot below:

       CPU0              CPU1                    CPU2
       ----              ----                    ----
                         lock(console_owner);
                                                 lock(&port_lock_key);
  lock(&port->lock);
                         lock(&port_lock_key);
                                                 lock(&port->lock);
  lock(console_owner);

As commit dbdda84 ("printk: Add console owner and waiter logic to
load balance console writes") said, such deadlock can be prevented by
using printk_deferred() in kmalloc() (which is invoked in the section
guarded by the port->lock).  But there are too many printk() on the
kmalloc() path, and kmalloc() can be called from anywhere, so changing
printk() to printk_deferred() is too complicated and inelegant.

Therefore, this patch chooses to specify __GFP_NOWARN to kmalloc(), so
that printk() will not be called, and this deadlock problem can be
avoided.

Syzbot reported the following lockdep error:

======================================================
WARNING: possible circular locking dependency detected
5.4.143-00237-g08ccc19a-dirty #10 Not tainted
------------------------------------------------------
syz-executor.4/29420 is trying to acquire lock:
ffffffff8aedb2a0 (console_owner){....}-{0:0}, at: console_trylock_spinning kernel/printk/printk.c:1752 [inline]
ffffffff8aedb2a0 (console_owner){....}-{0:0}, at: vprintk_emit+0x2ca/0x470 kernel/printk/printk.c:2023

but task is already holding lock:
ffff8880119c9158 (&port->lock){-.-.}-{2:2}, at: pty_write+0xf4/0x1f0 drivers/tty/pty.c:120

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #2 (&port->lock){-.-.}-{2:2}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x35/0x50 kernel/locking/spinlock.c:159
       tty_port_tty_get drivers/tty/tty_port.c:288 [inline]          		<-- lock(&port->lock);
       tty_port_default_wakeup+0x1d/0xb0 drivers/tty/tty_port.c:47
       serial8250_tx_chars+0x530/0xa80 drivers/tty/serial/8250/8250_port.c:1767
       serial8250_handle_irq.part.0+0x31f/0x3d0 drivers/tty/serial/8250/8250_port.c:1854
       serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1827 [inline] 	<-- lock(&port_lock_key);
       serial8250_default_handle_irq+0xb2/0x220 drivers/tty/serial/8250/8250_port.c:1870
       serial8250_interrupt+0xfd/0x200 drivers/tty/serial/8250/8250_core.c:126
       __handle_irq_event_percpu+0x109/0xa50 kernel/irq/handle.c:156
       [...]

-> #1 (&port_lock_key){-.-.}-{2:2}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x35/0x50 kernel/locking/spinlock.c:159
       serial8250_console_write+0x184/0xa40 drivers/tty/serial/8250/8250_port.c:3198
										<-- lock(&port_lock_key);
       call_console_drivers kernel/printk/printk.c:1819 [inline]
       console_unlock+0x8cb/0xd00 kernel/printk/printk.c:2504
       vprintk_emit+0x1b5/0x470 kernel/printk/printk.c:2024			<-- lock(console_owner);
       vprintk_func+0x8d/0x250 kernel/printk/printk_safe.c:394
       printk+0xba/0xed kernel/printk/printk.c:2084
       register_console+0x8b3/0xc10 kernel/printk/printk.c:2829
       univ8250_console_init+0x3a/0x46 drivers/tty/serial/8250/8250_core.c:681
       console_init+0x49d/0x6d3 kernel/printk/printk.c:2915
       start_kernel+0x5e9/0x879 init/main.c:713
       secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:241

-> #0 (console_owner){....}-{0:0}:
       [...]
       lock_acquire+0x127/0x340 kernel/locking/lockdep.c:4734
       console_trylock_spinning kernel/printk/printk.c:1773 [inline]		<-- lock(console_owner);
       vprintk_emit+0x307/0x470 kernel/printk/printk.c:2023
       vprintk_func+0x8d/0x250 kernel/printk/printk_safe.c:394
       printk+0xba/0xed kernel/printk/printk.c:2084
       fail_dump lib/fault-inject.c:45 [inline]
       should_fail+0x67b/0x7c0 lib/fault-inject.c:144
       __should_failslab+0x152/0x1c0 mm/failslab.c:33
       should_failslab+0x5/0x10 mm/slab_common.c:1224
       slab_pre_alloc_hook mm/slab.h:468 [inline]
       slab_alloc_node mm/slub.c:2723 [inline]
       slab_alloc mm/slub.c:2807 [inline]
       __kmalloc+0x72/0x300 mm/slub.c:3871
       kmalloc include/linux/slab.h:582 [inline]
       tty_buffer_alloc+0x23f/0x2a0 drivers/tty/tty_buffer.c:175
       __tty_buffer_request_room+0x156/0x2a0 drivers/tty/tty_buffer.c:273
       tty_insert_flip_string_fixed_flag+0x93/0x250 drivers/tty/tty_buffer.c:318
       tty_insert_flip_string include/linux/tty_flip.h:37 [inline]
       pty_write+0x126/0x1f0 drivers/tty/pty.c:122				<-- lock(&port->lock);
       n_tty_write+0xa7a/0xfc0 drivers/tty/n_tty.c:2356
       do_tty_write drivers/tty/tty_io.c:961 [inline]
       tty_write+0x512/0x930 drivers/tty/tty_io.c:1045
       __vfs_write+0x76/0x100 fs/read_write.c:494
       [...]

other info that might help us debug this:

Chain exists of:
  console_owner --> &port_lock_key --> &port->lock

Link: https://lkml.kernel.org/r/20220511061951.1114-2-zhengqi.arch@bytedance.com
Link: https://lkml.kernel.org/r/20220510113809.80626-2-zhengqi.arch@bytedance.com
Fixes: b6da31b ("tty: Fix data race in tty_insert_flip_string_fixed_flag")
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
Acked-by: Jiri Slaby <jirislaby@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
jackpot51 pushed a commit that referenced this issue Oct 22, 2022
[ Upstream commit 97f88a3 ]

I found a null pointer reference in arch_prepare_kprobe():

  # echo 'p cmdline_proc_show' > kprobe_events
  # echo 'p cmdline_proc_show+16' >> kprobe_events
  Kernel attempted to read user page (0) - exploit attempt? (uid: 0)
  BUG: Kernel NULL pointer dereference on read at 0x00000000
  Faulting instruction address: 0xc000000000050bfc
  Oops: Kernel access of bad area, sig: 11 [#1]
  LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA PowerNV
  Modules linked in:
  CPU: 0 PID: 122 Comm: sh Not tainted 6.0.0-rc3-00007-gdcf8e5633e2e #10
  NIP:  c000000000050bfc LR: c000000000050bec CTR: 0000000000005bdc
  REGS: c0000000348475b0 TRAP: 0300   Not tainted  (6.0.0-rc3-00007-gdcf8e5633e2e)
  MSR:  9000000000009033 <SF,HV,EE,ME,IR,DR,RI,LE>  CR: 88002444  XER: 20040006
  CFAR: c00000000022d100 DAR: 0000000000000000 DSISR: 40000000 IRQMASK: 0
  ...
  NIP arch_prepare_kprobe+0x10c/0x2d0
  LR  arch_prepare_kprobe+0xfc/0x2d0
  Call Trace:
    0xc0000000012f77a0 (unreliable)
    register_kprobe+0x3c0/0x7a0
    __register_trace_kprobe+0x140/0x1a0
    __trace_kprobe_create+0x794/0x1040
    trace_probe_create+0xc4/0xe0
    create_or_delete_trace_kprobe+0x2c/0x80
    trace_parse_run_command+0xf0/0x210
    probes_write+0x20/0x40
    vfs_write+0xfc/0x450
    ksys_write+0x84/0x140
    system_call_exception+0x17c/0x3a0
    system_call_vectored_common+0xe8/0x278
  --- interrupt: 3000 at 0x7fffa5682de0
  NIP:  00007fffa5682de0 LR: 0000000000000000 CTR: 0000000000000000
  REGS: c000000034847e80 TRAP: 3000   Not tainted  (6.0.0-rc3-00007-gdcf8e5633e2e)
  MSR:  900000000280f033 <SF,HV,VEC,VSX,EE,PR,FP,ME,IR,DR,RI,LE>  CR: 44002408  XER: 00000000

The address being probed has some special:

  cmdline_proc_show: Probe based on ftrace
  cmdline_proc_show+16: Probe for the next instruction at the ftrace location

The ftrace-based kprobe does not generate kprobe::ainsn::insn, it gets
set to NULL. In arch_prepare_kprobe() it will check for:

  ...
  prev = get_kprobe(p->addr - 1);
  preempt_enable_no_resched();
  if (prev && ppc_inst_prefixed(ppc_inst_read(prev->ainsn.insn))) {
  ...

If prev is based on ftrace, 'ppc_inst_read(prev->ainsn.insn)' will occur
with a null pointer reference. At this point prev->addr will not be a
prefixed instruction, so the check can be skipped.

Check if prev is ftrace-based kprobe before reading 'prev->ainsn.insn'
to fix this problem.

Fixes: b4657f7 ("powerpc/kprobes: Don't allow breakpoints on suffixes")
Signed-off-by: Li Huafei <lihuafei1@huawei.com>
[mpe: Trim oops]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220923093253.177298-1-lihuafei1@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
13r0ck pushed a commit that referenced this issue Mar 13, 2023
[ Upstream commit 91621be ]

When --overwrite and --max-size options of perf record are used
together, a segmentation fault occurs. The following is an example:

  # perf record -e sched:sched* --overwrite --max-size 1K -a -- sleep 1
  [ perf record: Woken up 1 times to write data ]
  perf: Segmentation fault
  Obtained 12 stack frames.
  ./perf/perf(+0x197673) [0x55f99710b673]
  /lib/x86_64-linux-gnu/libc.so.6(+0x3ef0f) [0x7fa45f3cff0f]
  ./perf/perf(+0x8eb40) [0x55f997002b40]
  ./perf/perf(+0x1f6882) [0x55f99716a882]
  ./perf/perf(+0x794c2) [0x55f996fed4c2]
  ./perf/perf(+0x7b7c7) [0x55f996fef7c7]
  ./perf/perf(+0x9074b) [0x55f99700474b]
  ./perf/perf(+0x12e23c) [0x55f9970a223c]
  ./perf/perf(+0x12e54a) [0x55f9970a254a]
  ./perf/perf(+0x7db60) [0x55f996ff1b60]
  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe6) [0x7fa45f3b2c86]
  ./perf/perf(+0x7dfe9) [0x55f996ff1fe9]
  Segmentation fault (core dumped)

backtrace of the core file is as follows:

  (gdb) bt
  #0  record__bytes_written (rec=0x55f99755a200 <record>) at builtin-record.c:234
  #1  record__output_max_size_exceeded (rec=0x55f99755a200 <record>) at builtin-record.c:242
  #2  record__write (map=0x0, size=12816, bf=0x55f9978da2e0, rec=0x55f99755a200 <record>) at builtin-record.c:263
  #3  process_synthesized_event (tool=tool@entry=0x55f99755a200 <record>, event=event@entry=0x55f9978da2e0, sample=sample@entry=0x0, machine=machine@entry=0x55f997893658) at builtin-record.c:618
  #4  0x000055f99716a883 in __perf_event__synthesize_id_index (tool=tool@entry=0x55f99755a200 <record>, process=process@entry=0x55f997002aa0 <process_synthesized_event>, evlist=0x55f9978928b0, machine=machine@entry=0x55f997893658,
      from=from@entry=0) at util/synthetic-events.c:1895
  #5  0x000055f99716a91f in perf_event__synthesize_id_index (tool=tool@entry=0x55f99755a200 <record>, process=process@entry=0x55f997002aa0 <process_synthesized_event>, evlist=<optimized out>, machine=machine@entry=0x55f997893658)
      at util/synthetic-events.c:1905
  #6  0x000055f996fed4c3 in record__synthesize (tail=tail@entry=true, rec=0x55f99755a200 <record>) at builtin-record.c:1997
  #7  0x000055f996fef7c8 in __cmd_record (argc=argc@entry=2, argv=argv@entry=0x7ffc67551260, rec=0x55f99755a200 <record>) at builtin-record.c:2802
  #8  0x000055f99700474c in cmd_record (argc=<optimized out>, argv=0x7ffc67551260) at builtin-record.c:4258
  #9  0x000055f9970a223d in run_builtin (p=0x55f997564d88 <commands+264>, argc=10, argv=0x7ffc67551260) at perf.c:330
  #10 0x000055f9970a254b in handle_internal_command (argc=10, argv=0x7ffc67551260) at perf.c:384
  #11 0x000055f996ff1b61 in run_argv (argcp=<synthetic pointer>, argv=<synthetic pointer>) at perf.c:428
  #12 main (argc=<optimized out>, argv=0x7ffc67551260) at perf.c:562

The reason is that record__bytes_written accesses the freed memory rec->thread_data,
The process is as follows:
  __cmd_record
    -> record__free_thread_data
      -> zfree(&rec->thread_data)         // free rec->thread_data
    -> record__synthesize
      -> perf_event__synthesize_id_index
        -> process_synthesized_event
          -> record__write
            -> record__bytes_written      // access rec->thread_data

We add a member variable "thread_bytes_written" in the struct "record"
to save the data size written by the threads.

Fixes: 6d57581 ("perf record: Add support for limit perf output file size")
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Jiwei Sun <jiwei.sun@windriver.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/CAM9d7ci_TRrqBQVQNW8=GwakUr7SsZpYxaaty-S4bxF8zJWyqw@mail.gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
13r0ck pushed a commit that referenced this issue Jun 15, 2023
[ Upstream commit 05bb016 ]

ACPICA commit 770653e3ba67c30a629ca7d12e352d83c2541b1e

Before this change we see the following UBSAN stack trace in Fuchsia:

  #0    0x000021e4213b3302 in acpi_ds_init_aml_walk(struct acpi_walk_state*, union acpi_parse_object*, struct acpi_namespace_node*, u8*, u32, struct acpi_evaluate_info*, u8) ../../third_party/acpica/source/components/dispatcher/dswstate.c:682 <platform-bus-x86.so>+0x233302
  #1.2  0x000020d0f660777f in ubsan_get_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:41 <libclang_rt.asan.so>+0x3d77f
  #1.1  0x000020d0f660777f in maybe_print_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:51 <libclang_rt.asan.so>+0x3d77f
  #1    0x000020d0f660777f in ~scoped_report() compiler-rt/lib/ubsan/ubsan_diag.cpp:387 <libclang_rt.asan.so>+0x3d77f
  #2    0x000020d0f660b96d in handlepointer_overflow_impl() compiler-rt/lib/ubsan/ubsan_handlers.cpp:809 <libclang_rt.asan.so>+0x4196d
  #3    0x000020d0f660b50d in compiler-rt/lib/ubsan/ubsan_handlers.cpp:815 <libclang_rt.asan.so>+0x4150d
  #4    0x000021e4213b3302 in acpi_ds_init_aml_walk(struct acpi_walk_state*, union acpi_parse_object*, struct acpi_namespace_node*, u8*, u32, struct acpi_evaluate_info*, u8) ../../third_party/acpica/source/components/dispatcher/dswstate.c:682 <platform-bus-x86.so>+0x233302
  #5    0x000021e4213e2369 in acpi_ds_call_control_method(struct acpi_thread_state*, struct acpi_walk_state*, union acpi_parse_object*) ../../third_party/acpica/source/components/dispatcher/dsmethod.c:605 <platform-bus-x86.so>+0x262369
  #6    0x000021e421437fac in acpi_ps_parse_aml(struct acpi_walk_state*) ../../third_party/acpica/source/components/parser/psparse.c:550 <platform-bus-x86.so>+0x2b7fac
  #7    0x000021e4214464d2 in acpi_ps_execute_method(struct acpi_evaluate_info*) ../../third_party/acpica/source/components/parser/psxface.c:244 <platform-bus-x86.so>+0x2c64d2
  #8    0x000021e4213aa052 in acpi_ns_evaluate(struct acpi_evaluate_info*) ../../third_party/acpica/source/components/namespace/nseval.c:250 <platform-bus-x86.so>+0x22a052
  #9    0x000021e421413dd8 in acpi_ns_init_one_device(acpi_handle, u32, void*, void**) ../../third_party/acpica/source/components/namespace/nsinit.c:735 <platform-bus-x86.so>+0x293dd8
  #10   0x000021e421429e98 in acpi_ns_walk_namespace(acpi_object_type, acpi_handle, u32, u32, acpi_walk_callback, acpi_walk_callback, void*, void**) ../../third_party/acpica/source/components/namespace/nswalk.c:298 <platform-bus-x86.so>+0x2a9e98
  #11   0x000021e4214131ac in acpi_ns_initialize_devices(u32) ../../third_party/acpica/source/components/namespace/nsinit.c:268 <platform-bus-x86.so>+0x2931ac
  #12   0x000021e42147c40d in acpi_initialize_objects(u32) ../../third_party/acpica/source/components/utilities/utxfinit.c:304 <platform-bus-x86.so>+0x2fc40d
  #13   0x000021e42126d603 in acpi::acpi_impl::initialize_acpi(acpi::acpi_impl*) ../../src/devices/board/lib/acpi/acpi-impl.cc:224 <platform-bus-x86.so>+0xed603

Add a simple check that avoids incrementing a pointer by zero, but
otherwise behaves as before. Note that our findings are against ACPICA
20221020, but the same code exists on master.

Link: acpica/acpica@770653e3
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
13r0ck pushed a commit that referenced this issue Jun 15, 2023
[ Upstream commit 37c3b9f ]

The cited commit adds a compeletion to remove dependency on rtnl
lock. But it causes a deadlock for multiple encapsulations:

 crash> bt ffff8aece8a64000
 PID: 1514557  TASK: ffff8aece8a64000  CPU: 3    COMMAND: "tc"
  #0 [ffffa6d14183f368] __schedule at ffffffffb8ba7f45
  #1 [ffffa6d14183f3f8] schedule at ffffffffb8ba8418
  #2 [ffffa6d14183f418] schedule_preempt_disabled at ffffffffb8ba8898
  #3 [ffffa6d14183f428] __mutex_lock at ffffffffb8baa7f8
  #4 [ffffa6d14183f4d0] mutex_lock_nested at ffffffffb8baabeb
  #5 [ffffa6d14183f4e0] mlx5e_attach_encap at ffffffffc0f48c17 [mlx5_core]
  #6 [ffffa6d14183f628] mlx5e_tc_add_fdb_flow at ffffffffc0f39680 [mlx5_core]
  #7 [ffffa6d14183f688] __mlx5e_add_fdb_flow at ffffffffc0f3b636 [mlx5_core]
  #8 [ffffa6d14183f6f0] mlx5e_tc_add_flow at ffffffffc0f3bcdf [mlx5_core]
  #9 [ffffa6d14183f728] mlx5e_configure_flower at ffffffffc0f3c1d1 [mlx5_core]
 #10 [ffffa6d14183f790] mlx5e_rep_setup_tc_cls_flower at ffffffffc0f3d529 [mlx5_core]
 #11 [ffffa6d14183f7a0] mlx5e_rep_setup_tc_cb at ffffffffc0f3d714 [mlx5_core]
 #12 [ffffa6d14183f7b0] tc_setup_cb_add at ffffffffb8931bb8
 #13 [ffffa6d14183f810] fl_hw_replace_filter at ffffffffc0dae901 [cls_flower]
 #14 [ffffa6d14183f8d8] fl_change at ffffffffc0db5c57 [cls_flower]
 #15 [ffffa6d14183f970] tc_new_tfilter at ffffffffb8936047
 #16 [ffffa6d14183fac8] rtnetlink_rcv_msg at ffffffffb88c7c31
 #17 [ffffa6d14183fb50] netlink_rcv_skb at ffffffffb8942853
 #18 [ffffa6d14183fbc0] rtnetlink_rcv at ffffffffb88c1835
 #19 [ffffa6d14183fbd0] netlink_unicast at ffffffffb8941f27
 #20 [ffffa6d14183fc18] netlink_sendmsg at ffffffffb8942245
 #21 [ffffa6d14183fc98] sock_sendmsg at ffffffffb887d482
 #22 [ffffa6d14183fcb8] ____sys_sendmsg at ffffffffb887d81a
 #23 [ffffa6d14183fd38] ___sys_sendmsg at ffffffffb88806e2
 #24 [ffffa6d14183fe90] __sys_sendmsg at ffffffffb88807a2
 #25 [ffffa6d14183ff28] __x64_sys_sendmsg at ffffffffb888080f
 #26 [ffffa6d14183ff38] do_syscall_64 at ffffffffb8b9b6a8
 #27 [ffffa6d14183ff50] entry_SYSCALL_64_after_hwframe at ffffffffb8c0007c
 crash> bt 0xffff8aeb07544000
 PID: 1110766  TASK: ffff8aeb07544000  CPU: 0    COMMAND: "kworker/u20:9"
  #0 [ffffa6d14e6b7bd8] __schedule at ffffffffb8ba7f45
  #1 [ffffa6d14e6b7c68] schedule at ffffffffb8ba8418
  #2 [ffffa6d14e6b7c88] schedule_timeout at ffffffffb8baef88
  #3 [ffffa6d14e6b7d10] wait_for_completion at ffffffffb8ba968b
  #4 [ffffa6d14e6b7d60] mlx5e_take_all_encap_flows at ffffffffc0f47ec4 [mlx5_core]
  #5 [ffffa6d14e6b7da0] mlx5e_rep_update_flows at ffffffffc0f3e734 [mlx5_core]
  #6 [ffffa6d14e6b7df8] mlx5e_rep_neigh_update at ffffffffc0f400bb [mlx5_core]
  #7 [ffffa6d14e6b7e50] process_one_work at ffffffffb80acc9c
  #8 [ffffa6d14e6b7ed0] worker_thread at ffffffffb80ad012
  #9 [ffffa6d14e6b7f10] kthread at ffffffffb80b615d
 #10 [ffffa6d14e6b7f50] ret_from_fork at ffffffffb8001b2f

After the first encap is attached, flow will be added to encap
entry's flows list. If neigh update is running at this time, the
following encaps of the flow can't hold the encap_tbl_lock and
sleep. If neigh update thread is waiting for that flow's init_done,
deadlock happens.

Fix it by holding lock outside of the for loop. If neigh update is
running, prevent encap flows from offloading. Since the lock is held
outside of the for loop, concurrent creation of encap entries is not
allowed. So remove unnecessary wait_for_completion call for res_ready.

Fixes: 95435ad ("net/mlx5e: Only access fully initialized flows in neigh update")
Signed-off-by: Chris Mi <cmi@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Vlad Buslov <vladbu@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
mmstick pushed a commit that referenced this issue Jul 26, 2023
[ Upstream commit 99d4850 ]

Found by leak sanitizer:
```
==1632594==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 21 byte(s) in 1 object(s) allocated from:
    #0 0x7f2953a7077b in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:439
    #1 0x556701d6fbbf in perf_env__read_cpuid util/env.c:369
    #2 0x556701d70589 in perf_env__cpuid util/env.c:465
    #3 0x55670204bba2 in x86__is_amd_cpu arch/x86/util/env.c:14
    #4 0x5567020487a2 in arch__post_evsel_config arch/x86/util/evsel.c:83
    #5 0x556701d8f78b in evsel__config util/evsel.c:1366
    #6 0x556701ef5872 in evlist__config util/record.c:108
    #7 0x556701cd6bcd in test__PERF_RECORD tests/perf-record.c:112
    #8 0x556701cacd07 in run_test tests/builtin-test.c:236
    #9 0x556701cacfac in test_and_print tests/builtin-test.c:265
    #10 0x556701cadddb in __cmd_test tests/builtin-test.c:402
    #11 0x556701caf2aa in cmd_test tests/builtin-test.c:559
    #12 0x556701d3b557 in run_builtin tools/perf/perf.c:323
    #13 0x556701d3bac8 in handle_internal_command tools/perf/perf.c:377
    #14 0x556701d3be90 in run_argv tools/perf/perf.c:421
    #15 0x556701d3c3f8 in main tools/perf/perf.c:537
    #16 0x7f2952a46189 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

SUMMARY: AddressSanitizer: 21 byte(s) leaked in 1 allocation(s).
```

Fixes: f7b58cb ("perf mem/c2c: Add load store event mappings for AMD")
Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Ravi Bangoria <ravi.bangoria@amd.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Link: https://lore.kernel.org/r/20230613235416.1650755-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
mmstick pushed a commit that referenced this issue Jul 26, 2023
[ Upstream commit b684c09 ]

ppc_save_regs() skips one stack frame while saving the CPU register states.
Instead of saving current R1, it pulls the previous stack frame pointer.

When vmcores caused by direct panic call (such as `echo c >
/proc/sysrq-trigger`), are debugged with gdb, gdb fails to show the
backtrace correctly. On further analysis, it was found that it was because
of mismatch between r1 and NIP.

GDB uses NIP to get current function symbol and uses corresponding debug
info of that function to unwind previous frames, but due to the
mismatching r1 and NIP, the unwinding does not work, and it fails to
unwind to the 2nd frame and hence does not show the backtrace.

GDB backtrace with vmcore of kernel without this patch:

---------
(gdb) bt
 #0  0xc0000000002a53e8 in crash_setup_regs (oldregs=<optimized out>,
    newregs=0xc000000004f8f8d8) at ./arch/powerpc/include/asm/kexec.h:69
 #1  __crash_kexec (regs=<optimized out>) at kernel/kexec_core.c:974
 #2  0x0000000000000063 in ?? ()
 #3  0xc000000003579320 in ?? ()
---------

Further analysis revealed that the mismatch occurred because
"ppc_save_regs" was saving the previous stack's SP instead of the current
r1. This patch fixes this by storing current r1 in the saved pt_regs.

GDB backtrace with vmcore of patched kernel:

--------
(gdb) bt
 #0  0xc0000000002a53e8 in crash_setup_regs (oldregs=0x0, newregs=0xc00000000670b8d8)
    at ./arch/powerpc/include/asm/kexec.h:69
 #1  __crash_kexec (regs=regs@entry=0x0) at kernel/kexec_core.c:974
 #2  0xc000000000168918 in panic (fmt=fmt@entry=0xc000000001654a60 "sysrq triggered crash\n")
    at kernel/panic.c:358
 #3  0xc000000000b735f8 in sysrq_handle_crash (key=<optimized out>) at drivers/tty/sysrq.c:155
 #4  0xc000000000b742cc in __handle_sysrq (key=key@entry=99, check_mask=check_mask@entry=false)
    at drivers/tty/sysrq.c:602
 #5  0xc000000000b7506c in write_sysrq_trigger (file=<optimized out>, buf=<optimized out>,
    count=2, ppos=<optimized out>) at drivers/tty/sysrq.c:1163
 #6  0xc00000000069a7bc in pde_write (ppos=<optimized out>, count=<optimized out>,
    buf=<optimized out>, file=<optimized out>, pde=0xc00000000362cb40) at fs/proc/inode.c:340
 #7  proc_reg_write (file=<optimized out>, buf=<optimized out>, count=<optimized out>,
    ppos=<optimized out>) at fs/proc/inode.c:352
 #8  0xc0000000005b3bbc in vfs_write (file=file@entry=0xc000000006aa6b00,
    buf=buf@entry=0x61f498b4f60 <error: Cannot access memory at address 0x61f498b4f60>,
    count=count@entry=2, pos=pos@entry=0xc00000000670bda0) at fs/read_write.c:582
 #9  0xc0000000005b4264 in ksys_write (fd=<optimized out>,
    buf=0x61f498b4f60 <error: Cannot access memory at address 0x61f498b4f60>, count=2)
    at fs/read_write.c:637
 #10 0xc00000000002ea2c in system_call_exception (regs=0xc00000000670be80, r0=<optimized out>)
    at arch/powerpc/kernel/syscall.c:171
 #11 0xc00000000000c270 in system_call_vectored_common ()
    at arch/powerpc/kernel/interrupt_64.S:192
--------

Nick adds:
  So this now saves regs as though it was an interrupt taken in the
  caller, at the instruction after the call to ppc_save_regs, whereas
  previously the NIP was there, but R1 came from the caller's caller and
  that mismatch is what causes gdb's dwarf unwinder to go haywire.

Signed-off-by: Aditya Gupta <adityag@linux.ibm.com>
Fixes: d16a58f ("powerpc: Improve ppc_save_regs()")
Reivewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230615091047.90433-1-adityag@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
mmstick pushed a commit that referenced this issue Jul 26, 2023
commit 8785436 upstream.

Shift operation of 'exp' and 'shift' variables exceeds the maximum number
of shift values in the u32 range leading to UBSAN shift-out-of-bounds.

...
[    6.120512] UBSAN: shift-out-of-bounds in drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c:149:50
[    6.120598] shift exponent 104 is too large for 64-bit type 'long unsigned int'
[    6.120659] CPU: 4 PID: 96 Comm: kworker/4:1 Not tainted 6.4.0amd_1-next-20230519-dirty #10
[    6.120665] Hardware name: AMD Birman-PHX/Birman-PHX, BIOS SFH_with_HPD_SEN.FD 04/05/2023
[    6.120667] Workqueue: events amd_sfh_work_buffer [amd_sfh]
[    6.120687] Call Trace:
[    6.120690]  <TASK>
[    6.120694]  dump_stack_lvl+0x48/0x70
[    6.120704]  dump_stack+0x10/0x20
[    6.120707]  ubsan_epilogue+0x9/0x40
[    6.120716]  __ubsan_handle_shift_out_of_bounds+0x10f/0x170
[    6.120720]  ? psi_group_change+0x25f/0x4b0
[    6.120729]  float_to_int.cold+0x18/0xba [amd_sfh]
[    6.120739]  get_input_rep+0x57/0x340 [amd_sfh]
[    6.120748]  ? __schedule+0xba7/0x1b60
[    6.120756]  ? __pfx_get_input_rep+0x10/0x10 [amd_sfh]
[    6.120764]  amd_sfh_work_buffer+0x91/0x180 [amd_sfh]
[    6.120772]  process_one_work+0x229/0x430
[    6.120780]  worker_thread+0x4a/0x3c0
[    6.120784]  ? __pfx_worker_thread+0x10/0x10
[    6.120788]  kthread+0xf7/0x130
[    6.120792]  ? __pfx_kthread+0x10/0x10
[    6.120795]  ret_from_fork+0x29/0x50
[    6.120804]  </TASK>
...

Fix this by adding the condition to validate shift ranges.

Fixes: 93ce5e0 ("HID: amd_sfh: Implement SFH1.1 functionality")
Cc: stable@vger.kernel.org
Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Signed-off-by: Akshata MukundShetty <akshata.mukundshetty@amd.com>
Link: https://lore.kernel.org/r/20230707065722.9036-3-Basavaraj.Natikar@amd.com
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mmstick pushed a commit that referenced this issue Aug 14, 2023
[ Upstream commit 93a3319 ]

The cited commit holds encap tbl lock unconditionally when setting
up dests. But it may cause the following deadlock:

 PID: 1063722  TASK: ffffa062ca5d0000  CPU: 13   COMMAND: "handler8"
  #0 [ffffb14de05b7368] __schedule at ffffffffa1d5aa91
  #1 [ffffb14de05b7410] schedule at ffffffffa1d5afdb
  #2 [ffffb14de05b7430] schedule_preempt_disabled at ffffffffa1d5b528
  #3 [ffffb14de05b7440] __mutex_lock at ffffffffa1d5d6cb
  #4 [ffffb14de05b74e8] mutex_lock_nested at ffffffffa1d5ddeb
  #5 [ffffb14de05b74f8] mlx5e_tc_tun_encap_dests_set at ffffffffc12f2096 [mlx5_core]
  #6 [ffffb14de05b7568] post_process_attr at ffffffffc12d9fc5 [mlx5_core]
  #7 [ffffb14de05b75a0] mlx5e_tc_add_fdb_flow at ffffffffc12de877 [mlx5_core]
  #8 [ffffb14de05b75f0] __mlx5e_add_fdb_flow at ffffffffc12e0eef [mlx5_core]
  #9 [ffffb14de05b7660] mlx5e_tc_add_flow at ffffffffc12e12f7 [mlx5_core]
 #10 [ffffb14de05b76b8] mlx5e_configure_flower at ffffffffc12e1686 [mlx5_core]
 #11 [ffffb14de05b7720] mlx5e_rep_indr_offload at ffffffffc12e3817 [mlx5_core]
 #12 [ffffb14de05b7730] mlx5e_rep_indr_setup_tc_cb at ffffffffc12e388a [mlx5_core]
 #13 [ffffb14de05b7740] tc_setup_cb_add at ffffffffa1ab2ba8
 #14 [ffffb14de05b77a0] fl_hw_replace_filter at ffffffffc0bdec2f [cls_flower]
 #15 [ffffb14de05b7868] fl_change at ffffffffc0be6caa [cls_flower]
 #16 [ffffb14de05b7908] tc_new_tfilter at ffffffffa1ab71f0

[1031218.028143]  wait_for_completion+0x24/0x30
[1031218.028589]  mlx5e_update_route_decap_flows+0x9a/0x1e0 [mlx5_core]
[1031218.029256]  mlx5e_tc_fib_event_work+0x1ad/0x300 [mlx5_core]
[1031218.029885]  process_one_work+0x24e/0x510

Actually no need to hold encap tbl lock if there is no encap action.
Fix it by checking if encap action exists or not before holding
encap tbl lock.

Fixes: 37c3b9f ("net/mlx5e: Prevent encap offload when neigh update is running")
Signed-off-by: Chris Mi <cmi@nvidia.com>
Reviewed-by: Vlad Buslov <vladbu@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
jackpot51 pushed a commit that referenced this issue Sep 20, 2023
[ Upstream commit 94d9ba9 ]

Use-after-free can occur in hci_disconnect_all_sync if a connection is
deleted by concurrent processing of a controller event.

To prevent this the code now tries to iterate over the list backwards
to ensure the links are cleanup before its parents, also it no longer
relies on a cursor, instead it always uses the last element since
hci_abort_conn_sync is guaranteed to call hci_conn_del.

UAF crash log:
==================================================================
BUG: KASAN: slab-use-after-free in hci_set_powered_sync
(net/bluetooth/hci_sync.c:5424) [bluetooth]
Read of size 8 at addr ffff888009d9c000 by task kworker/u9:0/124

CPU: 0 PID: 124 Comm: kworker/u9:0 Tainted: G        W
6.5.0-rc1+ #10
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
1.16.2-1.fc38 04/01/2014
Workqueue: hci0 hci_cmd_sync_work [bluetooth]
Call Trace:
 <TASK>
 dump_stack_lvl+0x5b/0x90
 print_report+0xcf/0x670
 ? __virt_addr_valid+0xdd/0x160
 ? hci_set_powered_sync+0x2c9/0x4a0 [bluetooth]
 kasan_report+0xa6/0xe0
 ? hci_set_powered_sync+0x2c9/0x4a0 [bluetooth]
 ? __pfx_set_powered_sync+0x10/0x10 [bluetooth]
 hci_set_powered_sync+0x2c9/0x4a0 [bluetooth]
 ? __pfx_hci_set_powered_sync+0x10/0x10 [bluetooth]
 ? __pfx_lock_release+0x10/0x10
 ? __pfx_set_powered_sync+0x10/0x10 [bluetooth]
 hci_cmd_sync_work+0x137/0x220 [bluetooth]
 process_one_work+0x526/0x9d0
 ? __pfx_process_one_work+0x10/0x10
 ? __pfx_do_raw_spin_lock+0x10/0x10
 ? mark_held_locks+0x1a/0x90
 worker_thread+0x92/0x630
 ? __pfx_worker_thread+0x10/0x10
 kthread+0x196/0x1e0
 ? __pfx_kthread+0x10/0x10
 ret_from_fork+0x2c/0x50
 </TASK>

Allocated by task 1782:
 kasan_save_stack+0x33/0x60
 kasan_set_track+0x25/0x30
 __kasan_kmalloc+0x8f/0xa0
 hci_conn_add+0xa5/0xa80 [bluetooth]
 hci_bind_cis+0x881/0x9b0 [bluetooth]
 iso_connect_cis+0x121/0x520 [bluetooth]
 iso_sock_connect+0x3f6/0x790 [bluetooth]
 __sys_connect+0x109/0x130
 __x64_sys_connect+0x40/0x50
 do_syscall_64+0x60/0x90
 entry_SYSCALL_64_after_hwframe+0x6e/0xd8

Freed by task 695:
 kasan_save_stack+0x33/0x60
 kasan_set_track+0x25/0x30
 kasan_save_free_info+0x2b/0x50
 __kasan_slab_free+0x10a/0x180
 __kmem_cache_free+0x14d/0x2e0
 device_release+0x5d/0xf0
 kobject_put+0xdf/0x270
 hci_disconn_complete_evt+0x274/0x3a0 [bluetooth]
 hci_event_packet+0x579/0x7e0 [bluetooth]
 hci_rx_work+0x287/0xaa0 [bluetooth]
 process_one_work+0x526/0x9d0
 worker_thread+0x92/0x630
 kthread+0x196/0x1e0
 ret_from_fork+0x2c/0x50
==================================================================

Fixes: 182ee45 ("Bluetooth: hci_sync: Rework hci_suspend_notifier")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
jackpot51 pushed a commit that referenced this issue Sep 20, 2023
[ Upstream commit 7962ef1 ]

In 3cb4d5e ("perf trace: Free syscall tp fields in
evsel->priv") it only was freeing if strcmp(evsel->tp_format->system,
"syscalls") returned zero, while the corresponding initialization of
evsel->priv was being performed if it was _not_ zero, i.e. if the tp
system wasn't 'syscalls'.

Just stop looking for that and free it if evsel->priv was set, which
should be equivalent.

Also use the pre-existing evsel_trace__delete() function.

This resolves these leaks, detected with:

  $ make EXTRA_CFLAGS="-fsanitize=address" BUILD_BPF_SKEL=1 CORESIGHT=1 O=/tmp/build/perf-tools-next -C tools/perf install-bin

  =================================================================
  ==481565==ERROR: LeakSanitizer: detected memory leaks

  Direct leak of 40 byte(s) in 1 object(s) allocated from:
      #0 0x7f7343cba097 in calloc (/lib64/libasan.so.8+0xba097)
      #1 0x987966 in zalloc (/home/acme/bin/perf+0x987966)
      #2 0x52f9b9 in evsel_trace__new /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:307
      #3 0x52f9b9 in evsel__syscall_tp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:333
      #4 0x52f9b9 in evsel__init_raw_syscall_tp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:458
      #5 0x52f9b9 in perf_evsel__raw_syscall_newtp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:480
      #6 0x540e8b in trace__add_syscall_newtp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3212
      #7 0x540e8b in trace__run /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3891
      #8 0x540e8b in cmd_trace /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:5156
      #9 0x5ef262 in run_builtin /home/acme/git/perf-tools-next/tools/perf/perf.c:323
      #10 0x4196da in handle_internal_command /home/acme/git/perf-tools-next/tools/perf/perf.c:377
      #11 0x4196da in run_argv /home/acme/git/perf-tools-next/tools/perf/perf.c:421
      #12 0x4196da in main /home/acme/git/perf-tools-next/tools/perf/perf.c:537
      #13 0x7f7342c4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)

  Direct leak of 40 byte(s) in 1 object(s) allocated from:
      #0 0x7f7343cba097 in calloc (/lib64/libasan.so.8+0xba097)
      #1 0x987966 in zalloc (/home/acme/bin/perf+0x987966)
      #2 0x52f9b9 in evsel_trace__new /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:307
      #3 0x52f9b9 in evsel__syscall_tp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:333
      #4 0x52f9b9 in evsel__init_raw_syscall_tp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:458
      #5 0x52f9b9 in perf_evsel__raw_syscall_newtp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:480
      #6 0x540dd1 in trace__add_syscall_newtp /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3205
      #7 0x540dd1 in trace__run /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:3891
      #8 0x540dd1 in cmd_trace /home/acme/git/perf-tools-next/tools/perf/builtin-trace.c:5156
      #9 0x5ef262 in run_builtin /home/acme/git/perf-tools-next/tools/perf/perf.c:323
      #10 0x4196da in handle_internal_command /home/acme/git/perf-tools-next/tools/perf/perf.c:377
      #11 0x4196da in run_argv /home/acme/git/perf-tools-next/tools/perf/perf.c:421
      #12 0x4196da in main /home/acme/git/perf-tools-next/tools/perf/perf.c:537
      #13 0x7f7342c4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)

  SUMMARY: AddressSanitizer: 80 byte(s) leaked in 2 allocation(s).
  [root@quaco ~]#

With this we plug all leaks with "perf trace sleep 1".

Fixes: 3cb4d5e ("perf trace: Free syscall tp fields in evsel->priv")
Acked-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Riccardo Mancini <rickyman7@gmail.com>
Link: https://lore.kernel.org/lkml/20230719202951.534582-5-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
mmstick pushed a commit that referenced this issue Oct 13, 2023
commit 0b0747d upstream.

The following processes run into a deadlock. CPU 41 was waiting for CPU 29
to handle a CSD request while holding spinlock "crashdump_lock", but CPU 29
was hung by that spinlock with IRQs disabled.

  PID: 17360    TASK: ffff95c1090c5c40  CPU: 41  COMMAND: "mrdiagd"
  !# 0 [ffffb80edbf37b58] __read_once_size at ffffffff9b871a40 include/linux/compiler.h:185:0
  !# 1 [ffffb80edbf37b58] atomic_read at ffffffff9b871a40 arch/x86/include/asm/atomic.h:27:0
  !# 2 [ffffb80edbf37b58] dump_stack at ffffffff9b871a40 lib/dump_stack.c:54:0
   # 3 [ffffb80edbf37b78] csd_lock_wait_toolong at ffffffff9b131ad5 kernel/smp.c:364:0
   # 4 [ffffb80edbf37b78] __csd_lock_wait at ffffffff9b131ad5 kernel/smp.c:384:0
   # 5 [ffffb80edbf37bf8] csd_lock_wait at ffffffff9b13267a kernel/smp.c:394:0
   # 6 [ffffb80edbf37bf8] smp_call_function_many at ffffffff9b13267a kernel/smp.c:843:0
   # 7 [ffffb80edbf37c50] smp_call_function at ffffffff9b13279d kernel/smp.c:867:0
   # 8 [ffffb80edbf37c50] on_each_cpu at ffffffff9b13279d kernel/smp.c:976:0
   # 9 [ffffb80edbf37c78] flush_tlb_kernel_range at ffffffff9b085c4b arch/x86/mm/tlb.c:742:0
   #10 [ffffb80edbf37cb8] __purge_vmap_area_lazy at ffffffff9b23a1e0 mm/vmalloc.c:701:0
   #11 [ffffb80edbf37ce0] try_purge_vmap_area_lazy at ffffffff9b23a2cc mm/vmalloc.c:722:0
   #12 [ffffb80edbf37ce0] free_vmap_area_noflush at ffffffff9b23a2cc mm/vmalloc.c:754:0
   #13 [ffffb80edbf37cf8] free_unmap_vmap_area at ffffffff9b23bb3b mm/vmalloc.c:764:0
   #14 [ffffb80edbf37cf8] remove_vm_area at ffffffff9b23bb3b mm/vmalloc.c:1509:0
   #15 [ffffb80edbf37d18] __vunmap at ffffffff9b23bb8a mm/vmalloc.c:1537:0
   #16 [ffffb80edbf37d40] vfree at ffffffff9b23bc85 mm/vmalloc.c:1612:0
   #17 [ffffb80edbf37d58] megasas_free_host_crash_buffer [megaraid_sas] at ffffffffc020b7f2 drivers/scsi/megaraid/megaraid_sas_fusion.c:3932:0
   #18 [ffffb80edbf37d80] fw_crash_state_store [megaraid_sas] at ffffffffc01f804d drivers/scsi/megaraid/megaraid_sas_base.c:3291:0
   #19 [ffffb80edbf37dc0] dev_attr_store at ffffffff9b56dd7b drivers/base/core.c:758:0
   #20 [ffffb80edbf37dd0] sysfs_kf_write at ffffffff9b326acf fs/sysfs/file.c:144:0
   #21 [ffffb80edbf37de0] kernfs_fop_write at ffffffff9b325fd4 fs/kernfs/file.c:316:0
   #22 [ffffb80edbf37e20] __vfs_write at ffffffff9b29418a fs/read_write.c:480:0
   #23 [ffffb80edbf37ea8] vfs_write at ffffffff9b294462 fs/read_write.c:544:0
   #24 [ffffb80edbf37ee8] SYSC_write at ffffffff9b2946ec fs/read_write.c:590:0
   #25 [ffffb80edbf37ee8] SyS_write at ffffffff9b2946ec fs/read_write.c:582:0
   #26 [ffffb80edbf37f30] do_syscall_64 at ffffffff9b003ca9 arch/x86/entry/common.c:298:0
   #27 [ffffb80edbf37f58] entry_SYSCALL_64 at ffffffff9ba001b1 arch/x86/entry/entry_64.S:238:0

  PID: 17355    TASK: ffff95c1090c3d80  CPU: 29  COMMAND: "mrdiagd"
  !# 0 [ffffb80f2d3c7d30] __read_once_size at ffffffff9b0f2ab0 include/linux/compiler.h:185:0
  !# 1 [ffffb80f2d3c7d30] native_queued_spin_lock_slowpath at ffffffff9b0f2ab0 kernel/locking/qspinlock.c:368:0
   # 2 [ffffb80f2d3c7d58] pv_queued_spin_lock_slowpath at ffffffff9b0f244b arch/x86/include/asm/paravirt.h:674:0
   # 3 [ffffb80f2d3c7d58] queued_spin_lock_slowpath at ffffffff9b0f244b arch/x86/include/asm/qspinlock.h:53:0
   # 4 [ffffb80f2d3c7d68] queued_spin_lock at ffffffff9b8961a6 include/asm-generic/qspinlock.h:90:0
   # 5 [ffffb80f2d3c7d68] do_raw_spin_lock_flags at ffffffff9b8961a6 include/linux/spinlock.h:173:0
   # 6 [ffffb80f2d3c7d68] __raw_spin_lock_irqsave at ffffffff9b8961a6 include/linux/spinlock_api_smp.h:122:0
   # 7 [ffffb80f2d3c7d68] _raw_spin_lock_irqsave at ffffffff9b8961a6 kernel/locking/spinlock.c:160:0
   # 8 [ffffb80f2d3c7d88] fw_crash_buffer_store [megaraid_sas] at ffffffffc01f8129 drivers/scsi/megaraid/megaraid_sas_base.c:3205:0
   # 9 [ffffb80f2d3c7dc0] dev_attr_store at ffffffff9b56dd7b drivers/base/core.c:758:0
   #10 [ffffb80f2d3c7dd0] sysfs_kf_write at ffffffff9b326acf fs/sysfs/file.c:144:0
   #11 [ffffb80f2d3c7de0] kernfs_fop_write at ffffffff9b325fd4 fs/kernfs/file.c:316:0
   #12 [ffffb80f2d3c7e20] __vfs_write at ffffffff9b29418a fs/read_write.c:480:0
   #13 [ffffb80f2d3c7ea8] vfs_write at ffffffff9b294462 fs/read_write.c:544:0
   #14 [ffffb80f2d3c7ee8] SYSC_write at ffffffff9b2946ec fs/read_write.c:590:0
   #15 [ffffb80f2d3c7ee8] SyS_write at ffffffff9b2946ec fs/read_write.c:582:0
   #16 [ffffb80f2d3c7f30] do_syscall_64 at ffffffff9b003ca9 arch/x86/entry/common.c:298:0
   #17 [ffffb80f2d3c7f58] entry_SYSCALL_64 at ffffffff9ba001b1 arch/x86/entry/entry_64.S:238:0

The lock is used to synchronize different sysfs operations, it doesn't
protect any resource that will be touched by an interrupt. Consequently
it's not required to disable IRQs. Replace the spinlock with a mutex to fix
the deadlock.

Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Link: https://lore.kernel.org/r/20230828221018.19471-1-junxiao.bi@oracle.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Cc: stable@vger.kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mmstick pushed a commit that referenced this issue Dec 11, 2023
[ Upstream commit 7196398 ]

KMSAN reported the following uninit-value access issue:

=====================================================
BUG: KMSAN: uninit-value in ppp_sync_input drivers/net/ppp/ppp_synctty.c:690 [inline]
BUG: KMSAN: uninit-value in ppp_sync_receive+0xdc9/0xe70 drivers/net/ppp/ppp_synctty.c:334
 ppp_sync_input drivers/net/ppp/ppp_synctty.c:690 [inline]
 ppp_sync_receive+0xdc9/0xe70 drivers/net/ppp/ppp_synctty.c:334
 tiocsti+0x328/0x450 drivers/tty/tty_io.c:2295
 tty_ioctl+0x808/0x1920 drivers/tty/tty_io.c:2694
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:871 [inline]
 __se_sys_ioctl+0x211/0x400 fs/ioctl.c:857
 __x64_sys_ioctl+0x97/0xe0 fs/ioctl.c:857
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x63/0x6b

Uninit was created at:
 __alloc_pages+0x75d/0xe80 mm/page_alloc.c:4591
 __alloc_pages_node include/linux/gfp.h:238 [inline]
 alloc_pages_node include/linux/gfp.h:261 [inline]
 __page_frag_cache_refill+0x9a/0x2c0 mm/page_alloc.c:4691
 page_frag_alloc_align+0x91/0x5d0 mm/page_alloc.c:4722
 page_frag_alloc include/linux/gfp.h:322 [inline]
 __netdev_alloc_skb+0x215/0x6d0 net/core/skbuff.c:728
 netdev_alloc_skb include/linux/skbuff.h:3225 [inline]
 dev_alloc_skb include/linux/skbuff.h:3238 [inline]
 ppp_sync_input drivers/net/ppp/ppp_synctty.c:669 [inline]
 ppp_sync_receive+0x237/0xe70 drivers/net/ppp/ppp_synctty.c:334
 tiocsti+0x328/0x450 drivers/tty/tty_io.c:2295
 tty_ioctl+0x808/0x1920 drivers/tty/tty_io.c:2694
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:871 [inline]
 __se_sys_ioctl+0x211/0x400 fs/ioctl.c:857
 __x64_sys_ioctl+0x97/0xe0 fs/ioctl.c:857
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x63/0x6b

CPU: 0 PID: 12950 Comm: syz-executor.1 Not tainted 6.6.0-14500-g1c41041124bd #10
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-1.fc38 04/01/2014
=====================================================

ppp_sync_input() checks the first 2 bytes of the data are PPP_ALLSTATIONS
and PPP_UI. However, if the data length is 1 and the first byte is
PPP_ALLSTATIONS, an access to an uninitialized value occurs when checking
PPP_UI. This patch resolves this issue by checking the data length.

Fixes: 1da177e ("Linux-2.6.12-rc2")
Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
mmstick pushed a commit that referenced this issue Dec 11, 2023
[ Upstream commit fb317eb ]

KMSAN reported the following kernel-infoleak issue:

=====================================================
BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instrumented.h:114 [inline]
BUG: KMSAN: kernel-infoleak in copy_to_user_iter lib/iov_iter.c:24 [inline]
BUG: KMSAN: kernel-infoleak in iterate_ubuf include/linux/iov_iter.h:29 [inline]
BUG: KMSAN: kernel-infoleak in iterate_and_advance2 include/linux/iov_iter.h:245 [inline]
BUG: KMSAN: kernel-infoleak in iterate_and_advance include/linux/iov_iter.h:271 [inline]
BUG: KMSAN: kernel-infoleak in _copy_to_iter+0x4ec/0x2bc0 lib/iov_iter.c:186
 instrument_copy_to_user include/linux/instrumented.h:114 [inline]
 copy_to_user_iter lib/iov_iter.c:24 [inline]
 iterate_ubuf include/linux/iov_iter.h:29 [inline]
 iterate_and_advance2 include/linux/iov_iter.h:245 [inline]
 iterate_and_advance include/linux/iov_iter.h:271 [inline]
 _copy_to_iter+0x4ec/0x2bc0 lib/iov_iter.c:186
 copy_to_iter include/linux/uio.h:197 [inline]
 simple_copy_to_iter net/core/datagram.c:532 [inline]
 __skb_datagram_iter.5+0x148/0xe30 net/core/datagram.c:420
 skb_copy_datagram_iter+0x52/0x210 net/core/datagram.c:546
 skb_copy_datagram_msg include/linux/skbuff.h:3960 [inline]
 netlink_recvmsg+0x43d/0x1630 net/netlink/af_netlink.c:1967
 sock_recvmsg_nosec net/socket.c:1044 [inline]
 sock_recvmsg net/socket.c:1066 [inline]
 __sys_recvfrom+0x476/0x860 net/socket.c:2246
 __do_sys_recvfrom net/socket.c:2264 [inline]
 __se_sys_recvfrom net/socket.c:2260 [inline]
 __x64_sys_recvfrom+0x130/0x200 net/socket.c:2260
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x63/0x6b

Uninit was created at:
 slab_post_alloc_hook+0x103/0x9e0 mm/slab.h:768
 slab_alloc_node mm/slub.c:3478 [inline]
 kmem_cache_alloc_node+0x5f7/0xb50 mm/slub.c:3523
 kmalloc_reserve+0x13c/0x4a0 net/core/skbuff.c:560
 __alloc_skb+0x2fd/0x770 net/core/skbuff.c:651
 alloc_skb include/linux/skbuff.h:1286 [inline]
 tipc_tlv_alloc net/tipc/netlink_compat.c:156 [inline]
 tipc_get_err_tlv+0x90/0x5d0 net/tipc/netlink_compat.c:170
 tipc_nl_compat_recv+0x1042/0x15d0 net/tipc/netlink_compat.c:1324
 genl_family_rcv_msg_doit net/netlink/genetlink.c:972 [inline]
 genl_family_rcv_msg net/netlink/genetlink.c:1052 [inline]
 genl_rcv_msg+0x1220/0x12c0 net/netlink/genetlink.c:1067
 netlink_rcv_skb+0x4a4/0x6a0 net/netlink/af_netlink.c:2545
 genl_rcv+0x41/0x60 net/netlink/genetlink.c:1076
 netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
 netlink_unicast+0xf4b/0x1230 net/netlink/af_netlink.c:1368
 netlink_sendmsg+0x1242/0x1420 net/netlink/af_netlink.c:1910
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg net/socket.c:745 [inline]
 ____sys_sendmsg+0x997/0xd60 net/socket.c:2588
 ___sys_sendmsg+0x271/0x3b0 net/socket.c:2642
 __sys_sendmsg net/socket.c:2671 [inline]
 __do_sys_sendmsg net/socket.c:2680 [inline]
 __se_sys_sendmsg net/socket.c:2678 [inline]
 __x64_sys_sendmsg+0x2fa/0x4a0 net/socket.c:2678
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x63/0x6b

Bytes 34-35 of 36 are uninitialized
Memory access of size 36 starts at ffff88802d464a00
Data copied to user address 00007ff55033c0a0

CPU: 0 PID: 30322 Comm: syz-executor.0 Not tainted 6.6.0-14500-g1c41041124bd #10
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-1.fc38 04/01/2014
=====================================================

tipc_add_tlv() puts TLV descriptor and value onto `skb`. This size is
calculated with TLV_SPACE() macro. It adds the size of struct tlv_desc and
the length of TLV value passed as an argument, and aligns the result to a
multiple of TLV_ALIGNTO, i.e., a multiple of 4 bytes.

If the size of struct tlv_desc plus the length of TLV value is not aligned,
the current implementation leaves the remaining bytes uninitialized. This
is the cause of the above kernel-infoleak issue.

This patch resolves this issue by clearing data up to an aligned size.

Fixes: d0796d1 ("tipc: convert legacy nl bearer dump to nl compat")
Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
mmstick pushed a commit that referenced this issue Jan 2, 2024
[ Upstream commit a2e36cd ]

This allows it to break the following circular locking dependency.

Aug 10 07:01:29 dg1test kernel: ======================================================
Aug 10 07:01:29 dg1test kernel: WARNING: possible circular locking dependency detected
Aug 10 07:01:29 dg1test kernel: 6.4.0-rc7+ #10 Not tainted
Aug 10 07:01:29 dg1test kernel: ------------------------------------------------------
Aug 10 07:01:29 dg1test kernel: wireplumber/2236 is trying to acquire lock:
Aug 10 07:01:29 dg1test kernel: ffff8fca5320da18 (&fctx->lock){-...}-{2:2}, at: nouveau_fence_wait_uevent_handler+0x2b/0x100 [nouveau]
Aug 10 07:01:29 dg1test kernel:
                                but task is already holding lock:
Aug 10 07:01:29 dg1test kernel: ffff8fca41208610 (&event->list_lock#2){-...}-{2:2}, at: nvkm_event_ntfy+0x50/0xf0 [nouveau]
Aug 10 07:01:29 dg1test kernel:
                                which lock already depends on the new lock.
Aug 10 07:01:29 dg1test kernel:
                                the existing dependency chain (in reverse order) is:
Aug 10 07:01:29 dg1test kernel:
                                -> #3 (&event->list_lock#2){-...}-{2:2}:
Aug 10 07:01:29 dg1test kernel:        _raw_spin_lock_irqsave+0x4b/0x70
Aug 10 07:01:29 dg1test kernel:        nvkm_event_ntfy+0x50/0xf0 [nouveau]
Aug 10 07:01:29 dg1test kernel:        ga100_fifo_nonstall_intr+0x24/0x30 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nvkm_intr+0x12c/0x240 [nouveau]
Aug 10 07:01:29 dg1test kernel:        __handle_irq_event_percpu+0x88/0x240
Aug 10 07:01:29 dg1test kernel:        handle_irq_event+0x38/0x80
Aug 10 07:01:29 dg1test kernel:        handle_edge_irq+0xa3/0x240
Aug 10 07:01:29 dg1test kernel:        __common_interrupt+0x72/0x160
Aug 10 07:01:29 dg1test kernel:        common_interrupt+0x60/0xe0
Aug 10 07:01:29 dg1test kernel:        asm_common_interrupt+0x26/0x40
Aug 10 07:01:29 dg1test kernel:
                                -> #2 (&device->intr.lock){-...}-{2:2}:
Aug 10 07:01:29 dg1test kernel:        _raw_spin_lock_irqsave+0x4b/0x70
Aug 10 07:01:29 dg1test kernel:        nvkm_inth_allow+0x2c/0x80 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nvkm_event_ntfy_state+0x181/0x250 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nvkm_event_ntfy_allow+0x63/0xd0 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nvkm_uevent_mthd+0x4d/0x70 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nvkm_ioctl+0x10b/0x250 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nvif_object_mthd+0xa8/0x1f0 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nvif_event_allow+0x2a/0xa0 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nouveau_fence_enable_signaling+0x78/0x80 [nouveau]
Aug 10 07:01:29 dg1test kernel:        __dma_fence_enable_signaling+0x5e/0x100
Aug 10 07:01:29 dg1test kernel:        dma_fence_add_callback+0x4b/0xd0
Aug 10 07:01:29 dg1test kernel:        nouveau_cli_work_queue+0xae/0x110 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nouveau_gem_object_close+0x1d1/0x2a0 [nouveau]
Aug 10 07:01:29 dg1test kernel:        drm_gem_handle_delete+0x70/0xe0 [drm]
Aug 10 07:01:29 dg1test kernel:        drm_ioctl_kernel+0xa5/0x150 [drm]
Aug 10 07:01:29 dg1test kernel:        drm_ioctl+0x256/0x490 [drm]
Aug 10 07:01:29 dg1test kernel:        nouveau_drm_ioctl+0x5a/0xb0 [nouveau]
Aug 10 07:01:29 dg1test kernel:        __x64_sys_ioctl+0x91/0xd0
Aug 10 07:01:29 dg1test kernel:        do_syscall_64+0x3c/0x90
Aug 10 07:01:29 dg1test kernel:        entry_SYSCALL_64_after_hwframe+0x72/0xdc
Aug 10 07:01:29 dg1test kernel:
                                -> #1 (&event->refs_lock#4){....}-{2:2}:
Aug 10 07:01:29 dg1test kernel:        _raw_spin_lock_irqsave+0x4b/0x70
Aug 10 07:01:29 dg1test kernel:        nvkm_event_ntfy_state+0x37/0x250 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nvkm_event_ntfy_allow+0x63/0xd0 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nvkm_uevent_mthd+0x4d/0x70 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nvkm_ioctl+0x10b/0x250 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nvif_object_mthd+0xa8/0x1f0 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nvif_event_allow+0x2a/0xa0 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nouveau_fence_enable_signaling+0x78/0x80 [nouveau]
Aug 10 07:01:29 dg1test kernel:        __dma_fence_enable_signaling+0x5e/0x100
Aug 10 07:01:29 dg1test kernel:        dma_fence_add_callback+0x4b/0xd0
Aug 10 07:01:29 dg1test kernel:        nouveau_cli_work_queue+0xae/0x110 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nouveau_gem_object_close+0x1d1/0x2a0 [nouveau]
Aug 10 07:01:29 dg1test kernel:        drm_gem_handle_delete+0x70/0xe0 [drm]
Aug 10 07:01:29 dg1test kernel:        drm_ioctl_kernel+0xa5/0x150 [drm]
Aug 10 07:01:29 dg1test kernel:        drm_ioctl+0x256/0x490 [drm]
Aug 10 07:01:29 dg1test kernel:        nouveau_drm_ioctl+0x5a/0xb0 [nouveau]
Aug 10 07:01:29 dg1test kernel:        __x64_sys_ioctl+0x91/0xd0
Aug 10 07:01:29 dg1test kernel:        do_syscall_64+0x3c/0x90
Aug 10 07:01:29 dg1test kernel:        entry_SYSCALL_64_after_hwframe+0x72/0xdc
Aug 10 07:01:29 dg1test kernel:
                                -> #0 (&fctx->lock){-...}-{2:2}:
Aug 10 07:01:29 dg1test kernel:        __lock_acquire+0x14e3/0x2240
Aug 10 07:01:29 dg1test kernel:        lock_acquire+0xc8/0x2a0
Aug 10 07:01:29 dg1test kernel:        _raw_spin_lock_irqsave+0x4b/0x70
Aug 10 07:01:29 dg1test kernel:        nouveau_fence_wait_uevent_handler+0x2b/0x100 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nvkm_client_event+0xf/0x20 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nvkm_event_ntfy+0x9b/0xf0 [nouveau]
Aug 10 07:01:29 dg1test kernel:        ga100_fifo_nonstall_intr+0x24/0x30 [nouveau]
Aug 10 07:01:29 dg1test kernel:        nvkm_intr+0x12c/0x240 [nouveau]
Aug 10 07:01:29 dg1test kernel:        __handle_irq_event_percpu+0x88/0x240
Aug 10 07:01:29 dg1test kernel:        handle_irq_event+0x38/0x80
Aug 10 07:01:29 dg1test kernel:        handle_edge_irq+0xa3/0x240
Aug 10 07:01:29 dg1test kernel:        __common_interrupt+0x72/0x160
Aug 10 07:01:29 dg1test kernel:        common_interrupt+0x60/0xe0
Aug 10 07:01:29 dg1test kernel:        asm_common_interrupt+0x26/0x40
Aug 10 07:01:29 dg1test kernel:
                                other info that might help us debug this:
Aug 10 07:01:29 dg1test kernel: Chain exists of:
                                  &fctx->lock --> &device->intr.lock --> &event->list_lock#2
Aug 10 07:01:29 dg1test kernel:  Possible unsafe locking scenario:
Aug 10 07:01:29 dg1test kernel:        CPU0                    CPU1
Aug 10 07:01:29 dg1test kernel:        ----                    ----
Aug 10 07:01:29 dg1test kernel:   lock(&event->list_lock#2);
Aug 10 07:01:29 dg1test kernel:                                lock(&device->intr.lock);
Aug 10 07:01:29 dg1test kernel:                                lock(&event->list_lock#2);
Aug 10 07:01:29 dg1test kernel:   lock(&fctx->lock);
Aug 10 07:01:29 dg1test kernel:
                                 *** DEADLOCK ***
Aug 10 07:01:29 dg1test kernel: 2 locks held by wireplumber/2236:
Aug 10 07:01:29 dg1test kernel:  #0: ffff8fca53177bf8 (&device->intr.lock){-...}-{2:2}, at: nvkm_intr+0x29/0x240 [nouveau]
Aug 10 07:01:29 dg1test kernel:  #1: ffff8fca41208610 (&event->list_lock#2){-...}-{2:2}, at: nvkm_event_ntfy+0x50/0xf0 [nouveau]
Aug 10 07:01:29 dg1test kernel:
                                stack backtrace:
Aug 10 07:01:29 dg1test kernel: CPU: 6 PID: 2236 Comm: wireplumber Not tainted 6.4.0-rc7+ #10
Aug 10 07:01:29 dg1test kernel: Hardware name: Gigabyte Technology Co., Ltd. Z390 I AORUS PRO WIFI/Z390 I AORUS PRO WIFI-CF, BIOS F8 11/05/2021
Aug 10 07:01:29 dg1test kernel: Call Trace:
Aug 10 07:01:29 dg1test kernel:  <TASK>
Aug 10 07:01:29 dg1test kernel:  dump_stack_lvl+0x5b/0x90
Aug 10 07:01:29 dg1test kernel:  check_noncircular+0xe2/0x110
Aug 10 07:01:29 dg1test kernel:  __lock_acquire+0x14e3/0x2240
Aug 10 07:01:29 dg1test kernel:  lock_acquire+0xc8/0x2a0
Aug 10 07:01:29 dg1test kernel:  ? nouveau_fence_wait_uevent_handler+0x2b/0x100 [nouveau]
Aug 10 07:01:29 dg1test kernel:  ? lock_acquire+0xc8/0x2a0
Aug 10 07:01:29 dg1test kernel:  _raw_spin_lock_irqsave+0x4b/0x70
Aug 10 07:01:29 dg1test kernel:  ? nouveau_fence_wait_uevent_handler+0x2b/0x100 [nouveau]
Aug 10 07:01:29 dg1test kernel:  nouveau_fence_wait_uevent_handler+0x2b/0x100 [nouveau]
Aug 10 07:01:29 dg1test kernel:  nvkm_client_event+0xf/0x20 [nouveau]
Aug 10 07:01:29 dg1test kernel:  nvkm_event_ntfy+0x9b/0xf0 [nouveau]
Aug 10 07:01:29 dg1test kernel:  ga100_fifo_nonstall_intr+0x24/0x30 [nouveau]
Aug 10 07:01:29 dg1test kernel:  nvkm_intr+0x12c/0x240 [nouveau]
Aug 10 07:01:29 dg1test kernel:  __handle_irq_event_percpu+0x88/0x240
Aug 10 07:01:29 dg1test kernel:  handle_irq_event+0x38/0x80
Aug 10 07:01:29 dg1test kernel:  handle_edge_irq+0xa3/0x240
Aug 10 07:01:29 dg1test kernel:  __common_interrupt+0x72/0x160
Aug 10 07:01:29 dg1test kernel:  common_interrupt+0x60/0xe0
Aug 10 07:01:29 dg1test kernel:  asm_common_interrupt+0x26/0x40
Aug 10 07:01:29 dg1test kernel: RIP: 0033:0x7fb66174d700
Aug 10 07:01:29 dg1test kernel: Code: c1 e2 05 29 ca 8d 0c 10 0f be 07 84 c0 75 eb 89 c8 c3 0f 1f 84 00 00 00 00 00 f3 0f 1e fa e9 d7 0f fc ff 0f 1f 80 00 00 00 00 <f3> 0f 1e fa e9 c7 0f fc>
Aug 10 07:01:29 dg1test kernel: RSP: 002b:00007ffdd3c48438 EFLAGS: 00000206
Aug 10 07:01:29 dg1test kernel: RAX: 000055bb758763c0 RBX: 000055bb758752c0 RCX: 00000000000028b0
Aug 10 07:01:29 dg1test kernel: RDX: 000055bb758752c0 RSI: 000055bb75887490 RDI: 000055bb75862950
Aug 10 07:01:29 dg1test kernel: RBP: 00007ffdd3c48490 R08: 000055bb75873b10 R09: 0000000000000001
Aug 10 07:01:29 dg1test kernel: R10: 0000000000000004 R11: 000055bb7587f000 R12: 000055bb75887490
Aug 10 07:01:29 dg1test kernel: R13: 000055bb757f6280 R14: 000055bb758875c0 R15: 000055bb757f6280
Aug 10 07:01:29 dg1test kernel:  </TASK>

Signed-off-by: Dave Airlie <airlied@redhat.com>
Tested-by: Danilo Krummrich <dakr@redhat.com>
Reviewed-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231107053255.2257079-1-airlied@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
mmstick pushed a commit that referenced this issue Jan 2, 2024
[ Upstream commit 0550d46 ]

KMSAN reported the following uninit-value access issue:

lo speed is unknown, defaulting to 1000
=====================================================
BUG: KMSAN: uninit-value in ib_get_width_and_speed drivers/infiniband/core/verbs.c:1889 [inline]
BUG: KMSAN: uninit-value in ib_get_eth_speed+0x546/0xaf0 drivers/infiniband/core/verbs.c:1998
 ib_get_width_and_speed drivers/infiniband/core/verbs.c:1889 [inline]
 ib_get_eth_speed+0x546/0xaf0 drivers/infiniband/core/verbs.c:1998
 siw_query_port drivers/infiniband/sw/siw/siw_verbs.c:173 [inline]
 siw_get_port_immutable+0x6f/0x120 drivers/infiniband/sw/siw/siw_verbs.c:203
 setup_port_data drivers/infiniband/core/device.c:848 [inline]
 setup_device drivers/infiniband/core/device.c:1244 [inline]
 ib_register_device+0x1589/0x1df0 drivers/infiniband/core/device.c:1383
 siw_device_register drivers/infiniband/sw/siw/siw_main.c:72 [inline]
 siw_newlink+0x129e/0x13d0 drivers/infiniband/sw/siw/siw_main.c:490
 nldev_newlink+0x8fd/0xa60 drivers/infiniband/core/nldev.c:1763
 rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline]
 rdma_nl_rcv+0xe8a/0x1120 drivers/infiniband/core/netlink.c:259
 netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
 netlink_unicast+0xf4b/0x1230 net/netlink/af_netlink.c:1368
 netlink_sendmsg+0x1242/0x1420 net/netlink/af_netlink.c:1910
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg net/socket.c:745 [inline]
 ____sys_sendmsg+0x997/0xd60 net/socket.c:2588
 ___sys_sendmsg+0x271/0x3b0 net/socket.c:2642
 __sys_sendmsg net/socket.c:2671 [inline]
 __do_sys_sendmsg net/socket.c:2680 [inline]
 __se_sys_sendmsg net/socket.c:2678 [inline]
 __x64_sys_sendmsg+0x2fa/0x4a0 net/socket.c:2678
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x44/0x110 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x63/0x6b

Local variable lksettings created at:
 ib_get_eth_speed+0x4b/0xaf0 drivers/infiniband/core/verbs.c:1974
 siw_query_port drivers/infiniband/sw/siw/siw_verbs.c:173 [inline]
 siw_get_port_immutable+0x6f/0x120 drivers/infiniband/sw/siw/siw_verbs.c:203

CPU: 0 PID: 11257 Comm: syz-executor.1 Not tainted 6.6.0-14500-g1c41041124bd #10
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-1.fc38 04/01/2014
=====================================================

If __ethtool_get_link_ksettings() fails, `netdev_speed` is set to the
default value, SPEED_1000. In this case, if `lanes` field of struct
ethtool_link_ksettings is not initialized, an uninitialized value is passed
to ib_get_width_and_speed(). This causes the above issue. This patch
resolves the issue by initializing `lanes` to 0.

Fixes: cb06b6b ("RDMA/core: Get IB width and speed from netdev")
Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
Link: https://lore.kernel.org/r/20231108143113.1360567-1-syoshida@redhat.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
mmstick pushed a commit that referenced this issue Jan 2, 2024
[ Upstream commit e3e82fc ]

When creating ceq_0 during probing irdma, cqp.sc_cqp will be sent as a
cqp_request to cqp->sc_cqp.sq_ring. If the request is pending when
removing the irdma driver or unplugging its aux device, cqp.sc_cqp will be
dereferenced as wrong struct in irdma_free_pending_cqp_request().

  PID: 3669   TASK: ffff88aef892c000  CPU: 28  COMMAND: "kworker/28:0"
   #0 [fffffe0000549e38] crash_nmi_callback at ffffffff810e3a34
   #1 [fffffe0000549e40] nmi_handle at ffffffff810788b2
   #2 [fffffe0000549ea0] default_do_nmi at ffffffff8107938f
   #3 [fffffe0000549eb8] do_nmi at ffffffff81079582
   #4 [fffffe0000549ef0] end_repeat_nmi at ffffffff82e016b4
      [exception RIP: native_queued_spin_lock_slowpath+1291]
      RIP: ffffffff8127e72b  RSP: ffff88aa841ef778  RFLAGS: 00000046
      RAX: 0000000000000000  RBX: ffff88b01f849700  RCX: ffffffff8127e47e
      RDX: 0000000000000000  RSI: 0000000000000004  RDI: ffffffff83857ec0
      RBP: ffff88afe3e4efc8   R8: ffffed15fc7c9dfa   R9: ffffed15fc7c9dfa
      R10: 0000000000000001  R11: ffffed15fc7c9df9  R12: 0000000000740000
      R13: ffff88b01f849708  R14: 0000000000000003  R15: ffffed1603f092e1
      ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0000
  -- <NMI exception stack> --
   #5 [ffff88aa841ef778] native_queued_spin_lock_slowpath at ffffffff8127e72b
   #6 [ffff88aa841ef7b0] _raw_spin_lock_irqsave at ffffffff82c22aa4
   #7 [ffff88aa841ef7c8] __wake_up_common_lock at ffffffff81257363
   #8 [ffff88aa841ef888] irdma_free_pending_cqp_request at ffffffffa0ba12cc [irdma]
   #9 [ffff88aa841ef958] irdma_cleanup_pending_cqp_op at ffffffffa0ba1469 [irdma]
   #10 [ffff88aa841ef9c0] irdma_ctrl_deinit_hw at ffffffffa0b2989f [irdma]
   #11 [ffff88aa841efa28] irdma_remove at ffffffffa0b252df [irdma]
   #12 [ffff88aa841efae8] auxiliary_bus_remove at ffffffff8219afdb
   #13 [ffff88aa841efb00] device_release_driver_internal at ffffffff821882e6
   #14 [ffff88aa841efb38] bus_remove_device at ffffffff82184278
   #15 [ffff88aa841efb88] device_del at ffffffff82179d23
   #16 [ffff88aa841efc48] ice_unplug_aux_dev at ffffffffa0eb1c14 [ice]
   #17 [ffff88aa841efc68] ice_service_task at ffffffffa0d88201 [ice]
   #18 [ffff88aa841efde8] process_one_work at ffffffff811c589a
   #19 [ffff88aa841efe60] worker_thread at ffffffff811c71ff
   #20 [ffff88aa841eff10] kthread at ffffffff811d87a0
   #21 [ffff88aa841eff50] ret_from_fork at ffffffff82e0022f

Fixes: 44d9e52 ("RDMA/irdma: Implement device initialization definitions")
Link: https://lore.kernel.org/r/20231130081415.891006-1-lishifeng@sangfor.com.cn
Suggested-by: "Ismail, Mustafa" <mustafa.ismail@intel.com>
Signed-off-by: Shifeng Li <lishifeng@sangfor.com.cn>
Reviewed-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
mmstick pushed a commit that referenced this issue Mar 28, 2024
[ Upstream commit c957280 ]

From commit a304e1b ("[PATCH] Debug shared irqs"), there is a test
to make sure the shared irq handler should be able to handle the unexpected
event after deregistration. For this case, let's apply MT76_REMOVED flag to
indicate the device was removed and do not run into the resource access
anymore.

BUG: KASAN: use-after-free in mt7921_irq_handler+0xd8/0x100 [mt7921e]
Read of size 8 at addr ffff88824a7d3b78 by task rmmod/11115
CPU: 28 PID: 11115 Comm: rmmod Tainted: G        W    L    5.17.0 #10
Hardware name: Micro-Star International Co., Ltd. MS-7D73/MPG B650I
EDGE WIFI (MS-7D73), BIOS 1.81 01/05/2024
Call Trace:
 <TASK>
 dump_stack_lvl+0x6f/0xa0
 print_address_description.constprop.0+0x1f/0x190
 ? mt7921_irq_handler+0xd8/0x100 [mt7921e]
 ? mt7921_irq_handler+0xd8/0x100 [mt7921e]
 kasan_report.cold+0x7f/0x11b
 ? mt7921_irq_handler+0xd8/0x100 [mt7921e]
 mt7921_irq_handler+0xd8/0x100 [mt7921e]
 free_irq+0x627/0xaa0
 devm_free_irq+0x94/0xd0
 ? devm_request_any_context_irq+0x160/0x160
 ? kobject_put+0x18d/0x4a0
 mt7921_pci_remove+0x153/0x190 [mt7921e]
 pci_device_remove+0xa2/0x1d0
 __device_release_driver+0x346/0x6e0
 driver_detach+0x1ef/0x2c0
 bus_remove_driver+0xe7/0x2d0
 ? __check_object_size+0x57/0x310
 pci_unregister_driver+0x26/0x250
 __do_sys_delete_module+0x307/0x510
 ? free_module+0x6a0/0x6a0
 ? fpregs_assert_state_consistent+0x4b/0xb0
 ? rcu_read_lock_sched_held+0x10/0x70
 ? syscall_enter_from_user_mode+0x20/0x70
 ? trace_hardirqs_on+0x1c/0x130
 do_syscall_64+0x5c/0x80
 ? trace_hardirqs_on_prepare+0x72/0x160
 ? do_syscall_64+0x68/0x80
 ? trace_hardirqs_on_prepare+0x72/0x160
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Reported-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Closes: https://lore.kernel.org/linux-wireless/CABXGCsOdvVwdLmSsC8TZ1jF0UOg_F_W3wqLECWX620PUkvNk=A@mail.gmail.com/
Fixes: 9270270 ("wifi: mt76: mt7921: fix PCI DMA hang after reboot")
Tested-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
mmstick pushed a commit that referenced this issue Mar 28, 2024
[ Upstream commit fd5860a ]

The loop inside nfs_netfs_issue_read() currently does not disable
interrupts while iterating through pages in the xarray to submit
for NFS read.  This is not safe though since after taking xa_lock,
another page in the mapping could be processed for writeback inside
an interrupt, and deadlock can occur.  The fix is simple and clean
if we use xa_for_each_range(), which handles the iteration with RCU
while reducing code complexity.

The problem is easily reproduced with the following test:
 mount -o vers=3,fsc 127.0.0.1:/export /mnt/nfs
 dd if=/dev/zero of=/mnt/nfs/file1.bin bs=4096 count=1
 echo 3 > /proc/sys/vm/drop_caches
 dd if=/mnt/nfs/file1.bin of=/dev/null
 umount /mnt/nfs

On the console with a lockdep-enabled kernel a message similar to
the following will be seen:

 ================================
 WARNING: inconsistent lock state
 6.7.0-lockdbg+ #10 Not tainted
 --------------------------------
 inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
 test5/1708 [HC0[0]:SC0[0]:HE1:SE1] takes:
 ffff888127baa598 (&xa->xa_lock#4){+.?.}-{3:3}, at:
nfs_netfs_issue_read+0x1b2/0x4b0 [nfs]
 {IN-SOFTIRQ-W} state was registered at:
   lock_acquire+0x144/0x380
   _raw_spin_lock_irqsave+0x4e/0xa0
   __folio_end_writeback+0x17e/0x5c0
   folio_end_writeback+0x93/0x1b0
   iomap_finish_ioend+0xeb/0x6a0
   blk_update_request+0x204/0x7f0
   blk_mq_end_request+0x30/0x1c0
   blk_complete_reqs+0x7e/0xa0
   __do_softirq+0x113/0x544
   __irq_exit_rcu+0xfe/0x120
   irq_exit_rcu+0xe/0x20
   sysvec_call_function_single+0x6f/0x90
   asm_sysvec_call_function_single+0x1a/0x20
   pv_native_safe_halt+0xf/0x20
   default_idle+0x9/0x20
   default_idle_call+0x67/0xa0
   do_idle+0x2b5/0x300
   cpu_startup_entry+0x34/0x40
   start_secondary+0x19d/0x1c0
   secondary_startup_64_no_verify+0x18f/0x19b
 irq event stamp: 176891
 hardirqs last  enabled at (176891): [<ffffffffa67a0be4>]
_raw_spin_unlock_irqrestore+0x44/0x60
 hardirqs last disabled at (176890): [<ffffffffa67a0899>]
_raw_spin_lock_irqsave+0x79/0xa0
 softirqs last  enabled at (176646): [<ffffffffa515d91e>]
__irq_exit_rcu+0xfe/0x120
 softirqs last disabled at (176633): [<ffffffffa515d91e>]
__irq_exit_rcu+0xfe/0x120

 other info that might help us debug this:
  Possible unsafe locking scenario:

        CPU0
        ----
   lock(&xa->xa_lock#4);
   <Interrupt>
     lock(&xa->xa_lock#4);

  *** DEADLOCK ***

 2 locks held by test5/1708:
  #0: ffff888127baa498 (&sb->s_type->i_mutex_key#22){++++}-{4:4}, at:
      nfs_start_io_read+0x28/0x90 [nfs]
  #1: ffff888127baa650 (mapping.invalidate_lock#3){.+.+}-{4:4}, at:
      page_cache_ra_unbounded+0xa4/0x280

 stack backtrace:
 CPU: 6 PID: 1708 Comm: test5 Kdump: loaded Not tainted 6.7.0-lockdbg+
 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-1.fc39
04/01/2014
 Call Trace:
  dump_stack_lvl+0x5b/0x90
  mark_lock+0xb3f/0xd20
  __lock_acquire+0x77b/0x3360
  _raw_spin_lock+0x34/0x80
  nfs_netfs_issue_read+0x1b2/0x4b0 [nfs]
  netfs_begin_read+0x77f/0x980 [netfs]
  nfs_netfs_readahead+0x45/0x60 [nfs]
  nfs_readahead+0x323/0x5a0 [nfs]
  read_pages+0xf3/0x5c0
  page_cache_ra_unbounded+0x1c8/0x280
  filemap_get_pages+0x38c/0xae0
  filemap_read+0x206/0x5e0
  nfs_file_read+0xb7/0x140 [nfs]
  vfs_read+0x2a9/0x460
  ksys_read+0xb7/0x140

Fixes: 000dbe0 ("NFS: Convert buffered read paths to use netfs when fscache is enabled")
Suggested-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
mmstick pushed a commit that referenced this issue Jul 6, 2024
[ Upstream commit 769e6a1 ]

ui_browser__show() is capturing the input title that is stack allocated
memory in hist_browser__run().

Avoid a use after return by strdup-ing the string.

Committer notes:

Further explanation from Ian Rogers:

My command line using tui is:
$ sudo bash -c 'rm /tmp/asan.log*; export
ASAN_OPTIONS="log_path=/tmp/asan.log"; /tmp/perf/perf mem record -a
sleep 1; /tmp/perf/perf mem report'
I then go to the perf annotate view and quit. This triggers the asan
error (from the log file):
```
==1254591==ERROR: AddressSanitizer: stack-use-after-return on address
0x7f2813331920 at pc 0x7f28180
65991 bp 0x7fff0a21c750 sp 0x7fff0a21bf10
READ of size 80 at 0x7f2813331920 thread T0
    #0 0x7f2818065990 in __interceptor_strlen
../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:461
    #1 0x7f2817698251 in SLsmg_write_wrapped_string
(/lib/x86_64-linux-gnu/libslang.so.2+0x98251)
    #2 0x7f28176984b9 in SLsmg_write_nstring
(/lib/x86_64-linux-gnu/libslang.so.2+0x984b9)
    #3 0x55c94045b365 in ui_browser__write_nstring ui/browser.c:60
    #4 0x55c94045c558 in __ui_browser__show_title ui/browser.c:266
    #5 0x55c94045c776 in ui_browser__show ui/browser.c:288
    #6 0x55c94045c06d in ui_browser__handle_resize ui/browser.c:206
    #7 0x55c94047979b in do_annotate ui/browsers/hists.c:2458
    #8 0x55c94047fb17 in evsel__hists_browse ui/browsers/hists.c:3412
    #9 0x55c940480a0c in perf_evsel_menu__run ui/browsers/hists.c:3527
    #10 0x55c940481108 in __evlist__tui_browse_hists ui/browsers/hists.c:3613
    #11 0x55c9404813f7 in evlist__tui_browse_hists ui/browsers/hists.c:3661
    #12 0x55c93ffa253f in report__browse_hists tools/perf/builtin-report.c:671
    #13 0x55c93ffa58ca in __cmd_report tools/perf/builtin-report.c:1141
    #14 0x55c93ffaf159 in cmd_report tools/perf/builtin-report.c:1805
    #15 0x55c94000c05c in report_events tools/perf/builtin-mem.c:374
    #16 0x55c94000d96d in cmd_mem tools/perf/builtin-mem.c:516
    #17 0x55c9400e44ee in run_builtin tools/perf/perf.c:350
    #18 0x55c9400e4a5a in handle_internal_command tools/perf/perf.c:403
    #19 0x55c9400e4e22 in run_argv tools/perf/perf.c:447
    #20 0x55c9400e53ad in main tools/perf/perf.c:561
    #21 0x7f28170456c9 in __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
    #22 0x7f2817045784 in __libc_start_main_impl ../csu/libc-start.c:360
    #23 0x55c93ff544c0 in _start (/tmp/perf/perf+0x19a4c0) (BuildId:
84899b0e8c7d3a3eaa67b2eb35e3d8b2f8cd4c93)

Address 0x7f2813331920 is located in stack of thread T0 at offset 32 in frame
    #0 0x55c94046e85e in hist_browser__run ui/browsers/hists.c:746

  This frame has 1 object(s):
    [32, 192) 'title' (line 747) <== Memory access at offset 32 is
inside this variable
HINT: this may be a false positive if your program uses some custom
stack unwind mechanism, swapcontext or vfork
```
hist_browser__run isn't on the stack so the asan error looks legit.
There's no clean init/exit on struct ui_browser so I may be trading a
use-after-return for a memory leak, but that seems look a good trade
anyway.

Fixes: 05e8b08 ("perf ui browser: Stop using 'self'")
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ben Gainey <ben.gainey@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: K Prateek Nayak <kprateek.nayak@amd.com>
Cc: Li Dong <lidong@vivo.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Oliver Upton <oliver.upton@linux.dev>
Cc: Paran Lee <p4ranlee@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Sun Haiyong <sunhaiyong@loongson.cn>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Yanteng Si <siyanteng@loongson.cn>
Cc: Yicong Yang <yangyicong@hisilicon.com>
Link: https://lore.kernel.org/r/20240507183545.1236093-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
mmstick pushed a commit that referenced this issue Jul 6, 2024
…PLES event"

commit 5b3cde1 upstream.

This reverts commit 7d1405c.

This causes segfaults in some cases, as reported by Milian:

  ```
  sudo /usr/bin/perf record -z --call-graph dwarf -e cycles -e
  raw_syscalls:sys_enter ls
  ...
  [ perf record: Woken up 3 times to write data ]
  malloc(): invalid next size (unsorted)
  Aborted
  ```

  Backtrace with GDB + debuginfod:

  ```
  malloc(): invalid next size (unsorted)

  Thread 1 "perf" received signal SIGABRT, Aborted.
  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6,
  no_tid=no_tid@entry=0) at pthread_kill.c:44
  Downloading source file /usr/src/debug/glibc/glibc/nptl/pthread_kill.c
  44            return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO
  (ret) : 0;
  (gdb) bt
  #0  __pthread_kill_implementation (threadid=<optimized out>,
  signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
  #1  0x00007ffff6ea8eb3 in __pthread_kill_internal (threadid=<optimized out>,
  signo=6) at pthread_kill.c:78
  #2  0x00007ffff6e50a30 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/
  raise.c:26
  #3  0x00007ffff6e384c3 in __GI_abort () at abort.c:79
  #4  0x00007ffff6e39354 in __libc_message_impl (fmt=fmt@entry=0x7ffff6fc22ea
  "%s\n") at ../sysdeps/posix/libc_fatal.c:132
  #5  0x00007ffff6eb3085 in malloc_printerr (str=str@entry=0x7ffff6fc5850
  "malloc(): invalid next size (unsorted)") at malloc.c:5772
  #6  0x00007ffff6eb657c in _int_malloc (av=av@entry=0x7ffff6ff6ac0
  <main_arena>, bytes=bytes@entry=368) at malloc.c:4081
  #7  0x00007ffff6eb877e in __libc_calloc (n=<optimized out>,
  elem_size=<optimized out>) at malloc.c:3754
  #8  0x000055555569bdb6 in perf_session.do_write_header ()
  #9  0x00005555555a373a in __cmd_record.constprop.0 ()
  #10 0x00005555555a6846 in cmd_record ()
  #11 0x000055555564db7f in run_builtin ()
  #12 0x000055555558ed77 in main ()
  ```

  Valgrind memcheck:
  ```
  ==45136== Invalid write of size 8
  ==45136==    at 0x2B38A5: perf_event__synthesize_id_sample (in /usr/bin/perf)
  ==45136==    by 0x157069: __cmd_record.constprop.0 (in /usr/bin/perf)
  ==45136==    by 0x15A845: cmd_record (in /usr/bin/perf)
  ==45136==    by 0x201B7E: run_builtin (in /usr/bin/perf)
  ==45136==    by 0x142D76: main (in /usr/bin/perf)
  ==45136==  Address 0x6a866a8 is 0 bytes after a block of size 40 alloc'd
  ==45136==    at 0x4849BF3: calloc (vg_replace_malloc.c:1675)
  ==45136==    by 0x3574AB: zalloc (in /usr/bin/perf)
  ==45136==    by 0x1570E0: __cmd_record.constprop.0 (in /usr/bin/perf)
  ==45136==    by 0x15A845: cmd_record (in /usr/bin/perf)
  ==45136==    by 0x201B7E: run_builtin (in /usr/bin/perf)
  ==45136==    by 0x142D76: main (in /usr/bin/perf)
  ==45136==
  ==45136== Syscall param write(buf) points to unaddressable byte(s)
  ==45136==    at 0x575953D: __libc_write (write.c:26)
  ==45136==    by 0x575953D: write (write.c:24)
  ==45136==    by 0x35761F: ion (in /usr/bin/perf)
  ==45136==    by 0x357778: writen (in /usr/bin/perf)
  ==45136==    by 0x1548F7: record__write (in /usr/bin/perf)
  ==45136==    by 0x15708A: __cmd_record.constprop.0 (in /usr/bin/perf)
  ==45136==    by 0x15A845: cmd_record (in /usr/bin/perf)
  ==45136==    by 0x201B7E: run_builtin (in /usr/bin/perf)
  ==45136==    by 0x142D76: main (in /usr/bin/perf)
  ==45136==  Address 0x6a866a8 is 0 bytes after a block of size 40 alloc'd
  ==45136==    at 0x4849BF3: calloc (vg_replace_malloc.c:1675)
  ==45136==    by 0x3574AB: zalloc (in /usr/bin/perf)
  ==45136==    by 0x1570E0: __cmd_record.constprop.0 (in /usr/bin/perf)
  ==45136==    by 0x15A845: cmd_record (in /usr/bin/perf)
  ==45136==    by 0x201B7E: run_builtin (in /usr/bin/perf)
  ==45136==    by 0x142D76: main (in /usr/bin/perf)
  ==45136==
 -----

Closes: https://lore.kernel.org/linux-perf-users/23879991.0LEYPuXRzz@milian-workstation/
Reported-by: Milian Wolff <milian.wolff@kdab.com>
Tested-by: Milian Wolff <milian.wolff@kdab.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: stable@kernel.org # 6.8+
Link: https://lore.kernel.org/lkml/Zl9ksOlHJHnKM70p@x1
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mmstick pushed a commit that referenced this issue Jul 6, 2024
commit 9d274c1 upstream.

We have been seeing crashes on duplicate keys in
btrfs_set_item_key_safe():

  BTRFS critical (device vdb): slot 4 key (450 108 8192) new key (450 108 8192)
  ------------[ cut here ]------------
  kernel BUG at fs/btrfs/ctree.c:2620!
  invalid opcode: 0000 [#1] PREEMPT SMP PTI
  CPU: 0 PID: 3139 Comm: xfs_io Kdump: loaded Not tainted 6.9.0 #6
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-2.fc40 04/01/2014
  RIP: 0010:btrfs_set_item_key_safe+0x11f/0x290 [btrfs]

With the following stack trace:

  #0  btrfs_set_item_key_safe (fs/btrfs/ctree.c:2620:4)
  #1  btrfs_drop_extents (fs/btrfs/file.c:411:4)
  #2  log_one_extent (fs/btrfs/tree-log.c:4732:9)
  #3  btrfs_log_changed_extents (fs/btrfs/tree-log.c:4955:9)
  #4  btrfs_log_inode (fs/btrfs/tree-log.c:6626:9)
  #5  btrfs_log_inode_parent (fs/btrfs/tree-log.c:7070:8)
  #6  btrfs_log_dentry_safe (fs/btrfs/tree-log.c:7171:8)
  #7  btrfs_sync_file (fs/btrfs/file.c:1933:8)
  #8  vfs_fsync_range (fs/sync.c:188:9)
  #9  vfs_fsync (fs/sync.c:202:9)
  #10 do_fsync (fs/sync.c:212:9)
  #11 __do_sys_fdatasync (fs/sync.c:225:9)
  #12 __se_sys_fdatasync (fs/sync.c:223:1)
  #13 __x64_sys_fdatasync (fs/sync.c:223:1)
  #14 do_syscall_x64 (arch/x86/entry/common.c:52:14)
  #15 do_syscall_64 (arch/x86/entry/common.c:83:7)
  #16 entry_SYSCALL_64+0xaf/0x14c (arch/x86/entry/entry_64.S:121)

So we're logging a changed extent from fsync, which is splitting an
extent in the log tree. But this split part already exists in the tree,
triggering the BUG().

This is the state of the log tree at the time of the crash, dumped with
drgn (https://github.com/osandov/drgn/blob/main/contrib/btrfs_tree.py)
to get more details than btrfs_print_leaf() gives us:

  >>> print_extent_buffer(prog.crashed_thread().stack_trace()[0]["eb"])
  leaf 33439744 level 0 items 72 generation 9 owner 18446744073709551610
  leaf 33439744 flags 0x100000000000000
  fs uuid e5bd3946-400c-4223-8923-190ef1f18677
  chunk uuid d58cb17e-6d02-494a-829a-18b7d8a399da
          item 0 key (450 INODE_ITEM 0) itemoff 16123 itemsize 160
                  generation 7 transid 9 size 8192 nbytes 8473563889606862198
                  block group 0 mode 100600 links 1 uid 0 gid 0 rdev 0
                  sequence 204 flags 0x10(PREALLOC)
                  atime 1716417703.220000000 (2024-05-22 15:41:43)
                  ctime 1716417704.983333333 (2024-05-22 15:41:44)
                  mtime 1716417704.983333333 (2024-05-22 15:41:44)
                  otime 17592186044416.000000000 (559444-03-08 01:40:16)
          item 1 key (450 INODE_REF 256) itemoff 16110 itemsize 13
                  index 195 namelen 3 name: 193
          item 2 key (450 XATTR_ITEM 1640047104) itemoff 16073 itemsize 37
                  location key (0 UNKNOWN.0 0) type XATTR
                  transid 7 data_len 1 name_len 6
                  name: user.a
                  data a
          item 3 key (450 EXTENT_DATA 0) itemoff 16020 itemsize 53
                  generation 9 type 1 (regular)
                  extent data disk byte 303144960 nr 12288
                  extent data offset 0 nr 4096 ram 12288
                  extent compression 0 (none)
          item 4 key (450 EXTENT_DATA 4096) itemoff 15967 itemsize 53
                  generation 9 type 2 (prealloc)
                  prealloc data disk byte 303144960 nr 12288
                  prealloc data offset 4096 nr 8192
          item 5 key (450 EXTENT_DATA 8192) itemoff 15914 itemsize 53
                  generation 9 type 2 (prealloc)
                  prealloc data disk byte 303144960 nr 12288
                  prealloc data offset 8192 nr 4096
  ...

So the real problem happened earlier: notice that items 4 (4k-12k) and 5
(8k-12k) overlap. Both are prealloc extents. Item 4 straddles i_size and
item 5 starts at i_size.

Here is the state of the filesystem tree at the time of the crash:

  >>> root = prog.crashed_thread().stack_trace()[2]["inode"].root
  >>> ret, nodes, slots = btrfs_search_slot(root, BtrfsKey(450, 0, 0))
  >>> print_extent_buffer(nodes[0])
  leaf 30425088 level 0 items 184 generation 9 owner 5
  leaf 30425088 flags 0x100000000000000
  fs uuid e5bd3946-400c-4223-8923-190ef1f18677
  chunk uuid d58cb17e-6d02-494a-829a-18b7d8a399da
  	...
          item 179 key (450 INODE_ITEM 0) itemoff 4907 itemsize 160
                  generation 7 transid 7 size 4096 nbytes 12288
                  block group 0 mode 100600 links 1 uid 0 gid 0 rdev 0
                  sequence 6 flags 0x10(PREALLOC)
                  atime 1716417703.220000000 (2024-05-22 15:41:43)
                  ctime 1716417703.220000000 (2024-05-22 15:41:43)
                  mtime 1716417703.220000000 (2024-05-22 15:41:43)
                  otime 1716417703.220000000 (2024-05-22 15:41:43)
          item 180 key (450 INODE_REF 256) itemoff 4894 itemsize 13
                  index 195 namelen 3 name: 193
          item 181 key (450 XATTR_ITEM 1640047104) itemoff 4857 itemsize 37
                  location key (0 UNKNOWN.0 0) type XATTR
                  transid 7 data_len 1 name_len 6
                  name: user.a
                  data a
          item 182 key (450 EXTENT_DATA 0) itemoff 4804 itemsize 53
                  generation 9 type 1 (regular)
                  extent data disk byte 303144960 nr 12288
                  extent data offset 0 nr 8192 ram 12288
                  extent compression 0 (none)
          item 183 key (450 EXTENT_DATA 8192) itemoff 4751 itemsize 53
                  generation 9 type 2 (prealloc)
                  prealloc data disk byte 303144960 nr 12288
                  prealloc data offset 8192 nr 4096

Item 5 in the log tree corresponds to item 183 in the filesystem tree,
but nothing matches item 4. Furthermore, item 183 is the last item in
the leaf.

btrfs_log_prealloc_extents() is responsible for logging prealloc extents
beyond i_size. It first truncates any previously logged prealloc extents
that start beyond i_size. Then, it walks the filesystem tree and copies
the prealloc extent items to the log tree.

If it hits the end of a leaf, then it calls btrfs_next_leaf(), which
unlocks the tree and does another search. However, while the filesystem
tree is unlocked, an ordered extent completion may modify the tree. In
particular, it may insert an extent item that overlaps with an extent
item that was already copied to the log tree.

This may manifest in several ways depending on the exact scenario,
including an EEXIST error that is silently translated to a full sync,
overlapping items in the log tree, or this crash. This particular crash
is triggered by the following sequence of events:

- Initially, the file has i_size=4k, a regular extent from 0-4k, and a
  prealloc extent beyond i_size from 4k-12k. The prealloc extent item is
  the last item in its B-tree leaf.
- The file is fsync'd, which copies its inode item and both extent items
  to the log tree.
- An xattr is set on the file, which sets the
  BTRFS_INODE_COPY_EVERYTHING flag.
- The range 4k-8k in the file is written using direct I/O. i_size is
  extended to 8k, but the ordered extent is still in flight.
- The file is fsync'd. Since BTRFS_INODE_COPY_EVERYTHING is set, this
  calls copy_inode_items_to_log(), which calls
  btrfs_log_prealloc_extents().
- btrfs_log_prealloc_extents() finds the 4k-12k prealloc extent in the
  filesystem tree. Since it starts before i_size, it skips it. Since it
  is the last item in its B-tree leaf, it calls btrfs_next_leaf().
- btrfs_next_leaf() unlocks the path.
- The ordered extent completion runs, which converts the 4k-8k part of
  the prealloc extent to written and inserts the remaining prealloc part
  from 8k-12k.
- btrfs_next_leaf() does a search and finds the new prealloc extent
  8k-12k.
- btrfs_log_prealloc_extents() copies the 8k-12k prealloc extent into
  the log tree. Note that it overlaps with the 4k-12k prealloc extent
  that was copied to the log tree by the first fsync.
- fsync calls btrfs_log_changed_extents(), which tries to log the 4k-8k
  extent that was written.
- This tries to drop the range 4k-8k in the log tree, which requires
  adjusting the start of the 4k-12k prealloc extent in the log tree to
  8k.
- btrfs_set_item_key_safe() sees that there is already an extent
  starting at 8k in the log tree and calls BUG().

Fix this by detecting when we're about to insert an overlapping file
extent item in the log tree and truncating the part that would overlap.

CC: stable@vger.kernel.org # 6.1+
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mmstick pushed a commit that referenced this issue Jul 6, 2024
commit be346c1 upstream.

The code in ocfs2_dio_end_io_write() estimates number of necessary
transaction credits using ocfs2_calc_extend_credits().  This however does
not take into account that the IO could be arbitrarily large and can
contain arbitrary number of extents.

Extent tree manipulations do often extend the current transaction but not
in all of the cases.  For example if we have only single block extents in
the tree, ocfs2_mark_extent_written() will end up calling
ocfs2_replace_extent_rec() all the time and we will never extend the
current transaction and eventually exhaust all the transaction credits if
the IO contains many single block extents.  Once that happens a
WARN_ON(jbd2_handle_buffer_credits(handle) <= 0) is triggered in
jbd2_journal_dirty_metadata() and subsequently OCFS2 aborts in response to
this error.  This was actually triggered by one of our customers on a
heavily fragmented OCFS2 filesystem.

To fix the issue make sure the transaction always has enough credits for
one extent insert before each call of ocfs2_mark_extent_written().

Heming Zhao said:

------
PANIC: "Kernel panic - not syncing: OCFS2: (device dm-1): panic forced after error"

PID: xxx  TASK: xxxx  CPU: 5  COMMAND: "SubmitThread-CA"
  #0 machine_kexec at ffffffff8c069932
  #1 __crash_kexec at ffffffff8c1338fa
  #2 panic at ffffffff8c1d69b9
  #3 ocfs2_handle_error at ffffffffc0c86c0c [ocfs2]
  #4 __ocfs2_abort at ffffffffc0c88387 [ocfs2]
  #5 ocfs2_journal_dirty at ffffffffc0c51e98 [ocfs2]
  #6 ocfs2_split_extent at ffffffffc0c27ea3 [ocfs2]
  #7 ocfs2_change_extent_flag at ffffffffc0c28053 [ocfs2]
  #8 ocfs2_mark_extent_written at ffffffffc0c28347 [ocfs2]
  #9 ocfs2_dio_end_io_write at ffffffffc0c2bef9 [ocfs2]
#10 ocfs2_dio_end_io at ffffffffc0c2c0f5 [ocfs2]
#11 dio_complete at ffffffff8c2b9fa7
#12 do_blockdev_direct_IO at ffffffff8c2bc09f
#13 ocfs2_direct_IO at ffffffffc0c2b653 [ocfs2]
#14 generic_file_direct_write at ffffffff8c1dcf14
#15 __generic_file_write_iter at ffffffff8c1dd07b
#16 ocfs2_file_write_iter at ffffffffc0c49f1f [ocfs2]
#17 aio_write at ffffffff8c2cc72e
#18 kmem_cache_alloc at ffffffff8c248dde
#19 do_io_submit at ffffffff8c2ccada
#20 do_syscall_64 at ffffffff8c004984
#21 entry_SYSCALL_64_after_hwframe at ffffffff8c8000ba

Link: https://lkml.kernel.org/r/20240617095543.6971-1-jack@suse.cz
Link: https://lkml.kernel.org/r/20240614145243.8837-1-jack@suse.cz
Fixes: c15471f ("ocfs2: fix sparse file & data ordering issue in direct io")
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Reviewed-by: Heming Zhao <heming.zhao@suse.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mmstick pushed a commit that referenced this issue Oct 16, 2024
commit 7d59ac0 upstream.

Attaching SST PCI device to VM causes "BUG: KASAN: slab-out-of-bounds".
kasan report:
[   19.411889] ==================================================================
[   19.413702] BUG: KASAN: slab-out-of-bounds in _isst_if_get_pci_dev+0x3d5/0x400 [isst_if_common]
[   19.415634] Read of size 8 at addr ffff888829e65200 by task cpuhp/16/113
[   19.417368]
[   19.418627] CPU: 16 PID: 113 Comm: cpuhp/16 Tainted: G            E      6.9.0 #10
[   19.420435] Hardware name: VMware, Inc. VMware20,1/440BX Desktop Reference Platform, BIOS VMW201.00V.20192059.B64.2207280713 07/28/2022
[   19.422687] Call Trace:
[   19.424091]  <TASK>
[   19.425448]  dump_stack_lvl+0x5d/0x80
[   19.426963]  ? _isst_if_get_pci_dev+0x3d5/0x400 [isst_if_common]
[   19.428694]  print_report+0x19d/0x52e
[   19.430206]  ? __pfx__raw_spin_lock_irqsave+0x10/0x10
[   19.431837]  ? _isst_if_get_pci_dev+0x3d5/0x400 [isst_if_common]
[   19.433539]  kasan_report+0xf0/0x170
[   19.435019]  ? _isst_if_get_pci_dev+0x3d5/0x400 [isst_if_common]
[   19.436709]  _isst_if_get_pci_dev+0x3d5/0x400 [isst_if_common]
[   19.438379]  ? __pfx_sched_clock_cpu+0x10/0x10
[   19.439910]  isst_if_cpu_online+0x406/0x58f [isst_if_common]
[   19.441573]  ? __pfx_isst_if_cpu_online+0x10/0x10 [isst_if_common]
[   19.443263]  ? ttwu_queue_wakelist+0x2c1/0x360
[   19.444797]  cpuhp_invoke_callback+0x221/0xec0
[   19.446337]  cpuhp_thread_fun+0x21b/0x610
[   19.447814]  ? __pfx_cpuhp_thread_fun+0x10/0x10
[   19.449354]  smpboot_thread_fn+0x2e7/0x6e0
[   19.450859]  ? __pfx_smpboot_thread_fn+0x10/0x10
[   19.452405]  kthread+0x29c/0x350
[   19.453817]  ? __pfx_kthread+0x10/0x10
[   19.455253]  ret_from_fork+0x31/0x70
[   19.456685]  ? __pfx_kthread+0x10/0x10
[   19.458114]  ret_from_fork_asm+0x1a/0x30
[   19.459573]  </TASK>
[   19.460853]
[   19.462055] Allocated by task 1198:
[   19.463410]  kasan_save_stack+0x30/0x50
[   19.464788]  kasan_save_track+0x14/0x30
[   19.466139]  __kasan_kmalloc+0xaa/0xb0
[   19.467465]  __kmalloc+0x1cd/0x470
[   19.468748]  isst_if_cdev_register+0x1da/0x350 [isst_if_common]
[   19.470233]  isst_if_mbox_init+0x108/0xff0 [isst_if_mbox_msr]
[   19.471670]  do_one_initcall+0xa4/0x380
[   19.472903]  do_init_module+0x238/0x760
[   19.474105]  load_module+0x5239/0x6f00
[   19.475285]  init_module_from_file+0xd1/0x130
[   19.476506]  idempotent_init_module+0x23b/0x650
[   19.477725]  __x64_sys_finit_module+0xbe/0x130
[   19.476506]  idempotent_init_module+0x23b/0x650
[   19.477725]  __x64_sys_finit_module+0xbe/0x130
[   19.478920]  do_syscall_64+0x82/0x160
[   19.480036]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
[   19.481292]
[   19.482205] The buggy address belongs to the object at ffff888829e65000
 which belongs to the cache kmalloc-512 of size 512
[   19.484818] The buggy address is located 0 bytes to the right of
 allocated 512-byte region [ffff888829e65000, ffff888829e65200)
[   19.487447]
[   19.488328] The buggy address belongs to the physical page:
[   19.489569] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888829e60c00 pfn:0x829e60
[   19.491140] head: order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
[   19.492466] anon flags: 0x57ffffc0000840(slab|head|node=1|zone=2|lastcpupid=0x1fffff)
[   19.493914] page_type: 0xffffffff()
[   19.494988] raw: 0057ffffc0000840 ffff88810004cc80 0000000000000000 0000000000000001
[   19.496451] raw: ffff888829e60c00 0000000080200018 00000001ffffffff 0000000000000000
[   19.497906] head: 0057ffffc0000840 ffff88810004cc80 0000000000000000 0000000000000001
[   19.499379] head: ffff888829e60c00 0000000080200018 00000001ffffffff 0000000000000000
[   19.500844] head: 0057ffffc0000003 ffffea0020a79801 ffffea0020a79848 00000000ffffffff
[   19.502316] head: 0000000800000000 0000000000000000 00000000ffffffff 0000000000000000
[   19.503784] page dumped because: kasan: bad access detected
[   19.505058]
[   19.505970] Memory state around the buggy address:
[   19.507172]  ffff888829e65100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   19.508599]  ffff888829e65180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[   19.510013] >ffff888829e65200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.510014]                    ^
[   19.510016]  ffff888829e65280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.510018]  ffff888829e65300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   19.515367] ==================================================================

The reason for this error is physical_package_ids assigned by VMware VMM
are not continuous and have gaps. This will cause value returned by
topology_physical_package_id() to be more than topology_max_packages().

Here the allocation uses topology_max_packages(). The call to
topology_max_packages() returns maximum logical package ID not physical
ID. Hence use topology_logical_package_id() instead of
topology_physical_package_id().

Fixes: 9a1aac8 ("platform/x86: ISST: PUNIT device mapping with Sub-NUMA clustering")
Cc: stable@vger.kernel.org
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Zach Wade <zachwade.k@gmail.com>
Link: https://lore.kernel.org/r/20240923144508.1764-1-zachwade.k@gmail.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mmstick pushed a commit that referenced this issue Oct 16, 2024
commit ac01c8c upstream.

AddressSanitizer found a use-after-free bug in the symbol code which
manifested as 'perf top' segfaulting.

  ==1238389==ERROR: AddressSanitizer: heap-use-after-free on address 0x60b00c48844b at pc 0x5650d8035961 bp 0x7f751aaecc90 sp 0x7f751aaecc80
  READ of size 1 at 0x60b00c48844b thread T193
      #0 0x5650d8035960 in _sort__sym_cmp util/sort.c:310
      #1 0x5650d8043744 in hist_entry__cmp util/hist.c:1286
      #2 0x5650d8043951 in hists__findnew_entry util/hist.c:614
      #3 0x5650d804568f in __hists__add_entry util/hist.c:754
      #4 0x5650d8045bf9 in hists__add_entry util/hist.c:772
      #5 0x5650d8045df1 in iter_add_single_normal_entry util/hist.c:997
      #6 0x5650d8043326 in hist_entry_iter__add util/hist.c:1242
      #7 0x5650d7ceeefe in perf_event__process_sample /home/matt/src/linux/tools/perf/builtin-top.c:845
      #8 0x5650d7ceeefe in deliver_event /home/matt/src/linux/tools/perf/builtin-top.c:1208
      #9 0x5650d7fdb51b in do_flush util/ordered-events.c:245
      #10 0x5650d7fdb51b in __ordered_events__flush util/ordered-events.c:324
      #11 0x5650d7ced743 in process_thread /home/matt/src/linux/tools/perf/builtin-top.c:1120
      #12 0x7f757ef1f133 in start_thread nptl/pthread_create.c:442
      #13 0x7f757ef9f7db in clone3 ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

When updating hist maps it's also necessary to update the hist symbol
reference because the old one gets freed in map__put().

While this bug was probably introduced with 5c24b67 ("perf
tools: Replace map->referenced & maps->removed_maps with map->refcnt"),
the symbol objects were leaked until c087e94 ("perf machine:
Fix refcount usage when processing PERF_RECORD_KSYMBOL") was merged so
the bug was masked.

Fixes: c087e94 ("perf machine: Fix refcount usage when processing PERF_RECORD_KSYMBOL")
Reported-by: Yunzhao Li <yunzhao@cloudflare.com>
Signed-off-by: Matt Fleming (Cloudflare) <matt@readmodwrite.com>
Cc: Ian Rogers <irogers@google.com>
Cc: kernel-team@cloudflare.com
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Riccardo Mancini <rickyman7@gmail.com>
Cc: stable@vger.kernel.org # v5.13+
Link: https://lore.kernel.org/r/20240815142212.3834625-1-matt@readmodwrite.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mmstick pushed a commit that referenced this issue Oct 16, 2024
commit 9af2efe upstream.

The fields in the hist_entry are filled on-demand which means they only
have meaningful values when relevant sort keys are used.

So if neither of 'dso' nor 'sym' sort keys are used, the map/symbols in
the hist entry can be garbage.  So it shouldn't access it
unconditionally.

I got a segfault, when I wanted to see cgroup profiles.

  $ sudo perf record -a --all-cgroups --synth=cgroup true

  $ sudo perf report -s cgroup

  Program received signal SIGSEGV, Segmentation fault.
  0x00005555557a8d90 in map__dso (map=0x0) at util/map.h:48
  48		return RC_CHK_ACCESS(map)->dso;
  (gdb) bt
  #0  0x00005555557a8d90 in map__dso (map=0x0) at util/map.h:48
  #1  0x00005555557aa39b in map__load (map=0x0) at util/map.c:344
  #2  0x00005555557aa592 in map__find_symbol (map=0x0, addr=140736115941088) at util/map.c:385
  #3  0x00005555557ef000 in hists__findnew_entry (hists=0x555556039d60, entry=0x7fffffffa4c0, al=0x7fffffffa8c0, sample_self=true)
      at util/hist.c:644
  #4  0x00005555557ef61c in __hists__add_entry (hists=0x555556039d60, al=0x7fffffffa8c0, sym_parent=0x0, bi=0x0, mi=0x0, ki=0x0,
      block_info=0x0, sample=0x7fffffffaa90, sample_self=true, ops=0x0) at util/hist.c:761
  #5  0x00005555557ef71f in hists__add_entry (hists=0x555556039d60, al=0x7fffffffa8c0, sym_parent=0x0, bi=0x0, mi=0x0, ki=0x0,
      sample=0x7fffffffaa90, sample_self=true) at util/hist.c:779
  #6  0x00005555557f00fb in iter_add_single_normal_entry (iter=0x7fffffffa900, al=0x7fffffffa8c0) at util/hist.c:1015
  #7  0x00005555557f09a7 in hist_entry_iter__add (iter=0x7fffffffa900, al=0x7fffffffa8c0, max_stack_depth=127, arg=0x7fffffffbce0)
      at util/hist.c:1260
  #8  0x00005555555ba7ce in process_sample_event (tool=0x7fffffffbce0, event=0x7ffff7c14128, sample=0x7fffffffaa90, evsel=0x555556039ad0,
      machine=0x5555560388e8) at builtin-report.c:334
  #9  0x00005555557b30c8 in evlist__deliver_sample (evlist=0x555556039010, tool=0x7fffffffbce0, event=0x7ffff7c14128,
      sample=0x7fffffffaa90, evsel=0x555556039ad0, machine=0x5555560388e8) at util/session.c:1232
  #10 0x00005555557b32bc in machines__deliver_event (machines=0x5555560388e8, evlist=0x555556039010, event=0x7ffff7c14128,
      sample=0x7fffffffaa90, tool=0x7fffffffbce0, file_offset=110888, file_path=0x555556038ff0 "perf.data") at util/session.c:1271
  #11 0x00005555557b3848 in perf_session__deliver_event (session=0x5555560386d0, event=0x7ffff7c14128, tool=0x7fffffffbce0,
      file_offset=110888, file_path=0x555556038ff0 "perf.data") at util/session.c:1354
  #12 0x00005555557affaf in ordered_events__deliver_event (oe=0x555556038e60, event=0x555556135aa0) at util/session.c:132
  #13 0x00005555557bb605 in do_flush (oe=0x555556038e60, show_progress=false) at util/ordered-events.c:245
  #14 0x00005555557bb95c in __ordered_events__flush (oe=0x555556038e60, how=OE_FLUSH__ROUND, timestamp=0) at util/ordered-events.c:324
  #15 0x00005555557bba46 in ordered_events__flush (oe=0x555556038e60, how=OE_FLUSH__ROUND) at util/ordered-events.c:342
  #16 0x00005555557b1b3b in perf_event__process_finished_round (tool=0x7fffffffbce0, event=0x7ffff7c15bb8, oe=0x555556038e60)
      at util/session.c:780
  #17 0x00005555557b3b27 in perf_session__process_user_event (session=0x5555560386d0, event=0x7ffff7c15bb8, file_offset=117688,
      file_path=0x555556038ff0 "perf.data") at util/session.c:1406

As you can see the entry->ms.map was NULL even if he->ms.map has a
value.  This is because 'sym' sort key is not given, so it cannot assume
whether he->ms.sym and entry->ms.sym is the same.  I only checked the
'sym' sort key here as it implies 'dso' behavior (so maps are the same).

Fixes: ac01c8c ("perf hist: Update hist symbol when updating maps")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Matt Fleming <matt@readmodwrite.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20240826221045.1202305-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants