[RISC-V/Linux] clock_nanosleep accepts an invalid clock ID
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 66/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- operating-systems
Hướng nghiên cứu
The bug is in the clock_nanosleep handler in qiling/os/posix/syscall/time.py, which the issue says ignores its clockid argument. Read that handler first, then build the probe.c guest with a RISC-V cross compiler and run it through Qiling to reproduce the zero-duration call with clockid 999. Done means clockid 999 returns -1 with errno EINVAL while CLOCK_MONOTONIC still returns 0.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
On an RV64 Linux guest, Qiling v1.4.11 returns success for clock_nanosleep with clockid=999. Linux returns EINVAL. A zero-duration request makes this a deterministic clock-ID validation case.
Sample Code
#define _GNU_SOURCE
#include <errno.h>
#include <stdio.h>
#include <time.h>
#include <sys/syscall.h>
#include <unistd.h>
int main(void)
{
struct timespec req = {0, 0};
long control = syscall(SYS_clock_nanosleep, CLOCK_MONOTONIC, 0, &req, 0);
if (control != 0)
return 2;
errno = 0;
long invalid = syscall(SYS_clock_nanosleep, 999, 0, &req, 0);
int invalid_errno = errno;
printf("control=%ld invalid=%ld errno=%d\n",
control, invalid, invalid_errno);
return !(invalid == -1 && invalid_errno == EINVAL);
}
mkdir -p rootfs
riscv64-linux-gnu-gcc -static -O2 probe.c -o probe.elf
Run the static RV64 guest with Qiling:
from qiling import Qiling
ql = Qiling(["./probe.elf"], "./rootfs")
ql.run()
Expected behavior
The valid CLOCK_MONOTONIC control returns 0. The invalid clock ID should return -1 with errno EINVAL. Qiling v1.4.11 returns 0 for both calls.
Additional context
Reproduced with Qiling v1.4.11. The current dev source was checked at commit 23ad4fd369a360ad7992d90cb7577f0241061c2b; that exact commit was not dynamically re-run. Its handler ignores clockid; see time.py. Linux documents EINVAL for an invalid clock ID in clock_nanosleep(2).
- Ngôn ngữ chính
- Python
- Star
- 6.2k
- Fork
- 806
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của qilingframework/qiling
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
qilingframework/qiling#1690 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
qilingframework/qiling#1689 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
qilingframework/qiling#1688 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
qilingframework/qiling#1686 ·
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 82/100
qilingframework/qiling#1640 ·
Tất cả issue của qilingframework/qiling
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
huggingface/datasets#9128 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
priority:low ready-for-dev
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
OpenHands/extensions#975 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Function/dict state handlers can't supply provider-state injected values (`generate.provider_state`)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
pact-foundation/pact-python#1789 ·
Maintainer thường phản hồi trong vòng 9 ngày
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
juandresrodca/AdminForge#66 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày