In the Linux kernel, the following vulnerability has been resolved:
octeontx2-pf: Fix the use of GFP_KERNEL in atomic context on rt
The commit 4af1b64f80fb ("octeontx2-pf: Fix lmtst ID used in aura free") uses the get/putcpu() to protect the usage of percpu pointer in ->aurafreeptr() callback, but it also unnecessarily disable the preemption for the blockable memory allocation. The commit 87b93b678e95 ("octeontx2-pf: Avoid use of GFPKERNEL in atomic context") tried to fix these sleep inside atomic warnings. But it only fix the one for the non-rt kernel. For the rt kernel, we still get the similar warnings like below. BUG: sleeping function called from invalid context at kernel/locking/spinlockrt.c:46 inatomic(): 1, irqsdisabled(): 0, nonblock: 0, pid: 1, name: swapper/0 preemptcount: 1, expected: 0 RCU nest depth: 0, expected: 0 3 locks held by swapper/0/1: #0: ffff800009fc5fe8 (rtnlmutex){+.+.}-{3:3}, at: rtnllock+0x24/0x30 #1: ffff000100c276c0 (&mbox->lock){+.+.}-{3:3}, at: otx2inithwresources+0x8c/0x3a4 #2: ffffffbfef6537e0 (&cpurcache->lock){+.+.}-{2:2}, at: allociovafast+0x1ac/0x2ac Preemption disabled at: [<ffff800008b1908c>] otx2rqaurapoolinit+0x14c/0x284 CPU: 20 PID: 1 Comm: swapper/0 Tainted: G W 6.2.0-rc3-rt1-yocto-preempt-rt #1 Hardware name: Marvell OcteonTX CN96XX board (DT) Call trace: dumpbacktrace.part.0+0xe8/0xf4 showstack+0x20/0x30 dumpstacklvl+0x9c/0xd8 dumpstack+0x18/0x34 _mightresched+0x188/0x224 rtspinlock+0x64/0x110 allociovafast+0x1ac/0x2ac iommudmaallociova+0xd4/0x110 _iommudmamap+0x80/0x144 iommudmamappage+0xe8/0x260 dmamappageattrs+0xb4/0xc0 _otx2allocrbuf+0x90/0x150 otx2rqaurapoolinit+0x1c8/0x284 otx2inithwresources+0xe4/0x3a4 otx2open+0xf0/0x610 _devopen+0x104/0x224 _devchangeflags+0x1e4/0x274 devchangeflags+0x2c/0x7c icopendevs+0x124/0x2f8 ipautoconfig+0x180/0x42c dooneinitcall+0x90/0x4dc dobasicsetup+0x10c/0x14c kernelinitfreeable+0x10c/0x13c kernelinit+0x2c/0x140 retfromfork+0x10/0x20
Of course, we can shuffle the get/putcpu() to only wrap the invocation of ->aurafreeptr() as what commit 87b93b678e95 does. But there are only two ->aurafreeptr() callbacks, otx2aurafreeptr() and cn10kaurafreeptr(). There is no usage of perpcu variable in the otx2aurafreeptr() at all, so the get/putcpu() seems redundant to it. We can move the get/putcpu() into the corresponding callback which really has the percpu variable usage and avoid the sprinkling of get/putcpu() in several places.
[
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@55ba18dc62deff5910c0fa64486dea1ff20832ff",
"target": {
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-14a5e790",
"digest": {
"threshold": 0.9,
"line_hashes": [
"180216307134842886694760735474275332236",
"73766870951184596162189131585467257738",
"276154736603202248226885812527572249087",
"302138788453522313351344653576620148404",
"120167065127459444517910082478258242426"
]
},
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@55ba18dc62deff5910c0fa64486dea1ff20832ff",
"target": {
"function": "otx2_pool_refill_task",
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-452f3232",
"digest": {
"length": 751.0,
"function_hash": "46203870725528048262521291233896244719"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@659518e013d6bd562bb0f1d2d9f99d0ac54720e2",
"target": {
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-6703d79e",
"digest": {
"threshold": 0.9,
"line_hashes": [
"162720610922771334184989391925643476931",
"264778674184036028371811308252936262445",
"157616157347591298529733864676610495477",
"285319259176757935580237532246276841458",
"290629332248977481608044023129319534996",
"249884151540044385259222636892595590505",
"164027980976133695205824592697125690073",
"118125071581963578967397272017538416694",
"270374587135269108840072380966154265374",
"112728635514345889341677939728286232776",
"273462732968119976802381864858116961295",
"267813192304616549074914162872341395276",
"183660800804357254881121579914702652136",
"127376506023992377152049668983619574163",
"98135601722605301404944427420983074532",
"41780164687145270615236382328131373396",
"16388829864833136734923325468099038755",
"124690888505038174048177215258289233044",
"176564619164250756809854026601987551198",
"180233603617291384761990367155193994706",
"116611432715365045169913150171823142451",
"170399564376689379885466684278298749053",
"315670181134482412750768425803470699229",
"39184864846242535504813100298088261431",
"140845289174719778707070715358557969878",
"160408167133207267832755974967990932414",
"305835127996705234460526506324522499667",
"52622931572608389616961811712972720066",
"315745102206753280539892084044488588933",
"292441242241910570033993983003257403373",
"182804587115187196819090791579178429782"
]
},
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@55ba18dc62deff5910c0fa64486dea1ff20832ff",
"target": {
"function": "otx2_sq_aura_pool_init",
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-749096b8",
"digest": {
"length": 1357.0,
"function_hash": "78520111330014718882320739170594944014"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@29e9c67bf3271067735c188e95cf3631ecd64d58",
"target": {
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-75ee4c34",
"digest": {
"threshold": 0.9,
"line_hashes": [
"180216307134842886694760735474275332236",
"73766870951184596162189131585467257738",
"276154736603202248226885812527572249087",
"302138788453522313351344653576620148404",
"120167065127459444517910082478258242426"
]
},
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@659518e013d6bd562bb0f1d2d9f99d0ac54720e2",
"target": {
"function": "otx2_rq_aura_pool_init",
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-7fbaa814",
"digest": {
"length": 1034.0,
"function_hash": "268187038418160126476666220738034681316"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@29e9c67bf3271067735c188e95cf3631ecd64d58",
"target": {
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-8ebe63b7",
"digest": {
"threshold": 0.9,
"line_hashes": [
"162720610922771334184989391925643476931",
"264778674184036028371811308252936262445",
"157616157347591298529733864676610495477",
"285319259176757935580237532246276841458",
"290629332248977481608044023129319534996",
"249884151540044385259222636892595590505",
"164027980976133695205824592697125690073",
"118125071581963578967397272017538416694",
"270374587135269108840072380966154265374",
"112728635514345889341677939728286232776",
"273462732968119976802381864858116961295",
"267813192304616549074914162872341395276",
"183660800804357254881121579914702652136",
"127376506023992377152049668983619574163",
"98135601722605301404944427420983074532",
"41780164687145270615236382328131373396",
"16388829864833136734923325468099038755",
"124690888505038174048177215258289233044",
"176564619164250756809854026601987551198",
"180233603617291384761990367155193994706",
"116611432715365045169913150171823142451",
"170399564376689379885466684278298749053",
"315670181134482412750768425803470699229",
"39184864846242535504813100298088261431",
"140845289174719778707070715358557969878",
"160408167133207267832755974967990932414",
"305835127996705234460526506324522499667",
"52622931572608389616961811712972720066",
"315745102206753280539892084044488588933",
"292441242241910570033993983003257403373",
"182804587115187196819090791579178429782"
]
},
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@29e9c67bf3271067735c188e95cf3631ecd64d58",
"target": {
"function": "otx2_rq_aura_pool_init",
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-ab71610b",
"digest": {
"length": 1034.0,
"function_hash": "268187038418160126476666220738034681316"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@659518e013d6bd562bb0f1d2d9f99d0ac54720e2",
"target": {
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-b6a4b292",
"digest": {
"threshold": 0.9,
"line_hashes": [
"180216307134842886694760735474275332236",
"73766870951184596162189131585467257738",
"276154736603202248226885812527572249087",
"302138788453522313351344653576620148404",
"120167065127459444517910082478258242426"
]
},
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@29e9c67bf3271067735c188e95cf3631ecd64d58",
"target": {
"function": "cn10k_aura_freeptr",
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-bc126023",
"digest": {
"length": 175.0,
"function_hash": "190272289396674518321199261150761998009"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@55ba18dc62deff5910c0fa64486dea1ff20832ff",
"target": {
"function": "cn10k_aura_freeptr",
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-d2bc700e",
"digest": {
"length": 175.0,
"function_hash": "190272289396674518321199261150761998009"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@55ba18dc62deff5910c0fa64486dea1ff20832ff",
"target": {
"function": "otx2_rq_aura_pool_init",
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-d3ef3eaf",
"digest": {
"length": 1034.0,
"function_hash": "268187038418160126476666220738034681316"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@29e9c67bf3271067735c188e95cf3631ecd64d58",
"target": {
"function": "otx2_pool_refill_task",
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-dabb52e8",
"digest": {
"length": 751.0,
"function_hash": "46203870725528048262521291233896244719"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@659518e013d6bd562bb0f1d2d9f99d0ac54720e2",
"target": {
"function": "otx2_pool_refill_task",
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-df2ffcf6",
"digest": {
"length": 751.0,
"function_hash": "46203870725528048262521291233896244719"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@29e9c67bf3271067735c188e95cf3631ecd64d58",
"target": {
"function": "otx2_sq_aura_pool_init",
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-e33b2bca",
"digest": {
"length": 1349.0,
"function_hash": "219606042562827496164380052415873188473"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@659518e013d6bd562bb0f1d2d9f99d0ac54720e2",
"target": {
"function": "cn10k_aura_freeptr",
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-eed50328",
"digest": {
"length": 175.0,
"function_hash": "190272289396674518321199261150761998009"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@659518e013d6bd562bb0f1d2d9f99d0ac54720e2",
"target": {
"function": "otx2_sq_aura_pool_init",
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-f9e52562",
"digest": {
"length": 1357.0,
"function_hash": "78520111330014718882320739170594944014"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@55ba18dc62deff5910c0fa64486dea1ff20832ff",
"target": {
"file": "drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c"
},
"deprecated": false,
"signature_version": "v1",
"id": "CVE-2023-53029-fdc691a0",
"digest": {
"threshold": 0.9,
"line_hashes": [
"162720610922771334184989391925643476931",
"264778674184036028371811308252936262445",
"157616157347591298529733864676610495477",
"285319259176757935580237532246276841458",
"290629332248977481608044023129319534996",
"249884151540044385259222636892595590505",
"164027980976133695205824592697125690073",
"118125071581963578967397272017538416694",
"270374587135269108840072380966154265374",
"112728635514345889341677939728286232776",
"273462732968119976802381864858116961295",
"267813192304616549074914162872341395276",
"183660800804357254881121579914702652136",
"127376506023992377152049668983619574163",
"98135601722605301404944427420983074532",
"41780164687145270615236382328131373396",
"16388829864833136734923325468099038755",
"124690888505038174048177215258289233044",
"176564619164250756809854026601987551198",
"180233603617291384761990367155193994706",
"116611432715365045169913150171823142451",
"170399564376689379885466684278298749053",
"315670181134482412750768425803470699229",
"39184864846242535504813100298088261431",
"140845289174719778707070715358557969878",
"160408167133207267832755974967990932414",
"305835127996705234460526506324522499667",
"52622931572608389616961811712972720066",
"315745102206753280539892084044488588933",
"292441242241910570033993983003257403373",
"182804587115187196819090791579178429782"
]
},
"signature_type": "Line"
}
]