Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix proc info lru #3918

Merged
merged 3 commits into from
Mar 14, 2024
Merged

Conversation

yanivagman
Copy link
Collaborator

@yanivagman yanivagman commented Mar 14, 2024

1. Explain what the PR does

fix: always initialize proc_info map

In environments with a high amount of CPUs the current proc_info map
size of 10240 entries might not be enough, and gets filled quickly.
In these cases we got an error of missing proc_info entry.

A quick mitigation then will be to set a bigger map size.

The root cause of this issue is that we assume that if task_info exists
for some task in the task_info_map, then also the proc_info of the
process to which the task belongs to also has an entry in the map,
but that is not the case.

To fix this issue, add proc_info lookup and initialization in
init_program_data() function. In addition, init proc_info of the
relevant pid in case it was not found in other places.

Fix: #3914

2. Explain how to test it

To test, I changed proc_info_map size to 50, then reproduced the issue.
Then see that the issue is fixed with this change

3. Other comments

@yanivagman yanivagman added this to the v0.21.0 milestone Mar 14, 2024
@yanivagman yanivagman linked an issue Mar 14, 2024 that may be closed by this pull request
@yanivagman yanivagman requested a review from geyslan March 14, 2024 12:10
@geyslan
Copy link
Member

geyslan commented Mar 14, 2024

To test, I changed proc_info_map size to 50, then reproduced the issue.
Then see that the issue is fixed with this change

Yes. I also tested it locally and everything worked perfectly.

Copy link
Member

@geyslan geyslan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

In environments with a high amount of CPUs the current proc_info map
size of 10240 entries might not be enough, and gets filled quickly.
In these cases we got an error of missing proc_info entry.

A quick mitigation then will be to set a bigger map size.

The root cause of this issue is that we assume that if task_info exists
for some task in the task_info_map, then also the proc_info of the
process to which the task belongs to also has an entry in the map,
but that is not the case.

To fix this issue, add proc_info lookup and initialization in
init_program_data() function. In addition, init proc_info of the
relevant pid in case it was not found in other places.

Fix: aquasecurity#3914
@yanivagman yanivagman merged commit 69f8167 into aquasecurity:main Mar 14, 2024
32 checks passed
@yanivagman yanivagman deleted the fix_proc_info_lru branch March 14, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed to find a process in proc_info_map
2 participants