"value":"In the Linux kernel, the following vulnerability has been resolved:\n\nxhci: Handle TD clearing for multiple streams case\n\nWhen multiple streams are in use, multiple TDs might be in flight when\nan endpoint is stopped. We need to issue a Set TR Dequeue Pointer for\neach, to ensure everything is reset properly and the caches cleared.\nChange the logic so that any N>1 TDs found active for different streams\nare deferred until after the first one is processed, calling\nxhci_invalidate_cancelled_tds() again from xhci_handle_cmd_set_deq() to\nqueue another command until we are done with all of them. Also change\nthe error/\"should never happen\" paths to ensure we at least clear any\naffected TDs, even if we can't issue a command to clear the hardware\ncache, and complain loudly with an xhci_warn() if this ever happens.\n\nThis problem case dates back to commit e9df17eb1408 (\"USB: xhci: Correct\nassumptions about number of rings per endpoint.\") early on in the XHCI\ndriver's life, when stream support was first added.\nIt was then identified but not fixed nor made into a warning in commit\n674f8438c121 (\"xhci: split handling halted endpoints into two steps\"),\nwhich added a FIXME comment for the problem case (without materially\nchanging the behavior as far as I can tell, though the new logic made\nthe problem more obvious).\n\nThen later, in commit 94f339147fc3 (\"xhci: Fix failure to give back some\ncached cancelled URBs.\"), it was acknowledged again.\n\n[Mathias: commit 94f339147fc3 (\"xhci: Fix failure to give back some cached\ncancelled URBs.\")wasatargetedregressionfixtothepreviouslymentioned\npatch.Usersreportedissueswithusbstuckafterunmounting/disconnecting\nUASdevices.ThisrolledbacktheTDclearingofmultiplestreamstoits\noriginalstate.]\n\nApparentlythecommitauthorwasawareoftheproblem(yetstillchose\ntosubmitit):ItwasstillmentionedasaFIXME,anxhci_dbg()was\naddedtologtheproblemcondition,andtheremainingissuewasmentioned\ninthecommitdescription.Thechoiceofmakingthelogtypexhci_dbg()\nforwhatis,atthispoint,acompletelyunhandledandknownbroken\nconditionispuzzlingandunfortunate,asitguaranteesthatnoactual\nuserswouldseetheloginproduction,therebymakingitnigh\nundebuggable(indeed,evenifyouturnonDEBUG,themessagedoesn't\nreallyhintattherebeingaproblematall).\n\nIttookme*months*ofrandomxHCcrashestofinallyfindareliable\nreproandbeabletodoadeepdivedebugsession,whichcouldallhave\nbeenavoidedhadthisunhandled,brokenconditionbeenactuallyreported\nwithawarning,asitshouldhavebeenasabugintentionallyleftin\nunfixed(nevermindthatitshouldn'thavebeenleftinatall).\n\n>Anotherfixtosolveclearingthecachesofallstreamringswith\n>cancelledTDsisneeded,butnotasurgent.\n\n3yearsafterthatstatementand14yearsaftertheoriginalbugwas\nintroduced,Ithinkit'sfinallytimetofixit.Andmaybenexttime\nlet'snotleavebugsunfixed(thatareactuallyworsethantheoriginal\nbug),andlet'sactuallygetpeopletoreviewkernelcommitsplease.\n\nFixesxHCcrashesandIOMMUfaultswithUASdeviceswhenhandling\nerrors/faults.Easiestreproistouse`hdparm`tomarkanearlysector\n(e.g.1024)onadiskasbad,then`cat/dev/sdX>/dev/null`inaloop.\nAtleastinthecaseofJMicroncontrollers,thereaderrorsendup\nhavingtocanceltwoTDs(fortwoqueuedrequeststodifferentstreams)\nandtheonethatdidn'tgetclearedproperlyendsupfaultingthexHC\nentirelywhenittriestoaccessDMApagesthathavesincebeenunmapped,\nreferredtobythestaleTDs.Thisnormallyhappensquickly(aftertwo\northreeloops).Afterthisfix,Ileftthe`cat`inalooprunning\novernightandexperiencednoxHCfailures,withallreaderrors\nrecoveredproperly.Repro'dandtestedonanAppleM1MacMini\n(dwc3host).\n\nOnsystemswithoutanIOMMU,thisbugwouldinsteadsilentlycorrupt\nfreedmemory,makingthisa\n---truncated--
"value":"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: xhci: Manejar el borrado de TD para el caso de m\u00faltiples flujos Cuando se utilizan m\u00faltiples flujos, es posible que haya m\u00faltiples TD en vuelo cuando se detiene un endpoint. Necesitamos emitir un puntero de salida de cola TR para cada uno, para garantizar que todo se restablezca correctamente y se borren los cach\u00e9s. Cambie la l\u00f3gica para que cualquier N>1 TD que se encuentre activo para diferentes flujos se difiera hasta despu\u00e9s de que se procese el primero, llamando a xhci_invalidate_cancelled_tds() nuevamente desde xhci_handle_cmd_set_deq() para poner en cola otro comando hasta que hayamos terminado con todos ellos. Tambi\u00e9n cambie las rutas de error/\"nunca deber\u00eda suceder\" para asegurarnos de que al menos borramos los TD afectados, incluso si no podemos emitir un comando para borrar el cach\u00e9 del hardware, y quejarnos en voz alta con un xhci_warn() si esto alguna vez sucede. Este caso de problema se remonta al commit e9df17eb1408 (\"USB: xhci: Suposiciones correctas sobre el n\u00famero de anillos por endpoint.\") al principio de la vida del controlador XHCI, cuando se agreg\u00f3 por primera vez el soporte de transmisi\u00f3n. Luego se identific\u00f3, pero no se solucion\u00f3 ni se convirti\u00f3 en una advertencia en el commit 674f8438c121 (\"xhci: dividir el manejo de endpoints detenidos en dos pasos\"), que agreg\u00f3 un comentario FIXME para el caso del problema (sin cambiar materialmente el comportamiento, hasta donde yo s\u00e9). , aunque la nueva l\u00f3gica hizo que el problema fuera m\u00e1s obvio). Luego, m\u00e1s tarde, en el commit 94f339147fc3 (\"xhci: Se corrigi\u00f3 el error al devolver algunas URB canceladas en cach\u00e9\"), se reconoci\u00f3 nuevamente. [Mathias: commit 94f339147fc3 (\"xhci: Se corrigi\u00f3 el error al devolver algunas URB canceladas en cach\u00e9\")fueunasoluci\u00f3nderegresi\u00f3nespec\u00edficaparaelparchemencionadoanteriormente.LosusuariosinformaronproblemasconelUSBatascadodespu\u00e9sdedesmontar/desconectardispositivosUAS.Estorevirti\u00f3lalimpiezadeTDdem\u00faltiplestransmisionesasuestadooriginal.]Aparentemente,elautordeelcommitestabaaltantodelproblema(peroa\u00fanas\u00eddecidi\u00f3enviarlo):todav\u00edasemencionabacomoFIXME,seagreg\u00f3unxhci_dbg()pararegistrarelcondici\u00f3ndelproblemayelproblemarestantesemencion\u00f3enladescripci\u00f3ndeElcommit.Laelecci\u00f3ndecreareltipoderegistroxhci_dbg()paraloque,enestemomento,esunacondici\u00f3nrotacompletamentenocontroladayconocidaesdesconcertanteydesafortunada,yaquegarantizaquening\u00fanusuariorealver\u00e1elregistroenproducci\u00f3n,loquelohacecasinodepurable(dehecho,inclusosiactivaDEBUG,elmensajerealmentenoindicaquehayaning\u00fanproblema).Metom\u00f3*meses*defallasaleatoriasdexHCparafinalmenteencontrarunareproducci\u00f3nconfiableypoderrealizarunasesi\u00f3ndedepuraci\u00f3nprofunda,quepodr\u00edahaberseevitadosiestacondici\u00f3nrotaynocontroladasehubierainformadoconunaadvertencia,comodeber\u00edahabersido.hasidounerrorquesedej\u00f3intencionalmentesincorregir(sinimportarquenodeber\u00edahabersedejadoenabsoluto).>Senecesitaotrasoluci\u00f3nparasolucionarelborradodeloscach\u00e9sdetodoslosanillosdetransmisi\u00f3ncon>TDcancelados,peronoestanurgente.3a\u00f1osdespu\u00e9sdeesadeclaraci\u00f3ny14a\u00f1osdespu\u00e9sdequeseintrodujoelerrororiginal,creoquefinalmenteeshoradesolucionarlo.Ytalvezlapr\u00f3ximaveznodejemoserroressincorregir(queenrealidadsonpeoresqueelerrororiginal),yhagamosquelagentereviselasconfirmacionesdelkernel,porfavor.SolucionafallasdexHCyfallasdeIOMMUcondispositivosUASalmanejarerrores/fallas.Lareproducci\u00f3nm\u00e1ssencillaesusar`hdparm`paramarcarunsec