Skip to content

Commit

Permalink
[CWS] bump syscall table + extract into separate task (#15061)
Browse files Browse the repository at this point in the history
* 5.19 -> 6.1

* switch syscall table generator from go generate to task

* extract linux version
  • Loading branch information
paulcacheux authored and val06 committed Jan 16, 2023
1 parent 6dbb17f commit 4c20115
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
3 changes: 0 additions & 3 deletions pkg/security/secl/model/syscalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
//go:build linux
// +build linux

//go:generate go run github.com/DataDog/datadog-agent/pkg/security/secl/model/syscall_table_generator -table-url https://raw.githubusercontent.com/torvalds/linux/v5.19/arch/x86/entry/syscalls/syscall_64.tbl -output syscalls_linux_amd64.go -output-string syscalls_string_linux_amd64.go -abis common,64
//go:generate go run github.com/DataDog/datadog-agent/pkg/security/secl/model/syscall_table_generator -table-url https://raw.githubusercontent.com/torvalds/linux/v5.19/include/uapi/asm-generic/unistd.h -output syscalls_linux_arm64.go -output-string syscalls_string_linux_arm64.go

package model

import (
Expand Down
2 changes: 1 addition & 1 deletion pkg/security/secl/model/syscalls_string_linux_amd64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/security/secl/model/syscalls_string_linux_arm64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions tasks/security_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,31 @@ def cws_go_generate(ctx):
ctx.run("go generate ./pkg/security/...")


@task
def generate_syscall_table(ctx):
def single_run(ctx, table_url, output_file, output_string_file, abis=None):
if abis:
abis = f"-abis {abis}"
ctx.run(
f"go run github.com/DataDog/datadog-agent/pkg/security/secl/model/syscall_table_generator -table-url {table_url} -output {output_file} -output-string {output_string_file} {abis}"
)

linux_version = "v6.1"
single_run(
ctx,
f"https://raw.githubusercontent.com/torvalds/linux/{linux_version}/arch/x86/entry/syscalls/syscall_64.tbl",
"pkg/security/secl/model/syscalls_linux_amd64.go",
"pkg/security/secl/model/syscalls_string_linux_amd64.go",
abis="common,64",
)
single_run(
ctx,
f"https://raw.githubusercontent.com/torvalds/linux/{linux_version}/include/uapi/asm-generic/unistd.h",
"pkg/security/secl/model/syscalls_linux_arm64.go",
"pkg/security/secl/model/syscalls_string_linux_arm64.go",
)


@task
def generate_btfhub_constants(ctx, archive_path, force_refresh=False):
output_path = "./pkg/security/probe/constantfetch/btfhub/constants.json"
Expand Down

0 comments on commit 4c20115

Please sign in to comment.