[RISC-V/Linux] clock_nanosleep accepts an invalid clock ID
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 66/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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).
- 主要言語
- Python
- スター
- 6.2k
- フォーク
- 806
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
qilingframework/qiling のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
qilingframework/qiling#1690 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
qilingframework/qiling#1689 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
qilingframework/qiling#1688 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
qilingframework/qiling#1686 ·
-
難易度 2/5 半日 初心者へのやさしさ 82/100
qilingframework/qiling#1640 ·
qilingframework/qiling の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
huggingface/datasets#9128 ·
メンテナーはふだん 1 日以内に返信
-
priority:low ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
OpenHands/extensions#975 ·
メンテナーはふだん 1 日以内に返信
-
Function/dict state handlers can't supply provider-state injected values (`generate.provider_state`)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
pact-foundation/pact-python#1789 ·
メンテナーはふだん 9 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
juandresrodca/AdminForge#66 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信