"value":"In the Linux kernel, the following vulnerability has been resolved:\n\nsched/numa: fix memory leak due to the overwritten vma->numab_state\n\n[Problem Description]\nWhen running the hackbench program of LTP, the following memory leak is\nreported by kmemleak.\n\n # /opt/ltp/testcases/bin/hackbench 20 thread 1000\n Running with 20*40 (== 800) tasks.\n\n # dmesg | grep kmemleak\n ...\n kmemleak: 480 new suspected memory leaks (see /sys/kernel/debug/kmemleak)\n kmemleak: 665 new suspected memory leaks (see /sys/kernel/debug/kmemleak)\n\n # cat /sys/kernel/debug/kmemleak\n unreferenced object 0xffff888cd8ca2c40 (size 64):\n comm \"hackbench\", pid 17142, jiffies 4299780315\n hex dump (first 32 bytes):\n ac 74 49 00 01 00 00 00 4c 84 49 00 01 00 00 00 .tI.....L.I.....\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n backtrace (crc bff18fd4):\n [<ffffffff81419a89>] __kmalloc_cache_noprof+0x2f9/0x3f0\n [<ffffffff8113f715>] task_numa_work+0x725/0xa00\n [<ffffffff8110f878>] task_work_run+0x58/0x90\n [<ffffffff81ddd9f8>] syscall_exit_to_user_mode+0x1c8/0x1e0\n [<ffffffff81dd78d5>] do_syscall_64+0x85/0x150\n [<ffffffff81e0012b>] entry_SYSCALL_64_after_hwframe+0x76/0x7e\n ...\n\nThis issue can be consistently reproduced on three different servers:\n * a 448-core server\n * a 256-core server\n * a 192-core server\n\n[Root Cause]\nSince multiple threads are created by the hackbench program (along with\nthe command argument 'thread'), a shared vma might be accessed by two or\nmore cores simultaneously. When two or more cores observe that\nvma->numab_state is NULL at the same time, vma->numab_state will be\noverwritten.\n\nAlthough current code ensures that only one thread scans the VMAs in a\nsingle 'numa_scan_period', there might be a chance for another thread\nto enter in the next 'numa_scan_period' while we have not gotten till\nnumab_state allocation [1].\n\nNote that the command `/opt/ltp/testcases/bin/hackbench 50 process 1000`\ncannot the reproduce the issue. It is verified with 200+ test runs.\n\n[Solution]\nUse the cmpxchg atomic operation to ensure that only one thread executes\nthe vma->numab_state assignment.\n\n[1] https://lore.kernel.org/lkml/1794be3c-358c-4cdc-a43d-a1f841d91ef7@amd.com/"
"value":"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: sched/numa: se corrige la p\u00e9rdida de memoria debido a la sobrescritura de vma->numab_state [Descripci\u00f3n del problema] Al ejecutar el programa hackbench de LTP, kmemleak informa la siguiente p\u00e9rdida de memoria. # /opt/ltp/testcases/bin/hackbench 20 thread 1000 Se ejecuta con 20*40 (== 800) tareas. # dmesg | grep kmemleak ... kmemleak: 480 nuevas fugas de memoria sospechosas (consulte /sys/kernel/debug/kmemleak) kmemleak: 665 nuevas fugas de memoria sospechosas (consulte /sys/kernel/debug/kmemleak) # cat /sys/kernel/debug/kmemleak objeto sin referencia 0xffff888cd8ca2c40 (tama\u00f1o 64): comm \"hackbench\", pid 17142, jiffies 4299780315 volcado hexadecimal (primeros 32 bytes): ac 74 49 00 01 00 00 00 4c 84 49 00 01 00 00 00 .tI.....LI.... 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ seguimiento inverso (crc bff18fd4): [] __kmalloc_cache_noprof+0x2f9/0x3f0 [] tarea_numa_work+0x725/0xa00 [] tarea_work_run+0x58/0x90 [] llamada_al_sistema_salir_al_modo_usuario+0x1c8/0x1e0 [] hacer_llamada_al_sistema_64+0x85/0x150 [] entry_SYSCALL_64_after_hwframe+0x76/0x7e ... Este problema se puede reproducir consistentemente en tres servidores diferentes: * un servidor de 448 n\u00facleos * un servidor de 256 n\u00facleos * un servidor de 192 n\u00facleos [Causa ra\u00edz] Dado que el programa hackbench crea m\u00faltiples subprocesos (junto con el argumento de comando 'thread'), dos o m\u00e1s n\u00facleos pueden acceder simult\u00e1neamente a un VMA compartido. Cuando dos o m\u00e1s n\u00facleos observan que vma->numab_state es NULL al mismo tiempo, se sobrescribir\u00e1 vma->numab_state. Aunque el c\u00f3digo actual garantiza que solo un subproceso escanee los VMA en un solo 'numa_scan_period', puede haber una posibilidad de que otro subproceso ingrese en el siguiente 'numa_scan_period' mientras no hayamos obtenido hasta la asignaci\u00f3n de numab_state [1]. Tenga en cuenta que el comando `/opt/ltp/testcases/bin/hackbench 50 process 1000` no puede reproducir el problema. Esto se ha verificado con m\u00e1s de 200 ejecuciones de pruebas. [Soluci\u00f3n] Utilice la operaci\u00f3n at\u00f3mica cmpxchg para asegurarse de que solo un subproceso ejecute la asignaci\u00f3n vma->numab_state. [1] https://lore.kernel.org/lkml/1794be3c-358c-4cdc-a43d-a1f841d91ef7@amd.com/"