-
Notifications
You must be signed in to change notification settings - Fork 94
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
feat(ksymbols): reintroduce lazy symbol queries #437
feat(ksymbols): reintroduce lazy symbol queries #437
Conversation
Going on this soon. |
5451945
to
3f00c64
Compare
Add new required symbol and addresses lists to the KSymbolTable helper. When either list is given, the data structure will only save required symbols during scanning. This should reduce memory usage for users who can mostly guarentee that symbols are known ahead of time. Dynamic querying is still allowed in this mode, though it will incur a penalty as rescanning is required.
3f00c64
to
716c1f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, put some questions.
k.updateLock.RLock() | ||
defer k.updateLock.RUnlock() | ||
k.updateLock.Lock() | ||
defer k.updateLock.Unlock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the goal is to squeeze as much as possible (optimise wise), what do you think unlocking right after the getTextSegmentAddresses()
call?
@@ -225,6 +308,13 @@ func (k *KernelSymbolTable) processLines(chans []chan *KernelSymbol) error { | |||
continue | |||
} | |||
if sym := parseLine(fields); sym != nil { | |||
if k.onlyRequired { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we assume at this stage that if !k.onlyRequired
we should continue?
type name struct { | ||
name string | ||
} | ||
type name string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call.
|
||
symbols, exist := k.symbols[name{n}] | ||
err := k.validateOrAddRequiredSym(name(n)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about returning symbols
and exist
from validateOrAddRequiredSym
, so we could release the lock right after it returns checking them later.
Closing this in favour of aquasecurity/tracee#4095 |
Add new required symbol and addresses lists to the KSymbolTable helper. When either list is given, the data structure will only save required symbols during scanning. This should reduce memory usage for users who can mostly guarentee that symbols are known ahead of time.
Dynamic querying is still allowed in this mode, though it will incur a penalty as rescanning is required.