github / github/codeql

Potential segmentation fault in semmle_utils.cpp Logger / bazel?

Đang mở
#13,378 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
question
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

**Description of the issue**
In the last few days I've started getting intermittent (say 10%) SIGSEGV crashes during `dotnet restore` and `dotnet build` when running under CodeQL via GitHub Actions Runner.

I've managed to capture a core dump and ran gdb backtrace on the offending thread from a GitHub Action Runner.

I notice in the stack trace context line 3 it mentions `Logger::Logger` in `semmle_utils.cpp` just before entering `bazel_runner`.

I don't have a separate test case, but I can re-run the build and every now and then it will trigger with a failure; without CodeQL there is no issue.

```
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `dotnet restore /home/runner/work/project/project/project/project.sln'.
Program terminated with signal SIGSEGV, Segmentation fault.
--Type for more, q to quit, c to continue without paging--c
#0 0x00007f5ebe8b4d11 in std::__1::__shared_count::__release_shared (this=0x55a493a19fe0) at /home/runner/.cache/bazel/_bazel_runner/9f4ed60bba64c867c2242caf607221b5/external/cc_linux_toolchain/bin/../include/c++/v1/__memory/shared_ptr.h:174
174 /home/runner/.cache/bazel/_bazel_runner/9f4ed60bba64c867c2242caf607221b5/external/cc_linux_toolchain/bin/../include/c++/v1/__memory/shared_ptr.h: No such file or directory.
[Current thread is 1 (Thread 0x7f1d55ff9640 (LWP 2031))]
(gdb)
(gdb)
(gdb)
(gdb)
(gdb) bt
#0 0x00007f5ebe8b4d11 in std::__1::__shared_count::__release_shared (this=0x55a493a19fe0)
at /home/runner/.cache/bazel/_bazel_runner/9f4ed60bba64c867c2242caf607221b5/external/cc_linux_toolchain/bin/../include/c++/v1/__memory/shared_ptr.h:174
#1 std::__1::__shared_weak_count::__release_shared (this=0x55a493a19fe0)
at /home/runner/.cache/bazel/_bazel_runner/9f4ed60bba64c867c2242caf607221b5/external/cc_linux_toolchain/bin/../include/c++/v1/__memory/shared_ptr.h:216
#2 std::__1::shared_ptr::~shared_ptr (this=)
at /home/runner/.cache/bazel/_bazel_runner/9f4ed60bba64c867c2242caf607221b5/external/cc_linux_toolchain/bin/../include/c++/v1/__memory/shared_ptr.h:703
#3 Logger::Logger (this=0x7f1d55ff7ee8) at c/tracers/shared/semmle_utils.cpp:235
#4 0x00007f5ebe8a7d6b in request_file (path=path@entry=0x7f1d55ff80d0 "/home/runner/.dotnet/TelemetryStorageService/20230606052549_25cdd4595fba42aba356228c2a6492eb.trn") at c/tracers/posix/libtrace.cpp:1302
#5 0x00007f5ebe8a82a4 in __lxstat64 (x=1, path=0x7f1d55ff80d0 "/home/runner/.dotnet/TelemetryStorageService/20230606052549_25cdd4595fba42aba356228c2a6492eb.trn", st=0x7f1d55ff7f80)
at c/tracers/posix/libtrace.cpp:1452
#6 0x00007f5eb6c1b620 in SystemNative_LStat () from /usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.5/libSystem.Native.so
#7 0x00007f5e3ece735c in ?? ()
#8 0x000000000001b8d9 in ?? ()
#9 0x00007f5ebe18c2d8 in ?? () from /usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.5/libcoreclr.so
#10 0x00007f1d55ff8c10 in ?? ()
#11 0x0000000000000000 in ?? ()
(gdb)
```

GitHub Runner Image:
```
Image: ubuntu-22.04
Version: 20230517.1
```

CodeQL:
```
/opt/hostedtoolcache/CodeQL/2.13.3-20230524/x64/codeql/codeql version --format=json
{
"productName" : "CodeQL",
"vendor" : "GitHub",
"version" : "2.13.3",
"sha" : "d93[19](https://github.com/my-org/project/actions/runs/5184926281/jobs/9344299955#step:3:20)29688e85c41f9452f89c2ea2640bdae3a19",
"branches" : [
"codeql-cli-2.13.3"
],
"copyright" : "Copyright (C) [20](https://github.com/my-org/project/actions/runs/5184926281/jobs/9344299955#step:3:21)19-20[23](https://github.com/my-org/project/actions/runs/5184926281/jobs/9344299955#step:3:24) GitHub, Inc.",
"unpackedLocation" : "/opt/hostedtoolcache/CodeQL/2.13.3-202305[24](https://github.com/my-org/project/actions/runs/5184926281/jobs/9344299955#step:3:25)/x64/codeql",
"configFileLocation" : "/home/runner/.config/codeql/config",
"configFileFound" : false
}
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by inspecting c/tracers/shared/semmle_utils.cpp around Logger::Logger and c/tracers/posix/libtrace.cpp around request_file and __lxstat64. Reproduce dotnet restore or dotnet build under CodeQL 2.13.3 on the specified Ubuntu runner, then use the supplied core-dump backtrace to investigate the intermittent SIGSEGV. Done means the CodeQL-wrapped build no longer crashes in this path.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
cpp
Lĩnh vực
devtools
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.