github / github/codeql

C++ extractor giving multiple compilation errors when trying to compile the linux kernel

Đang mở
#16,908 17 bình luận 0 reaction 0 người được giao Xem trên GitHub
C++ 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**

I noticed that several files of the linux kernel source were missing when creatiung a database with code ql using the kernel config attached to this issue and the following command:

```
codeql database create ~/codeql_db/linux/linux_db --language c --command "make -j`nproc`"
```

One of the missing files (kernel/bpf/verifier.c) is being correctly compiled by the kernel build system but it seems there are multiple compilation errors when the cpp extractor runs (I attached to complete log to this issue), for example:

```
E 15:08:35 2293019] Warning[extractor-c++]: In construct_text_message: "./arch/x86/include/asm/processor.h", line 525: error: expected a ")"

this_cpu_write(cpu_tss_rw.x86_tss.sp0, sp0);

```

Please note:

1. I have verified the subsystem where that this file belongs to (CONFIG_BPF) is enabled and the feature works when running the kernel
2. I have attempted to create a database in multiple computers, some of them with a fresh install of debian, and the issue always reproduces
3. verifier.c is just an example, there are many many other missing files due to similar reasons
4. The code compiles just fine for the kernel
5. I compiled an unmodified checkout of https://github.com/torvalds/linux

I believe this might be a bug in the extractor similar to https://github.com/github/codeql/issues/16901 and https://github.com/github/codeql/issues/13994. If that is so, please feel free to close this as duplicate.

Let me know if you need anything else from me to reproduce this
[extractor_log.txt](https://github.com/user-attachments/files/16101584/extractor_log.txt)
[config.txt](https://github.com/user-attachments/files/16101585/config.txt)

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

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

Hướng nghiên cứu

Bắt đầu với lệnh tạo cơ sở dữ liệu trong issue, sau đó kiểm tra extractor_log.txt cùng với config.txt. So sánh các lỗi liên quan đến kernel/bpf/verifier.c và arch/x86/include/asm/processor.h với đầu ra build của kernel; hoàn tất có nghĩa là các lỗi extractor đã được báo cáo đã được xử lý và các tệp trước đây bị thiếu đã được đưa vào cơ sở dữ liệu.

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

Đánh giá

Công nghệ
c, cpp, linux
Lĩnh vực
compilers, tooling
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
35/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.