"value":"In the Linux kernel, the following vulnerability has been resolved:\n\nibmvnic: fix race between xmit and reset\n\nThere is a race between reset and the transmit paths that can lead to\nibmvnic_xmit() accessing an scrq after it has been freed in the reset\npath. It can result in a crash like:\n\n\tKernel attempted to read user page (0) - exploit attempt? (uid: 0)\n\tBUG: Kernel NULL pointer dereference on read at 0x00000000\n\tFaulting instruction address: 0xc0080000016189f8\n\tOops: Kernel access of bad area, sig: 11 [#1]\n\t...\n\tNIP [c0080000016189f8] ibmvnic_xmit+0x60/0xb60 [ibmvnic]\n\tLR [c000000000c0046c] dev_hard_start_xmit+0x11c/0x280\n\tCall Trace:\n\t[c008000001618f08] ibmvnic_xmit+0x570/0xb60 [ibmvnic] (unreliable)\n\t[c000000000c0046c] dev_hard_start_xmit+0x11c/0x280\n\t[c000000000c9cfcc] sch_direct_xmit+0xec/0x330\n\t[c000000000bfe640] __dev_xmit_skb+0x3a0/0x9d0\n\t[c000000000c00ad4] __dev_queue_xmit+0x394/0x730\n\t[c008000002db813c] __bond_start_xmit+0x254/0x450 [bonding]\n\t[c008000002db8378] bond_start_xmit+0x40/0xc0 [bonding]\n\t[c000000000c0046c] dev_hard_start_xmit+0x11c/0x280\n\t[c000000000c00ca4] __dev_queue_xmit+0x564/0x730\n\t[c000000000cf97e0] neigh_hh_output+0xd0/0x180\n\t[c000000000cfa69c] ip_finish_output2+0x31c/0x5c0\n\t[c000000000cfd244] __ip_queue_xmit+0x194/0x4f0\n\t[c000000000d2a3c4] __tcp_transmit_skb+0x434/0x9b0\n\t[c000000000d2d1e0] __tcp_retransmit_skb+0x1d0/0x6a0\n\t[c000000000d2d984] tcp_retransmit_skb+0x34/0x130\n\t[c000000000d310e8] tcp_retransmit_timer+0x388/0x6d0\n\t[c000000000d315ec] tcp_write_timer_handler+0x1bc/0x330\n\t[c000000000d317bc] tcp_write_timer+0x5c/0x200\n\t[c000000000243270] call_timer_fn+0x50/0x1c0\n\t[c000000000243704] __run_timers.part.0+0x324/0x460\n\t[c000000000243894] run_timer_softirq+0x54/0xa0\n\t[c000000000ea713c] __do_softirq+0x15c/0x3e0\n\t[c000000000166258] __irq_exit_rcu+0x158/0x190\n\t[c000000000166420] irq_exit+0x20/0x40\n\t[c00000000002853c] timer_interrupt+0x14c/0x2b0\n\t[c000000000009a00] decrementer_common_virt+0x210/0x220\n\t--- interrupt: 900 at plpar_hcall_norets_notrace+0x18/0x2c\n\nThe immediate cause of the crash is the access of tx_scrq in the following\nsnippet during a reset, where the tx_scrq can be either NULL or an address\nthat will soon be invalid:\n\n\tibmvnic_xmit()\n\t{\n\t\t...\n\t\ttx_scrq = adapter->tx_scrq[queue_num];\n\t\ttxq = netdev_get_tx_queue(netdev, queue_num);\n\t\tind_bufp = &tx_scrq->ind_buf;\n\n\t\tif (test_bit(0, &adapter->resetting)) {\n\t\t...\n\t}\n\nBut beyond that, the call to ibmvnic_xmit() itself is not safe during a\nreset and the reset path attempts to avoid this by stopping the queue in\nibmvnic_cleanup(). However just after the queue was stopped, an in-flight\nibmvnic_complete_tx() could have restarted the queue even as the reset is\nprogressing.\n\nSince the queue was restarted we could get a call to ibmvnic_xmit() which\ncan then access the bad tx_scrq (or other fields).\n\nWe cannot however simply have ibmvnic_complete_tx() check the ->resetting\nbit and skip starting the queue. This can race at the \"back-end\"ofagood\nresetwhichjustrestartedthequeuebuthasnotclearedthe->resetting\nbityet.Ifweskiprestartingthequeuedueto->resettingbeingtrue,\nthequeuewouldremainstoppedindefinitelypotentiallyleadingtotransmit\ntimeouts.\n\nIOW->resettingistoobroadforthispurpose.Insteaduseanewflag\nthatindicateswhetherornotthequeuesareactive.Onlytheopen/\nresetpathscontrolwhenthequeuesareactive.ibmvnic_complete_tx()\nandotherswakeupthequeueonlyifthequeueismarkedactive.\n\nSowewillhave:\n\tA.reset/openthreadinibmvnic_cleanup()and__ibmvnic_open()\n\n\t\t->resetting=true\n\t\t->tx_queues_active=false\n\t\tdisabletxqueues\n\t\t...\n\t\t->tx_queues_active=true\n\t\tstarttxqueues\n\n\tB.Txinterruptinibmvnic_complete_tx():\n\n\t\tif(->tx_queues_active)\n\t\t\tnetif_wake_subqueue();\n\nToensurethat->tx_queues_activeandstateofthequeuesareconsistent,\nweneedalockwhich:\n\n\t-mustalsobetakenin
"value":"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: ibmvnic: se corrige la ejecuci\u00f3n entre xmit y reset Existe una ejecuci\u00f3n entre reset y las rutas de transmisi\u00f3n que puede provocar que ibmvnic_xmit() acceda a un scrq despu\u00e9s de que se haya liberado en la ruta de reset. Puede provocar un bloqueo como: El kernel intent\u00f3 leer la p\u00e1gina del usuario (0): \u00bfintento de explotaci\u00f3n? (uid: 0) ERROR: Desreferencia de puntero NULL del kernel en lectura en 0x00000000 Direcci\u00f3n de instrucci\u00f3n con error: 0xc0080000016189f8 Oops: Acceso del kernel al \u00e1rea defectuosa, sig: 11 [#1] ... NIP [c0080000016189f8] ibmvnic_xmit+0x60/0xb60 [ibmvnic] LR [c000000000c0046c] dev_hard_start_xmit+0x11c/0x280 Rastreo de llamadas: [c008000001618f08] ibmvnic_xmit+0x570/0xb60 [ibmvnic] (no confiable) [c000000000c0046c] dev_hard_start_xmit+0x11c/0x280 [c000000000c9cfcc] sch_direct_xmit+0xec/0x330 [c000000000bfe640] __dev_xmit_skb+0x3a0/0x9d0 [c000000000c00ad4] __dev_queue_xmit+0x394/0x730 [c008000002db813c] __bond_start_xmit+0x254/0x450 [enlace] [c008000002db8378] bond_start_xmit+0x40/0xc0 [enlace] [c000000000c0046c] dev_hard_start_xmit+0x11c/0x280 [c000000000c00ca4] __dev_queue_xmit+0x564/0x730 [c000000000cf97e0] neigh_hh_output+0xd0/0x180 [c000000000cfa69c] ip_finish_output2+0x31c/0x5c0 [c000000000cfd244] __ip_queue_xmit+0x194/0x4f0 [c000000000d2a3c4] __tcp_transmit_skb+0x434/0x9b0 [c000000000d2d1e0] __tcp_retransmit_skb+0x1d0/0x6a0 [c000000000d2d984] tcp_retransmit_skb+0x34/0x130 [c000000000d310e8] tcp_retransmit_timer+0x388/0x6d0 [c000000000d315ec] tcp_write_timer_handler+0x1bc/0x330 [c000000000d317bc] tcp_write_timer+0x5c/0x200 [c000000000243270] call_timer_fn+0x50/0x1c0 [c000000000243704] __run_timers.part.0+0x324/0x460 [c000000000243894] run_timer_softirq+0x54/0xa0 [c000000000ea713c] __do_softirq+0x15c/0x3e0 [c000000000166258] __irq_exit_rcu+0x158/0x190 [c000000000166420] irq_exit+0x20/0x40 [c00000000002853c] timer_interrupt+0x14c/0x2b0 [c000000000009a00] decrementer_common_virt+0x210/0x220 --- interrupci\u00f3n: 900 La causa inmediata del bloqueo es el acceso a tx_scrq en el siguiente fragmento durante un reinicio, donde tx_scrq puede ser NULL o una direcci\u00f3n que pronto ser\u00e1 inv\u00e1lida: ibmvnic_xmit() { ... tx_scrq = adaptador->tx_scrq[queue_num]; txq = netdev_get_tx_queue(netdev, queue_num); ind_bufp = &tx_scrq->ind_buf; if (test_bit(0, &adapter->resetting)) { ... } Pero m\u00e1s all\u00e1 de eso, la llamada a ibmvnic_xmit() en s\u00ed no es segura durante un reinicio y la ruta de reinicio intenta evitar esto deteniendo la cola en ibmvnic_cleanup(). Sin embargo, justo despu\u00e9s de que se detuviera la cola, una ibmvnic_complete_tx() en curso podr\u00eda haber reiniciado la cola incluso mientras el reinicio estaba en progreso. Dado que la cola se reinici\u00f3, podr\u00edamos recibir una llamada a ibmvnic_xmit() que luego puede acceder al tx_scrq incorrecto (u otros campos). Sin embargo, no podemos simplemente hacer que ibmvnic_complete_tx() verifique el bit ->resetting y omita el inicio de la cola. Esto puede funcionar en el \"back-end\"deunreiniciocorrectoquesimplementereinici\u00f3lacolaperoa\u00fannoborr\u00f3elbit->resetting.Siomitimoselreiniciodelacoladebidoaque->resettingesverdadero,lacolapermanecer\u00edadetenidaindefinidamente,loquepodr\u00edaprovocartiemposdeesperadetransmisi\u00f3n.IOW->resettingesdemasiadoamplioparaesteprop\u00f3sito.Ensulugar,useunnuevoindicadorqueindiquesilascolasest\u00e1nactivasono.Sololasrutasdeapertura/reiniciocontrolancu\u00e1ndoest\u00e1nactivaslascolas.ibmvnic_complete_tx()yotrosactivanlacolasolosilacolaest\u00e1marcadacomoactiva.Porlotanto,tendremos:A.restablecer/abrirsubprocesoenibmvnic_cleanup()y__ibmvnic_open()->resetting=true->tx_queues_active=falsedeshabilitarcolasdetransmisi\u00f3n...->tx_queues_active=trueiniciarcolasdetransmisi\u00f3nB.Interru