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

tetragon: Add support to match 32 bit syscalls #1816

Merged
merged 10 commits into from
Dec 13, 2023

Conversation

olsajiri
Copy link
Contributor

@olsajiri olsajiri commented Nov 30, 2023

Adding support to match 32 bit syscalls through syscall type lists.

Copy link

netlify bot commented Nov 30, 2023

Deploy Preview for tetragon ready!

Name Link
🔨 Latest commit 3f5abc0
🔍 Latest deploy log https://app.netlify.com/sites/tetragon/deploys/6570854b55523d00084ff8cf
😎 Deploy Preview https://deploy-preview-1816--tetragon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@olsajiri olsajiri added the release-note/minor This PR introduces a minor user-visible change label Nov 30, 2023
@olsajiri olsajiri force-pushed the pr/olsajiri/32bit_syscalls branch 11 times, most recently from 88d413d to d178649 Compare December 5, 2023 12:36
When running on 64 bits we don't have access to 32bit syscall values,
adding them into under syscallinfo/i386 in i386 package.

Signed-off-by: Jiri Olsa <[email protected]>
Adding syscallNames32 name map for 32bit syscalls.

Signed-off-by: Jiri Olsa <[email protected]>
Adding extra return argument to CutSyscallPrefix that returns
true if the cut prefix was for 32bit syscall.

Signed-off-by: Jiri Olsa <[email protected]>
At the moment we treat syscall number as standard uint64 argument
type, which is fine unless you want to recognize syscalls from
32bit applications running in 64 bit system.

Adding syscall64 type which is used to carry the syscall number
value as :

  - "value" for 64 bit application executing syscall
  - "value|0x80000000" for 32 bit application executing syscall

The reason for this is that syscall numbers differ for 32 and 64 bit
architecture, so we are using 32nd bit and mark the value as 32bit
when we detect the 32bit syscall emulation.

This way we can load map with both 64 and 32 bit syscall values
that we are interested in and use 'InMap' operator in filter,
like in following spec (functional with extra other fixes on top
of this change):

  - name: "mine"
    type: "syscalls"
    values:
    - "sys_prctl"
    - "__ia32_sys_prctl"
  tracepoints:
  - subsystem: "raw_syscalls"
    event: "sys_enter"
    args:
    - index: 4
      type: "syscall64"

At the moment it's implemented for x86 only.

Signed-off-by: Jiri Olsa <[email protected]>
Adding support to load syscall lists with 32 bit syscall values.

This implies that the syscall lists always carry syscall64 type values.

Signed-off-by: Jiri Olsa <[email protected]>
Adding support for syscall64 to be used as KProbeArg type.

Signed-off-by: Jiri Olsa <[email protected]>
@olsajiri olsajiri changed the title Pr/olsajiri/32bit syscalls tetragon: Add support to match 32 bit syscalls Dec 6, 2023
Using syscall64 type in killer specs and in tests where it's needed.

Signed-off-by: Jiri Olsa <[email protected]>
Adding killer tests for 32bit syscall values.

Signed-off-by: Jiri Olsa <[email protected]>
Adding killer test that combines both 32 and 64 syscall values.

Signed-off-by: Jiri Olsa <[email protected]>
And 32 bit syscalls.

Signed-off-by: Jiri Olsa <[email protected]>
@olsajiri olsajiri marked this pull request as ready for review December 7, 2023 07:44
@olsajiri olsajiri requested review from mtardy, a team and willfindlay as code owners December 7, 2023 07:44
@jrfastab jrfastab merged commit c9ae738 into main Dec 13, 2023
33 checks passed
@jrfastab jrfastab deleted the pr/olsajiri/32bit_syscalls branch December 13, 2023 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/minor This PR introduces a minor user-visible change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants