{"$schema": "https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json",
 "version": "2.1.0",
 "runs": [{"tool": {"driver": {"name": "GNU C23",
                               "fullName": "GNU C23 (GCC) version 16.1.1 20260703 (Red Hat 16.1.1-4) (x86_64-redhat-linux)",
                               "version": "16.1.1 20260703 (Red Hat 16.1.1-4)",
                               "informationUri": "https://gcc.gnu.org/gcc-16/",
                               "rules": [{"id": "-Wanalyzer-fd-leak",
                                          "helpUri": "https://gcc.gnu.org/onlinedocs/gcc-16.1.0/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-leak"}]}},
           "taxonomies": [{"name": "CWE",
                           "version": "4.7",
                           "organization": "MITRE",
                           "shortDescription": {"text": "The MITRE Common Weakness Enumeration"},
                           "taxa": [{"id": "775",
                                     "helpUri": "https://cwe.mitre.org/data/definitions/775.html"}]}],
           "invocations": [{"arguments": ["/usr/libexec/gcc/x86_64-redhat-linux/16/cc1",
                                          "-quiet",
                                          "-I",
                                          "../src/include/",
                                          "-D",
                                          "_GNU_SOURCE",
                                          "-D",
                                          "__SANE_USERSPACE_TYPES__",
                                          "-D",
                                          "_LARGEFILE_SOURCE",
                                          "-D",
                                          "_FILE_OFFSET_BITS=64",
                                          "-D",
                                          "LIBURING_BUILD_TEST",
                                          "-include",
                                          "../config-host.h",
                                          "ring-leak.c",
                                          "-quiet",
                                          "-dumpbase",
                                          "ring-leak.c",
                                          "-dumpbase-ext",
                                          ".c",
                                          "-m64",
                                          "-mtune=generic",
                                          "-march=x86-64",
                                          "-mtls-dialect=gnu2",
                                          "-O2",
                                          "-Wno-unused-parameter",
                                          "-Wno-sign-compare",
                                          "-Wno-unknown-pragmas",
                                          "-flto=auto",
                                          "-ffat-lto-objects",
                                          "-fexceptions",
                                          "-fstack-protector-strong",
                                          "-fasynchronous-unwind-tables",
                                          "-fstack-clash-protection",
                                          "-fcf-protection=full",
                                          "-fno-omit-frame-pointer",
                                          "-fanalyzer",
                                          "-fdiagnostics-path-format=separate-events",
                                          "-fno-diagnostics-show-caret",
                                          "-fno-lto",
                                          "-fanalyzer-assume-nothrow",
                                          "-fdiagnostics-text-art-charset=none",
                                          "-fdiagnostics-set-output=sarif:file=/builddir/gcc-results/4534-8FoS.sarif",
                                          "-o",
                                          "/tmp/ccOEqcb7.s"],
                            "workingDirectory": {"uri": "/builddir/build/BUILD/liburing-2.13-build/liburing-2.13/test"},
                            "startTimeUtc": "2026-08-03T18:01:59Z",
                            "executionSuccessful": true,
                            "toolExecutionNotifications": [],
                            "endTimeUtc": "2026-08-03T18:01:59Z"}],
           "originalUriBaseIds": {"PWD": {"uri": "file:///builddir/build/BUILD/liburing-2.13-build/liburing-2.13/test/"}},
           "artifacts": [{"location": {"uri": "ring-leak.c",
                                       "uriBaseId": "PWD"},
                          "sourceLanguage": "c",
                          "contents": {"text": "/* SPDX-License-Identifier: MIT */\n/*\n * Based on description from Al Viro - this demonstrates a leak of the\n * io_uring instance, by sending the io_uring fd over a UNIX socket.\n *\n * See:\n *\n * https://lore.kernel.org/linux-block/20190129192702.3605-1-axboe@kernel.dk/T/#m6c87fc64e4d063786af6ec6fadce3ac1e95d3184\n *\n */\n#include <stdio.h>\n#include <stdlib.h>\n#include <stddef.h>\n#include <signal.h>\n#include <inttypes.h>\n#include <sys/types.h>\n#include <sys/syscall.h>\n#include <sys/socket.h>\n#include <sys/wait.h>\n#include <fcntl.h>\n#include <unistd.h>\n#include <string.h>\n#include <linux/fs.h>\n\n#include \"liburing.h\"\n#include \"helpers.h\"\n#include \"../src/syscall.h\"\n\nstatic int __io_uring_register_files(int ring_fd, int fd1, int fd2)\n{\n\t__s32 fds[2] = { fd1, fd2 };\n\n\treturn __sys_io_uring_register(ring_fd, IORING_REGISTER_FILES, fds, 2);\n}\n\nstatic int get_ring_fd(void)\n{\n\tstruct io_uring_params p;\n\tint fd;\n\n\tmemset(&p, 0, sizeof(p));\n\n\tfd = __sys_io_uring_setup(2, &p);\n\tif (fd < 0) {\n\t\tperror(\"io_uring_setup\");\n\t\treturn -1;\n\t}\n\n\treturn fd;\n}\n\nstatic int send_fd(int socket, int fd)\n{\n\tchar buf[CMSG_SPACE(sizeof(fd))];\n\tstruct cmsghdr *cmsg;\n\tstruct msghdr msg;\n\n\tmemset(buf, 0, sizeof(buf));\n\tmemset(&msg, 0, sizeof(msg));\n\n\tmsg.msg_control = buf;\n\tmsg.msg_controllen = sizeof(buf);\n\n\tcmsg = CMSG_FIRSTHDR(&msg);\n\tcmsg->cmsg_level = SOL_SOCKET;\n\tcmsg->cmsg_type = SCM_RIGHTS;\n\tcmsg->cmsg_len = CMSG_LEN(sizeof(fd));\n\n\tmemmove(CMSG_DATA(cmsg), &fd, sizeof(fd));\n\n\tmsg.msg_controllen = CMSG_SPACE(sizeof(fd));\n\n\tif (sendmsg(socket, &msg, 0) < 0) {\n\t\tif (errno == EINVAL)\n\t\t\treturn T_EXIT_SKIP;\n\t\tperror(\"sendmsg\");\n\t\treturn T_EXIT_FAIL;\n\t}\n\n\treturn T_EXIT_PASS;\n}\n\nstatic int test_iowq_request_cancel(void)\n{\n\tchar buffer[128];\n\tstruct io_uring ring;\n\tstruct io_uring_sqe *sqe;\n\tint ret, fds[2];\n\n\tret = io_uring_queue_init(8, &ring, 0);\n\tif (ret < 0) {\n\t\tfprintf(stderr, \"failed to init io_uring: %s\\n\", strerror(-ret));\n\t\treturn ret;\n\t}\n\tif (pipe(fds)) {\n\t\tperror(\"pipe\");\n\t\treturn -1;\n\t}\n\tret = io_uring_register_files(&ring, fds, 2);\n\tif (ret) {\n\t\tfprintf(stderr, \"file_register: %d\\n\", ret);\n\t\treturn ret;\n\t}\n\tclose(fds[1]);\n\n\tsqe = io_uring_get_sqe(&ring);\n\tif (!sqe) {\n\t\tfprintf(stderr, \"%s: failed to get sqe\\n\", __FUNCTION__);\n\t\treturn 1;\n\t}\n\t/* potentially sitting in internal polling */\n\tio_uring_prep_read(sqe, 0, buffer, 10, 0);\n\tsqe->flags |= IOSQE_FIXED_FILE;\n\n\tsqe = io_uring_get_sqe(&ring);\n\tif (!sqe) {\n\t\tfprintf(stderr, \"%s: failed to get sqe\\n\", __FUNCTION__);\n\t\treturn 1;\n\t}\n\t/* staying in io-wq */\n\tio_uring_prep_read(sqe, 0, buffer, 10, 0);\n\tsqe->flags |= IOSQE_FIXED_FILE | IOSQE_ASYNC;\n\n\tret = io_uring_submit(&ring);\n\tif (ret != 2) {\n\t\tfprintf(stderr, \"%s: got %d, wanted 1\\n\", __FUNCTION__, ret);\n\t\treturn 1;\n\t}\n\n\t/* should unregister files and close the write fd */\n\tio_uring_queue_exit(&ring);\n\n\t/*\n\t * We're trying to wait for the ring to \"really\" exit, that will be\n\t * done async. For that rely on the registered write end to be closed\n\t * after ring quiesce, so failing read from the other pipe end.\n\t */\n\tret = read(fds[0], buffer, 10);\n\tif (ret < 0)\n\t\tperror(\"read\");\n\tclose(fds[0]);\n\treturn 0;\n}\n\nstatic void trigger_unix_gc(void)\n{\n\tint fd;\n\n\tfd = socket(AF_UNIX, SOCK_DGRAM, 0);\n\tif (fd < 0)\n\t\tperror(\"socket dgram\");\n\telse\n\t\tclose(fd);\n}\n\nstatic int test_scm_cycles(bool update)\n{\n\tchar buffer[128];\n\tstruct io_uring ring;\n\tint i, ret;\n\tint sp[2], fds[2], reg_fds[4];\n\n\tif (socketpair(AF_UNIX, SOCK_DGRAM, 0, sp) != 0) {\n\t\tperror(\"Failed to create Unix-domain socket pair\\n\");\n\t\treturn 1;\n\t}\n\tret = io_uring_queue_init(8, &ring, 0);\n\tif (ret < 0) {\n\t\tfprintf(stderr, \"failed to init io_uring: %s\\n\", strerror(-ret));\n\t\treturn ret;\n\t}\n\tif (pipe(fds)) {\n\t\tperror(\"pipe\");\n\t\treturn -1;\n\t}\n\tret = send_fd(sp[0], ring.ring_fd);\n\tif (ret != T_EXIT_PASS)\n\t\treturn ret;\n\n\t/* register an empty set for updates */\n\tif (update) {\n\t\tfor (i = 0; i < 4; i++)\n\t\t\treg_fds[i] = -1;\n\t\tret = io_uring_register_files(&ring, reg_fds, 4);\n\t\tif (ret) {\n\t\t\tfprintf(stderr, \"file_register: %d\\n\", ret);\n\t\t\treturn ret;\n\t\t}\n\t}\n\n\treg_fds[0] = fds[0];\n\treg_fds[1] = fds[1];\n\treg_fds[2] = sp[0];\n\treg_fds[3] = sp[1];\n\tif (update) {\n\t\tret = io_uring_register_files_update(&ring, 0, reg_fds, 4);\n\t\tif (ret != 4) {\n\t\t\tfprintf(stderr, \"file_register: %d\\n\", ret);\n\t\t\treturn ret;\n\t\t}\n\t} else {\n\t\tret = io_uring_register_files(&ring, reg_fds, 4);\n\t\tif (ret) {\n\t\t\tfprintf(stderr, \"file_register: %d\\n\", ret);\n\t\t\treturn ret;\n\t\t}\n\t}\n\n\tclose(fds[1]);\n\tclose(sp[0]);\n\tclose(sp[1]);\n\n\t/* should unregister files and close the write fd */\n\tio_uring_queue_exit(&ring);\n\n\ttrigger_unix_gc();\n\n\t/*\n\t * We're trying to wait for the ring to \"really\" exit, that will be\n\t * done async. For that rely on the registered write end to be closed\n\t * after ring quiesce, so failing read from the other pipe end.\n\t */\n\tret = read(fds[0], buffer, 10);\n\tif (ret < 0)\n\t\tperror(\"read\");\n\tclose(fds[0]);\n\treturn 0;\n}\n\nint main(int argc, char *argv[])\n{\n\tint sp[2], pid, ring_fd, ret;\n\tint i;\n\n\tif (argc > 1)\n\t\treturn 0;\n\n\tret = test_iowq_request_cancel();\n\tif (ret) {\n\t\tfprintf(stderr, \"test_iowq_request_cancel() failed\\n\");\n\t\treturn 1;\n\t}\n\n\tfor (i = 0; i < 2; i++) {\n\t\tbool update = !!(i & 1);\n\n\t\tret = test_scm_cycles(update);\n\t\tif (ret == T_EXIT_SKIP)\n\t\t\treturn T_EXIT_SKIP;\n\t\tif (ret) {\n\t\t\tfprintf(stderr, \"test_scm_cycles() failed %i\\n\",\n\t\t\t\tupdate);\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\tif (socketpair(AF_UNIX, SOCK_DGRAM, 0, sp) != 0) {\n\t\tperror(\"Failed to create Unix-domain socket pair\\n\");\n\t\treturn 1;\n\t}\n\n\tring_fd = get_ring_fd();\n\tif (ring_fd < 0)\n\t\treturn 1;\n\n\tret = __io_uring_register_files(ring_fd, sp[0], sp[1]);\n\tif (ret < 0) {\n\t\tperror(\"register files\");\n\t\treturn 1;\n\t}\n\n\tpid = fork();\n\tif (pid) {\n\t\tret = send_fd(sp[0], ring_fd);\n\t\tif (ret != T_EXIT_PASS)\n\t\t\treturn ret;\n\t}\n\n\tclose(ring_fd);\n\tclose(sp[0]);\n\tclose(sp[1]);\n\treturn 0;\n}\n"},
                          "roles": ["analysisTarget",
                                    "tracedFile"]}],
           "results": [{"ruleId": "-Wanalyzer-fd-leak",
                        "taxa": [{"id": "775",
                                  "toolComponent": {"name": "cwe"}}],
                        "properties": {"gcc/analyzer/saved_diagnostic/sm": "file-descriptor",
                                       "gcc/analyzer/saved_diagnostic/ploc": {"enode": 805},
                                       "gcc/analyzer/saved_diagnostic/var": "fds[0]",
                                       "gcc/analyzer/saved_diagnostic/sval": "CONJURED(_5 = pipe (&fds);, fds[(int)0])",
                                       "gcc/analyzer/saved_diagnostic/state": "fd-valid-read-write",
                                       "gcc/analyzer/saved_diagnostic/idx": 8,
                                       "gcc/analyzer/saved_diagnostic/duplicates": [{"properties": {"gcc/analyzer/saved_diagnostic/sm": "file-descriptor",
                                                                                                    "gcc/analyzer/saved_diagnostic/ploc": {"enode": 805},
                                                                                                    "gcc/analyzer/saved_diagnostic/var": "fds[0]",
                                                                                                    "gcc/analyzer/saved_diagnostic/sval": "CONJURED(_5 = pipe (&fds);, fds[(int)0])",
                                                                                                    "gcc/analyzer/saved_diagnostic/state": "fd-valid-read-write",
                                                                                                    "gcc/analyzer/saved_diagnostic/idx": 10,
                                                                                                    "gcc/analyzer/pending_diagnostic/kind": "fd_leak"}}],
                                       "gcc/analyzer/pending_diagnostic/kind": "fd_leak"},
                        "level": "warning",
                        "message": {"text": "leak of file descriptor ‘fds[0]’"},
                        "locations": [{"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                 "uriBaseId": "PWD"},
                                                            "region": {"startLine": 165,
                                                                       "startColumn": 24,
                                                                       "endColumn": 25},
                                                            "contextRegion": {"startLine": 165,
                                                                              "snippet": {"text": "\t\treturn 1;\n"}}},
                                       "logicalLocations": [{"index": 0,
                                                             "fullyQualifiedName": "test_scm_cycles"}]}],
                        "codeFlows": [{"threadFlows": [{"id": "main",
                                                        "locations": [{"properties": {"gcc/analyzer/checker_event/emission_id": "(1)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 88,
                                                                                                                                 "dst_id": 91}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 163,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 163,
                                                                                                                           "snippet": {"text": "\tif (socketpair(AF_UNIX, SOCK_DGRAM, 0, sp) != 0) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "following ‘false’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 1},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(2)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 88,
                                                                                                                                 "dst_id": 91}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 167,
                                                                                                                    "startColumn": 15,
                                                                                                                    "endColumn": 47},
                                                                                                         "contextRegion": {"startLine": 167,
                                                                                                                           "snippet": {"text": "\tret = io_uring_queue_init(8, &ring, 0);\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 2},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(3)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 92,
                                                                                                                                 "dst_id": 98}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 168,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 168,
                                                                                                                           "snippet": {"text": "\tif (ret < 0) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "following ‘false’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 3},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(4)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 92,
                                                                                                                                 "dst_id": 98}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 172,
                                                                                                                    "startColumn": 13,
                                                                                                                    "endColumn": 22},
                                                                                                         "contextRegion": {"startLine": 172,
                                                                                                                           "snippet": {"text": "\tif (pipe(fds)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 4},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(5)",
                                                                                      "gcc/analyzer/checker_event/kind": "state_change"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 172,
                                                                                                                    "startColumn": 13,
                                                                                                                    "endColumn": 22},
                                                                                                         "contextRegion": {"startLine": 172,
                                                                                                                           "snippet": {"text": "\tif (pipe(fds)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "opened here as read-write"}},
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 5},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(6)",
                                                                                      "gcc/analyzer/checker_event/kind": "custom"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 172,
                                                                                                                    "startColumn": 13,
                                                                                                                    "endColumn": 22},
                                                                                                         "contextRegion": {"startLine": 172,
                                                                                                                           "snippet": {"text": "\tif (pipe(fds)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "when ‘pipe’ succeeds"}},
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 6},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(7)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 99,
                                                                                                                                 "dst_id": 102}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 172,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 172,
                                                                                                                           "snippet": {"text": "\tif (pipe(fds)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "following ‘false’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 7},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(8)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 99,
                                                                                                                                 "dst_id": 102}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 176,
                                                                                                                    "startColumn": 15,
                                                                                                                    "endColumn": 43},
                                                                                                         "contextRegion": {"startLine": 176,
                                                                                                                           "snippet": {"text": "\tret = send_fd(sp[0], ring.ring_fd);\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 8},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(9)",
                                                                                      "gcc/analyzer/checker_event/kind": "warning"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 165,
                                                                                                                    "startColumn": 24,
                                                                                                                    "endColumn": 25},
                                                                                                         "contextRegion": {"startLine": 165,
                                                                                                                           "snippet": {"text": "\t\treturn 1;\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "‘fds[0]’ leaks here"}},
                                                                       "kinds": ["danger"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 9}]}]}]},
                       {"ruleId": "-Wanalyzer-fd-leak",
                        "taxa": [{"id": "775",
                                  "toolComponent": {"name": "cwe"}}],
                        "properties": {"gcc/analyzer/saved_diagnostic/sm": "file-descriptor",
                                       "gcc/analyzer/saved_diagnostic/ploc": {"enode": 805},
                                       "gcc/analyzer/saved_diagnostic/var": "fds[1]",
                                       "gcc/analyzer/saved_diagnostic/sval": "CONJURED(_5 = pipe (&fds);, fds[(int)1])",
                                       "gcc/analyzer/saved_diagnostic/state": "fd-valid-read-write",
                                       "gcc/analyzer/saved_diagnostic/idx": 9,
                                       "gcc/analyzer/saved_diagnostic/duplicates": [{"properties": {"gcc/analyzer/saved_diagnostic/sm": "file-descriptor",
                                                                                                    "gcc/analyzer/saved_diagnostic/ploc": {"enode": 805},
                                                                                                    "gcc/analyzer/saved_diagnostic/var": "fds[1]",
                                                                                                    "gcc/analyzer/saved_diagnostic/sval": "CONJURED(_5 = pipe (&fds);, fds[(int)1])",
                                                                                                    "gcc/analyzer/saved_diagnostic/state": "fd-valid-read-write",
                                                                                                    "gcc/analyzer/saved_diagnostic/idx": 11,
                                                                                                    "gcc/analyzer/pending_diagnostic/kind": "fd_leak"}}],
                                       "gcc/analyzer/pending_diagnostic/kind": "fd_leak"},
                        "level": "warning",
                        "message": {"text": "leak of file descriptor ‘fds[1]’"},
                        "locations": [{"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                 "uriBaseId": "PWD"},
                                                            "region": {"startLine": 165,
                                                                       "startColumn": 24,
                                                                       "endColumn": 25},
                                                            "contextRegion": {"startLine": 165,
                                                                              "snippet": {"text": "\t\treturn 1;\n"}}},
                                       "logicalLocations": [{"index": 0,
                                                             "fullyQualifiedName": "test_scm_cycles"}]}],
                        "codeFlows": [{"threadFlows": [{"id": "main",
                                                        "locations": [{"properties": {"gcc/analyzer/checker_event/emission_id": "(1)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 88,
                                                                                                                                 "dst_id": 91}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 163,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 163,
                                                                                                                           "snippet": {"text": "\tif (socketpair(AF_UNIX, SOCK_DGRAM, 0, sp) != 0) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "following ‘false’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 1},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(2)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 88,
                                                                                                                                 "dst_id": 91}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 167,
                                                                                                                    "startColumn": 15,
                                                                                                                    "endColumn": 47},
                                                                                                         "contextRegion": {"startLine": 167,
                                                                                                                           "snippet": {"text": "\tret = io_uring_queue_init(8, &ring, 0);\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 2},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(3)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 92,
                                                                                                                                 "dst_id": 98}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 168,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 168,
                                                                                                                           "snippet": {"text": "\tif (ret < 0) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "following ‘false’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 3},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(4)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 92,
                                                                                                                                 "dst_id": 98}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 172,
                                                                                                                    "startColumn": 13,
                                                                                                                    "endColumn": 22},
                                                                                                         "contextRegion": {"startLine": 172,
                                                                                                                           "snippet": {"text": "\tif (pipe(fds)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 4},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(5)",
                                                                                      "gcc/analyzer/checker_event/kind": "state_change"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 172,
                                                                                                                    "startColumn": 13,
                                                                                                                    "endColumn": 22},
                                                                                                         "contextRegion": {"startLine": 172,
                                                                                                                           "snippet": {"text": "\tif (pipe(fds)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "opened here as read-write"}},
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 5},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(6)",
                                                                                      "gcc/analyzer/checker_event/kind": "custom"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 172,
                                                                                                                    "startColumn": 13,
                                                                                                                    "endColumn": 22},
                                                                                                         "contextRegion": {"startLine": 172,
                                                                                                                           "snippet": {"text": "\tif (pipe(fds)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "when ‘pipe’ succeeds"}},
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 6},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(7)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 99,
                                                                                                                                 "dst_id": 102}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 172,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 172,
                                                                                                                           "snippet": {"text": "\tif (pipe(fds)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "following ‘false’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 7},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(8)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 99,
                                                                                                                                 "dst_id": 102}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 176,
                                                                                                                    "startColumn": 15,
                                                                                                                    "endColumn": 43},
                                                                                                         "contextRegion": {"startLine": 176,
                                                                                                                           "snippet": {"text": "\tret = send_fd(sp[0], ring.ring_fd);\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 8},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(9)",
                                                                                      "gcc/analyzer/checker_event/kind": "warning"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "ring-leak.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 165,
                                                                                                                    "startColumn": 24,
                                                                                                                    "endColumn": 25},
                                                                                                         "contextRegion": {"startLine": 165,
                                                                                                                           "snippet": {"text": "\t\treturn 1;\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "test_scm_cycles"}],
                                                                                    "message": {"text": "‘fds[1]’ leaks here"}},
                                                                       "kinds": ["danger"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 9}]}]}]}],
           "logicalLocations": [{"name": "test_scm_cycles",
                                 "fullyQualifiedName": "test_scm_cycles",
                                 "decoratedName": "test_scm_cycles",
                                 "kind": "function",
                                 "index": 0}]}]}
