aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-declextract
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2025-04-09 10:38:03 +0200
committerDmitry Vyukov <dvyukov@google.com>2025-04-10 17:07:48 +0000
commit2d9fa31cf7abaddf944824814053e67b4d5c478e (patch)
tree12c10728542789e81ec4eef0496250933516e217 /tools/syz-declextract
parenta6ec893839824d1b080d8c0c02360e5db5c6d39f (diff)
pkg/declextract: export syscall variants as separate interfaces
Export each syscall variant (e.g. fcnt$*) as a separate interface. Effectively these are separate syscalls. We will want this for ioctl as well (it's not 1 interface).
Diffstat (limited to 'tools/syz-declextract')
-rw-r--r--tools/syz-declextract/clangtool/declextract.cpp32
-rw-r--r--tools/syz-declextract/clangtool/output.h10
-rw-r--r--tools/syz-declextract/testdata/file_operations.c.json47
-rw-r--r--tools/syz-declextract/testdata/functions.c.json42
-rw-r--r--tools/syz-declextract/testdata/io_uring.c.json14
-rw-r--r--tools/syz-declextract/testdata/netlink.c.json20
-rw-r--r--tools/syz-declextract/testdata/scopes.c.info15
-rw-r--r--tools/syz-declextract/testdata/scopes.c.json45
-rw-r--r--tools/syz-declextract/testdata/syscall.c.json10
-rw-r--r--tools/syz-declextract/testdata/types.c.info2
-rw-r--r--tools/syz-declextract/testdata/types.c.json23
11 files changed, 177 insertions, 83 deletions
diff --git a/tools/syz-declextract/clangtool/declextract.cpp b/tools/syz-declextract/clangtool/declextract.cpp
index 2df651e07..6d23d2a50 100644
--- a/tools/syz-declextract/clangtool/declextract.cpp
+++ b/tools/syz-declextract/clangtool/declextract.cpp
@@ -141,7 +141,6 @@ private:
int sizeofType(const Type* T);
int alignofType(const Type* T);
void extractIoctl(const Expr* Cmd, const MacroDesc& Macro);
- int getStmtLOC(const Stmt* S);
std::optional<MacroDesc> isMacroRef(const Expr* E);
};
@@ -358,11 +357,6 @@ std::string Extractor::getDeclFileID(const Decl* Decl) {
return file;
}
-int Extractor::getStmtLOC(const Stmt* S) {
- return std::max<int>(0, SourceManager->getExpansionLineNumber(S->getSourceRange().getEnd()) -
- SourceManager->getExpansionLineNumber(S->getSourceRange().getBegin()) - 1);
-}
-
std::optional<MacroDesc> Extractor::isMacroRef(const Expr* E) {
if (!E)
return {};
@@ -636,7 +630,7 @@ struct FunctionAnalyzer : RecursiveASTVisitor<FunctionAnalyzer> {
: Extractor(Extractor), CurrentFunc(Func->getNameAsString()), Context(Extractor->Context),
SourceManager(Extractor->SourceManager) {
// The global function scope.
- Scopes.push_back(FunctionScope{.Arg = -1, .LOC = Extractor->getStmtLOC(Func->getBody())});
+ Scopes.push_back(FunctionScope{.Arg = -1});
Current = &Scopes[0];
TraverseStmt(Func->getBody());
}
@@ -692,11 +686,7 @@ struct FunctionAnalyzer : RecursiveASTVisitor<FunctionAnalyzer> {
}
}
- int Begin = SourceManager->getExpansionLineNumber(S->getBeginLoc());
- int End = SourceManager->getExpansionLineNumber(S->getEndLoc());
- if (IsInteresting)
- Scopes[0].LOC = std::max<int>(0, Scopes[0].LOC - (End - Begin));
- SwitchStack.push({S, IsInteresting, IsInteresting ? static_cast<int>(Param->Argument->Arg) : -1, End});
+ SwitchStack.push({S, IsInteresting, IsInteresting ? static_cast<int>(Param->Argument->Arg) : -1});
return true;
}
@@ -711,10 +701,10 @@ struct FunctionAnalyzer : RecursiveASTVisitor<FunctionAnalyzer> {
if (!C->getNextSwitchCase() || C->getNextSwitchCase()->getSubStmt() != C) {
int Line = SourceManager->getExpansionLineNumber(C->getBeginLoc());
if (Current != &Scopes[0])
- Current->LOC = Line - Current->LOC;
+ Current->EndLine = Line;
Scopes.push_back(FunctionScope{
.Arg = SwitchStack.top().Arg,
- .LOC = Line,
+ .StartLine = Line,
});
Current = &Scopes.back();
}
@@ -749,10 +739,8 @@ struct FunctionAnalyzer : RecursiveASTVisitor<FunctionAnalyzer> {
auto Top = SwitchStack.top();
if (Top.S != S)
return true;
- if (Top.IsInteresting) {
- Current->LOC = Top.EndLine - Current->LOC;
+ if (Top.IsInteresting)
Current = &Scopes[0];
- }
SwitchStack.pop();
return true;
}
@@ -769,7 +757,6 @@ struct FunctionAnalyzer : RecursiveASTVisitor<FunctionAnalyzer> {
const SwitchStmt* S;
bool IsInteresting;
int Arg;
- int EndLine;
};
Extractor* Extractor;
@@ -787,12 +774,17 @@ void Extractor::matchFunctionDef() {
const auto* Func = getResult<FunctionDecl>("function");
if (!Func->getBody())
return;
- const std::string& SourceFile = std::filesystem::relative(
- SourceManager->getFilename(SourceManager->getExpansionLoc(Func->getSourceRange().getBegin())).str());
+ auto Range = Func->getSourceRange();
+ const std::string& SourceFile =
+ std::filesystem::relative(SourceManager->getFilename(SourceManager->getExpansionLoc(Range.getBegin())).str());
+ const int StartLine = SourceManager->getExpansionLineNumber(Range.getBegin());
+ const int EndLine = SourceManager->getExpansionLineNumber(Range.getEnd());
FunctionAnalyzer Analyzer(this, Func);
Output.emit(Function{
.Name = Func->getNameAsString(),
.File = SourceFile,
+ .StartLine = StartLine,
+ .EndLine = EndLine,
.IsStatic = Func->isStatic(),
.Scopes = std::move(Analyzer.Scopes),
});
diff --git a/tools/syz-declextract/clangtool/output.h b/tools/syz-declextract/clangtool/output.h
index 4a482ed3c..56b207be1 100644
--- a/tools/syz-declextract/clangtool/output.h
+++ b/tools/syz-declextract/clangtool/output.h
@@ -158,7 +158,8 @@ struct TypingFact {
struct FunctionScope {
int Arg = 0;
- int LOC = 0;
+ int StartLine = 0;
+ int EndLine = 0;
std::vector<std::string> Values;
std::vector<std::string> Calls;
std::vector<TypingFact> Facts;
@@ -167,6 +168,8 @@ struct FunctionScope {
struct Function {
std::string Name;
std::string File;
+ int StartLine = 0;
+ int EndLine = 0;
bool IsStatic = false;
std::vector<FunctionScope> Scopes;
};
@@ -362,7 +365,8 @@ inline void print(JSONPrinter& Printer, const FunctionScope& V) {
JSONPrinter::Scope Scope(Printer);
Printer.Field("arg", V.Arg);
Printer.Field("values", V.Values);
- Printer.Field("loc", V.LOC);
+ Printer.Field("start_line", V.StartLine);
+ Printer.Field("end_line", V.EndLine);
Printer.Field("calls", V.Calls);
Printer.Field("facts", V.Facts, true);
}
@@ -371,6 +375,8 @@ inline void print(JSONPrinter& Printer, const Function& V) {
JSONPrinter::Scope Scope(Printer);
Printer.Field("name", V.Name);
Printer.Field("file", V.File);
+ Printer.Field("start_line", V.StartLine);
+ Printer.Field("end_line", V.EndLine);
Printer.Field("is_static", V.IsStatic);
Printer.Field("scopes", V.Scopes, true);
}
diff --git a/tools/syz-declextract/testdata/file_operations.c.json b/tools/syz-declextract/testdata/file_operations.c.json
index dd0415fd2..9fcd64ce4 100644
--- a/tools/syz-declextract/testdata/file_operations.c.json
+++ b/tools/syz-declextract/testdata/file_operations.c.json
@@ -3,6 +3,8 @@
{
"name": "__fget_light",
"file": "include/fs.h",
+ "start_line": 18,
+ "end_line": 19,
"is_static": true,
"scopes": [
{
@@ -13,22 +15,24 @@
{
"name": "alloc_fd",
"file": "include/fs.h",
+ "start_line": 14,
+ "end_line": 16,
"is_static": true,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
}
]
},
{
"name": "foo_ioctl",
"file": "file_operations.c",
+ "start_line": 21,
+ "end_line": 30,
"is_static": true,
"scopes": [
{
"arg": -1,
- "loc": 2,
"calls": [
"foo_ioctl2"
],
@@ -72,18 +76,19 @@
"FOO_IOCTL4",
"FOO_IOCTL5"
],
- "loc": 5
+ "start_line": 23
}
]
},
{
"name": "foo_ioctl2",
"file": "file_operations.c",
+ "start_line": 13,
+ "end_line": 19,
"is_static": true,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
},
{
"arg": 0,
@@ -91,13 +96,15 @@
"FOO_IOCTL6",
"FOO_IOCTL7"
],
- "loc": 3
+ "start_line": 15
}
]
},
{
"name": "foo_mmap",
"file": "file_operations.c",
+ "start_line": 11,
+ "end_line": 11,
"is_static": true,
"scopes": [
{
@@ -108,6 +115,8 @@
{
"name": "foo_open",
"file": "file_operations.c",
+ "start_line": 8,
+ "end_line": 8,
"is_static": true,
"scopes": [
{
@@ -118,6 +127,8 @@
{
"name": "foo_read",
"file": "file_operations.c",
+ "start_line": 9,
+ "end_line": 9,
"is_static": true,
"scopes": [
{
@@ -128,6 +139,8 @@
{
"name": "foo_write",
"file": "file_operations.c",
+ "start_line": 10,
+ "end_line": 10,
"is_static": true,
"scopes": [
{
@@ -138,17 +151,20 @@
{
"name": "from_kuid",
"file": "include/fs.h",
+ "start_line": 21,
+ "end_line": 23,
"is_static": true,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
}
]
},
{
"name": "proc_ioctl",
"file": "file_operations.c",
+ "start_line": 43,
+ "end_line": 43,
"is_static": true,
"scopes": [
{
@@ -159,6 +175,8 @@
{
"name": "proc_open",
"file": "file_operations.c",
+ "start_line": 40,
+ "end_line": 40,
"is_static": true,
"scopes": [
{
@@ -169,6 +187,8 @@
{
"name": "proc_read",
"file": "file_operations.c",
+ "start_line": 41,
+ "end_line": 41,
"is_static": true,
"scopes": [
{
@@ -179,6 +199,8 @@
{
"name": "proc_write",
"file": "file_operations.c",
+ "start_line": 42,
+ "end_line": 42,
"is_static": true,
"scopes": [
{
@@ -189,11 +211,12 @@
{
"name": "unused_ioctl",
"file": "file_operations.c",
+ "start_line": 59,
+ "end_line": 64,
"is_static": true,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
},
{
"arg": 1,
@@ -201,7 +224,7 @@
"UNUSED_IOCTL1",
"UNUSED_IOCTL2"
],
- "loc": 2
+ "start_line": 61
}
]
}
diff --git a/tools/syz-declextract/testdata/functions.c.json b/tools/syz-declextract/testdata/functions.c.json
index 6d636233e..b4766e73e 100644
--- a/tools/syz-declextract/testdata/functions.c.json
+++ b/tools/syz-declextract/testdata/functions.c.json
@@ -3,10 +3,11 @@
{
"name": "__do_sys_functions",
"file": "functions.c",
+ "start_line": 31,
+ "end_line": 34,
"scopes": [
{
"arg": -1,
- "loc": 2,
"calls": [
"__fget_light",
"func_baz"
@@ -45,6 +46,8 @@
{
"name": "__fget_light",
"file": "include/fs.h",
+ "start_line": 18,
+ "end_line": 19,
"is_static": true,
"scopes": [
{
@@ -55,54 +58,59 @@
{
"name": "alloc_fd",
"file": "include/fs.h",
+ "start_line": 14,
+ "end_line": 16,
"is_static": true,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
}
]
},
{
"name": "atomic_load32",
"file": "include/types.h",
+ "start_line": 17,
+ "end_line": 19,
"is_static": true,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
}
]
},
{
"name": "atomic_load64",
"file": "include/types.h",
+ "start_line": 21,
+ "end_line": 23,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
}
]
},
{
"name": "from_kuid",
"file": "include/fs.h",
+ "start_line": 21,
+ "end_line": 23,
"is_static": true,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
}
]
},
{
"name": "func_bar",
"file": "functions.c",
+ "start_line": 11,
+ "end_line": 13,
"is_static": true,
"scopes": [
{
"arg": -1,
- "loc": 1,
"calls": [
"func_foo"
]
@@ -112,10 +120,11 @@
{
"name": "func_baz",
"file": "functions.c",
+ "start_line": 15,
+ "end_line": 24,
"scopes": [
{
"arg": -1,
- "loc": 8,
"calls": [
"func_foo",
"func_bar",
@@ -155,6 +164,8 @@
{
"name": "func_foo",
"file": "functions.c",
+ "start_line": 8,
+ "end_line": 9,
"is_static": true,
"scopes": [
{
@@ -165,10 +176,11 @@
{
"name": "func_qux",
"file": "functions.c",
+ "start_line": 26,
+ "end_line": 29,
"scopes": [
{
"arg": -1,
- "loc": 2,
"calls": [
"alloc_fd"
],
@@ -204,10 +216,11 @@
{
"name": "typing",
"file": "functions.c",
+ "start_line": 46,
+ "end_line": 52,
"scopes": [
{
"arg": -1,
- "loc": 5,
"calls": [
"typing1"
],
@@ -298,10 +311,11 @@
{
"name": "typing1",
"file": "functions.c",
+ "start_line": 42,
+ "end_line": 44,
"scopes": [
{
"arg": -1,
- "loc": 1,
"facts": [
{
"src": {
diff --git a/tools/syz-declextract/testdata/io_uring.c.json b/tools/syz-declextract/testdata/io_uring.c.json
index 60ac44818..e82cf6c8c 100644
--- a/tools/syz-declextract/testdata/io_uring.c.json
+++ b/tools/syz-declextract/testdata/io_uring.c.json
@@ -3,6 +3,8 @@
{
"name": "io_eopnotsupp_prep",
"file": "io_uring.c",
+ "start_line": 11,
+ "end_line": 11,
"scopes": [
{
"arg": -1
@@ -12,6 +14,8 @@
{
"name": "io_nop",
"file": "io_uring.c",
+ "start_line": 13,
+ "end_line": 13,
"scopes": [
{
"arg": -1
@@ -21,6 +25,8 @@
{
"name": "io_nop_prep",
"file": "io_uring.c",
+ "start_line": 12,
+ "end_line": 12,
"scopes": [
{
"arg": -1
@@ -30,6 +36,8 @@
{
"name": "io_read",
"file": "io_uring.c",
+ "start_line": 15,
+ "end_line": 15,
"scopes": [
{
"arg": -1
@@ -39,6 +47,8 @@
{
"name": "io_readv_prep",
"file": "io_uring.c",
+ "start_line": 14,
+ "end_line": 14,
"scopes": [
{
"arg": -1
@@ -48,6 +58,8 @@
{
"name": "io_write",
"file": "io_uring.c",
+ "start_line": 17,
+ "end_line": 17,
"scopes": [
{
"arg": -1
@@ -57,6 +69,8 @@
{
"name": "io_writev_prep",
"file": "io_uring.c",
+ "start_line": 16,
+ "end_line": 16,
"scopes": [
{
"arg": -1
diff --git a/tools/syz-declextract/testdata/netlink.c.json b/tools/syz-declextract/testdata/netlink.c.json
index 9571730f7..95fcc7e5d 100644
--- a/tools/syz-declextract/testdata/netlink.c.json
+++ b/tools/syz-declextract/testdata/netlink.c.json
@@ -3,27 +3,31 @@
{
"name": "atomic_load32",
"file": "include/types.h",
+ "start_line": 17,
+ "end_line": 19,
"is_static": true,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
}
]
},
{
"name": "atomic_load64",
"file": "include/types.h",
+ "start_line": 21,
+ "end_line": 23,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
}
]
},
{
"name": "bar_cmd",
"file": "netlink.c",
+ "start_line": 43,
+ "end_line": 43,
"is_static": true,
"scopes": [
{
@@ -34,6 +38,8 @@
{
"name": "bar_doit",
"file": "netlink.c",
+ "start_line": 76,
+ "end_line": 76,
"is_static": true,
"scopes": [
{
@@ -44,6 +50,8 @@
{
"name": "bar_post_doit",
"file": "netlink.c",
+ "start_line": 77,
+ "end_line": 77,
"is_static": true,
"scopes": [
{
@@ -54,6 +62,8 @@
{
"name": "bar_pre_doit",
"file": "netlink.c",
+ "start_line": 75,
+ "end_line": 75,
"is_static": true,
"scopes": [
{
@@ -64,6 +74,8 @@
{
"name": "foo_cmd",
"file": "netlink.c",
+ "start_line": 42,
+ "end_line": 42,
"is_static": true,
"scopes": [
{
diff --git a/tools/syz-declextract/testdata/scopes.c.info b/tools/syz-declextract/testdata/scopes.c.info
index aeee09ace..1841dcf14 100644
--- a/tools/syz-declextract/testdata/scopes.c.info
+++ b/tools/syz-declextract/testdata/scopes.c.info
@@ -1 +1,14 @@
-SYSCALL scopes0 func:__do_sys_scopes0 loc:35 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0 func:__do_sys_scopes0 loc:37 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$100 func:__do_sys_scopes0 loc:11 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$101 func:__do_sys_scopes0 loc:11 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$102 func:__do_sys_scopes0 loc:11 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$1074291461 func:__do_sys_scopes0 loc:11 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$1074291462 func:__do_sys_scopes0 loc:11 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$FOO_IOCTL1 func:__do_sys_scopes0 loc:11 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$FOO_IOCTL2 func:__do_sys_scopes0 loc:13 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$FOO_IOCTL3 func:__do_sys_scopes0 loc:13 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$FOO_IOCTL4 func:__do_sys_scopes0 loc:11 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$FOO_IOCTL7 func:__do_sys_scopes0 loc:21 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$FOO_IOCTL8 func:__do_sys_scopes0 loc:21 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$LARGE_SINT func:__do_sys_scopes0 loc:8 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
+SYSCALL scopes0$LARGE_UINT func:__do_sys_scopes0 loc:8 access:unknown manual_desc:false auto_desc:true file:scopes.c subsystem:kernel
diff --git a/tools/syz-declextract/testdata/scopes.c.json b/tools/syz-declextract/testdata/scopes.c.json
index b5921869c..dd0e54a99 100644
--- a/tools/syz-declextract/testdata/scopes.c.json
+++ b/tools/syz-declextract/testdata/scopes.c.json
@@ -3,10 +3,11 @@
{
"name": "__do_sys_scopes0",
"file": "scopes.c",
+ "start_line": 25,
+ "end_line": 51,
"scopes": [
{
"arg": -1,
- "loc": 4,
"calls": [
"__fget_light"
],
@@ -44,7 +45,8 @@
"values": [
"FOO_IOCTL1"
],
- "loc": 3,
+ "start_line": 29,
+ "end_line": 32,
"calls": [
"__fget_light"
],
@@ -71,7 +73,8 @@
"FOO_IOCTL2",
"FOO_IOCTL3"
],
- "loc": 4,
+ "start_line": 32,
+ "end_line": 36,
"calls": [
"alloc_fd"
],
@@ -109,7 +112,8 @@
"1074291461",
"1074291462"
],
- "loc": 3
+ "start_line": 36,
+ "end_line": 39
},
{
"arg": 1,
@@ -117,7 +121,8 @@
"FOO_IOCTL7",
"FOO_IOCTL8"
],
- "loc": 4,
+ "start_line": 39,
+ "end_line": 43,
"calls": [
"scopes_helper"
],
@@ -171,11 +176,12 @@
"101",
"102"
],
- "loc": 3
+ "start_line": 43,
+ "end_line": 46
},
{
"arg": 1,
- "loc": 3,
+ "start_line": 46,
"facts": [
{
"src": {
@@ -197,6 +203,8 @@
{
"name": "__fget_light",
"file": "include/fs.h",
+ "start_line": 18,
+ "end_line": 19,
"is_static": true,
"scopes": [
{
@@ -207,40 +215,44 @@
{
"name": "alloc_fd",
"file": "include/fs.h",
+ "start_line": 14,
+ "end_line": 16,
"is_static": true,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
}
]
},
{
"name": "from_kuid",
"file": "include/fs.h",
+ "start_line": 21,
+ "end_line": 23,
"is_static": true,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
}
]
},
{
"name": "scopes_helper",
"file": "scopes.c",
+ "start_line": 11,
+ "end_line": 23,
"is_static": true,
"scopes": [
{
- "arg": -1,
- "loc": 2
+ "arg": -1
},
{
"arg": 0,
"values": [
"FOO_IOCTL7"
],
- "loc": 2,
+ "start_line": 13,
+ "end_line": 15,
"calls": [
"alloc_fd"
],
@@ -264,7 +276,8 @@
"values": [
"FOO_IOCTL8"
],
- "loc": 3,
+ "start_line": 15,
+ "end_line": 18,
"calls": [
"__fget_light"
],
@@ -291,7 +304,7 @@
"LARGE_UINT",
"LARGE_SINT"
],
- "loc": 3
+ "start_line": 18
}
]
}
diff --git a/tools/syz-declextract/testdata/syscall.c.json b/tools/syz-declextract/testdata/syscall.c.json
index 4e466a3ae..371fe183b 100644
--- a/tools/syz-declextract/testdata/syscall.c.json
+++ b/tools/syz-declextract/testdata/syscall.c.json
@@ -3,20 +3,22 @@
{
"name": "__do_sys_chmod",
"file": "syscall.c",
+ "start_line": 10,
+ "end_line": 12,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
}
]
},
{
"name": "__do_sys_open",
"file": "syscall.c",
+ "start_line": 6,
+ "end_line": 8,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
}
]
}
diff --git a/tools/syz-declextract/testdata/types.c.info b/tools/syz-declextract/testdata/types.c.info
index 7c4e66ca1..0e5da0671 100644
--- a/tools/syz-declextract/testdata/types.c.info
+++ b/tools/syz-declextract/testdata/types.c.info
@@ -1,2 +1,2 @@
SYSCALL align_syscall func:__do_sys_align_syscall loc:1 access:unknown manual_desc:false auto_desc:true file:types.c subsystem:kernel
-SYSCALL types_syscall func:__do_sys_types_syscall loc:1 access:unknown manual_desc:false auto_desc:true file:types.c subsystem:kernel
+SYSCALL types_syscall func:__do_sys_types_syscall loc:3 access:unknown manual_desc:false auto_desc:true file:types.c subsystem:kernel
diff --git a/tools/syz-declextract/testdata/types.c.json b/tools/syz-declextract/testdata/types.c.json
index da494969c..558d0d5f4 100644
--- a/tools/syz-declextract/testdata/types.c.json
+++ b/tools/syz-declextract/testdata/types.c.json
@@ -3,30 +3,33 @@
{
"name": "__do_sys_align_syscall",
"file": "types.c",
+ "start_line": 97,
+ "end_line": 99,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
}
]
},
{
"name": "__do_sys_types_syscall",
"file": "types.c",
+ "start_line": 53,
+ "end_line": 57,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
}
]
},
{
"name": "anon_flow",
"file": "types.c",
+ "start_line": 59,
+ "end_line": 68,
"scopes": [
{
"arg": -1,
- "loc": 8,
"facts": [
{
"src": {
@@ -133,21 +136,23 @@
{
"name": "atomic_load32",
"file": "include/types.h",
+ "start_line": 17,
+ "end_line": 19,
"is_static": true,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
}
]
},
{
"name": "atomic_load64",
"file": "include/types.h",
+ "start_line": 21,
+ "end_line": 23,
"scopes": [
{
- "arg": -1,
- "loc": 1
+ "arg": -1
}
]
}