RT-Thread / RT-Thread/rt-thread
[Bug] dfs_v2打开pagecache,运行elf后会存在memleak
Open
Nobody has claimed this yet.
BSP: K230
- Dominant language
- C
- Stars
- 12.2k
- Forks
- 5.4k
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 40
Description
RT-Thread Version
53bd56ccf9cb77dd1cec3c3c9e1fde24b0a95267
Hardware Type/Architectures
risc-v/K230
Develop Toolchain
GCC
Describe the bug
- dfs_v2打开pagecache,运行任意elf后,通过free对比运行前后发现存在memleak
Other additional context
定位到具体位置有两处:
- 加载elf文件时对应的
struct dfs_file *file结构未释放,原因为elf map时会增加file->ref_count,导致执行close->fd_release->fdt_fd_release时file->ref_count不等于1,未能正常释放 - 用户程序退出时会执行
lwp_exit->_clear_child_tid->sys_futex,此处是个share futex,不会被删除
对于share futex,还有一个疑问,对于没有进程使用的futex似乎没有删除操作?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the leak with dfs_v2 pagecache enabled by running an ELF and comparing free memory before and after. Inspect ELF mapping and the referenced flow through close, fd_release, and fdt_fd_release, then trace lwp_exit, clear_child_tid, and sys_futex for shared-futex cleanup. Done means the ELF file reference and unused shared futex are released without a post-exit leak.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100