Skip to content

Commit

Permalink
chore: fill new ia32 table with -1 when there is no 64bit mapped value.
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP committed Oct 3, 2023
1 parent 51a254f commit 2ec98b8
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,13 +556,22 @@ func bumpIA32to64Map() {
}

writeBanner(fW)
_, _ = fW.WriteString("#include \"ppm_events_public.h\"\n\n")

_, _ = fW.WriteString("#include \"ppm_events_public.h\"\n")
_, _ = fW.WriteString(`
/*
* This table is used by drivers when receiving a 32bit syscall.
* It is needed to convert a 32bit syscall (the array index) to a 64bit syscall value.
*/
`)
_, _ = fW.WriteString("const int g_ia32_64_map[SYSCALL_TABLE_SIZE] = {\n")
for x32Name, x32Nr := range x32Map {
x32NrStr := strconv.FormatInt(x32Nr, 10)
if x64Nr, ok := x64Map[x32Name]; ok {
x32NrStr := strconv.FormatInt(x32Nr, 10)
x64NrStr := strconv.FormatInt(x64Nr, 10)
_, _ = fW.WriteString("\t[" + x32NrStr + "] = " + x64NrStr + ",\n")
} else {
_, _ = fW.WriteString("\t[" + x32NrStr + "] = -1,\n")
}
}
_, _ = fW.WriteString("};\n")
Expand All @@ -584,8 +593,11 @@ func checkOverwriteRepoFile(fW *os.File, fp string) {
}

func writeBanner(fW *os.File) {
_, _ = fW.WriteString("/*\n")
_, _ = fW.WriteString(" * This file was automatically created by syscalls-bumper (https://github.com/falcosecurity/syscalls-bumper).\n")
_, _ = fW.WriteString(" * DO NOT EDIT THIS FILE MANUALLY.\n")
_, _ = fW.WriteString(" */\n\n")
_, _ = fW.WriteString(
`/*
* This file was automatically created by syscalls-bumper (https://github.com/falcosecurity/syscalls-bumper).")
* DO NOT EDIT THIS FILE MANUALLY.")
*/
`)
}

0 comments on commit 2ec98b8

Please sign in to comment.