)]}'
{
  "commit": "82f1c815aaef1905c5c6c386c8a0d74f6ff70a54",
  "tree": "738fe9ea4efe34f53da73d383eb771a7de5db691",
  "parents": [
    "b44341e39d856e4cc6ad8ed94ebffd440f39846c"
  ],
  "author": {
    "name": "Christian Brauner",
    "email": "brauner@kernel.org",
    "time": "Fri Oct 30 16:50:07 2026 +0100"
  },
  "committer": {
    "name": "Christian Brauner",
    "email": "brauner@kernel.org",
    "time": "Fri Oct 30 17:17:55 2026 +0100"
  },
  "message": "ns: don\u0027t add init_ipc_ns and init_net without namespace support\n\nWhen CONFIG_IPC_NS or CONFIG_NET_NS are turned off we still add the\ninitial ipc and network namespace to the namespace trees. ipc_ns_init()\ncalls ns_tree_add(\u0026init_ipc_ns) whenever CONFIG_SYSVIPC is set and\nsetup_net() calls ns_tree_add_raw() on init_net whenever CONFIG_NET is\nset.\n\nBut without CONFIG_IPC_NS and CONFIG_NET_NS these aren\u0027t namespaces\nuserspace can do anything with. They don\u0027t have proc_ns_operations so\nthere\u0027s no /proc/\u003cpid\u003e/ns/{ipc,net} for them, nsfs_fh_to_dentry()\nrefuses them with -EOPNOTSUPP, and since ns-\u003eops is NULL\n__ns_tree_add_raw() doesn\u0027t add them to the owner list of init_user_ns\neither. So they end up half registered. That\u0027s also not how we treat\nany of the other namespace types. Without CONFIG_UTS_NS, CONFIG_PID_NS,\nCONFIG_TIME_NS or CONFIG_USER_NS the initial namespace is never added\nto the tree.\n\nlistns() walks the unified tree and calls is_current_namespace() for\nevery namespace it finds via may_list_ns(). But is_current_namespace()\nonly knows about CLONE_NEWIPC and CLONE_NEWNET if CONFIG_IPC_NS and\nCONFIG_NET_NS are set. Otherwise we end up in the default case and its\nVFS_WARN_ON_ONCE(). Any unprivileged caller can trigger that with a\nplain listns() call:\n\n  WARNING: CPU: 0 PID: 526 at fs/nsfs.c:508 is_current_namespace+0x12f/0x440\n  Call Trace:\n   legitimize_ns+0x25f/0x4c0\n   do_listns+0x185/0x5c0\n   __do_sys_listns+0x13b/0x300\n\nInstead of teaching is_current_namespace() about namespaces that can\u0027t\nbe opened, only add the initial namespaces to the tree if their\nnamespace type is enabled. Move the registration of init_ipc_ns into\nipc/namespace.c which is only built with CONFIG_IPC_NS. That also fixes\nCONFIG_SYSVIPC\u003dn, CONFIG_POSIX_MQUEUE\u003dy, CONFIG_IPC_NS\u003dy where\nipc/shm.c isn\u0027t built and init_ipc_ns was never added at all. For the\nnetwork namespace only call ns_tree_add_raw() if CONFIG_NET_NS is set.\nWithout CONFIG_NET_NS cleanup_net() isn\u0027t built and init_net is never\nremoved so there\u0027s nothing to balance.\n\nFixes: 74b24a582e1f (\"ipc: support ns lookup\")\nFixes: 195f7422298d (\"net: support ns lookup\")\nReported-by: kernel test robot \u003cyi1.lai@intel.com\u003e\nCloses: https://lore.kernel.org/oe-lkp/202610260917.6248e316-lkp@intel.com\nCc: stable@vger.kernel.org # v6.18+\nLink: https://patch.msgid.link/20261030-work-nsfs-init_ns_tree-v1-1-7ec0adb47c54@kernel.org\nSigned-off-by: Christian Brauner (Amutable) \u003cbrauner@kernel.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "75aa7b469348447bbb3e436aba9c2f48d7553e06",
      "old_mode": 33188,
      "old_path": "ipc/namespace.c",
      "new_id": "b54d23fd83d701b61bf88b10946b716abe4ad220",
      "new_mode": 33188,
      "new_path": "ipc/namespace.c"
    },
    {
      "type": "modify",
      "old_id": "bb1a721a3e746e94c84046c3c26ef593d67a717e",
      "old_mode": 33188,
      "old_path": "ipc/shm.c",
      "new_id": "cbab3d16cf70b6ba08da9382b39392bfb39bb27a",
      "new_mode": 33188,
      "new_path": "ipc/shm.c"
    },
    {
      "type": "modify",
      "old_id": "da5f881fbd3b9808a5e89a0c0dce5077adae5f54",
      "old_mode": 33188,
      "old_path": "net/core/net_namespace.c",
      "new_id": "52c2bd44778a8e6b28cfcf8c74c75436ffaf6be5",
      "new_mode": 33188,
      "new_path": "net/core/net_namespace.c"
    }
  ]
}
