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

support 32-bit ARM (aarch32) syscalls #2898

Merged
merged 10 commits into from
Sep 19, 2024
Merged

support 32-bit ARM (aarch32) syscalls #2898

merged 10 commits into from
Sep 19, 2024

Commits on Sep 19, 2024

  1. restructure i386 syscalls code in syscall lists

    syscall lists are used so that we can have a common place to define:
    syscall ids for the tracepoint hook filtering, and syscall function
    symbols for the enforcer.
    
    The previous implementation of i386 syscalls in these lists was using
    the fact that (most) of the i386 syscalls are implemented using
    functions prefixed by __ia32_sys. This, however, is not true for ARM
    where most system calls have the same implementation for aarch32 and
    aarch64 and their prefix is __arm64. This means that for arm, we cannot
    determine the ABI of a system call from its function.
    
    Morover, x86_64 has two 32-bit abis: i386 and x32, and we might,
    eventually, want to add supoprt the latter.
    
    This patch reworks the code of the syscall lists. In syscall lists,
    users can now use the abi/ prefix (e.g., i386/) to specify system calls
    under a specific ABI.
    
    The commits adds a new SyscallVal type which represents values in a
    system call list. For this type, we imlement the two required methods:
     - ID(): get the id of the system call to pass in BPF
     - Symbol(): get the symbol that corresponds to the implementation of
       the syscall
    
    Signed-off-by: Kornilios Kourtis <[email protected]>
    kkourt committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    c386ebe View commit details
    Browse the repository at this point in the history
  2. SyscallVal: add some simple tests

    Signed-off-by: Kornilios Kourtis <[email protected]>
    kkourt committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    dc3ce82 View commit details
    Browse the repository at this point in the history
  3. observer_test_helper: properly clenup base sensor

    During a test failure, where loading a sensor failed, the next test
    would also fail because the base sensor existed already.
    
    Fix this by registering a cleanup function to unload the base sensor
    rogjt after we load it.
    
    Signed-off-by: Kornilios Kourtis <[email protected]>
    kkourt committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    323a835 View commit details
    Browse the repository at this point in the history
  4. misc: rename dup test policies

    Rename some of the policies to better reflect the tests.
    
    Signed-off-by: Kornilios Kourtis <[email protected]>
    kkourt committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    3b3ca88 View commit details
    Browse the repository at this point in the history
  5. testEnforcer: refactor test helper

    refactor the enforcer tester so that it can accept more than two
    arguments. Also, allow for having different check functions for each
    command. Finally, pass the test context from where the check actually
    happens.
    
    Signed-off-by: Kornilios Kourtis <[email protected]>
    kkourt committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    cdb798c View commit details
    Browse the repository at this point in the history
  6. tester-progs: build enforcer-tester-32 for ARM

    Requires arm-linux-gnuabihf-gcc cross-compiler.
    
    Signed-off-by: Kornilios Kourtis <[email protected]>
    kkourt committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    b82a158 View commit details
    Browse the repository at this point in the history
  7. gh: install gcc for 32-bit ARM

    Also, do a single apt-get update.
    
    Signed-off-by: Kornilios Kourtis <[email protected]>
    kkourt committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    af52ce5 View commit details
    Browse the repository at this point in the history
  8. syscallinfo: add ARM32 syscall ids

    Also, don't constrain building i386 ids in amd64. This will be used
    later in tests.
    
    Signed-off-by: Kornilios Kourtis <[email protected]>
    kkourt committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    8bba71f View commit details
    Browse the repository at this point in the history
  9. arm64: support 32-bit syscalls

    This commit adds support for 32-bit syscalls in arm64. The commit, using
    what was added in previous patches, adds support for an arm32 ABI.
    (Tecnically, I believe the ABI should have been named aarch32 ABI, but
    arm32 seems clearer)
    
    Most of the 32-bit system calls use the same function as their 64-bit
    counterparts. So for now we just add a __arm64  prefix to get the
    symbol. For cases where this does not work, users would have to add the
    specific symbol on their own.
    
    Signed-off-by: Kornilios Kourtis <[email protected]>
    kkourt committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    fd94b63 View commit details
    Browse the repository at this point in the history
  10. enforcer_tests: test arm32 syscalls

    Previously, the 32-bit syscall enforcer tests were only done in amd64
    because we did not supported 32-bit syscalls in arm64. This patch
    modifies these tests to also test arm64 32-bit calls.
    
    Signed-off-by: Kornilios Kourtis <[email protected]>
    kkourt committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    051f50e View commit details
    Browse the repository at this point in the history