Skip to content

Conversation

@anchao
Copy link
Contributor

@anchao anchao commented Mar 11, 2024

Summary

sched/group: set clear flag if the group is not really needed

The delete flag is not synchronized with the life cycle of the group, if the flag set before waitpid(), the tcb will be mistakenly deleted by group_del_waiter(), use-after-free will happen.

Regression by:

| commit 29e50ffa7374fa4c473d8d4f8cb3506665443d3e (origin/master, origin/HEAD)
| Author: chao an <anchao@lixiang.com>
| Date:   Mon Mar 4 09:19:27 2024 +0800
|
|     sched/group: move task group into task_tcb_s to improve performance
|
|     move task group into task_tcb_s to avoid access allocator to improve performance
|
|     for Task Termination, the time consumption will be reduced ~2us (Tricore TC397 300MHZ):
|     15.97(us) -> 13.55(us)
|
|     Signed-off-by: chao an <anchao@lixiang.com>

Impact

N/A

Testing

rv-virt:ksmp64

The delete flag is not synchronized with the life cycle of the group,
if the flag set before waitpid(), the tcb will be mistakenly deleted
by group_del_waiter(), use-after-free will happen.

Regression by:
| commit 29e50ff (origin/master, origin/HEAD)
| Author: chao an <anchao@lixiang.com>
| Date:   Mon Mar 4 09:19:27 2024 +0800
|
|     sched/group: move task group into task_tcb_s to improve performance
|
|     move task group into task_tcb_s to avoid access allocator to improve performance
|
|     for Task Termination, the time consumption will be reduced ~2us (Tricore TC397 300MHZ):
|     15.97(us) -> 13.55(us)
|
|     Signed-off-by: chao an <anchao@lixiang.com>

Signed-off-by: chao an <anchao@lixiang.com>
@anchao anchao requested a review from masayuki2009 March 11, 2024 02:47
@anchao
Copy link
Contributor Author

anchao commented Mar 11, 2024

@masayuki2009 @xiaoxiang781216 @acassis
This PR is to resolve the regression issue caused by #11832

  1. If sched/group: move task group into task_tcb_s to improve performance #11832 needs further review, please merge Revert "sched/group: move task group into task_tcb_s to improve performance" #11883 and I will do a fully test based on the new PR.
  2. If the sched/group: set clear flag if the group is not really needed #11885 test has no regression issues, then this PR could be merged

@masayuki2009
Copy link
Contributor

@anchao
I confirmed this PR fixes the issues.

@masayuki2009 masayuki2009 merged commit d468ff3 into apache:master Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants