Skip to content

[HUST CSE][core] validate thread priority at runtime#11297

Open
Telecaster2147 wants to merge 2 commits intoRT-Thread:masterfrom
Telecaster2147:security/core-priority-validation
Open

[HUST CSE][core] validate thread priority at runtime#11297
Telecaster2147 wants to merge 2 commits intoRT-Thread:masterfrom
Telecaster2147:security/core-priority-validation

Conversation

@Telecaster2147
Copy link
Copy Markdown

@Telecaster2147 Telecaster2147 commented Mar 25, 2026

拉取/合并请求描述:(PR description)

为什么提交这份PR (why to submit this PR)

当前调度优先级更新路径对非法优先级的保护主要依赖 RT_ASSERT。在非断言构建下,越界优先级可能继续进入核心调度逻辑,带来不可预期行为。

你的解决方案是什么 (what is your solution)

本 PR 在 rt_sched_thread_change_priority() 和 rt_sched_thread_reset_priority() 中增加运行时检查:当 priority 大于等于 RT_THREAD_PRIORITY_MAX 时,直接返回 -RT_EINVAL,避免非法值继续传入内部调度更新逻辑。

请提供验证的bsp和config (provide the config and bsp)

  • BSP:
    bsp/qemu-vexpress-a9

  • .config:使用 bsp/qemu-vexpress-a9/.config 做基础编译验证。

  • action:currently unavailable

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/ALL_BSP_COMPILE.json 详细请参考链接BSP自查

@Telecaster2147 Telecaster2147 marked this pull request as draft March 25, 2026 12:05
@Telecaster2147 Telecaster2147 marked this pull request as ready for review March 25, 2026 12:05
@Telecaster2147
Copy link
Copy Markdown
Author

Telecaster2147 commented Mar 25, 2026

@Rbb666 您好,我这边的 PR #11297 好像被卡在 workflow approval 这里了,导致 pr-labeler 和 reviewer assign 都没有继续执行。能麻烦您有空帮忙看一下并 approve 一下吗,感谢!!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 25, 2026

📌 Code Review Assignment

🏷️ Tag: components

Reviewers: Maihuanyi

Changed Files (Click to expand)
  • components/lwp/lwp_syscall.c

🏷️ Tag: components_lwp

Reviewers: xu18838022837

Changed Files (Click to expand)
  • components/lwp/lwp_syscall.c

🏷️ Tag: kernel

Reviewers: GorrayLi ReviewSun hamburger-os lianux-mm wdfk-prog xu18838022837

Changed Files (Click to expand)
  • src/scheduler_comm.c

📊 Current Review Status (Last Updated: 2026-03-28 19:39 CST)

  • GorrayLi Pending Review
  • Maihuanyi Pending Review
  • ReviewSun Pending Review
  • hamburger-os Pending Review
  • lianux-mm Pending Review
  • wdfk-prog Pending Review
  • xu18838022837 Pending Review

📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

@github-actions github-actions bot added the Kernel PR has src relate code label Mar 25, 2026
@Rbb666
Copy link
Copy Markdown
Member

Rbb666 commented Mar 25, 2026

@Rbb666 您好,我这边的 PR #11297 好像被卡在 workflow approval 这里了,导致 pr-labeler 和 reviewer assign 都没有继续执行。能麻烦您有空帮忙看一下并 approve 一下吗,感谢!!

可以了,因为第一次贡献不会运行ci,下一次就好了

@Telecaster2147 Telecaster2147 force-pushed the security/core-priority-validation branch from 7797e7f to 034f06d Compare March 26, 2026 04:25
@github-actions github-actions bot added RT-Smart RT-Thread Smart related PR or issues component: lwp Component labels Mar 26, 2026
@Telecaster2147 Telecaster2147 requested a review from Rbb666 March 26, 2026 04:28
@Rbb666
Copy link
Copy Markdown
Member

Rbb666 commented Mar 28, 2026

lgtm,然后第一条和第二条压缩成一个 commit 吧,format 的 commit 也单独保留即可,我会 rebase 合并

@Telecaster2147 Telecaster2147 force-pushed the security/core-priority-validation branch from 452333b to 2b81eb8 Compare March 28, 2026 11:30
@Telecaster2147
Copy link
Copy Markdown
Author

lgtm,然后第一条和第二条压缩成一个 commit 吧,format 的 commit 也单独保留即可,我会 rebase 合并

好的,感谢!已经压缩完成了

@Telecaster2147 Telecaster2147 force-pushed the security/core-priority-validation branch from 2b81eb8 to 7349773 Compare March 28, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: lwp Component Kernel PR has src relate code RT-Smart RT-Thread Smart related PR or issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants