cve-2024-26732
Vulnerability from cvelistv5
Published
2024-04-03 17:00
Modified
2024-08-02 00:14
Severity
Summary
net: implement lockless setsockopt(SO_PEEK_OFF)
Impacted products
VendorProduct
LinuxLinux
LinuxLinux
Show details on NVD website


{
  "containers": {
    "adp": [
      {
        "metrics": [
          {
            "other": {
              "content": {
                "id": "CVE-2024-26732",
                "options": [
                  {
                    "Exploitation": "none"
                  },
                  {
                    "Automatable": "no"
                  },
                  {
                    "Technical Impact": "partial"
                  }
                ],
                "role": "CISA Coordinator",
                "timestamp": "2024-06-17T19:28:35.916343Z",
                "version": "2.0.3"
              },
              "type": "ssvc"
            }
          }
        ],
        "providerMetadata": {
          "dateUpdated": "2024-06-17T19:28:53.102Z",
          "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
          "shortName": "CISA-ADP"
        },
        "title": "CISA ADP Vulnrichment"
      },
      {
        "providerMetadata": {
          "dateUpdated": "2024-08-02T00:14:12.930Z",
          "orgId": "af854a3a-2127-422b-91ae-364da2661108",
          "shortName": "CVE"
        },
        "references": [
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/897f75e2cde8a5f9f7529b55249af1fa4248c83b"
          },
          {
            "tags": [
              "x_transferred"
            ],
            "url": "https://git.kernel.org/stable/c/56667da7399eb19af857e30f41bea89aa6fa812c"
          }
        ],
        "title": "CVE Program Container"
      }
    ],
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "net/core/sock.c",
            "net/ipv4/udp.c",
            "net/unix/af_unix.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "897f75e2cde8",
              "status": "affected",
              "version": "859051dd165e",
              "versionType": "git"
            },
            {
              "lessThan": "56667da7399e",
              "status": "affected",
              "version": "859051dd165e",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "net/core/sock.c",
            "net/ipv4/udp.c",
            "net/unix/af_unix.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "6.7"
            },
            {
              "lessThan": "6.7",
              "status": "unaffected",
              "version": "0",
              "versionType": "custom"
            },
            {
              "lessThanOrEqual": "6.7.*",
              "status": "unaffected",
              "version": "6.7.7",
              "versionType": "custom"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.8",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nnet: implement lockless setsockopt(SO_PEEK_OFF)\n\nsyzbot reported a lockdep violation [1] involving af_unix\nsupport of SO_PEEK_OFF.\n\nSince SO_PEEK_OFF is inherently not thread safe (it uses a per-socket\nsk_peek_off field), there is really no point to enforce a pointless\nthread safety in the kernel.\n\nAfter this patch :\n\n- setsockopt(SO_PEEK_OFF) no longer acquires the socket lock.\n\n- skb_consume_udp() no longer has to acquire the socket lock.\n\n- af_unix no longer needs a special version of sk_set_peek_off(),\n  because it does not lock u-\u003eiolock anymore.\n\nAs a followup, we could replace prot-\u003eset_peek_off to be a boolean\nand avoid an indirect call, since we always use sk_set_peek_off().\n\n[1]\n\nWARNING: possible circular locking dependency detected\n6.8.0-rc4-syzkaller-00267-g0f1dd5e91e2b #0 Not tainted\n\nsyz-executor.2/30025 is trying to acquire lock:\n ffff8880765e7d80 (\u0026u-\u003eiolock){+.+.}-{3:3}, at: unix_set_peek_off+0x26/0xa0 net/unix/af_unix.c:789\n\nbut task is already holding lock:\n ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1691 [inline]\n ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: sockopt_lock_sock net/core/sock.c:1060 [inline]\n ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: sk_setsockopt+0xe52/0x3360 net/core/sock.c:1193\n\nwhich lock already depends on the new lock.\n\nthe existing dependency chain (in reverse order) is:\n\n-\u003e #1 (sk_lock-AF_UNIX){+.+.}-{0:0}:\n        lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754\n        lock_sock_nested+0x48/0x100 net/core/sock.c:3524\n        lock_sock include/net/sock.h:1691 [inline]\n        __unix_dgram_recvmsg+0x1275/0x12c0 net/unix/af_unix.c:2415\n        sock_recvmsg_nosec+0x18e/0x1d0 net/socket.c:1046\n        ____sys_recvmsg+0x3c0/0x470 net/socket.c:2801\n        ___sys_recvmsg net/socket.c:2845 [inline]\n        do_recvmmsg+0x474/0xae0 net/socket.c:2939\n        __sys_recvmmsg net/socket.c:3018 [inline]\n        __do_sys_recvmmsg net/socket.c:3041 [inline]\n        __se_sys_recvmmsg net/socket.c:3034 [inline]\n        __x64_sys_recvmmsg+0x199/0x250 net/socket.c:3034\n       do_syscall_64+0xf9/0x240\n       entry_SYSCALL_64_after_hwframe+0x6f/0x77\n\n-\u003e #0 (\u0026u-\u003eiolock){+.+.}-{3:3}:\n        check_prev_add kernel/locking/lockdep.c:3134 [inline]\n        check_prevs_add kernel/locking/lockdep.c:3253 [inline]\n        validate_chain+0x18ca/0x58e0 kernel/locking/lockdep.c:3869\n        __lock_acquire+0x1345/0x1fd0 kernel/locking/lockdep.c:5137\n        lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754\n        __mutex_lock_common kernel/locking/mutex.c:608 [inline]\n        __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752\n        unix_set_peek_off+0x26/0xa0 net/unix/af_unix.c:789\n       sk_setsockopt+0x207e/0x3360\n        do_sock_setsockopt+0x2fb/0x720 net/socket.c:2307\n        __sys_setsockopt+0x1ad/0x250 net/socket.c:2334\n        __do_sys_setsockopt net/socket.c:2343 [inline]\n        __se_sys_setsockopt net/socket.c:2340 [inline]\n        __x64_sys_setsockopt+0xb5/0xd0 net/socket.c:2340\n       do_syscall_64+0xf9/0x240\n       entry_SYSCALL_64_after_hwframe+0x6f/0x77\n\nother info that might help us debug this:\n\n Possible unsafe locking scenario:\n\n       CPU0                    CPU1\n       ----                    ----\n  lock(sk_lock-AF_UNIX);\n                               lock(\u0026u-\u003eiolock);\n                               lock(sk_lock-AF_UNIX);\n  lock(\u0026u-\u003eiolock);\n\n *** DEADLOCK ***\n\n1 lock held by syz-executor.2/30025:\n  #0: ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1691 [inline]\n  #0: ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: sockopt_lock_sock net/core/sock.c:1060 [inline]\n  #0: ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: sk_setsockopt+0xe52/0x3360 net/core/sock.c:1193\n\nstack backtrace:\nCPU: 0 PID: 30025 Comm: syz-executor.2 Not tainted 6.8.0-rc4-syzkaller-00267-g0f1dd5e91e2b #0\nHardware name: Google Google C\n---truncated---"
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2024-05-29T05:21:43.230Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/897f75e2cde8a5f9f7529b55249af1fa4248c83b"
        },
        {
          "url": "https://git.kernel.org/stable/c/56667da7399eb19af857e30f41bea89aa6fa812c"
        }
      ],
      "title": "net: implement lockless setsockopt(SO_PEEK_OFF)",
      "x_generator": {
        "engine": "bippy-a5840b7849dd"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2024-26732",
    "datePublished": "2024-04-03T17:00:19.722Z",
    "dateReserved": "2024-02-19T14:20:24.165Z",
    "dateUpdated": "2024-08-02T00:14:12.930Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.1",
  "meta": {
    "nvd": "{\"cve\":{\"id\":\"CVE-2024-26732\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2024-04-03T17:15:50.977\",\"lastModified\":\"2024-04-03T17:24:18.150\",\"vulnStatus\":\"Awaiting Analysis\",\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nnet: implement lockless setsockopt(SO_PEEK_OFF)\\n\\nsyzbot reported a lockdep violation [1] involving af_unix\\nsupport of SO_PEEK_OFF.\\n\\nSince SO_PEEK_OFF is inherently not thread safe (it uses a per-socket\\nsk_peek_off field), there is really no point to enforce a pointless\\nthread safety in the kernel.\\n\\nAfter this patch :\\n\\n- setsockopt(SO_PEEK_OFF) no longer acquires the socket lock.\\n\\n- skb_consume_udp() no longer has to acquire the socket lock.\\n\\n- af_unix no longer needs a special version of sk_set_peek_off(),\\n  because it does not lock u-\u003eiolock anymore.\\n\\nAs a followup, we could replace prot-\u003eset_peek_off to be a boolean\\nand avoid an indirect call, since we always use sk_set_peek_off().\\n\\n[1]\\n\\nWARNING: possible circular locking dependency detected\\n6.8.0-rc4-syzkaller-00267-g0f1dd5e91e2b #0 Not tainted\\n\\nsyz-executor.2/30025 is trying to acquire lock:\\n ffff8880765e7d80 (\u0026u-\u003eiolock){+.+.}-{3:3}, at: unix_set_peek_off+0x26/0xa0 net/unix/af_unix.c:789\\n\\nbut task is already holding lock:\\n ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1691 [inline]\\n ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: sockopt_lock_sock net/core/sock.c:1060 [inline]\\n ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: sk_setsockopt+0xe52/0x3360 net/core/sock.c:1193\\n\\nwhich lock already depends on the new lock.\\n\\nthe existing dependency chain (in reverse order) is:\\n\\n-\u003e #1 (sk_lock-AF_UNIX){+.+.}-{0:0}:\\n        lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754\\n        lock_sock_nested+0x48/0x100 net/core/sock.c:3524\\n        lock_sock include/net/sock.h:1691 [inline]\\n        __unix_dgram_recvmsg+0x1275/0x12c0 net/unix/af_unix.c:2415\\n        sock_recvmsg_nosec+0x18e/0x1d0 net/socket.c:1046\\n        ____sys_recvmsg+0x3c0/0x470 net/socket.c:2801\\n        ___sys_recvmsg net/socket.c:2845 [inline]\\n        do_recvmmsg+0x474/0xae0 net/socket.c:2939\\n        __sys_recvmmsg net/socket.c:3018 [inline]\\n        __do_sys_recvmmsg net/socket.c:3041 [inline]\\n        __se_sys_recvmmsg net/socket.c:3034 [inline]\\n        __x64_sys_recvmmsg+0x199/0x250 net/socket.c:3034\\n       do_syscall_64+0xf9/0x240\\n       entry_SYSCALL_64_after_hwframe+0x6f/0x77\\n\\n-\u003e #0 (\u0026u-\u003eiolock){+.+.}-{3:3}:\\n        check_prev_add kernel/locking/lockdep.c:3134 [inline]\\n        check_prevs_add kernel/locking/lockdep.c:3253 [inline]\\n        validate_chain+0x18ca/0x58e0 kernel/locking/lockdep.c:3869\\n        __lock_acquire+0x1345/0x1fd0 kernel/locking/lockdep.c:5137\\n        lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754\\n        __mutex_lock_common kernel/locking/mutex.c:608 [inline]\\n        __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752\\n        unix_set_peek_off+0x26/0xa0 net/unix/af_unix.c:789\\n       sk_setsockopt+0x207e/0x3360\\n        do_sock_setsockopt+0x2fb/0x720 net/socket.c:2307\\n        __sys_setsockopt+0x1ad/0x250 net/socket.c:2334\\n        __do_sys_setsockopt net/socket.c:2343 [inline]\\n        __se_sys_setsockopt net/socket.c:2340 [inline]\\n        __x64_sys_setsockopt+0xb5/0xd0 net/socket.c:2340\\n       do_syscall_64+0xf9/0x240\\n       entry_SYSCALL_64_after_hwframe+0x6f/0x77\\n\\nother info that might help us debug this:\\n\\n Possible unsafe locking scenario:\\n\\n       CPU0                    CPU1\\n       ----                    ----\\n  lock(sk_lock-AF_UNIX);\\n                               lock(\u0026u-\u003eiolock);\\n                               lock(sk_lock-AF_UNIX);\\n  lock(\u0026u-\u003eiolock);\\n\\n *** DEADLOCK ***\\n\\n1 lock held by syz-executor.2/30025:\\n  #0: ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1691 [inline]\\n  #0: ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: sockopt_lock_sock net/core/sock.c:1060 [inline]\\n  #0: ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: sk_setsockopt+0xe52/0x3360 net/core/sock.c:1193\\n\\nstack backtrace:\\nCPU: 0 PID: 30025 Comm: syz-executor.2 Not tainted 6.8.0-rc4-syzkaller-00267-g0f1dd5e91e2b #0\\nHardware name: Google Google C\\n---truncated---\"},{\"lang\":\"es\",\"value\":\"En el kernel de Linux, se resolvi\u00f3 la siguiente vulnerabilidad: net: implementar lockless setsockopt(SO_PEEK_OFF) syzbot inform\u00f3 una violaci\u00f3n de lockdep [1] que involucraba el soporte de SO_PEEK_OFF por parte de af_unix. Dado que SO_PEEK_OFF no es inherentemente seguro para subprocesos (utiliza un campo sk_peek_off por socket), realmente no tiene sentido imponer una seguridad de subprocesos in\u00fatil en el kernel. Despu\u00e9s de este parche: - setsockopt(SO_PEEK_OFF) ya no adquiere el bloqueo del socket. - skb_consume_udp() ya no tiene que adquirir el bloqueo del socket. - af_unix ya no necesita una versi\u00f3n especial de sk_set_peek_off(), porque ya no bloquea u-\u0026gt;iolock. Como seguimiento, podr\u00edamos reemplazar prot-\u0026gt;set_peek_off para que sea booleano y evitar una llamada indirecta, ya que siempre usamos sk_set_peek_off(). [1] ADVERTENCIA: posible dependencia de bloqueo circular detectada 6.8.0-rc4-syzkaller-00267-g0f1dd5e91e2b #0 No contaminado syz-executor.2/30025 est\u00e1 intentando adquirir el bloqueo: ffff8880765e7d80 (\u0026amp;u-\u0026gt;iolock){+.+. }-{3:3}, en: unix_set_peek_off+0x26/0xa0 net/unix/af_unix.c:789 pero la tarea ya mantiene el bloqueo: ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, en: lock_sock include/net/sock.h:1691 [en l\u00ednea] ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, en: sockopt_lock_sock net/core/sock.c:1060 [en l\u00ednea] ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, en: sk_setsockopt+0xe52/0x3360 net/core/sock.c:1193 cuyo bloqueo ya depende del nuevo bloqueo. la cadena de dependencia existente (en orden inverso) es: -\u0026gt; #1 (sk_lock-AF_UNIX){+.+.}-{0:0}: lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754 lock_sock_nested+0x48 /0x100 net/core/sock.c:3524 lock_sock include/net/sock.h:1691 [en l\u00ednea] __unix_dgram_recvmsg+0x1275/0x12c0 net/unix/af_unix.c:2415 sock_recvmsg_nosec+0x18e/0x1d0 net/socket.c:1046 ____sys_recvmsg+0x3c0/0x470 net/socket.c:2801 ___sys_recvmsg net/socket.c:2845 [en l\u00ednea] do_recvmmsg+0x474/0xae0 net/socket.c:2939 __sys_recvmmsg net/socket.c:3018 [en l\u00ednea] __do_sy s_recvmmsg red/socket .c:3041 [en l\u00ednea] __se_sys_recvmmsg net/socket.c:3034 [en l\u00ednea] __x64_sys_recvmmsg+0x199/0x250 net/socket.c:3034 do_syscall_64+0xf9/0x240 Entry_SYSCALL_64_after_hwframe+0x6f/0x77 -\u0026gt; #0 (\u0026amp;u-\u0026gt;iolock) {+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3134 [en l\u00ednea] check_prevs_add kernel/locking/lockdep.c:3253 [en l\u00ednea] validar_chain+0x18ca/0x58e0 kernel/locking/lockdep. c:3869 __lock_acquire+0x1345/0x1fd0 kernel/locking/lockdep.c:5137 lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754 __mutex_lock_common kernel/locking/mutex.c:608 [en l\u00ednea] __mutex_lock+0x136/0xd70 kernel /locking/mutex.c:752 unix_set_peek_off+0x26/0xa0 net/unix/af_unix.c:789 sk_setsockopt+0x207e/0x3360 do_sock_setsockopt+0x2fb/0x720 net/socket.c:2307 __sys_setsockopt+0x1ad/0x250 net/ enchufe.c: 2334 __do_sys_setsockopt net/socket.c:2343 [en l\u00ednea] __se_sys_setsockopt net/socket.c:2340 [en l\u00ednea] __x64_sys_setsockopt+0xb5/0xd0 net/socket.c:2340 do_syscall_64+0xf9/0x240 entrada_SYSCALL_6 4_after_hwframe+0x6f/0x77 otra informaci\u00f3n que podr\u00eda ayudar depuremos esto: Posible escenario de bloqueo inseguro: CPU0 CPU1 ---- ---- lock(sk_lock-AF_UNIX); bloquear(\u0026amp;u-\u0026gt;iolock); bloquear(sk_lock-AF_UNIX); bloquear(\u0026amp;u-\u0026gt;iolock); *** DEADLOCK *** 1 bloqueo retenido por syz-executor.2/30025: #0: ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, en: lock_sock include/net/sock. h:1691 [en l\u00ednea] #0: ffff8880765e7930 (sk_lock-AF_UNIX){+.+.}-{0:0}, en: sockopt_lock_sock net/core/sock.c:1060 [en l\u00ednea] #0: ffff8880765e7930 (sk_lock- AF_UNIX){+.+.}-{0:0}, en: sk_setsockopt+0xe52/0x3360 net/core/sock.c:1193 seguimiento de pila: CPU: 0 PID: 30025 Comm: syz-executor.2 No contaminado 6.8 .0-rc4-syzkaller-00267-g0f1dd5e91e2b #0 Nombre del hardware: Google Google C ---truncado---\"}],\"metrics\":{},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/56667da7399eb19af857e30f41bea89aa6fa812c\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/897f75e2cde8a5f9f7529b55249af1fa4248c83b\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"}]}}"
  }
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading...

Loading...