[ARM/Linux] fstat64 reports epoch nanoseconds as subsecond nanoseconds
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 半天
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
调研方向
The bug is in the stat64 serializer at qiling/os/posix/syscall/stat.py, which writes the ARM32 Linux subsecond nanoseconds field. Start by reading how the nanosecond value is computed and packed for the ARM32 stat64 layout, then compare it with the layout the issue describes. Done means the field holds only the 0 to 999999999 fraction, and the sample prints mtime=1700000000.123456789 for the fixture created with touch -d.
由索引模型根据 Issue 内容生成。
描述
Describe the bug
On an ARM32 Linux guest, Qiling v1.4.11's fstat64 result places the full epoch nanosecond value into the ABI's subsecond nanoseconds field. The field should contain only the nanosecond fraction within the second.
Sample Code
Create a fresh empty directory named rootfs, create the fixture there, then run an ARM EABI guest that calls fstat64:
mkdir rootfs
touch -d '@1700000000.123456789' rootfs/fixture
#define _GNU_SOURCE
#define _LARGEFILE64_SOURCE
#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>
#include <time.h>
int main(void)
{
int fd = open("fixture", O_RDONLY);
struct stat64 st;
if (fd < 0 || fstat64(fd, &st) != 0)
return 1;
printf("mtime=%lld.%09ld\n",
(long long)st.st_mtim.tv_sec, st.st_mtim.tv_nsec);
return 0;
}
arm-linux-gnueabihf-gcc -static -O2 probe.c -o fstat64-probe
Run the ARM guest with Qiling:
from qiling import Qiling
ql = Qiling(["./fstat64-probe"], "./rootfs")
ql.run()
Expected behavior
The mtime fields should be 1700000000 seconds and 123456789 nanoseconds. The nanoseconds field must be in the range 0 through 999999999. Qiling currently writes the epoch nanosecond count into the 32-bit subsecond field.
With this fixture, Qiling narrows 1700000000123456789 to 1032178965; the sample therefore prints mtime=1700000000.1032178965 instead of mtime=1700000000.123456789.
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. The affected serializer is in stat.py. The issue concerns the ARM32 Linux stat64 layout.
- 主要语言
- Python
- 星标
- 6.2k
- 派生
- 806
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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 天内回复