LCOV - code coverage report
Current view: top level - flamenco/accdb/generated - fd_accdb_tile_seccomp.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 48 0.0 %
Date: 2026-06-30 05:50:37 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /* THIS FILE WAS GENERATED BY generate_filters.py. DO NOT EDIT BY HAND! */
       2             : #ifndef HEADER_fd_src_flamenco_accdb_generated_fd_accdb_tile_seccomp_h
       3             : #define HEADER_fd_src_flamenco_accdb_generated_fd_accdb_tile_seccomp_h
       4             : 
       5             : #if defined(__linux__)
       6             : 
       7             : #include "../../../../src/util/fd_util_base.h"
       8             : #include <linux/audit.h>
       9             : #include <linux/capability.h>
      10             : #include <linux/filter.h>
      11             : #include <linux/seccomp.h>
      12             : #include <linux/bpf.h>
      13             : #include <linux/unistd.h>
      14             : #include <sys/syscall.h>
      15             : #include <signal.h>
      16             : #include <stddef.h>
      17             : 
      18             : #if defined(__i386__)
      19             : # define ARCH_NR  AUDIT_ARCH_I386
      20             : #elif defined(__x86_64__)
      21             : # define ARCH_NR  AUDIT_ARCH_X86_64
      22             : #elif defined(__aarch64__)
      23             : # define ARCH_NR AUDIT_ARCH_AARCH64
      24             : #else
      25             : # error "Target architecture is unsupported by seccomp."
      26             : #endif
      27             : 
      28             : #define FD_SECCOMP_ARG_LO_OFFSET(argno) ( offsetof( struct seccomp_data, args[(argno)] ) )
      29             : #define FD_SECCOMP_ARG_HI_OFFSET(argno) ( offsetof( struct seccomp_data, args[(argno)] ) + 4U )
      30             : 
      31             : #define FD_SECCOMP_ARG_LO(x) ((uint)(((ulong)(uint)(int)(x)      ) & 0xffffffffUL))
      32             : #define FD_SECCOMP_ARG_HI(x) ((uint)(((ulong)(x) >> 32) & 0xffffffffUL))
      33             : 
      34             : static const uint sock_filter_policy_fd_accdb_tile_instr_cnt = 43;
      35             : 
      36           0 : static void populate_sock_filter_policy_fd_accdb_tile( ulong out_cnt, struct sock_filter out[ static 43 ], uint logfile_fd, uint accounts_fd ) {
      37           0 :   FD_TEST( out_cnt >= 43 );
      38           0 :   struct sock_filter filter[43] = {
      39             :     /* validate architecture */
      40           0 :     BPF_STMT( BPF_LD | BPF_W | BPF_ABS, ( offsetof( struct seccomp_data, arch ) )),
      41           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, ARCH_NR, 0, /* RET_KILL_PROCESS */ 7 ),
      42             :     /* load syscall number */
      43           0 :     BPF_STMT( BPF_LD | BPF_W | BPF_ABS, ( offsetof( struct seccomp_data, nr ) )),
      44             :     /* check write */
      45           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, SYS_write, /* check_write */ 7, 0 ),
      46             :     /* check fsync */
      47           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, SYS_fsync, /* check_fsync */ 12, 0 ),
      48             :     /* check pread64 */
      49           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, SYS_pread64, /* check_pread64 */ 15, 0 ),
      50             :     /* check pwritev2 */
      51           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, SYS_pwritev2, /* check_pwritev2 */ 18, 0 ),
      52             :     /* check fallocate */
      53           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, SYS_fallocate, /* check_fallocate */ 21, 0 ),
      54             :     /* check copy_file_range */
      55           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, SYS_copy_file_range, /* check_copy_file_range */ 26, 0 ),
      56             : //  RET_KILL_PROCESS:
      57             :     /* default deny */
      58           0 :     BPF_STMT( BPF_RET | BPF_K, SECCOMP_RET_KILL_PROCESS ),
      59             : //  RET_ALLOW:
      60             :     /* allow */
      61           0 :     BPF_STMT( BPF_RET | BPF_K, SECCOMP_RET_ALLOW ),
      62             : //  check_write:
      63             :     /* arg 0 low 32 bits */
      64           0 :     BPF_STMT( BPF_LD | BPF_W | BPF_ABS, FD_SECCOMP_ARG_LO_OFFSET(0)),
      65           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, 0x00000002U, /* write_ALLOW */ 3, /* or_1 */ 0 ),
      66             : //  or_1:
      67             :     /* arg 0 low 32 bits */
      68           0 :     BPF_STMT( BPF_LD | BPF_W | BPF_ABS, FD_SECCOMP_ARG_LO_OFFSET(0)),
      69           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, ((uint)(logfile_fd)), /* write_ALLOW */ 1, /* write_KILL */ 0 ),
      70             : //  write_KILL:
      71           0 :     BPF_STMT( BPF_RET | BPF_K, SECCOMP_RET_KILL_PROCESS ),
      72             : //  write_ALLOW:
      73           0 :     BPF_STMT( BPF_RET | BPF_K, SECCOMP_RET_ALLOW ),
      74             : //  check_fsync:
      75             :     /* arg 0 low 32 bits */
      76           0 :     BPF_STMT( BPF_LD | BPF_W | BPF_ABS, FD_SECCOMP_ARG_LO_OFFSET(0)),
      77           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, ((uint)(logfile_fd)), /* fsync_ALLOW */ 1, /* fsync_KILL */ 0 ),
      78             : //  fsync_KILL:
      79           0 :     BPF_STMT( BPF_RET | BPF_K, SECCOMP_RET_KILL_PROCESS ),
      80             : //  fsync_ALLOW:
      81           0 :     BPF_STMT( BPF_RET | BPF_K, SECCOMP_RET_ALLOW ),
      82             : //  check_pread64:
      83             :     /* arg 0 low 32 bits */
      84           0 :     BPF_STMT( BPF_LD | BPF_W | BPF_ABS, FD_SECCOMP_ARG_LO_OFFSET(0)),
      85           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, ((uint)(accounts_fd)), /* pread64_ALLOW */ 1, /* pread64_KILL */ 0 ),
      86             : //  pread64_KILL:
      87           0 :     BPF_STMT( BPF_RET | BPF_K, SECCOMP_RET_KILL_PROCESS ),
      88             : //  pread64_ALLOW:
      89           0 :     BPF_STMT( BPF_RET | BPF_K, SECCOMP_RET_ALLOW ),
      90             : //  check_pwritev2:
      91             :     /* arg 0 low 32 bits */
      92           0 :     BPF_STMT( BPF_LD | BPF_W | BPF_ABS, FD_SECCOMP_ARG_LO_OFFSET(0)),
      93           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, ((uint)(accounts_fd)), /* pwritev2_ALLOW */ 1, /* pwritev2_KILL */ 0 ),
      94             : //  pwritev2_KILL:
      95           0 :     BPF_STMT( BPF_RET | BPF_K, SECCOMP_RET_KILL_PROCESS ),
      96             : //  pwritev2_ALLOW:
      97           0 :     BPF_STMT( BPF_RET | BPF_K, SECCOMP_RET_ALLOW ),
      98             : //  check_fallocate:
      99             :     /* arg 0 low 32 bits */
     100           0 :     BPF_STMT( BPF_LD | BPF_W | BPF_ABS, FD_SECCOMP_ARG_LO_OFFSET(0)),
     101           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, ((uint)(accounts_fd)), /* and_2 */ 0, /* fallocate_KILL */ 2 ),
     102             : //  and_2:
     103             :     /* arg 1 low 32 bits */
     104           0 :     BPF_STMT( BPF_LD | BPF_W | BPF_ABS, FD_SECCOMP_ARG_LO_OFFSET(1)),
     105           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, 0x00000000U, /* fallocate_ALLOW */ 1, /* fallocate_KILL */ 0 ),
     106             : //  fallocate_KILL:
     107           0 :     BPF_STMT( BPF_RET | BPF_K, SECCOMP_RET_KILL_PROCESS ),
     108             : //  fallocate_ALLOW:
     109           0 :     BPF_STMT( BPF_RET | BPF_K, SECCOMP_RET_ALLOW ),
     110             : //  check_copy_file_range:
     111             :     /* arg 0 low 32 bits */
     112           0 :     BPF_STMT( BPF_LD | BPF_W | BPF_ABS, FD_SECCOMP_ARG_LO_OFFSET(0)),
     113           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, ((uint)(accounts_fd)), /* and_3 */ 0, /* copy_file_range_KILL */ 4 ),
     114             : //  and_3:
     115             :     /* arg 2 low 32 bits */
     116           0 :     BPF_STMT( BPF_LD | BPF_W | BPF_ABS, FD_SECCOMP_ARG_LO_OFFSET(2)),
     117           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, ((uint)(accounts_fd)), /* and_4 */ 0, /* copy_file_range_KILL */ 2 ),
     118             : //  and_4:
     119             :     /* arg 5 low 32 bits */
     120           0 :     BPF_STMT( BPF_LD | BPF_W | BPF_ABS, FD_SECCOMP_ARG_LO_OFFSET(5)),
     121           0 :     BPF_JUMP( BPF_JMP | BPF_JEQ | BPF_K, 0x00000000U, /* copy_file_range_ALLOW */ 1, /* copy_file_range_KILL */ 0 ),
     122             : //  copy_file_range_KILL:
     123           0 :     BPF_STMT( BPF_RET | BPF_K, SECCOMP_RET_KILL_PROCESS ),
     124             : //  copy_file_range_ALLOW:
     125             :     BPF_STMT( BPF_RET | BPF_K, SECCOMP_RET_ALLOW ),
     126           0 :   };
     127           0 :   fd_memcpy( out, filter, sizeof( filter ) );
     128           0 : }
     129             : 
     130             : #endif /* defined(__linux__) */
     131             : 
     132             : #endif /* HEADER_fd_src_flamenco_accdb_generated_fd_accdb_tile_seccomp_h */

Generated by: LCOV version 1.14