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

H264 encode make kernel hang #44

Closed
wants to merge 100 commits into from

Conversation

dalmatele
Copy link

When I run encode H264 video on Rock64 with https://github.com/ayufan-rock64/linux-build/releases kernel, it hangs.
And the output I see this:

41.675708] ff340000.vepu: power on
[ 41.676326] Unhandled fault: synchronous external abort (0x96000210) at 0xffffff8008066804
[ 41.677599] Internal error: : 96000210 [#1] SMP
[ 41.678269] Modules linked in:
[ 41.678760] CPU: 1 PID: 525 Comm: mpp_enc_ctrl Not tainted 4.4.71 #3
[ 41.679682] Hardware name: Rockchip RK3328 EVB (DT)
[ 41.680403] task: ffffffc038530000 ti: ffffffc038538000 task.ti: ffffffc038538000
[ 41.681498] PC is at rk_iommu_read+0x20/0x34
[ 41.682132] LR is at rk_iommu_is_stall_active+0x44/0x64
[ 41.682893] pc : [] lr : [] pstate: 80000145
[ 41.696025] sp : ffffffc03853bb60
[ 41.708725] x29: ffffffc03853bb60 x28: ffffffc038538000
[ 41.721762] x27: ffffff8008bb2000 x26: 000000000000001d
[ 41.734521] x25: 000000000000011d x24: ffffffc0397cd030
[ 41.747008] x23: ffffffc03977ded0 x22: ffffffc03e5cac10
[ 41.759381] x21: ffffffc03e67b728 x20: ffffff8008066800
[ 41.771668] x19: 0000000000000004 x18: 00000000000a4f7c
[ 41.783931] x17: 0000007f7ab57ed0 x16: ffffff80081b6254
[ 41.795952] x15: 000000000000000a x14: ffffff8009683c20
[ 41.807699] x13: ffffff8009683c20 x12: 0000000000000000
[ 41.819401] x11: ffffff8008c0d600 x10: 0000000000000001
[ 41.830920] x9 : 0000000000000001 x8 : 00000000ffffffff
[ 41.842345] x7 : ffffffc039053480 x6 : ffffff8009683c20
[ 41.853679] x5 : 0000000000000000 x4 : 0000000000000000
[ 41.864900] x3 : 0000000000000000 x2 : ffffff80091504e8
[ 41.876019] x1 : 0000000000000004 x0 : ffffff8008066804
[ 41.886960]
[ 41.886960] PC: 0xffffff8008452098:
[ 41.907716] 2098 910103a1 aa1703e0 d63f0040 350001a0 110006d6 910103a4 2a1603e3 aa1503e2
[ 41.919268] 20b8 aa1403e1 aa1803e0 9411d621 350000e0 f94023a0 97ffffbd aa0003f3 b5fffde0
[ 41.930935] 20d8 d2800000 14000002 aa1303e0 a94153f3 a9425bf5 a94363f7 a8c97bfd d65f03c0
[ 41.942704] 20f8 a9be7bfd 910003fd a90153f3 aa0003f4 aa1e03e0 2a0103f3 d503201f 8b334280
[ 41.954434] 2118 b9400000 d5033d9f a94153f3 a8c27bfd d65f03c0 a9be7bfd 910003fd a90153f3
[ 41.966098] 2138 aa0003f3 aa1e03e0 2a0103f4 d503201f 52800000 b9401262 6b02001f 5400010a
[ 41.977798] 2158 d5033e9f f9400661 f860d822 91002042 b9000054 11000400 17fffff7 a94153f3
[ 41.989579] 2178 a8c27bfd d65f03c0 a9bd7bfd 910003fd a90153f3 f90013f5 aa0003f5 aa1e03e0
[ 42.001399]
[ 42.001399] LR: 0xffffff8008452144:
[ 42.022878] 2144 d503201f 52800000 b9401262 6b02001f 5400010a d5033e9f f9400661 f860d822
[ 42.034775] 2164 91002042 b9000054 11000400 17fffff7 a94153f3 a8c27bfd d65f03c0 a9bd7bfd
[ 42.046698] 2184 910003fd a90153f3 f90013f5 aa0003f5 aa1e03e0 52800013 52800034 d503201f
[ 42.058718] 21a4 b94012a0 6b00027f 5400012a f94006a0 52800081 f873d800 11000673 97ffffce
[ 42.070763] 21c4 d3420800 0a000294 17fffff6 2a1403e0 f94013f5 a94153f3 a8c37bfd d65f03c0
[ 42.082891] 21e4 a9bd7bfd 910003fd a90153f3 f90013f5 aa0003f5 aa1e03e0 52800013 52800034
[ 42.095013] 2204 d503201f b94012a0 6b00027f 5400010a f94006a0 52800081 f873d800 11000673
[ 42.107202] 2224 97ffffb5 0a140014 17fffff7 2a1403e0 f94013f5 a94153f3 a8c37bfd d65f03c0
[ 42.119358]
[ 42.119358] SP: 0xffffffc03853bae0:
[ 42.141329] bae0 3e5cac10 ffffffc0 3977ded0 ffffffc0 397cd030 ffffffc0 0000011d 00000000
[ 42.153484] bb00 0000001d 00000000 08bb2000 ffffff80 38538000 ffffffc0 3853bb60 ffffffc0
[ 42.165635] bb20 084521c4 ffffff80 3853bb60 ffffffc0 08452118 ffffff80 80000145 00000000
[ 42.177695] bb40 0000011d 00000000 0000001d 00000000 00000000 00000080 08b9ee78 ffffff80
[ 42.189725] bb60 3853bb80 ffffffc0 084521c4 ffffff80 00000001 00000000 00000001 00000000
[ 42.201865] bb80 3853bbb0 ffffffc0 08453538 ffffff80 3e67b728 ffffffc0 3977ded0 ffffffc0
[ 42.213882] bba0 3977ded0 ffffffc0 3977ded0 ffffffc0 3853bbe0 ffffffc0 084538d4 ffffff80
[ 42.225767] bbc0 3e67b728 ffffffc0 3977ded0 ffffffc0 3977ded0 ffffffc0 3e5cac10 ffffffc0
[ 42.233395] xhci-hcd xhci-hcd.8.auto: Cannot set link state.
[ 42.233449] usb usb5-port1: cannot disable (err = -32)
[ 42.260595]
[ 42.260595] X0: 0xffffff8008066784:
[ 42.282852] 6784
[ 42.283140] Unhandled fault: synchronous external abort (0x96000210) at 0xffffff8008066784
[ 49.306020] BUG: spinlock lockup suspected on CPU#1, mpp_enc_ctrl/525
[ 49.318172] lock: 0xffffff80090d8ca8, .magic: dead4ead, .owner: mpp_enc_ctrl/525, .owner_cpu: 1
[ 49.330854] CPU: 1 PID: 525 Comm: mpp_enc_ctrl Not tainted 4.4.71 #3
[ 49.343503] Hardware name: Rockchip RK3328 EVB (DT)
[ 49.356072] Call trace:
[ 49.368319] [] dump_backtrace+0x0/0x1b4
[ 49.381044] [] show_stack+0x24/0x30
[ 49.393759] [] dump_stack+0x94/0xb4
[ 49.406485] [] spin_dump+0x8c/0x9c
[ 49.419133] [] do_raw_spin_lock+0x104/0x158
[ 49.431955] [] _raw_spin_lock_irq+0x24/0x30
[ 49.444596] [] die+0x3c/0x1b4
[ 49.457010] [] arm64_notify_die+0x6c/0x7c
[ 49.469422] [] do_mem_abort+0x9c/0xac
[ 49.481648] Exception stack(0xffffffc03853b670 to 0xffffffc03853b7a0)
[ 49.494059] b660: ffffffc038538000 0000008000000000
[ 49.506650] b680: ffffffc03853b840 ffffff8008380c44 0000000000000007 ffffff8000000000
[ 49.519220] b6a0: ffffff8008066784 0000000000000004 ffffff80090e5000 ffffff800921b000
[ 49.531702] b6c0: 0000000000000005 0000000000000000 0000000000000000 ffffff800925e040
[ 49.543999] b6e0: 0000000000000005 0000000000000000 ffffffc03853b710 0000000000000368
[ 49.556359] b700: 0000000000000001 ffffff80090e5818 ffffffc03853b8cc ffffff8008066784
[ 49.568545] b720: 0000000000000004 ffffffc038530000 0000000000000000 ffffffc03853b8d0
[ 49.580619] b740: ffffffc03853b8cc ffffffc039052560 00000000ffffffff 0000000000000001
[ 49.592641] b760: 0000000000000001 ffffff8008c0d600 0000000000000000 ffffff8009723ea0
[ 49.604609] b780: ffffff8009723ea0 000000000000000a ffffff80081b6254 0000007f7ab57ed0
[ 49.616577] [] el1_da+0x18/0x78
[ 49.628154] [] show_data.constprop.3+0xa4/0xf4
[ 49.639783] [] __show_regs+0x158/0x198
[ 49.651190] [] die+0xb8/0x1b4
[ 49.662290] [] arm64_notify_die+0x6c/0x7c
[ 49.673576] [] do_mem_abort+0x9c/0xac
[ 49.684612] Exception stack(0xffffffc03853b990 to 0xffffffc03853bac0)
[ 49.695863] b980: 0000000000000004 0000008000000000
[ 49.707402] b9a0: ffffffc03853bb60 ffffff8008452118 0000000000000007 0000000000000000
[ 49.718842] b9c0: ffffff8008066804 ffff000100010002 ffffffc038434000 0000000000000000
[ 49.730226] b9e0: 0000024000000000 0000001000000008 0000000000000007 ffffffc0397db401
[ 49.741678] ba00: ffffffc03853ba40 ffffff80080b924c ffffff8009146450 0000000000000004
[ 49.753258] ba20: ffffffc03853ba90 000000000000000a ffffff8008066804 0000000000000004
[ 49.764829] ba40: ffffff80091504e8 0000000000000000 0000000000000000 0000000000000000
[ 49.776195] ba60: ffffff8009683c20 ffffffc039053480 00000000ffffffff 0000000000000001
[ 49.787498] ba80: 0000000000000001 ffffff8008c0d600 0000000000000000 ffffff8009683c20
[ 49.798841] baa0: ffffff8009683c20 000000000000000a ffffff80081b6254 0000007f7ab57ed0
[ 49.810376] [] el1_da+0x18/0x78
[ 49.821689] [] rk_iommu_is_stall_active+0x44/0x64
[ 49.833065] [] rk_iommu_enable_stall+0x24/0xf4
[ 49.844180] [] rk_iommu_attach_device+0x44/0x308
[ 49.855075] [] __iommu_attach_device+0x38/0xb0
[ 49.865738] [] iommu_group_do_attach_device+0x28/0x34
[ 49.876417] [] __iommu_group_for_each_dev+0x3c/0x5c
[ 49.887102] [] __iommu_attach_group+0x48/0x5c
[ 49.897652] [] iommu_attach_device+0x84/0xac
[ 49.908222] [] vpu_drm_attach+0xa0/0xf0
[ 49.918814] [] vpu_iommu_attach+0x38/0x44
[ 49.929428] [] mpp_dev_power_on+0xf8/0x128
[ 49.940038] [] rockchip_mpp_try_run+0xec/0x250
[ 49.950686] [] mpp_dev_ioctl+0x148/0x34c
[ 49.961262] [] do_vfs_ioctl+0x4d4/0x56c
[ 49.971839] [] SyS_ioctl+0x6c/0x94
[ 49.982341] [] el0_svc_naked+0x24/0x28
[ 60.146026] Watchdog detected hard LOCKUP on cpu 1
[ 60.146748] ------------[ cut here ]------------
[ 60.166562] WARNING: at kernel/watchdog.c:352
[ 60.176665] Modules linked in:
[ 60.186602]
[ 60.196239] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.71 #3
[ 60.206541] Hardware name: Rockchip RK3328 EVB (DT)
[ 60.216757] task: ffffff80090d7010 ti: ffffff80090c0000 task.ti: ffffff80090c0000
[ 60.227435] PC is at watchdog_timer_fn+0xfc/0x2e0
[ 60.237791] LR is at watchdog_timer_fn+0xfc/0x2e0
[ 60.247879] pc : [] lr : [] pstate: 600001c5
[ 60.258329] sp : ffffffc03ff5ee00
[ 60.268316] x29: ffffffc03ff5ee00 x28: 0000000000000001
[ 60.278580] x27: ffffff80090cdf10 x26: ffffff800909b1f8
[ 60.288835] x25: ffffffc03ff61210 x24: ffffff80090c3e10
[ 60.299038] x23: 0000000000000000 x22: 0000000000000034
[ 60.309248] x21: ffffff80090cc000 x20: ffffff800909b270
[ 60.319330] x19: ffffff800909b000 x18: 0000000000023a6a
[ 60.329187] x17: 0000000000000008 x16: 000000000000000e
[ 60.338962] x15: 000000000000000a x14: ffffff80097242c0
[ 60.348664] x13: ffffff80097242c0 x12: 0000000000000000
[ 60.358256] x11: ffffff8008c0d600 x10: 0000000000000001
[ 60.367614] x9 : 0000000000000001 x8 : 00000000ffffffff
[ 60.376994] x7 : ffffffc039053890 x6 : ffffff80097242c0
[ 60.386397] x5 : 0000000000000000 x4 : 0000000000000000
[ 60.395790] x3 : 00000000ffffffff x2 : ffffff80090e58b8
[ 60.405079] x1 : 0000000000000000 x0 : 0000000000000026
[ 60.414216]
[ 60.414216] PC: 0xffffff8008129d00:
[ 60.431181] 9d00 54000481 d5384100 b9401c00 f90037a4 97fffea6 2a0003e1 f0007d00 b94ea400
[ 60.440928] 9d20 6b00003f 54000362 d50339bf 90007d3b 2a0103fc 913c437b 91002283 f94037a4
[ 60.450825] 9d40 f87c7b62 38626860 34000060 3823685f 14000010 91020283 f8626b40 f8636845
[ 60.460818] 9d60 91022294 eb05001f 54000e00 f8236840 f87c7b60 3834681f 14000006 9400d533
[ 60.470926] 9d80 d4210000 f87c7b60 52800021 38346801 9107a274 913be2ba d538d081 91008280
[ 60.481102] 9da0 f8616800 97fe6b21 f9400b5b f9401b20 f9401000 d63f0000 aa0003e1 aa1b03e2
[ 60.491431] 9dc0 aa1903e0 97ff5854 b50000f6 91022694 d538d080 38606a81 34000341 38206a9f
[ 60.501861] 9de0 14000018 97fe7fb0 f9477ea1 36080941 b9400b41 34000901 531f7821 d35efc00
[ 60.512415]
[ 60.512415] LR: 0xffffff8008129d00:
[ 60.531644] 9d00 54000481 d5384100 b9401c00 f90037a4 97fffea6 2a0003e1 f0007d00 b94ea400
[ 60.542536] 9d20 6b00003f 54000362 d50339bf 90007d3b 2a0103fc 913c437b 91002283 f94037a4
[ 60.553547] 9d40 f87c7b62 38626860 34000060 3823685f 14000010 91020283 f8626b40 f8636845
[ 60.564701] 9d60 91022294 eb05001f 54000e00 f8236840 f87c7b60 3834681f 14000006 9400d533
[ 60.575997] 9d80 d4210000 f87c7b60 52800021 38346801 9107a274 913be2ba d538d081 91008280
[ 60.587441] 9da0 f8616800 97fe6b21 f9400b5b f9401b20 f9401000 d63f0000 aa0003e1 aa1b03e2
[ 60.598954] 9dc0 aa1903e0 97ff5854 b50000f6 91022694 d538d080 38606a81 34000341 38206a9f
[ 60.610573] 9de0 14000018 97fe7fb0 f9477ea1 36080941 b9400b41 34000901 531f7821 d35efc00
[ 60.622285]
[ 60.622285] SP: 0xffffffc03ff5ed80:
[ 60.643885] ed80 00000034 00000000 00000000 00000000 090c3e10 ffffff80 3ff61210 ffffffc0
[ 60.655915] eda0 0909b1f8 ffffff80 090cdf10 ffffff80 00000001 00000000 3ff5ee00 ffffffc0
[ 60.667928] edc0 08129d80 ffffff80 3ff5ee00 ffffffc0 08129d80 ffffff80 600001c5 00000000
[ 60.679857] ede0 090ccef8 ffffff80 0000000a 00000000 00000000 00000080 3e800028 ffffffc0
[ 60.691726] ee00 3ff5ee70 ffffffc0 08100758 ffffff80 3ff61210 ffffffc0 3ff60bc0 ffffffc0
[ 60.703788] ee20 3ff60c40 ffffffc0 00000003 00000000 0920b470 ffffff80 090cbe88 ffffff80
[ 60.715713] ee40 08129c84 ffffff80 fbad22f0 0000000d 3ff60d28 ffffffc0 090c0000 ffffff80
[ 60.727551] ee60 3ff61210 ffffffc0 090ccef8 ffffff80 3ff5eee0 ffffffc0 08100d8c ffffff80
[ 60.739471]
[ 60.739471] X2: 0xffffff80090e5838:
[ 60.761475] 5838 008d008d dead4ead ffffffff 00000000 ffffffff ffffffff 38f3a978 ffffffc0
[ 60.773786] 5858 38f3a978 ffffffc0 00000001 00000000 00000000 dead4ead ffffffff 00000000
[ 60.786235] 5878 ffffffff ffffffff 090e5880 ffffff80 090e5880 ffffff80 00040000 00000000
[ 60.798777] 5898 0ea50ea5 dead4ead ffffffff 00000000 ffffffff ffffffff 00000001 00000000
[ 60.811461] 58b8 090e58b8 ffffff80 090e58b8 ffffff80 00000000 dead4ead ffffffff 00000000
[ 60.824329] 58d8 ffffffff ffffffff 00001388 0000000a 00000000 00000000 00000000 00000000
[ 60.837254] 58f8 00000000 00000000 0000000f 00000004 00000001 00000007 00000001 ffffffff
[ 60.850310] 5918 ffffffff 00000000 080ec464 ffffff80 090dfc50 ffffff80 00000000 00000000
[ 60.863474]
[ 60.863474] X6: 0xffffff8009724240:
[ 60.887863] 4240 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 60.901350] 4260 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 60.914719] 4280 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 60.927934] 42a0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 60.941067] 42c0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 60.953879] 42e0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 60.966420] 4300 00000000 00000000 00000000 00000000 00aaaaaa 00000000 00000000 00000000
[ 60.978731] 4320 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 60.990814]
[ 60.990814] X7: 0xffffffc039053810:
[ 61.012650] 3810 c6c6c6c6 00c6c6c6 c6c6c6c6 78c6c6c6 d6d6d6d6 00000000 00000000 00000000
[ 61.024650] 3830 fcc6fcc6 fcc6fcc6 c6c0c6c0 c6c0c6c0 c6c0c6c0 c6c0c6c0 c6c0c6c0 c6c0c6c0
[ 61.036587] 3850 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.048479] 3870 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.060278] 3890 00000000 00000000 00000000 00000000 00000000 6cc6387c c606c606 d606d63c
[ 61.071872] 38b0 c606c606 387c6cc6 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.083380] 38d0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.094684] 38f0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.105724]
[ 61.105724] X11: 0xffffff8008c0d580:
[ 61.125482] d580 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.136440] d5a0 00000000 00000000 00000000 00000000 00000000 ff000000 00ff0000 ffff0000
[ 61.147144] d5c0 0000ff00 ff00ff00 00ffff00 ffffff00 000000ff ff0000ff 00ff00ff ffff00ff
[ 61.157679] d5e0 0000ffff ff00ffff 00ffffff ffffffff 00000000 ffff0000 0000ffff ffffffff
[ 61.168238] d600 00000000 ffffffff 00000000 ff000000 00ff0000 ffff0000 0000ff00 ff00ff00
[ 61.178633] d620 00ffff00 ffffff00 000000ff ff0000ff 00ff00ff ffff00ff 0000ffff ff00ffff
[ 61.188904] d640 00ffffff ffffffff 00000000 ffff0000 0000ffff ffffffff 00000000 ffffffff
[ 61.199081] d660 00000000 00000000 00000000 00000000 08500e48 ffffff80 08501208 ffffff80
[ 61.209205]
[ 61.209205] X13: 0xffffff8009724240:
[ 61.227375] 4240 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.237679] 4260 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.247822] 4280 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.257641] 42a0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.267375] 42c0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.276811] 42e0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.285977] 4300 00000000 00000000 00000000 00000000 00aaaaaa 00000000 00000000 00000000
[ 61.294955] 4320 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.303775]
[ 61.303775] X14: 0xffffff8009724240:
[ 61.319176] 4240 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.328070] 4260 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.336736] 4280 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.345109] 42a0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.353408] 42c0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.361384] 42e0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.369334] 4300 00000000 00000000 00000000 00000000 00aaaaaa 00000000 00000000 00000000
[ 61.377317] 4320 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.385347]
[ 61.385347] X19: 0xffffff800909af80:
[ 61.399852] af80 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.408559] afa0 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.417201] afc0 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.425557] afe0 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.433812] b000 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.441773] b020 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.449532] b040 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.457023] b060 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.464525]
[ 61.464525] X20: 0xffffff800909b1f0:
[ 61.477616] b1f0 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.485475] b210 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.493351] b230 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.500897] b250 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.508341] b270 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.515497] b290 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.522590] b2b0 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.529577] b2d0 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.536466]
[ 61.536466] X21: 0xffffff80090cbf80:
[ 61.548339] bf80 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.555564] bfa0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.562628] bfc0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.569376] bfe0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.576040] c000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.582398] c020 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.588773] c040 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.595132] c060 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.601504]
[ 61.601504] X24: 0xffffff80090c3d90:
[ 61.612749] 3d90 090c3db0 ffffff80 080cdb00 ffffff80 3ff652c8 ffffffc0 3ff652c8 ffffffc0
[ 61.619815] 3db0 090c3e30 ffffff80 080d7da0 ffffff80 3ff65240 ffffffc0 003a4ce0 ffffffc0
[ 61.626920] 3dd0 090c0000 ffffff80 00000000 00000000 00000000 00000000 090e6140 ffffff80
[ 61.633895] 3df0 00000000 01000000 57d60bc3 00000000 00008cae 00000000 00000000 00000000
[ 61.640935] 3e10 00000140 00000000 00000000 00000000 00000000 00000000 090e6140 ffffff80
[ 61.647814] 3e30 00000000 01000000 57d60bc3 00000000 00008cae 00000000 00000000 00000000
[ 61.654813] 3e50 090c3f1c ffffff80 090c0000 ffffff80 00000900 00000000 00000400 00000000
[ 61.661955] 3e70 00000144 00000000 00000004 00000000 00000001 00000000 00000007 00000000
[ 61.669263]
[ 61.669263] X25: 0xffffffc03ff61190:
[ 61.682350] 1190 ffffffff 00000000 ffffffff ffffffff 00000001 00000000 3ff611a8 ffffffc0
[ 61.690327] 11b0 3ff611a8 ffffffc0 3ff611b8 ffffffc0 3ff611b8 ffffffc0 08128888 ffffff80
[ 61.698467] 11d0 002ffcf8 ffffffc0 002ffc50 ffffffc0 00020002 00000000 00000034 00000000
[ 61.706518] 11f0 00000000 00000000 0000000f 00000000 0000000e 00000000 003a72c0 ffffffc0
[ 61.714699] 1210 3ff61210 ffffffc0 3ff61080 ffffffc0 00000000 00000000 fbad1840 0000000d
[ 61.722772] 1230 fbad1840 0000000d 08129c84 ffffff80 3ff60c40 ffffffc0 00000000 0000000a
[ 61.731061] 1250 08129c54 ffffff80 63746177 676f6468 0000302f 00000000 0000000f 00000000
[ 61.739538] 1270 00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000
[ 61.748212]
[ 61.748212] X26: 0xffffff800909b178:
[ 61.764037] b178 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.773437] b198 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.782825] b1b8 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.791879] b1d8 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.800875] b1f8 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.809532] b218 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.818175] b238 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.826828] b258 ******** ******** ******** ******** ******** ******** ******** ********
[ 61.835481]
[ 61.835481] X27: 0xffffff80090cde90:
[ 61.851286] de90 00000001 00000000 00000001 00000000 000003e8 00000000 3ffaf500 ffffffc0
[ 61.860652] deb0 00000015 00000000 3ffaf4c0 ffffffc0 00000001 00000000 00000060 00000000
[ 61.870187] ded0 00015000 00001000 00000001 00000000 3ffaf540 ffffffc0 3ffb1700 ffffffc0
[ 61.879651] def0 00000004 00000000 00000003 00000010 3ffaf3c0 ffffffc0 3ff5b000 ffffffc0
[ 61.889097] df10 36ec6000 00000040 36edb000 00000040 36ef0000 00000040 36f05000 00000040
[ 61.898417] df30 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 61.907828] df50 00000002 00000000 00003217 00000000 00010000 00000000 0003ffff 00000000
[ 61.917313] df70 00007233 00000000 00002000 00000000 00000000 0000fffa 00000000 00000000
[ 61.926894]
[ 61.926894] X29: 0xffffffc03ff5ed80:
[ 61.944532] ed80 00000034 00000000 00000000 00000000 090c3e10 ffffff80 3ff61210 ffffffc0
[ 61.954831] eda0 0909b1f8 ffffff80 090cdf10 ffffff80 00000001 00000000 3ff5ee00 ffffffc0
[ 61.965334] edc0 08129d80 ffffff80 3ff5ee00 ffffffc0 08129d80 ffffff80 600001c5 00000000
[ 61.975692] ede0 090ccef8 ffffff80 0000000a 00000000 00000000 00000080 3e800028 ffffffc0
[ 61.986229] ee00 3ff5ee70 ffffffc0 08100758 ffffff80 3ff61210 ffffffc0 3ff60bc0 ffffffc0
[ 61.996646] ee20 3ff60c40 ffffffc0 00000003 00000000 0920b470 ffffff80 090cbe88 ffffff80
[ 62.007142] ee40 08129c84 ffffff80 fbad22f0 0000000d 3ff60d28 ffffffc0 090c0000 ffffff80
[ 62.017609] ee60 3ff61210 ffffffc0 090ccef8 ffffff80 3ff5eee0 ffffffc0 08100d8c ffffff80
[ 62.028104]
[ 62.037541] ---[ end trace bc6b2d37aa9b4068 ]---
[ 62.047435] Call trace:
[ 62.057022] Exception stack(0xffffffc03ff5ec30 to 0xffffffc03ff5ed60)
[ 62.067271] ec20: ffffff800909b000 0000008000000000
[ 62.077684] ec40: ffffffc03ff5ee00 ffffff8008129d80 0000000000000000 ffffff800925e040
[ 62.088270] ec60: 0000000000000026 0000000000000000 ffffffc03ff5ec90 00000000000003a5
[ 62.098827] ec80: 0000000000000000 ffffff80090e5818 ffffffc03ff5ed20 ffffff80080ebdf8
[ 62.109316] eca0: ffffffc03ff5ed80 ffffff8008e34fe5 ffffff80090cc000 0000000000000034
[ 62.119812] ecc0: 0000000000000000 ffffff80090c3e10 0000000000000026 0000000000000000
[ 62.130272] ece0: ffffff80090e58b8 00000000ffffffff 0000000000000000 0000000000000000
[ 62.140659] ed00: ffffff80097242c0 ffffffc039053890 00000000ffffffff 0000000000000001
[ 62.150974] ed20: 0000000000000001 ffffff8008c0d600 0000000000000000 ffffff80097242c0
[ 62.161263] ed40: ffffff80097242c0 000000000000000a 000000000000000e 0000000000000008
[ 62.171601] [] watchdog_timer_fn+0xfc/0x2e0
[ 62.181632] [] __hrtimer_run_queues+0x15c/0x280
[ 62.191791] [] hrtimer_interrupt+0xac/0x1bc
[ 62.201729] [] arch_timer_handler_phys+0x3c/0x4c
[ 62.211908] [] handle_percpu_devid_irq+0xc4/0x170
[ 62.222234] [] generic_handle_irq+0x2c/0x44
[ 62.232649] [] __handle_domain_irq+0x90/0xb8
[ 62.243218] [] gic_handle_irq+0x78/0xc8
[ 62.253857] Exception stack(0xffffff80090c3e10 to 0xffffff80090c3f40)
[ 62.264892] 3e00: 0000000000000140 0000000000000000
[ 62.276417] 3e20: 0000000000000000 ffffff80090e6140 0100000000000000 0000000057d60bc3
[ 62.287825] 3e40: 0000000000008cae 0000000000000000 ffffff80090c3f1c ffffff80090c0000
[ 62.299370] 3e60: 0000000000000900 0000000000000400 0000000000000144 0000000000000004
[ 62.310742] 3e80: 0000000000000001 0000000000000007 000000000000000e 0000000000000008
[ 62.322002] 3ea0: 000000001ed3e33c 0000000000000000 0000000000000000 ffffff80090c0000
[ 62.333127] 3ec0: ffffff80090cb000 ffffff80090cbe18 ffffff8009004b38 00000000032d5000
[ 62.344441] 3ee0: 00000000032d8000 0000000002ba01f0 0000000002fb001c ffffff80090c3f40
[ 62.355815] 3f00: ffffff80080df29c ffffff80090c3f40 ffffff80080df30c 0000000060000145
[ 62.367338] 3f20: ffffff80090c0000 ffffff80090cb000 ffffffffffffffff ffffff80080df29c
[ 62.378957] [] el1_irq+0xb4/0x140
[ 62.390389] [] cpu_startup_entry+0x23c/0x2b8
[ 62.401705] [] rest_init+0x78/0x80
[ 62.412975] [] start_kernel+0x3d0/0x3e4
[ 62.424114] [] __primary_switched+0x30/0x6c
In Rock64, in this link http://rockchip.fr/RK312X%20TRM/chapter-14-power-management-unit-(pmu).pdf I see that it uses PD_VIDEO for video encode, but in dtsi file, in vepu section, it does not have power-domain.
Maybe this is problem?

Randy Li and others added 30 commits June 21, 2017 01:07
The RK3328 has two video IP sharing the same mmu,
but only the VDPU is available in this platform.

Change-Id: I24d73cd5ab2c3d32da6ef29661061c7fda9186f2
Signed-off-by: Randy Li <randy.li@rock-chips.com>
This commit would enable the VDPU and RKVDEC devices. The VDPU works in the non combo mode.

Change-Id: I643350d5a2ac17759984fda2e95fb2b82701e7cf
Signed-off-by: Randy Li <randy.li@rock-chips.com>
Signed-off-by: Hans Yang <yhx@rock-chips.com>

Conflicts:
	arch/arm64/boot/dts/rockchip/rk3328-evb.dts
Change-Id: Idf5691c7b0c7da75579be410c2fb5e1a346ab012
Change-Id: I4d0b01491f4183c7e700fdb8ba7025871a162951
Change-Id: I2c01055569640e8238f48ec069ec4a58300dccd8
Change-Id: I02e7ab0bed3166cf98483f35b3f4da6113baacd6
Add helper to allow users to retrieve the speaker allocations without
knowledge of the ELD structure.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
During probe, DAIs can need to perform some actions that requests
the knowledge of the pcm runtime handle.
The callback is called during DAIs linking, after PCM device creation.
For instance this can be used to add relationship between a DAI pcm
control and the pcm device.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Add user interface to provide channel mapping.
In a first step this control is read only.

As TLV type, the control provides all configuration available for
HDMI sink(ELD), and provides current channel mapping selected by codec
based on ELD and number of channels specified by user on open.
When control is called before the number of the channel is specified
(i.e. hw_params is set), it returns all channels set to UNKNOWN.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
DRM legacy doesn't allow that, will be only available with drm atomic.
Although, when running 4K modes, it's preferable to get a 1080p frambuffer that can be handlded properly by GPU and then use VOP to upscale that to 4K.
Revert "Squashfs: optimize reading uncompressed data"

This reverts commit 0c2f831.

Revert "Squashfs: implement .readpages()"

This reverts commit 9c6d9ab.

Revert "Squashfs: replace buffer_head with BIO"

This reverts commit 8327714.

Revert "Squashfs: refactor page_actor"

This reverts commit 4bc7d97.

Revert "Squashfs: remove the FILE_CACHE option"

This reverts commit 3de0af4.
IagoAbal and others added 17 commits August 28, 2017 21:29
The static bug finder EBA (http://www.iagoabal.eu/eba/) reported the
following double-lock bug:

    Double lock:
    1. spin_lock_irqsave(pch->lock, flags) at pl330_free_chan_resources:2236;
    2. call to function `pl330_release_channel' immediately after;
    3. call to function `dma_pl330_rqcb' in line 1753;
    4. spin_lock_irqsave(pch->lock, flags) at dma_pl330_rqcb:1505.

I have fixed it as suggested by Marek Szyprowski.

First, I have replaced `pch->lock' with `pl330->lock' in functions
`pl330_alloc_chan_resources' and `pl330_free_chan_resources'. This avoids
the double-lock by acquiring a different lock than `dma_pl330_rqcb'.

NOTE that, as a result, `pl330_free_chan_resources' executes
`list_splice_tail_init' on `pch->work_list' under lock `pl330->lock',
whereas in the rest of the code `pch->work_list' is protected by
`pch->lock'. I don't know if this may cause race conditions. Similarly
`pch->cyclic' is written by `pl330_alloc_chan_resources' under
`pl330->lock' but read by `pl330_tx_submit' under `pch->lock'.

Second, I have removed locking from `pl330_request_channel' and
`pl330_release_channel' functions. Function `pl330_request_channel' is
only called from `pl330_alloc_chan_resources', so the lock is already
held. Function `pl330_release_channel' is called from
`pl330_free_chan_resources', which already holds the lock, and from
`pl330_del'. Function `pl330_del' is called in an error path of
`pl330_probe' and at the end of `pl330_remove', but I assume that there
cannot be concurrent accesses to the protected data at those points.

Signed-off-by: Iago Abal <mail@iagoabal.eu>
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
(cherry picked from commit 91539eb)
When removing a device with less than 9 IRQs (AMBA_NR_IRQS), we'll get a
big WARN_ON from devres.c because pl330_remove calls devm_free_irqs for
unallocated irqs. Similarly to pl330_probe, check that IRQ number is
present before calling devm_free_irq.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
(cherry picked from commit ebcdaee)
This driver is now used only on platforms which support device tree, so
it is safe to remove legacy platform data based initialization code.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
For plat-samsung:
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
(cherry picked from commit e8bb467)
The functions _queue_empty(), _emit_ADDH(), _emit_NOP(), _emit_STZ()
and _emit_WFE() are not used. Delete them.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
(cherry picked from commit d43674e)
Change-Id: I266376a272ba0efd0b488c496dbcad3247df656b
The kernel headers package (linux-headers) doesn't include
header files from other architectures required to build
out-of-tree modules.

For e.g. on ARM64, opcodes.h includes the same file from ARM
which causes the following error:
./arch/arm64/include/asm/opcodes.h:1:43: fatal error:
../../arm/include/asm/opcodes.h: No such file or directory
compilation terminated.

Signed-off-by: Azriel Samson <asamson@codeaurora.org>
Change-Id: I27a9d962f778e39323e8ff70177379360f589de7
CONFIG_KEYS_COMPAT is defined in arch-specific Kconfigs and is missing for
several 64-bit architectures : mips, parisc, tile.

At the moment and for those architectures, calling in 32-bit userspace the
keyctl syscall would return an ENOSYS error.

This patch moves the CONFIG_KEYS_COMPAT option to security/keys/Kconfig, to
make sure the compatibility wrapper is registered by default for any 64-bit
architecture as long as it is configured with CONFIG_COMPAT.

[DH: Modified to remove arm64 compat enablement also as requested by Eric
 Biggers]

Signed-off-by: Bilal Amarni <bilal.amarni@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
cc: Eric Biggers <ebiggers3@gmail.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
…act-cert

Change-Id: I5a1df1068dc4a77b84b9a6e3107eb5f73930b0c0
Some special SoCs (e.g. rk322xh) USB3 PHY have problem to detect
disconnection, they lose the ability to detect an absence of Rx
termination specified in USB3 spec Table 6-21, fortunately, the
USB3 PHY can detect port link state change when USB3 device is
unplugged, so we can do soft disconnect according to the PLC.

Change-Id: I2cbd62fddc8a1f9c5a264d705db43fb0cf3e035c
Signed-off-by: William Wu <wulf@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
According to xHCI spec v1.1 section 6.4.5 TRB Completion Codes,
the standard XHCI controller provide a TRB Completion Status
'USB Transaction Error' to asserted in the case where the host
did not receive a valid response from the device, it's useful
to handle pending URBs on the endpoint when the USB device is
plugged out.

Unfortunately, some SOCs USB 3.0 modules lose the ability to
assert the 'USB Transaction Error' status when USB 3.0 device
disconnect. This may cause the pending URBs unhandled, even
lead to USB class driver stalled in waiting for URBs complete.

This patch flush pending URBs in usb_disable_device() when
USB 3.0 device disconnect, it will call xhci_urb_dequeue()
-> xhci_queue_stop_endpoint() to cancel pending URBs and
giveback URB status immediately.

Change-Id: If8acac59bc1f2c10a41ee390ccbeb84b2e7743c1
Signed-off-by: Feng Mingli <fml@rock-chips.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
We found the usb-phy lost devices detected ability after continuously
disconnect/connect, this patch add usb2-phy reset/deassert as one part
of previous workaround (commit c1ebf31) to fix it.

Change-Id: Ib7112047eb0f5030406389aa9c8ebd599f8118be
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Change-Id: I13149fd44ef5e19334f23cca43c9861b8fa581e7
@wzyy2 wzyy2 closed this Nov 22, 2017
Kwiboo pushed a commit to Kwiboo/linux-rockchip that referenced this pull request Feb 26, 2018
dwc3_of_simple_dev_pm_ops has never been used since commit a0d8c4c
("usb: dwc3: of-simple: set dev_pm_ops"), but this commit has brought
and oops when unbind the device due this sequence:

  dwc3_of_simple_remove
   -> clk_disable ...
      -> pm_runtime_put_sync
         -> dwc3_of_simple_runtime_suspend
            -> clk_disable (again)

This double call to clk_core_disable causes a kernel oops like this:

 WARNING: CPU: 1 PID: 4022 at drivers/clk/clk.c:656 clk_core_disable+0x78/0x80
 CPU: 1 PID: 4022 Comm: bash Not tainted 4.15.0-rc4+ rockchip-linux#44
 Hardware name: Google Kevin (DT)
 pstate: 80000085 (Nzcv daIf -PAN -UAO)
 pc : clk_core_disable+0x78/0x80
 lr : clk_core_disable_lock+0x20/0x38
 sp : ffff00000bbf3a90
 ...
 Call trace:
  clk_core_disable+0x78/0x80
  clk_disable+0x1c/0x30
  dwc3_of_simple_runtime_suspend+0x30/0x50
  pm_generic_runtime_suspend+0x28/0x40

This patch fixes the unbalanced clk disable call by setting the num_clocks
variable to zero once the clocks were disabled.

Fixes: a0d8c4c ("usb: dwc3: of-simple: set dev_pm_ops")
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Kwiboo pushed a commit to Kwiboo/linux-rockchip that referenced this pull request Dec 15, 2018
Increase kasan instrumented kernel stack size from 32k to 64k. Other
architectures seems to get away with just doubling kernel stack size under
kasan, but on s390 this appears to be not enough due to bigger frame size.
The particular pain point is kasan inlined checks (CONFIG_KASAN_INLINE
vs CONFIG_KASAN_OUTLINE). With inlined checks one particular case hitting
stack overflow is fs sync on xfs filesystem:

 #0 [9a0681e8]  704 bytes  check_usage at 34b1fc
 #1 [9a0684a8]  432 bytes  check_usage at 34c710
 #2 [9a068658]  1048 bytes  validate_chain at 35044a
 #3 [9a068a70]  312 bytes  __lock_acquire at 3559fe
 #4 [9a068ba8]  440 bytes  lock_acquire at 3576ee
 #5 [9a068d60]  104 bytes  _raw_spin_lock at 21b44e0
 #6 [9a068dc8]  1992 bytes  enqueue_entity at 2dbf72
 #7 [9a069590]  1496 bytes  enqueue_task_fair at 2df5f0
 #8 [9a069b68]  64 bytes  ttwu_do_activate at 28f438
 #9 [9a069ba8]  552 bytes  try_to_wake_up at 298c4c
 #10 [9a069dd0]  168 bytes  wake_up_worker at 23f97c
 #11 [9a069e78]  200 bytes  insert_work at 23fc2e
 #12 [9a069f40]  648 bytes  __queue_work at 2487c0
 #13 [9a06a1c8]  200 bytes  __queue_delayed_work at 24db28
 #14 [9a06a290]  248 bytes  mod_delayed_work_on at 24de84
 #15 [9a06a388]  24 bytes  kblockd_mod_delayed_work_on at 153e2a0
 #16 [9a06a3a0]  288 bytes  __blk_mq_delay_run_hw_queue at 158168c
 #17 [9a06a4c0]  192 bytes  blk_mq_run_hw_queue at 1581a3c
 #18 [9a06a580]  184 bytes  blk_mq_sched_insert_requests at 15a2192
 #19 [9a06a638]  1024 bytes  blk_mq_flush_plug_list at 1590f3a
 #20 [9a06aa38]  704 bytes  blk_flush_plug_list at 1555028
 #21 [9a06acf8]  320 bytes  schedule at 219e476
 #22 [9a06ae38]  760 bytes  schedule_timeout at 21b0aac
 #23 [9a06b130]  408 bytes  wait_for_common at 21a1706
 #24 [9a06b2c8]  360 bytes  xfs_buf_iowait at fa1540
 #25 [9a06b430]  256 bytes  __xfs_buf_submit at fadae6
 #26 [9a06b530]  264 bytes  xfs_buf_read_map at fae3f6
 #27 [9a06b638]  656 bytes  xfs_trans_read_buf_map at 10ac9a8
 #28 [9a06b8c8]  304 bytes  xfs_btree_kill_root at e72426
 #29 [9a06b9f8]  288 bytes  xfs_btree_lookup_get_block at e7bc5e
 #30 [9a06bb18]  624 bytes  xfs_btree_lookup at e7e1a6
 #31 [9a06bd88]  2664 bytes  xfs_alloc_ag_vextent_near at dfa070
 #32 [9a06c7f0]  144 bytes  xfs_alloc_ag_vextent at dff3ca
 #33 [9a06c880]  1128 bytes  xfs_alloc_vextent at e05fce
 #34 [9a06cce8]  584 bytes  xfs_bmap_btalloc at e58342
 #35 [9a06cf30]  1336 bytes  xfs_bmapi_write at e618de
 #36 [9a06d468]  776 bytes  xfs_iomap_write_allocate at ff678e
 #37 [9a06d770]  720 bytes  xfs_map_blocks at f82af8
 rockchip-linux#38 [9a06da40]  928 bytes  xfs_writepage_map at f83cd6
 rockchip-linux#39 [9a06dde0]  320 bytes  xfs_do_writepage at f85872
 rockchip-linux#40 [9a06df20]  1320 bytes  write_cache_pages at 73dfe8
 rockchip-linux#41 [9a06e448]  208 bytes  xfs_vm_writepages at f7f892
 rockchip-linux#42 [9a06e518]  88 bytes  do_writepages at 73fe6a
 rockchip-linux#43 [9a06e570]  872 bytes  __writeback_single_inode at a20cb6
 rockchip-linux#44 [9a06e8d8]  664 bytes  writeback_sb_inodes at a23be2
 rockchip-linux#45 [9a06eb70]  296 bytes  __writeback_inodes_wb at a242e0
 rockchip-linux#46 [9a06ec98]  928 bytes  wb_writeback at a2500e
 rockchip-linux#47 [9a06f038]  848 bytes  wb_do_writeback at a260ae
 rockchip-linux#48 [9a06f388]  536 bytes  wb_workfn at a28228
 rockchip-linux#49 [9a06f5a0]  1088 bytes  process_one_work at 24a234
 rockchip-linux#50 [9a06f9e0]  1120 bytes  worker_thread at 24ba26
 rockchip-linux#51 [9a06fe40]  104 bytes  kthread at 26545a
 rockchip-linux#52 [9a06fea8]             kernel_thread_starter at 21b6b62

To be able to increase the stack size to 64k reuse LLILL instruction
in __switch_to function to load 64k - STACK_FRAME_OVERHEAD - __PT_SIZE
(65192) value as unsigned.

Reported-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Kwiboo pushed a commit to Kwiboo/linux-rockchip that referenced this pull request Dec 15, 2018
There is no expression deactivation call from the rule replacement path,
hence, chain counter is not decremented. A few steps to reproduce the
problem:

   %nft add table ip filter
   %nft add chain ip filter c1
   %nft add chain ip filter c1
   %nft add rule ip filter c1 jump c2
   %nft replace rule ip filter c1 handle 3 accept
   %nft flush ruleset

<jump c2> expression means immediate NFT_JUMP to chain c2.
Reference count of chain c2 is increased when the rule is added.

When rule is deleted or replaced, the reference counter of c2 should be
decreased via nft_rule_expr_deactivate() which calls
nft_immediate_deactivate().

Splat looks like:
[  214.396453] WARNING: CPU: 1 PID: 21 at net/netfilter/nf_tables_api.c:1432 nf_tables_chain_destroy.isra.38+0x2f9/0x3a0 [nf_tables]
[  214.398983] Modules linked in: nf_tables nfnetlink
[  214.398983] CPU: 1 PID: 21 Comm: kworker/1:1 Not tainted 4.20.0-rc2+ rockchip-linux#44
[  214.398983] Workqueue: events nf_tables_trans_destroy_work [nf_tables]
[  214.398983] RIP: 0010:nf_tables_chain_destroy.isra.38+0x2f9/0x3a0 [nf_tables]
[  214.398983] Code: 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 8e 00 00 00 48 8b 7b 58 e8 e1 2c 4e c6 48 89 df e8 d9 2c 4e c6 eb 9a <0f> 0b eb 96 0f 0b e9 7e fe ff ff e8 a7 7e 4e c6 e9 a4 fe ff ff e8
[  214.398983] RSP: 0018:ffff8881152874e8 EFLAGS: 00010202
[  214.398983] RAX: 0000000000000001 RBX: ffff88810ef9fc28 RCX: ffff8881152876f0
[  214.398983] RDX: dffffc0000000000 RSI: 1ffff11022a50ede RDI: ffff88810ef9fc78
[  214.398983] RBP: 1ffff11022a50e9d R08: 0000000080000000 R09: 0000000000000000
[  214.398983] R10: 0000000000000000 R11: 0000000000000000 R12: 1ffff11022a50eba
[  214.398983] R13: ffff888114446e08 R14: ffff8881152876f0 R15: ffffed1022a50ed6
[  214.398983] FS:  0000000000000000(0000) GS:ffff888116400000(0000) knlGS:0000000000000000
[  214.398983] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  214.398983] CR2: 00007fab9bb5f868 CR3: 000000012aa16000 CR4: 00000000001006e0
[  214.398983] Call Trace:
[  214.398983]  ? nf_tables_table_destroy.isra.37+0x100/0x100 [nf_tables]
[  214.398983]  ? __kasan_slab_free+0x145/0x180
[  214.398983]  ? nf_tables_trans_destroy_work+0x439/0x830 [nf_tables]
[  214.398983]  ? kfree+0xdb/0x280
[  214.398983]  nf_tables_trans_destroy_work+0x5f5/0x830 [nf_tables]
[ ... ]

Fixes: bb7b40a ("netfilter: nf_tables: bogus EBUSY in chain deletions")
Reported by: Christoph Anton Mitterer <calestyo@scientia.net>
Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914505
Link: https://bugzilla.kernel.org/show_bug.cgi?id=201791
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Kwiboo pushed a commit to Kwiboo/linux-rockchip that referenced this pull request Dec 27, 2018
…lace()

basechain->stats is rcu protected data which is updated from
nft_chain_stats_replace(). This function is executed from the commit
phase which holds the pernet nf_tables commit mutex - not the global
nfnetlink subsystem mutex.

Test commands to reproduce the problem are:
   %iptables-nft -I INPUT
   %iptables-nft -Z
   %iptables-nft -Z

This patch uses RCU calls to handle basechain->stats updates to fix a
splat that looks like:

[89279.358755] =============================
[89279.363656] WARNING: suspicious RCU usage
[89279.368458] 4.20.0-rc2+ rockchip-linux#44 Tainted: G        W    L
[89279.374661] -----------------------------
[89279.379542] net/netfilter/nf_tables_api.c:1404 suspicious rcu_dereference_protected() usage!
[...]
[89279.406556] 1 lock held by iptables-nft/5225:
[89279.411728]  #0: 00000000bf45a000 (&net->nft.commit_mutex){+.+.}, at: nf_tables_valid_genid+0x1f/0x70 [nf_tables]
[89279.424022] stack backtrace:
[89279.429236] CPU: 0 PID: 5225 Comm: iptables-nft Tainted: G        W    L    4.20.0-rc2+ rockchip-linux#44
[89279.430135] Call Trace:
[89279.430135]  dump_stack+0xc9/0x16b
[89279.430135]  ? show_regs_print_info+0x5/0x5
[89279.430135]  ? lockdep_rcu_suspicious+0x117/0x160
[89279.430135]  nft_chain_commit_update+0x4ea/0x640 [nf_tables]
[89279.430135]  ? sched_clock_local+0xd4/0x140
[89279.430135]  ? check_flags.part.35+0x440/0x440
[89279.430135]  ? __rhashtable_remove_fast.constprop.67+0xec0/0xec0 [nf_tables]
[89279.430135]  ? sched_clock_cpu+0x126/0x170
[89279.430135]  ? find_held_lock+0x39/0x1c0
[89279.430135]  ? hlock_class+0x140/0x140
[89279.430135]  ? is_bpf_text_address+0x5/0xf0
[89279.430135]  ? check_flags.part.35+0x440/0x440
[89279.430135]  ? __lock_is_held+0xb4/0x140
[89279.430135]  nf_tables_commit+0x2555/0x39c0 [nf_tables]

Fixes: f102d66 ("netfilter: nf_tables: use dedicated mutex to guard transactions")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
0lvin pushed a commit to free-z4u/roc-rk3328-cc-official that referenced this pull request May 3, 2019
…nitcall

fs_initcall is definitely too late to initialize DMA-debug hash tables,
because some drivers might get probed and use DMA mapping framework
already in core_initcall. Late initialization of DMA-debug results in
false warning about accessing memory, that was not allocated, like this
one:
------------[ cut here ]------------
WARNING: CPU: 5 PID: 1 at lib/dma-debug.c:1104 check_unmap+0xa1c/0xe50
exynos-sysmmu 10a60000.sysmmu: DMA-API: device driver tries to free DMA memory it has not allocated [device
address=0x000000006ebd0000] [size=16384 bytes]
Modules linked in:
CPU: 5 PID: 1 Comm: swapper/0 Not tainted 4.9.0-rc5-00028-g39dde3d-dirty rockchip-linux#44
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[<c0119dd4>] (unwind_backtrace) from [<c01122bc>] (show_stack+0x20/0x24)
[<c01122bc>] (show_stack) from [<c062714c>] (dump_stack+0x84/0xa0)
[<c062714c>] (dump_stack) from [<c0132560>] (__warn+0x14c/0x180)
[<c0132560>] (__warn) from [<c01325dc>] (warn_slowpath_fmt+0x48/0x50)
[<c01325dc>] (warn_slowpath_fmt) from [<c06814f8>] (check_unmap+0xa1c/0xe50)
[<c06814f8>] (check_unmap) from [<c06819c4>] (debug_dma_unmap_page+0x98/0xc8)
[<c06819c4>] (debug_dma_unmap_page) from [<c076c3e8>] (exynos_iommu_domain_free+0x158/0x380)
[<c076c3e8>] (exynos_iommu_domain_free) from [<c0764a30>] (iommu_domain_free+0x34/0x60)
[<c0764a30>] (iommu_domain_free) from [<c011f168>] (release_iommu_mapping+0x30/0xb8)
[<c011f168>] (release_iommu_mapping) from [<c011f23c>] (arm_iommu_release_mapping+0x4c/0x50)
[<c011f23c>] (arm_iommu_release_mapping) from [<c0b061ac>] (s5p_mfc_probe+0x640/0x80c)
[<c0b061ac>] (s5p_mfc_probe) from [<c07e6750>] (platform_drv_probe+0x70/0x148)
[<c07e6750>] (platform_drv_probe) from [<c07e25c0>] (driver_probe_device+0x12c/0x6b0)
[<c07e25c0>] (driver_probe_device) from [<c07e2c6c>] (__driver_attach+0x128/0x17c)
[<c07e2c6c>] (__driver_attach) from [<c07df74c>] (bus_for_each_dev+0x88/0xc8)
[<c07df74c>] (bus_for_each_dev) from [<c07e1b6c>] (driver_attach+0x34/0x58)
[<c07e1b6c>] (driver_attach) from [<c07e1350>] (bus_add_driver+0x18c/0x32c)
[<c07e1350>] (bus_add_driver) from [<c07e4198>] (driver_register+0x98/0x148)
[<c07e4198>] (driver_register) from [<c07e5cb0>] (__platform_driver_register+0x58/0x74)
[<c07e5cb0>] (__platform_driver_register) from [<c174cb30>] (s5p_mfc_driver_init+0x1c/0x20)
[<c174cb30>] (s5p_mfc_driver_init) from [<c0102690>] (do_one_initcall+0x64/0x258)
[<c0102690>] (do_one_initcall) from [<c17014c0>] (kernel_init_freeable+0x3d0/0x4d0)
[<c17014c0>] (kernel_init_freeable) from [<c116eeb4>] (kernel_init+0x18/0x134)
[<c116eeb4>] (kernel_init) from [<c010bbd8>] (ret_from_fork+0x14/0x3c)
---[ end trace dc54c54bd3581296 ]---

This patch moves initialization of DMA-debug to core_initcall. This is
safe from the initialization perspective. dma_debug_do_init() internally calls
debugfs functions and debugfs also gets initialised at core_initcall(), and
that is earlier than arch code in the link order, so it will get initialized
just before the DMA-debug.

Reported-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
0lvin pushed a commit to free-z4u/roc-rk3328-cc-official that referenced this pull request Sep 1, 2019
When a tail call fails, it is documented that the tail call should
continue execution at the following instruction.  An example tail call
sequence is:

  12: (85) call bpf_tail_call#12
  13: (b7) r0 = 0
  14: (95) exit

The ARM assembler for the tail call in this case ends up branching to
instruction 14 instead of instruction 13, resulting in the BPF filter
returning a non-zero value:

  178:	ldr	r8, [sp, #588]	; insn 12
  17c:	ldr	r6, [r8, r6]
  180:	ldr	r8, [sp, #580]
  184:	cmp	r8, r6
  188:	bcs	0x1e8
  18c:	ldr	r6, [sp, #524]
  190:	ldr	r7, [sp, #528]
  194:	cmp	r7, #0
  198:	cmpeq	r6, rockchip-linux#32
  19c:	bhi	0x1e8
  1a0:	adds	r6, r6, FireflyTeam#1
  1a4:	adc	r7, r7, #0
  1a8:	str	r6, [sp, #524]
  1ac:	str	r7, [sp, #528]
  1b0:	mov	r6, rockchip-linux#104
  1b4:	ldr	r8, [sp, #588]
  1b8:	add	r6, r8, r6
  1bc:	ldr	r8, [sp, #580]
  1c0:	lsl	r7, r8, FireflyTeam#2
  1c4:	ldr	r6, [r6, r7]
  1c8:	cmp	r6, #0
  1cc:	beq	0x1e8
  1d0:	mov	r8, rockchip-linux#32
  1d4:	ldr	r6, [r6, r8]
  1d8:	add	r6, r6, rockchip-linux#44
  1dc:	bx	r6
  1e0:	mov	r0, #0		; insn 13
  1e4:	mov	r1, #0
  1e8:	add	sp, sp, #596	; insn 14
  1ec:	pop	{r4, r5, r6, r7, r8, sl, pc}

For other sequences, the tail call could end up branching midway through
the following BPF instructions, or maybe off the end of the function,
leading to unknown behaviours.

Fixes: 39c13c2 ("arm: eBPF JIT compiler")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
friendlyarm pushed a commit to friendlyarm/kernel-rockchip that referenced this pull request Apr 2, 2020
commit f2e97dc upstream.

Fix following build error. We could push a tcp.h header into one of the
include paths, but I think its easy enough to simply pull in the three
defines we need here. If we end up using more of tcp.h at some point
we can pull it in later.

/home/john/git/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c: In function ‘connected_socket_v4’:
/home/john/git/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:20:11: error: ‘TCP_REPAIR_ON’ undeclared (first use in this function)
  repair = TCP_REPAIR_ON;
           ^
/home/john/git/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:20:11: note: each undeclared identifier is reported only once for each function it appears in
/home/john/git/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:29:11: error: ‘TCP_REPAIR_OFF_NO_WP’ undeclared (first use in this function)
  repair = TCP_REPAIR_OFF_NO_WP;

Then with fix,

$ ./test_progs -n 44
rockchip-linux#44/1 sockmap create_update_free:OK
rockchip-linux#44/2 sockhash create_update_free:OK
rockchip-linux#44 sockmap_basic:OK

Fixes: 5d3919a ("selftests/bpf: Test freeing sockmap/sockhash with a socket in it")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
Link: https://lore.kernel.org/bpf/158131347731.21414.12120493483848386652.stgit@john-Precision-5820-Tower
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
friendlyarm pushed a commit to friendlyarm/kernel-rockchip that referenced this pull request Aug 31, 2020
[ Upstream commit 3c8ce24 ]

The lifetime of EMAD transactions (i.e., 'struct mlxsw_reg_trans') is
managed using RCU. They are freed using kfree_rcu() once the transaction
ends.

However, in case the transaction failed it is freed immediately after being
removed from the active transactions list. This is problematic because it is
still possible for a different CPU to dereference the transaction from an RCU
read-side critical section while traversing the active transaction list in
mlxsw_emad_rx_listener_func(). In which case, a use-after-free is triggered
[1].

Fix this by freeing the transaction after a grace period by calling
kfree_rcu().

[1]
BUG: KASAN: use-after-free in mlxsw_emad_rx_listener_func+0x969/0xac0 drivers/net/ethernet/mellanox/mlxsw/core.c:671
Read of size 8 at addr ffff88800b7964e8 by task syz-executor.2/2881

CPU: 0 PID: 2881 Comm: syz-executor.2 Not tainted 5.8.0-rc4+ rockchip-linux#44
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org 04/01/2014
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0xf6/0x16e lib/dump_stack.c:118
 print_address_description.constprop.0+0x1c/0x250 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 mlxsw_emad_rx_listener_func+0x969/0xac0 drivers/net/ethernet/mellanox/mlxsw/core.c:671
 mlxsw_core_skb_receive+0x571/0x700 drivers/net/ethernet/mellanox/mlxsw/core.c:2061
 mlxsw_pci_cqe_rdq_handle drivers/net/ethernet/mellanox/mlxsw/pci.c:595 [inline]
 mlxsw_pci_cq_tasklet+0x12a6/0x2520 drivers/net/ethernet/mellanox/mlxsw/pci.c:651
 tasklet_action_common.isra.0+0x13f/0x3e0 kernel/softirq.c:550
 __do_softirq+0x223/0x964 kernel/softirq.c:292
 asm_call_on_stack+0x12/0x20 arch/x86/entry/entry_64.S:711
 </IRQ>
 __run_on_irqstack arch/x86/include/asm/irq_stack.h:22 [inline]
 run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:48 [inline]
 do_softirq_own_stack+0x109/0x140 arch/x86/kernel/irq_64.c:77
 invoke_softirq kernel/softirq.c:387 [inline]
 __irq_exit_rcu kernel/softirq.c:417 [inline]
 irq_exit_rcu+0x16f/0x1a0 kernel/softirq.c:429
 sysvec_apic_timer_interrupt+0x4e/0xd0 arch/x86/kernel/apic/apic.c:1091
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:587
RIP: 0010:arch_local_irq_restore arch/x86/include/asm/irqflags.h:85 [inline]
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0x3b/0x40 kernel/locking/spinlock.c:191
Code: e8 2a c3 f4 fc 48 89 ef e8 12 96 f5 fc f6 c7 02 75 11 53 9d e8 d6 db 11 fd 65 ff 0d 1f 21 b3 56 5b 5d c3 e8 a7 d7 11 fd 53 9d <eb> ed 0f 1f 00 55 48 89 fd 65 ff 05 05 21 b3 56 ff 74 24 08 48 8d
RSP: 0018:ffff8880446ffd80 EFLAGS: 00000286
RAX: 0000000000000006 RBX: 0000000000000286 RCX: 0000000000000006
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffffa94ecea9
RBP: ffff888012934408 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000001 R11: fffffbfff57be301 R12: 1ffff110088dffc1
R13: ffff888037b817c0 R14: ffff88802442415a R15: ffff888024424000
 __do_sys_perf_event_open+0x1b5d/0x2bd0 kernel/events/core.c:11874
 do_syscall_64+0x56/0xa0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x473dbd
Code: Bad RIP value.
RSP: 002b:00007f21e5e9cc28 EFLAGS: 00000246 ORIG_RAX: 000000000000012a
RAX: ffffffffffffffda RBX: 000000000057bf00 RCX: 0000000000473dbd
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000040
RBP: 000000000057bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000003 R11: 0000000000000246 R12: 000000000057bf0c
R13: 00007ffd0493503f R14: 00000000004d0f46 R15: 00007f21e5e9cd80

Allocated by task 871:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc mm/kasan/common.c:494 [inline]
 __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:467
 kmalloc include/linux/slab.h:555 [inline]
 kzalloc include/linux/slab.h:669 [inline]
 mlxsw_core_reg_access_emad+0x70/0x1410 drivers/net/ethernet/mellanox/mlxsw/core.c:1812
 mlxsw_core_reg_access+0xeb/0x540 drivers/net/ethernet/mellanox/mlxsw/core.c:1991
 mlxsw_sp_port_get_hw_xstats+0x335/0x7e0 drivers/net/ethernet/mellanox/mlxsw/spectrum.c:1130
 update_stats_cache+0xf4/0x140 drivers/net/ethernet/mellanox/mlxsw/spectrum.c:1173
 process_one_work+0xa3e/0x17a0 kernel/workqueue.c:2269
 worker_thread+0x9e/0x1050 kernel/workqueue.c:2415
 kthread+0x355/0x470 kernel/kthread.c:291
 ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:293

Freed by task 871:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 kasan_set_free_info mm/kasan/common.c:316 [inline]
 __kasan_slab_free+0x12c/0x170 mm/kasan/common.c:455
 slab_free_hook mm/slub.c:1474 [inline]
 slab_free_freelist_hook mm/slub.c:1507 [inline]
 slab_free mm/slub.c:3072 [inline]
 kfree+0xe6/0x320 mm/slub.c:4052
 mlxsw_core_reg_access_emad+0xd45/0x1410 drivers/net/ethernet/mellanox/mlxsw/core.c:1819
 mlxsw_core_reg_access+0xeb/0x540 drivers/net/ethernet/mellanox/mlxsw/core.c:1991
 mlxsw_sp_port_get_hw_xstats+0x335/0x7e0 drivers/net/ethernet/mellanox/mlxsw/spectrum.c:1130
 update_stats_cache+0xf4/0x140 drivers/net/ethernet/mellanox/mlxsw/spectrum.c:1173
 process_one_work+0xa3e/0x17a0 kernel/workqueue.c:2269
 worker_thread+0x9e/0x1050 kernel/workqueue.c:2415
 kthread+0x355/0x470 kernel/kthread.c:291
 ret_from_fork+0x22/0x30 arch/x86/entry/entry_64.S:293

The buggy address belongs to the object at ffff88800b796400
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 232 bytes inside of
 512-byte region [ffff88800b796400, ffff88800b796600)
The buggy address belongs to the page:
page:ffffea00002de500 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 head:ffffea00002de500 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x100000000010200(slab|head)
raw: 0100000000010200 dead000000000100 dead000000000122 ffff88806c402500
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88800b796380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88800b796400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88800b796480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                          ^
 ffff88800b796500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88800b796580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

Fixes: caf7297 ("mlxsw: core: Introduce support for asynchronous EMAD register access")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
rkchrome pushed a commit that referenced this pull request Oct 10, 2020
[ Upstream commit 95a3d8f ]

When xfstests generic/451, there is an BUG at mm/memcontrol.c:
  page:ffffea000560f2c0 refcount:2 mapcount:0 mapping:000000008544e0ea
       index:0xf
  mapping->aops:cifs_addr_ops dentry name:"tst-aio-dio-cycle-write.451"
  flags: 0x2fffff80000001(locked)
  raw: 002fffff80000001 ffffc90002023c50 ffffea0005280088 ffff88815cda0210
  raw: 000000000000000f 0000000000000000 00000002ffffffff ffff88817287d000
  page dumped because: VM_BUG_ON_PAGE(page->mem_cgroup)
  page->mem_cgroup:ffff88817287d000
  ------------[ cut here ]------------
  kernel BUG at mm/memcontrol.c:2659!
  invalid opcode: 0000 [#1] SMP
  CPU: 2 PID: 2038 Comm: xfs_io Not tainted 5.8.0-rc1 #44
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_
    073836-buildvm-ppc64le-16.ppc.4
  RIP: 0010:commit_charge+0x35/0x50
  Code: 0d 48 83 05 54 b2 02 05 01 48 89 77 38 c3 48 c7
        c6 78 4a ea ba 48 83 05 38 b2 02 05 01 e8 63 0d9
  RSP: 0018:ffffc90002023a50 EFLAGS: 00010202
  RAX: 0000000000000000 RBX: ffff88817287d000 RCX: 0000000000000000
  RDX: 0000000000000000 RSI: ffff88817ac97ea0 RDI: ffff88817ac97ea0
  RBP: ffffea000560f2c0 R08: 0000000000000203 R09: 0000000000000005
  R10: 0000000000000030 R11: ffffc900020237a8 R12: 0000000000000000
  R13: 0000000000000001 R14: 0000000000000001 R15: ffff88815a1272c0
  FS:  00007f5071ab0800(0000) GS:ffff88817ac80000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 000055efcd5ca000 CR3: 000000015d312000 CR4: 00000000000006e0
  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
  Call Trace:
   mem_cgroup_charge+0x166/0x4f0
   __add_to_page_cache_locked+0x4a9/0x710
   add_to_page_cache_locked+0x15/0x20
   cifs_readpages+0x217/0x1270
   read_pages+0x29a/0x670
   page_cache_readahead_unbounded+0x24f/0x390
   __do_page_cache_readahead+0x3f/0x60
   ondemand_readahead+0x1f1/0x470
   page_cache_async_readahead+0x14c/0x170
   generic_file_buffered_read+0x5df/0x1100
   generic_file_read_iter+0x10c/0x1d0
   cifs_strict_readv+0x139/0x170
   new_sync_read+0x164/0x250
   __vfs_read+0x39/0x60
   vfs_read+0xb5/0x1e0
   ksys_pread64+0x85/0xf0
   __x64_sys_pread64+0x22/0x30
   do_syscall_64+0x69/0x150
   entry_SYSCALL_64_after_hwframe+0x44/0xa9
  RIP: 0033:0x7f5071fcb1af
  Code: Bad RIP value.
  RSP: 002b:00007ffde2cdb8e0 EFLAGS: 00000293 ORIG_RAX: 0000000000000011
  RAX: ffffffffffffffda RBX: 00007ffde2cdb990 RCX: 00007f5071fcb1af
  RDX: 0000000000001000 RSI: 000055efcd5ca000 RDI: 0000000000000003
  RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
  R10: 0000000000001000 R11: 0000000000000293 R12: 0000000000000001
  R13: 000000000009f000 R14: 0000000000000000 R15: 0000000000001000
  Modules linked in:
  ---[ end trace 725fa14a3e1af65c ]---

Since commit 3fea5a4 ("mm: memcontrol: convert page cache to a new
mem_cgroup_charge() API") not cancel the page charge, the pages maybe
double add to pagecache:
thread1                       | thread2
cifs_readpages
readpages_get_pages
 add_to_page_cache_locked(head,index=n)=0
                              | readpages_get_pages
                              | add_to_page_cache_locked(head,index=n+1)=0
 add_to_page_cache_locked(head, index=n+1)=-EEXIST
 then, will next loop with list head page's
 index=n+1 and the page->mapping not NULL
readpages_get_pages
add_to_page_cache_locked(head, index=n+1)
 commit_charge
  VM_BUG_ON_PAGE

So, we should not do the next loop when any page add to page cache
failed.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Acked-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
friendlyarm pushed a commit to friendlyarm/kernel-rockchip that referenced this pull request Nov 17, 2020
[ Upstream commit 95a3d8f ]

When xfstests generic/451, there is an BUG at mm/memcontrol.c:
  page:ffffea000560f2c0 refcount:2 mapcount:0 mapping:000000008544e0ea
       index:0xf
  mapping->aops:cifs_addr_ops dentry name:"tst-aio-dio-cycle-write.451"
  flags: 0x2fffff80000001(locked)
  raw: 002fffff80000001 ffffc90002023c50 ffffea0005280088 ffff88815cda0210
  raw: 000000000000000f 0000000000000000 00000002ffffffff ffff88817287d000
  page dumped because: VM_BUG_ON_PAGE(page->mem_cgroup)
  page->mem_cgroup:ffff88817287d000
  ------------[ cut here ]------------
  kernel BUG at mm/memcontrol.c:2659!
  invalid opcode: 0000 [#1] SMP
  CPU: 2 PID: 2038 Comm: xfs_io Not tainted 5.8.0-rc1 rockchip-linux#44
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_
    073836-buildvm-ppc64le-16.ppc.4
  RIP: 0010:commit_charge+0x35/0x50
  Code: 0d 48 83 05 54 b2 02 05 01 48 89 77 38 c3 48 c7
        c6 78 4a ea ba 48 83 05 38 b2 02 05 01 e8 63 0d9
  RSP: 0018:ffffc90002023a50 EFLAGS: 00010202
  RAX: 0000000000000000 RBX: ffff88817287d000 RCX: 0000000000000000
  RDX: 0000000000000000 RSI: ffff88817ac97ea0 RDI: ffff88817ac97ea0
  RBP: ffffea000560f2c0 R08: 0000000000000203 R09: 0000000000000005
  R10: 0000000000000030 R11: ffffc900020237a8 R12: 0000000000000000
  R13: 0000000000000001 R14: 0000000000000001 R15: ffff88815a1272c0
  FS:  00007f5071ab0800(0000) GS:ffff88817ac80000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 000055efcd5ca000 CR3: 000000015d312000 CR4: 00000000000006e0
  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
  Call Trace:
   mem_cgroup_charge+0x166/0x4f0
   __add_to_page_cache_locked+0x4a9/0x710
   add_to_page_cache_locked+0x15/0x20
   cifs_readpages+0x217/0x1270
   read_pages+0x29a/0x670
   page_cache_readahead_unbounded+0x24f/0x390
   __do_page_cache_readahead+0x3f/0x60
   ondemand_readahead+0x1f1/0x470
   page_cache_async_readahead+0x14c/0x170
   generic_file_buffered_read+0x5df/0x1100
   generic_file_read_iter+0x10c/0x1d0
   cifs_strict_readv+0x139/0x170
   new_sync_read+0x164/0x250
   __vfs_read+0x39/0x60
   vfs_read+0xb5/0x1e0
   ksys_pread64+0x85/0xf0
   __x64_sys_pread64+0x22/0x30
   do_syscall_64+0x69/0x150
   entry_SYSCALL_64_after_hwframe+0x44/0xa9
  RIP: 0033:0x7f5071fcb1af
  Code: Bad RIP value.
  RSP: 002b:00007ffde2cdb8e0 EFLAGS: 00000293 ORIG_RAX: 0000000000000011
  RAX: ffffffffffffffda RBX: 00007ffde2cdb990 RCX: 00007f5071fcb1af
  RDX: 0000000000001000 RSI: 000055efcd5ca000 RDI: 0000000000000003
  RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
  R10: 0000000000001000 R11: 0000000000000293 R12: 0000000000000001
  R13: 000000000009f000 R14: 0000000000000000 R15: 0000000000001000
  Modules linked in:
  ---[ end trace 725fa14a3e1af65c ]---

Since commit 3fea5a4 ("mm: memcontrol: convert page cache to a new
mem_cgroup_charge() API") not cancel the page charge, the pages maybe
double add to pagecache:
thread1                       | thread2
cifs_readpages
readpages_get_pages
 add_to_page_cache_locked(head,index=n)=0
                              | readpages_get_pages
                              | add_to_page_cache_locked(head,index=n+1)=0
 add_to_page_cache_locked(head, index=n+1)=-EEXIST
 then, will next loop with list head page's
 index=n+1 and the page->mapping not NULL
readpages_get_pages
add_to_page_cache_locked(head, index=n+1)
 commit_charge
  VM_BUG_ON_PAGE

So, we should not do the next loop when any page add to page cache
failed.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Acked-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
friendlyarm pushed a commit to friendlyarm/kernel-rockchip that referenced this pull request Jun 15, 2021
[ Upstream commit d5027ca ]

Ritesh reported a bug [1] against UML, noting that it crashed on
startup. The backtrace shows the following (heavily redacted):

(gdb) bt
...
 rockchip-linux#26 0x0000000060015b5d in sem_init () at ipc/sem.c:268
 rockchip-linux#27 0x00007f89906d92f7 in ?? () from /lib/x86_64-linux-gnu/libcom_err.so.2
 rockchip-linux#28 0x00007f8990ab8fb2 in call_init (...) at dl-init.c:72
...
 rockchip-linux#40 0x00007f89909bf3a6 in nss_load_library (...) at nsswitch.c:359
...
 rockchip-linux#44 0x00007f8990895e35 in _nss_compat_getgrnam_r (...) at nss_compat/compat-grp.c:486
 rockchip-linux#45 0x00007f8990968b85 in __getgrnam_r [...]
 rockchip-linux#46 0x00007f89909d6b77 in grantpt [...]
 rockchip-linux#47 0x00007f8990a9394e in __GI_openpty [...]
 rockchip-linux#48 0x00000000604a1f65 in openpty_cb (...) at arch/um/os-Linux/sigio.c:407
 rockchip-linux#49 0x00000000604a58d0 in start_idle_thread (...) at arch/um/os-Linux/skas/process.c:598
 rockchip-linux#50 0x0000000060004a3d in start_uml () at arch/um/kernel/skas/process.c:45
 rockchip-linux#51 0x00000000600047b2 in linux_main (...) at arch/um/kernel/um_arch.c:334
 rockchip-linux#52 0x000000006000574f in main (...) at arch/um/os-Linux/main.c:144

indicating that the UML function openpty_cb() calls openpty(),
which internally calls __getgrnam_r(), which causes the nsswitch
machinery to get started.

This loads, through lots of indirection that I snipped, the
libcom_err.so.2 library, which (in an unknown function, "??")
calls sem_init().

Now, of course it wants to get libpthread's sem_init(), since
it's linked against libpthread. However, the dynamic linker
looks up that symbol against the binary first, and gets the
kernel's sem_init().

Hajime Tazaki noted that "objcopy -L" can localize a symbol,
so the dynamic linker wouldn't do the lookup this way. I tried,
but for some reason that didn't seem to work.

Doing the same thing in the linker script instead does seem to
work, though I cannot entirely explain - it *also* works if I
just add "VERSION { { global: *; }; }" instead, indicating that
something else is happening that I don't really understand. It
may be that explicitly doing that marks them with some kind of
empty version, and that's different from the default.

Explicitly marking them with a version breaks kallsyms, so that
doesn't seem to be possible.

Marking all the symbols as local seems correct, and does seem
to address the issue, so do that. Also do it for static link,
nsswitch libraries could still be loaded there.

[1] https://bugs.debian.org/983379

Reported-by: Ritesh Raj Sarraf <rrs@debian.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Tested-By: Ritesh Raj Sarraf <rrs@debian.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
friendlyarm pushed a commit to friendlyarm/kernel-rockchip that referenced this pull request Aug 31, 2021
[ Upstream commit 5e21bb4 ]

These two types of XDP progs (BPF_XDP_DEVMAP, BPF_XDP_CPUMAP) will not be
executed directly in the driver, therefore we should also not directly
run them from here. To run in these two situations, there must be further
preparations done, otherwise these may cause a kernel panic.

For more details, see also dev_xdp_attach().

  [   46.982479] BUG: kernel NULL pointer dereference, address: 0000000000000000
  [   46.984295] #PF: supervisor read access in kernel mode
  [   46.985777] #PF: error_code(0x0000) - not-present page
  [   46.987227] PGD 800000010dca4067 P4D 800000010dca4067 PUD 10dca6067 PMD 0
  [   46.989201] Oops: 0000 [#1] SMP PTI
  [   46.990304] CPU: 7 PID: 562 Comm: a.out Not tainted 5.13.0+ rockchip-linux#44
  [   46.992001] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/24
  [   46.995113] RIP: 0010:___bpf_prog_run+0x17b/0x1710
  [   46.996586] Code: 49 03 14 cc e8 76 f6 fe ff e9 ad fe ff ff 0f b6 43 01 48 0f bf 4b 02 48 83 c3 08 89 c2 83 e0 0f c0 ea 04 02
  [   47.001562] RSP: 0018:ffffc900005afc58 EFLAGS: 00010246
  [   47.003115] RAX: 0000000000000000 RBX: ffffc9000023f068 RCX: 0000000000000000
  [   47.005163] RDX: 0000000000000000 RSI: 0000000000000079 RDI: ffffc900005afc98
  [   47.007135] RBP: 0000000000000000 R08: ffffc9000023f048 R09: c0000000ffffdfff
  [   47.009171] R10: 0000000000000001 R11: ffffc900005afb40 R12: ffffc900005afc98
  [   47.011172] R13: 0000000000000001 R14: 0000000000000001 R15: ffffffff825258a8
  [   47.013244] FS:  00007f04a5207580(0000) GS:ffff88842fdc0000(0000) knlGS:0000000000000000
  [   47.015705] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  [   47.017475] CR2: 0000000000000000 CR3: 0000000100182005 CR4: 0000000000770ee0
  [   47.019558] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  [   47.021595] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
  [   47.023574] PKRU: 55555554
  [   47.024571] Call Trace:
  [   47.025424]  __bpf_prog_run32+0x32/0x50
  [   47.026296]  ? printk+0x53/0x6a
  [   47.027066]  ? ktime_get+0x39/0x90
  [   47.027895]  bpf_test_run.cold.28+0x23/0x123
  [   47.028866]  ? printk+0x53/0x6a
  [   47.029630]  bpf_prog_test_run_xdp+0x149/0x1d0
  [   47.030649]  __sys_bpf+0x1305/0x23d0
  [   47.031482]  __x64_sys_bpf+0x17/0x20
  [   47.032316]  do_syscall_64+0x3a/0x80
  [   47.033165]  entry_SYSCALL_64_after_hwframe+0x44/0xae
  [   47.034254] RIP: 0033:0x7f04a51364dd
  [   47.035133] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 48
  [   47.038768] RSP: 002b:00007fff8f9fc518 EFLAGS: 00000213 ORIG_RAX: 0000000000000141
  [   47.040344] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f04a51364dd
  [   47.041749] RDX: 0000000000000048 RSI: 0000000020002a80 RDI: 000000000000000a
  [   47.043171] RBP: 00007fff8f9fc530 R08: 0000000002049300 R09: 0000000020000100
  [   47.044626] R10: 0000000000000004 R11: 0000000000000213 R12: 0000000000401070
  [   47.046088] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
  [   47.047579] Modules linked in:
  [   47.048318] CR2: 0000000000000000
  [   47.049120] ---[ end trace 7ad34443d5be719a ]---
  [   47.050273] RIP: 0010:___bpf_prog_run+0x17b/0x1710
  [   47.051343] Code: 49 03 14 cc e8 76 f6 fe ff e9 ad fe ff ff 0f b6 43 01 48 0f bf 4b 02 48 83 c3 08 89 c2 83 e0 0f c0 ea 04 02
  [   47.054943] RSP: 0018:ffffc900005afc58 EFLAGS: 00010246
  [   47.056068] RAX: 0000000000000000 RBX: ffffc9000023f068 RCX: 0000000000000000
  [   47.057522] RDX: 0000000000000000 RSI: 0000000000000079 RDI: ffffc900005afc98
  [   47.058961] RBP: 0000000000000000 R08: ffffc9000023f048 R09: c0000000ffffdfff
  [   47.060390] R10: 0000000000000001 R11: ffffc900005afb40 R12: ffffc900005afc98
  [   47.061803] R13: 0000000000000001 R14: 0000000000000001 R15: ffffffff825258a8
  [   47.063249] FS:  00007f04a5207580(0000) GS:ffff88842fdc0000(0000) knlGS:0000000000000000
  [   47.065070] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  [   47.066307] CR2: 0000000000000000 CR3: 0000000100182005 CR4: 0000000000770ee0
  [   47.067747] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  [   47.069217] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
  [   47.070652] PKRU: 55555554
  [   47.071318] Kernel panic - not syncing: Fatal exception
  [   47.072854] Kernel Offset: disabled
  [   47.073683] ---[ end Kernel panic - not syncing: Fatal exception ]---

Fixes: 9216477 ("bpf: cpumap: Add the possibility to attach an eBPF program to cpumap")
Fixes: fbee97f ("bpf: Add support to attach bpf program to a devmap entry")
Reported-by: Abaci <abaci@linux.alibaba.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Dust Li <dust.li@linux.alibaba.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: David Ahern <dsahern@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20210708080409.73525-1-xuanzhuo@linux.alibaba.com
Signed-off-by: Sasha Levin <sashal@kernel.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

Successfully merging this pull request may close these issues.

None yet