diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2022-01-13 11:16:43 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2022-01-13 17:03:25 +0100 |
| commit | 65ab1192dcd0323e1b51e8e2f074fb5d6fcb2a1f (patch) | |
| tree | 4b73d9308804c3d1f51a5eaf455e04e793bfebca /tools/syz-check | |
| parent | 54ec1f8e0ee1d049dcc573169c33812ad860f20f (diff) | |
tools/syz-check: ignore structs with out_overlay attribute
Diffstat (limited to 'tools/syz-check')
| -rw-r--r-- | tools/syz-check/check.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/syz-check/check.go b/tools/syz-check/check.go index 12b5b431e..c97df4252 100644 --- a/tools/syz-check/check.go +++ b/tools/syz-check/check.go @@ -251,6 +251,14 @@ func checkStruct(typ prog.Type, astStruct *ast.Struct, str *dwarf.StructType) ([ if _, ok := typ.(*prog.UnionType); ok || str.Kind == "union" { return warnings, nil } + // Ignore structs with out_overlay attribute. + // They are never described in the kernel as a simple struct. + // We could only match and check fields based on some common conventions, + // but since we have very few of them it's unclear what are these conventions + // and implementing something complex will have low RoI. + if typ.(*prog.StructType).OverlayField != 0 { + return warnings, nil + } // TODO: we could also check enums (elements match corresponding flags in syzkaller). // TODO: we could also check values of literal constants (dwarf should have that, right?). // TODO: handle nested structs/unions, e.g.: @@ -638,6 +646,12 @@ func minTypeSize(t prog.Type) int { } switch typ := t.(type) { case *prog.StructType: + if typ.OverlayField != 0 { + // Overlayed structs are not supported here + // (and should not be used in netlink). + // Make this always produce a warning. + return -1 + } // Some struct args has trailing arrays, but are only checked for min size. // Try to get some estimation for min size of this struct. size := 0 |
