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

elf: freeze .kconfig map #1000

Merged
merged 1 commit into from
Apr 4, 2023
Merged

elf: freeze .kconfig map #1000

merged 1 commit into from
Apr 4, 2023

Conversation

lmb
Copy link
Collaborator

@lmb lmb commented Apr 4, 2023

The verifier will only treat .kconfig as constants if the map is frozen, since otherwise modification from user space is possible.

Always freeze the kconfig map.

The verifier will only treat .kconfig as constants if the map is
frozen, since otherwise modification from user space is possible.

Always freeze the kconfig map.

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
@lmb lmb requested a review from rgo3 April 4, 2023 13:58
@lmb
Copy link
Collaborator Author

lmb commented Apr 4, 2023

cc @eiffel-fl

Copy link
Contributor

@eiffel-fl eiffel-fl left a comment

Choose a reason for hiding this comment

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

This makes totally sense to forbid user space to modify this map once created but what is the benefits of this from the verifier point of view?
As it will consider it constant it will be quicker to check it, right?

@lmb
Copy link
Collaborator Author

lmb commented Apr 4, 2023

As it will consider it constant it will be quicker to check it, right?

I think it actually turns the load from memory into a constant load (in the JITed BPF code) and can then use the constant value for deciding whether code is reachable or not! This might make it faster to verify a program, but the main benefit is that some programs start working at all because large chunks can be ignored by the verifier.

@lmb lmb merged commit e20263d into cilium:master Apr 4, 2023
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