« Volver al listado

CVE-2026-23394

Estado: ModificadaMedia (4.7)—

In the Linux kernel, the following vulnerability has been resolved:

af_unix: Give up GC if MSG_PEEK intervened.

Igor Ushakov reported that GC purged the receive queue of an alive socket due to a race with MSG_PEEK with a nice repro.

After GC was replaced with the current algorithm, the cited commit removed the locking dance in unix_peek_fds() and reintroduced the same issue.

The problem is that MSG_PEEK bumps a file refcount without interacting with GC.

Consider an SCC containing sk-A and sk-B, where sk-A is close()d but can be recv()ed via sk-B.

The bad thing happens if sk-A is recv()ed with MSG_PEEK from sk-B and sk-B is close()d while GC is checking unix_vertex_dead() for sk-A and sk-B.

Leer descripción completaMostrar menos

Initially, sk-A's file refcount is 1 by the inflight fd in sk-B recvq. GC thinks sk-A is dead because the file refcount is the same as the number of its inflight fds.

However, sk-A's file refcount is bumped silently by MSG_PEEK, which invalidates the previous evaluation.

At this moment, sk-B's file refcount is 2; one by the open fd, and one by the inflight fd in sk-A. The subsequent close() releases one refcount by the former.

Finally, GC incorrectly concludes that both sk-A and sk-B are dead.

One option is to restore the locking dance in unix_peek_fds(), but we can resolve this more elegantly thanks to the new algorithm.

The point is that the issue does not occur without the subsequent close() and we actually do not need to synchronise MSG_PEEK with the dead SCC detection.

When the issue occurs, close() and GC touch the same file refcount. If GC sees the refcount being decremented by close(), it can just give up garbage-collecting the SCC.

Therefore, we only need to signal the race during MSG_PEEK with a proper memory barrier to make it visible to the GC.

Let's use seqcount_t to notify GC when MSG_PEEK occurs and let it defer the SCC to the next run.

This way no locking is needed on the MSG_PEEK side, and we can avoid imposing a penalty on every MSG_PEEK unnecessarily.

Note that we can retry within unix_scc_dead() if MSG_PEEK is detected, but we do not do so to avoid hung task splat from abusive MSG_PEEK calls.

Detalles técnicos trazas, registros y código del informe original
This is the exact same issue previously fixed by commit
cbcf01128d0a ("af_unix: fix garbage collect vs MSG_PEEK").

  GC thread                    User thread
  ---------                    -----------
  unix_vertex_dead(sk-A)
  -> true   <------.
                    \
                     `------   recv(sk-B, MSG_PEEK)
              invalidate !!    -> sk-A's file refcount : 1 -> 2

                               close(sk-B)
                               -> sk-B's file refcount : 2 -> 1
  unix_vertex_dead(sk-B)
  -> true

CVSS

Probabilidad de explotación (EPSS)

EPSS (Exploit Prediction Scoring System, de FIRST) estima la probabilidad de que una vulnerabilidad sea explotada en 30 días. Complementa a CVSS (impacto) y a CISA KEV (explotación confirmada).

Tecnologías afectadas (1)

CWE

Referencias

JSON original (NVD)

Mostrar
{
  "id": "CVE-2026-23394",
  "cveTags": [],
  "metrics": {
    "cvssMetricV31": [
      {
        "type": "Primary",
        "source": "nvd@nist.gov",
        "cvssData": {
          "scope": "UNCHANGED",
          "version": "3.1",
          "baseScore": 4.7,
          "attackVector": "LOCAL",
          "baseSeverity": "MEDIUM",
          "vectorString": "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H",
          "integrityImpact": "NONE",
          "userInteraction": "NONE",
          "attackComplexity": "HIGH",
          "availabilityImpact": "HIGH",
          "privilegesRequired": "LOW",
          "confidentialityImpact": "NONE"
        },
        "impactScore": 3.6,
        "exploitabilityScore": 1
      }
    ]
  },
  "affected": [
    {
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
      "affectedData": [
        {
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "product": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "61a75360dca93c945ef6bd757f8b8a96f39b77cb",
              "lessThan": "980999a96e1ad043f1197606e5d637219cb102b9",
              "versionType": "git"
            },
            {
              "status": "affected",
              "version": "7b1ffbd3b22e755d481d49647dcb7c5cfbde5844",
              "lessThan": "3106f326f67c03dd9da4ca64663d11e40138cf40",
              "versionType": "git"
            },
            {
              "status": "affected",
              "version": "118f457da9ed58a79e24b73c2ef0aa1987241f0e",
              "lessThan": "e3dd56fb5683ba80bf8d7a2f9aa21cfa53f05202",
              "versionType": "git"
            },
            {
              "status": "affected",
              "version": "118f457da9ed58a79e24b73c2ef0aa1987241f0e",
              "lessThan": "72cf49ad50c16270b52bc512d9c2df5743922968",
              "versionType": "git"
            },
            {
              "status": "affected",
              "version": "118f457da9ed58a79e24b73c2ef0aa1987241f0e",
              "lessThan": "37dd7ab332396eb8dd80b2dc7ea4b61abf767436",
              "versionType": "git"
            },
            {
              "status": "affected",
              "version": "118f457da9ed58a79e24b73c2ef0aa1987241f0e",
              "lessThan": "e5b31d988a41549037b8d8721a3c3cae893d8670",
              "versionType": "git"
            },
            {
              "status": "affected",
              "version": "6.1.141",
              "lessThan": "6.1.183",
              "versionType": "semver"
            },
            {
              "status": "affected",
              "version": "6.6.93",
              "lessThan": "6.6.142",
              "versionType": "semver"
            }
          ],
          "programFiles": [
            "net/unix/af_unix.c",
            "net/unix/af_unix.h",
            "net/unix/garbage.c"
          ],
          "defaultStatus": "unaffected"
        },
        {
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "product": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "6.10"
            },
            {
              "status": "unaffected",
              "version": "0",
              "lessThan": "6.10",
              "versionType": "semver"
            },
            {
              "status": "unaffected",
              "version": "6.1.183",
              "versionType": "semver",
              "lessThanOrEqual": "6.1.*"
            },
            {
              "status": "unaffected",
              "version": "6.6.142",
              "versionType": "semver",
              "lessThanOrEqual": "6.6.*"
            },
            {
              "status": "unaffected",
              "version": "6.12.92",
              "versionType": "semver",
              "lessThanOrEqual": "6.12.*"
            },
            {
              "status": "unaffected",
              "version": "6.18.23",
              "versionType": "semver",
              "lessThanOrEqual": "6.18.*"
            },
            {
              "status": "unaffected",
              "version": "6.19.10",
              "versionType": "semver",
              "lessThanOrEqual": "6.19.*"
            },
            {
              "status": "unaffected",
              "version": "7.0",
              "versionType": "original_commit_for_fix",
              "lessThanOrEqual": "*"
            }
          ],
          "programFiles": [
            "net/unix/af_unix.c",
            "net/unix/af_unix.h",
            "net/unix/garbage.c"
          ],
          "defaultStatus": "affected"
        }
      ]
    }
  ],
  "published": "2026-03-25T11:16:40.190",
  "references": [
    {
      "url": "https://git.kernel.org/stable/c/3106f326f67c03dd9da4ca64663d11e40138cf40",
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    },
    {
      "url": "https://git.kernel.org/stable/c/37dd7ab332396eb8dd80b2dc7ea4b61abf767436",
      "tags": [
        "Patch"
      ],
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    },
    {
      "url": "https://git.kernel.org/stable/c/72cf49ad50c16270b52bc512d9c2df5743922968",
      "tags": [
        "Patch"
      ],
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    },
    {
      "url": "https://git.kernel.org/stable/c/980999a96e1ad043f1197606e5d637219cb102b9",
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    },
    {
      "url": "https://git.kernel.org/stable/c/e3dd56fb5683ba80bf8d7a2f9aa21cfa53f05202",
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    },
    {
      "url": "https://git.kernel.org/stable/c/e5b31d988a41549037b8d8721a3c3cae893d8670",
      "tags": [
        "Patch"
      ],
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    }
  ],
  "vulnStatus": "Modified",
  "weaknesses": [
    {
      "type": "Primary",
      "source": "nvd@nist.gov",
      "description": [
        {
          "lang": "en",
          "value": "CWE-362"
        }
      ]
    }
  ],
  "descriptions": [
    {
      "lang": "en",
      "value": "In the Linux kernel, the following vulnerability has been resolved:\n\naf_unix: Give up GC if MSG_PEEK intervened.\n\nIgor Ushakov reported that GC purged the receive queue of\nan alive socket due to a race with MSG_PEEK with a nice repro.\n\nThis is the exact same issue previously fixed by commit\ncbcf01128d0a (\"af_unix: fix garbage collect vs MSG_PEEK\").\n\nAfter GC was replaced with the current algorithm, the cited\ncommit removed the locking dance in unix_peek_fds() and\nreintroduced the same issue.\n\nThe problem is that MSG_PEEK bumps a file refcount without\ninteracting with GC.\n\nConsider an SCC containing sk-A and sk-B, where sk-A is\nclose()d but can be recv()ed via sk-B.\n\nThe bad thing happens if sk-A is recv()ed with MSG_PEEK from\nsk-B and sk-B is close()d while GC is checking unix_vertex_dead()\nfor sk-A and sk-B.\n\n  GC thread                    User thread\n  ---------                    -----------\n  unix_vertex_dead(sk-A)\n  -> true   <------.\n                    \\\n                     `------   recv(sk-B, MSG_PEEK)\n              invalidate !!    -> sk-A's file refcount : 1 -> 2\n\n                               close(sk-B)\n                               -> sk-B's file refcount : 2 -> 1\n  unix_vertex_dead(sk-B)\n  -> true\n\nInitially, sk-A's file refcount is 1 by the inflight fd in sk-B\nrecvq.  GC thinks sk-A is dead because the file refcount is the\nsame as the number of its inflight fds.\n\nHowever, sk-A's file refcount is bumped silently by MSG_PEEK,\nwhich invalidates the previous evaluation.\n\nAt this moment, sk-B's file refcount is 2; one by the open fd,\nand one by the inflight fd in sk-A.  The subsequent close()\nreleases one refcount by the former.\n\nFinally, GC incorrectly concludes that both sk-A and sk-B are dead.\n\nOne option is to restore the locking dance in unix_peek_fds(),\nbut we can resolve this more elegantly thanks to the new algorithm.\n\nThe point is that the issue does not occur without the subsequent\nclose() and we actually do not need to synchronise MSG_PEEK with\nthe dead SCC detection.\n\nWhen the issue occurs, close() and GC touch the same file refcount.\nIf GC sees the refcount being decremented by close(), it can just\ngive up garbage-collecting the SCC.\n\nTherefore, we only need to signal the race during MSG_PEEK with\na proper memory barrier to make it visible to the GC.\n\nLet's use seqcount_t to notify GC when MSG_PEEK occurs and let\nit defer the SCC to the next run.\n\nThis way no locking is needed on the MSG_PEEK side, and we can\navoid imposing a penalty on every MSG_PEEK unnecessarily.\n\nNote that we can retry within unix_scc_dead() if MSG_PEEK is\ndetected, but we do not do so to avoid hung task splat from\nabusive MSG_PEEK calls."
    },
    {
      "lang": "es",
      "value": "En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\naf_unix: Abandonar la recolección de basura (GC) si MSG_PEEK intervino.\n\nIgor Ushakov informó que la recolección de basura (GC) purgó la cola de recepción de un socket activo debido a una condición de carrera con MSG_PEEK con una buena reproducción.\n\nEste es exactamente el mismo problema previamente solucionado por el commit cbcf01128d0a ('af_unix: corregir recolección de basura vs MSG_PEEK').\n\nDespués de que la recolección de basura (GC) fue reemplazada por el algoritmo actual, el commit citado eliminó la 'danza de bloqueo' en unix_peek_fds() y reintrodujo el mismo problema.\n\nEl problema es que MSG_PEEK incrementa un contador de referencias de archivo sin interactuar con la recolección de basura (GC).\n\nConsidere un SCC que contiene sk-A y sk-B, donde sk-A está close()d (cerrado) pero puede ser recv()ed (recibido) a través de sk-B.\n\nLo malo sucede si sk-A es recv()ed (recibido) con MSG_PEEK desde sk-B y sk-B está close()d (cerrado) mientras la recolección de basura (GC) está verificando unix_vertex_dead() para sk-A y sk-B.\n\n  Hilo de GC                    Hilo de usuario\n  ---------                    -----------\n  unix_vertex_dead(sk-A)\n  -&gt; true   &lt;------.\n                    \\\n                     `------   recv(sk-B, MSG_PEEK)\n              ¡¡invalidar!!    -&gt; contador de referencias de archivo de sk-A : 1 -&gt; 2\n\n                               close(sk-B)\n                               -&gt; contador de referencias de archivo de sk-B : 2 -&gt; 1\n  unix_vertex_dead(sk-B)\n  -&gt; true\n\nInicialmente, el contador de referencias de archivo de sk-A es 1 por el descriptor de archivo en tránsito en la cola de recepción de sk-B. La recolección de basura (GC) piensa que sk-A está muerto porque el contador de referencias de archivo es el mismo que el número de sus descriptores de archivo en tránsito.\n\nSin embargo, el contador de referencias de archivo de sk-A es incrementado silenciosamente por MSG_PEEK, lo que invalida la evaluación anterior.\n\nEn este momento, el contador de referencias de archivo de sk-B es 2; uno por el descriptor de archivo abierto, y uno por el descriptor de archivo en tránsito en sk-A. El close() (cierre) subsiguiente libera un contador de referencias por el primero.\n\nFinalmente, la recolección de basura (GC) concluye incorrectamente que tanto sk-A como sk-B están muertos.\n\nUna opción es restaurar la 'danza de bloqueo' en unix_peek_fds(), pero podemos resolver esto de manera más elegante gracias al nuevo algoritmo.\n\nEl punto es que el problema no ocurre sin el close() (cierre) subsiguiente y en realidad no necesitamos sincronizar MSG_PEEK con la detección de SCC muertos.\n\nCuando ocurre el problema, close() (el cierre) y la recolección de basura (GC) tocan el mismo contador de referencias de archivo. Si la recolección de basura (GC) ve que el contador de referencias es decrementado por close() (el cierre), puede simplemente abandonar la recolección de basura del SCC.\n\nPor lo tanto, solo necesitamos señalar la condición de carrera durante MSG_PEEK con una barrera de memoria adecuada para hacerla visible a la recolección de basura (GC).\n\nUsemos seqcount_t para notificar a la recolección de basura (GC) cuando ocurre MSG_PEEK y permitirle aplazar el SCC a la siguiente ejecución.\n\nDe esta manera, no se necesita bloqueo en el lado de MSG_PEEK, y podemos evitar imponer una penalización a cada MSG_PEEK innecesariamente.\n\nTenga en cuenta que podemos reintentar dentro de unix_scc_dead() si se detecta MSG_PEEK, pero no lo hacemos para evitar la 'salpicadura' de tareas colgadas por llamadas abusivas a MSG_PEEK."
    }
  ],
  "lastModified": "2026-08-19T17:18:45.960",
  "configurations": [
    {
      "nodes": [
        {
          "negate": false,
          "cpeMatch": [
            {
              "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
              "vulnerable": true,
              "matchCriteriaId": "B0A3421E-59FE-4E16-9DC6-4CAF59C361C7",
              "versionEndExcluding": "6.2",
              "versionStartIncluding": "6.1.141"
            },
            {
              "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
              "vulnerable": true,
              "matchCriteriaId": "4CAF81AF-E0B7-4112-B091-4DE2CB164414",
              "versionEndExcluding": "6.7",
              "versionStartIncluding": "6.6.93"
            },
            {
              "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
              "vulnerable": true,
              "matchCriteriaId": "7109F074-E2CB-44FB-A4DB-E45B24EF0E17",
              "versionEndExcluding": "6.18.23",
              "versionStartIncluding": "6.10.1"
            },
            {
              "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
              "vulnerable": true,
              "matchCriteriaId": "96D34333-38BE-4414-9E79-6EB764329581",
              "versionEndExcluding": "6.19.10",
              "versionStartIncluding": "6.19"
            },
            {
              "criteria": "cpe:2.3:o:linux:linux_kernel:6.10:-:*:*:*:*:*:*",
              "vulnerable": true,
              "matchCriteriaId": "9EA80796-744E-45F5-8632-2AB4F7889FCD"
            },
            {
              "criteria": "cpe:2.3:o:linux:linux_kernel:7.0:rc1:*:*:*:*:*:*",
              "vulnerable": true,
              "matchCriteriaId": "F253B622-8837-4245-BCE5-A7BF8FC76A16"
            },
            {
              "criteria": "cpe:2.3:o:linux:linux_kernel:7.0:rc2:*:*:*:*:*:*",
              "vulnerable": true,
              "matchCriteriaId": "4AE85AD8-4641-4E7C-A2F4-305E2CD9EE64"
            },
            {
              "criteria": "cpe:2.3:o:linux:linux_kernel:7.0:rc3:*:*:*:*:*:*",
              "vulnerable": true,
              "matchCriteriaId": "F666C8D8-6538-46D4-B318-87610DE64C34"
            },
            {
              "criteria": "cpe:2.3:o:linux:linux_kernel:7.0:rc4:*:*:*:*:*:*",
              "vulnerable": true,
              "matchCriteriaId": "02259FDA-961B-47BC-AE7F-93D7EC6E90C2"
            },
            {
              "criteria": "cpe:2.3:o:linux:linux_kernel:7.0:rc5:*:*:*:*:*:*",
              "vulnerable": true,
              "matchCriteriaId": "58A9FEFF-C040-420D-8F0A-BFDAAA1DF258"
            },
            {
              "criteria": "cpe:2.3:o:linux:linux_kernel:7.0:rc6:*:*:*:*:*:*",
              "vulnerable": true,
              "matchCriteriaId": "1D2315C0-D46F-4F85-9754-F9E5E11374A6"
            },
            {
              "criteria": "cpe:2.3:o:linux:linux_kernel:7.0:rc7:*:*:*:*:*:*",
              "vulnerable": true,
              "matchCriteriaId": "512EE3A8-A590-4501-9A94-5D4B268D6138"
            }
          ],
          "operator": "OR"
        }
      ]
    }
  ],
  "sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
}