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

[CWS] bump syscall table + extract into separate task #15061

Merged
merged 3 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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