Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Potential thread stack overflow in SystemTask::Process

未关闭
#2,407 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
cmake, cpp

调研方向

从链接的 SystemTask::Process 位置和 CMakeLists.txt 中的 stack 使用选项开始。使用 make pinetime-app 进行构建,检查生成的 .su 文件,并跟踪报告的从 Process 到 littlefs 的调用路径。完成的标准是确定 1432 字节的路径是否超出线程 stack,并处理或记录结果。

由索引模型根据 Issue 内容生成。

描述

Issue details

While some detailed build configuration, There are potential stack overflow in thread function named SystemTask::Process

https://github.com/InfiniTimeOrg/InfiniTime/blob/0fabfe99d9115c5e258a14fd0c985d300ee41f2d/src/systemtask/SystemTask.cpp#L90

In this line, SystemTask::Process Allows 1400(350*4) stack size.

However, after checking the stack using our internally developed tool, it might have 1432 Bytes in with some detailed configurations.

Steps to produce

1. In CMakeLists.txt , Add this line:

add_compile_options(
    $<$<COMPILE_LANGUAGE:C>:-fstack-usage>
    $<$<COMPILE_LANGUAGE:CXX>:-fstack-usage>
)

This will help you automatically calculating stack size of each function.

2. Build InfiniTime normally, using this configurations:

make pinetime-app

Now we can get stack usage file (*.su) for each source file, So we can manually check stack size of each function.

In case of SystemTask::Process :

There are large call stack with this flow:

Pinetime::System::SystemTask::Process (_ZN8Pinetime6System10SystemTask7ProcessEPv) => 8 bytes
Pinetime::System::SystemTask::Work (_ZN8Pinetime6System10SystemTask4WorkEv) => 64 bytes
Pinetime::Controllers::NimbleController::Init(_ZN8Pinetime11Controllers16NimbleController4InitEv) => 24 bytes
Pinetime::Controllers::NimbleController::RestoreBond(_ZN8Pinetime11Controllers16NimbleController11RestoreBondEv) => 272 bytes
Pinetime::Controllers::FS::FileDelete(_ZN8Pinetime11Controllers2FS10FileDeleteEPKc) => 0 bytes
lfs_remove(lfs_remove) => 120 bytes
lfs_fs_forceconsistency(lfs_fs_forceconsistency) => 144 bytes
lfs_dir_drop(lfs_dir_drop) => 24 bytes
lfs_dir_commit(lfs_dir_commit) => 168 bytes
lfs_dir_compact(lfs_dir_compact) => 160 bytes
lfs_dir_split(lfs_dir_split) => 88 bytes
lfs_dir_alloc(lfs_dir_alloc) => 32 bytes
lfs_alloc(lfs_alloc) => 24 bytes
lfs_fs_rawtraverse(lfs_fs_rawtraverse) => 104 bytes
lfs_dir_fetch(lfs_dir_fetch) => 24 bytes
lfs_dir_fetchmatch(lfs_dir_fetchmatch) => 112 bytes
lfs_bd_read(lfs_bd_read) => 64 bytes

SUM => 1432 bytes
So, there are potentially occur stack overflow in SystemTask::Process Thread function.

Environment

Version
Commit https://github.com/InfiniTimeOrg/InfiniTime/commit/7128fc045db083c7014166872b50b536942c06e0

主要语言
C
星标
3.4k
派生
1.1k
平均合并
23 小时 18 分钟
30 天内合并 PR
1

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

InfiniTimeOrg/InfiniTime 的其他 Issue

查看 InfiniTimeOrg/InfiniTime 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。