{"id":"CVE-2024-42096","aliases":["CVE-2024-42096"],"related":[],"kind":"vulnerability","state":"published","title":"x86: stop playing stack games in profile_pc()","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nx86: stop playing stack games in profile_pc()\n\nThe 'profile_pc()' function is used for timer-based profiling, which\nisn't really all that relevant any more to begin with, but it also ends\nup making assumptions based on the stack layout that aren't necessarily\nvalid.\n\nBasically, the code tries to account the time spent in spinlocks to the\ncaller rather than the spinlock, and while I support that as a concept,\nit's not worth the code complexity or the KASAN warnings when no serious\nprofiling is done using timers anyway these days.\n\nAnd the code really does depend on stack layout that is only true in the\nsimplest of cases.  We've lost the comment at some point (I think when\nthe 32-bit and 64-bit code was unified), but it used to say:\n\n\tAssume the lock function has either no stack frame or a copy\n\tof eflags from PUSHF.\n\nwhich explains why it just blindly loads a word or two straight off the\nstack pointer and then takes a minimal look at the values to just check\nif they might be eflags or the return pc:\n\n\tEflags always has bits 22 and up cleared unlike kernel addresses\n\nbut that basic stack layout assumption assumes that there isn't any lock\ndebugging etc going on that would complicate the code and cause a stack\nframe.\n\nIt causes KASAN unhappiness reported for years by syzkaller [1] and\nothers [2].\n\nWith no real practical reason for this any more, just remove the code.\n\nJust for historical interest, here's some background commits relating to\nthis code from 2006:\n\n  0cb91a229364 (\"i386: Account spinlocks to the caller during profiling for !FP kernels\")\n  31679f38d886 (\"Simplify profile_pc on x86-64\")\n\nand a code unification from 2009:\n\n  ef4512882dbe (\"x86: time_32/64.c unify profile_pc\")\n\nbut the basics of this thing actually goes back to before the git tree.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nx86: stop playing stack games in profile_pc()\n\nThe 'profile_pc()' function is used for timer-based profiling, which\nisn't really all that relevant any more to begin with, but it also ends\nup making assumptions based on the stack layout that aren't necessarily\nvalid.\n\nBasically, the code tries to account the time spent in spinlocks to the\ncaller rather than the spinlock, and while I support that as a concept,\nit's not worth the code complexity or the KASAN warnings when no serious\nprofiling is done using timers anyway these days.\n\nAnd the code really does depend on stack layout that is only true in the\nsimplest of cases.  We've lost the comment at some point (I think when\nthe 32-bit and 64-bit code was unified), but it used to say:\n\n\tAssume the lock function has either no stack frame or a copy\n\tof eflags from PUSHF.\n\nwhich explains why it just blindly loads a word or two straight off the\nstack pointer and then takes a minimal look at the values to just check\nif they might be eflags or the return pc:\n\n\tEflags always has bits 22 and up cleared unlike kernel addresses\n\nbut that basic stack layout assumption assumes that there isn't any lock\ndebugging etc going on that would complicate the code and cause a stack\nframe.\n\nIt causes KASAN unhappiness reported for years by syzkaller [1] and\nothers [2].\n\nWith no real practical reason for this any more, just remove the code.\n\nJust for historical interest, here's some background commits relating to\nthis code from 2006:\n\n  0cb91a229364 (\"i386: Account spinlocks to the caller during profiling for !FP kernels\")\n  31679f38d886 (\"Simplify profile_pc on x86-64\")\n\nand a code unification from 2009:\n\n  ef4512882dbe (\"x86: time_32/64.c unify profile_pc\")\n\nbut the basics of this thing actually goes back to before the git tree.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: x86: deja de jugar juegos de pila en perfil_pc() La función 'profile_pc()' se utiliza para la creación de perfiles basada en temporizador, lo cual ya no es tan relevante para empezar. , pero también termina haciendo suposiciones basadas en el diseño de la pila que no son necesariamente válidas. Básicamente, el código intenta contabilizar el tiempo invertido en bloqueos de giro para la persona que llama en lugar del bloqueo de giro, y si bien apoyo eso como concepto, no vale la pena la complejidad del código o las advertencias de KASAN cuando de todos modos no se realiza una creación de perfiles seria usando temporizadores en estos días. . Y el código realmente depende del diseño de la pila, lo que solo es cierto en los casos más simples. Perdimos el comentario en algún momento (creo que cuando se unificó el código de 32 y 64 bits), pero solía decir: Supongamos que la función de bloqueo no tiene marco de pila o tiene una copia de eflags de PUSHF. lo que explica por qué simplemente carga ciegamente una o dos palabras directamente desde el puntero de la pila y luego echa un vistazo mínimo a los valores para comprobar si podrían ser eflags o la PC de retorno: Eflags siempre tiene los bits 22 y superiores limpios, a diferencia de las direcciones del kernel, pero Esa suposición básica del diseño de la pila supone que no hay ninguna depuración de bloqueo, etc., que complicaría el código y provocaría un marco de pila. Provoca la infelicidad de KASAN que Syzkaller [1] y otros [2] han informado durante años. Sin ninguna razón práctica real para esto, simplemente elimine el código. Solo por interés histórico, aquí hay algunas confirmaciones de antecedentes relacionadas con este código de 2006: 0cb91a229364 (\"i386: La cuenta se bloquea en la persona que llama durante la creación de perfiles para los núcleos !FP\") 31679f38d886 (\"Simplificar perfil_pc en x86-64\") y una unificación de código de 2009: ef4512882dbe (\"x86: time_32/64.c unify perfil_pc\") pero los conceptos básicos de esto en realidad se remontan a antes del árbol git.","source":"nvd"}],"published":"2024-07-29T17:39:31.620Z","modified":"2026-10-15T01:18:43.320Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},"severities":[{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"}],"cwes":["CWE-908"],"affected":[{"ranges":[{"type":"git","introduced":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","fixed":"65ebdde16e7f5da99dbf8a548fb635837d78384e","status":"affected"},{"type":"git","introduced":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","fixed":"27c3be840911b15a3f24ed623f86153c825b6b29","status":"affected"},{"type":"git","introduced":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","fixed":"49c09ca35a5f521d7fa18caf62fdf378f15e8aa4","status":"affected"},{"type":"git","introduced":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","fixed":"2d07fea561d64357fb7b3f3751e653bf20306d77","status":"affected"},{"type":"git","introduced":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","fixed":"161cef818545ecf980f0e2ebaf8ba7326ce53c2b","status":"affected"},{"type":"git","introduced":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","fixed":"16222beb9f8e5ceb0beeb5cbe54bef16df501a92","status":"affected"},{"type":"git","introduced":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","fixed":"a3b65c8cbc139bfce9541bc81c1bb766e5ba3f68","status":"affected"},{"type":"git","introduced":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","fixed":"093d9603b60093a9aaae942db56107f6432a5dca","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"2.6.12","status":"affected"},{"type":"semver","introduced":"0","fixed":"2.6.12","status":"unaffected"},{"type":"semver","introduced":"4.19.317","lastAffected":"4.19.*","status":"unaffected"},{"type":"semver","introduced":"5.4.279","lastAffected":"5.4.*","status":"unaffected"},{"type":"semver","introduced":"5.10.221","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.15.162","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.1.97","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.37","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.9.8","lastAffected":"6.9.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.10","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"status":"affected","fixed":"4.19.317"},{"status":"affected","introduced":"4.20","fixed":"5.4.279"},{"status":"affected","introduced":"5.5","fixed":"5.10.221"},{"status":"affected","introduced":"5.11","fixed":"5.15.162"},{"status":"affected","introduced":"5.16","fixed":"6.1.97"},{"status":"affected","introduced":"6.2","fixed":"6.6.37"},{"status":"affected","introduced":"6.7","fixed":"6.9.8"},{"status":"affected","version":"6.10"},{"status":"affected","version":"6.10"},{"status":"affected","version":"6.10"},{"status":"affected","version":"6.10"},{"status":"affected","version":"6.10"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/65ebdde16e7f5da99dbf8a548fb635837d78384e","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/27c3be840911b15a3f24ed623f86153c825b6b29","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/49c09ca35a5f521d7fa18caf62fdf378f15e8aa4","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/2d07fea561d64357fb7b3f3751e653bf20306d77","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/161cef818545ecf980f0e2ebaf8ba7326ce53c2b","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/16222beb9f8e5ceb0beeb5cbe54bef16df501a92","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/a3b65c8cbc139bfce9541bc81c1bb766e5ba3f68","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/093d9603b60093a9aaae942db56107f6432a5dca","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html","tags":[],"sources":["cvelist","nvd"]},{"url":"https://cert-portal.siemens.com/productcert/html/ssa-398330.html","tags":[],"sources":["cvelist","nvd"]},{"url":"https://cert-portal.siemens.com/productcert/html/ssa-265688.html","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2024-09-10T16:18:21.628Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-42096","url":"https://www.cve.org/CVERecord?id=CVE-2024-42096","licence":"CVE Terms of Use","modified":"2026-10-15T00:47:52.702Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-42096","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-42096","licence":"Public domain","modified":"2026-10-15T01:18:43.320Z"}],"updatedAt":"2026-11-25T22:58:43.350Z","epss":{"score":0.0024,"percentile":0.16161,"date":"2026-12-01T12:00:22.000Z"}}