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

tools/syz-declextract: Code Restructuring #5346

Open
wants to merge 3 commits into from

Conversation

pimyn-girgis
Copy link
Contributor

No description provided.

sys/linux/auto.txt Outdated Show resolved Hide resolved
@a-nogikh
Copy link
Collaborator

I wonder if struct fields that mention fd should also become fd? At least those that are of 32 bit.

@a-nogikh
Copy link
Collaborator

I wonder if struct fields that mention fd should also become fd? At least those that are of 32 bit.

Same for _pid, _uid, _tid.

@a-nogikh
Copy link
Collaborator

Do we currently support nested netlink policies? E.g. for ETHTOOL_A_TSINFO_HEADER it should definitely not be nlattr[ETHTOOL_A_TSINFO_HEADER, array[int8, 3]]

https://elixir.bootlin.com/linux/v6.11/source/net/ethtool/tsinfo.c#L26

@pimyn-girgis
Copy link
Contributor Author

Do we currently support nested netlink policies? E.g. for ETHTOOL_A_TSINFO_HEADER it should definitely not be nlattr[ETHTOOL_A_TSINFO_HEADER, array[int8, 3]]

https://elixir.bootlin.com/linux/v6.11/source/net/ethtool/tsinfo.c#L26

No, these are not supported yet.

@a-nogikh
Copy link
Collaborator

a-nogikh commented Sep 30, 2024

Regarding the failing tests. They are due to this code preferring $auto-calls to their non-auto alternatives.

func (cs *defaultCallSelector) Select(call *parser.Syscall) *prog.Syscall {
var match *prog.Syscall
discriminators := discriminatorArgs[call.CallName]
if len(discriminators) == 0 {
return nil
}
score := 0
for _, meta := range cs.callSet(call.CallName) {
if score1 := cs.matchCall(meta, call, discriminators); score1 > score {
match, score = meta, score1
}
}
return match
}

It's a good question whether $auto really have a higher score here or the scores are equal and $auto versions just happen to be earlier in callSet(). Let's just skip all auto-generated calls here for now:

func (cs *selectorCommon) callSet(callName string) []*prog.Syscall {
calls, ok := cs.callCache[callName]
if ok {
return calls
}
for _, call := range cs.target.Syscalls {
if call.CallName == callName {
calls = append(calls, call)
}
}
cs.callCache[callName] = calls
return calls
}

sys/linux/auto.txt Outdated Show resolved Hide resolved
tools/syz-declextract/syz-declextract.cpp Outdated Show resolved Hide resolved
tools/syz-declextract/syz-declextract.cpp Outdated Show resolved Hide resolved
tools/syz-declextract/syz-declextract.cpp Outdated Show resolved Hide resolved
tools/syz-declextract/syz-declextract.cpp Outdated Show resolved Hide resolved
tools/syz-declextract/syz-declextract.cpp Outdated Show resolved Hide resolved
tools/syz-declextract/syz-declextract.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@dvyukov dvyukov left a comment

Choose a reason for hiding this comment

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

Otherwise looks good.

tools/syz-declextract/syz-declextract.cpp Outdated Show resolved Hide resolved
tools/syz-declextract/syz-declextract.cpp Outdated Show resolved Hide resolved
@dvyukov dvyukov enabled auto-merge October 9, 2024 15:17
@dvyukov dvyukov added this pull request to the merge queue Oct 9, 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.

3 participants