• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/procd/jail/seccomp-inject.h

  1 /*
  2  * Copyright (C) 2026 Daniel Golle <daniel@makrotopia.org>
  3  *
  4  * This program is free software; you can redistribute it and/or modify
  5  * it under the terms of the GNU Lesser General Public License version 2.1
  6  * as published by the Free Software Foundation
  7  *
  8  * This program is distributed in the hope that it will be useful,
  9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 11  * GNU General Public License for more details.
 12  */
 13 #ifndef _JAIL_SECCOMP_INJECT_H_
 14 #define _JAIL_SECCOMP_INJECT_H_
 15 
 16 #include <sys/types.h>
 17 #include <linux/filter.h>
 18 
 19 struct seccomp_bp {
 20         unsigned long addr;
 21         unsigned char saved[16];
 22         unsigned char len;
 23         unsigned char armed;
 24 };
 25 
 26 #ifdef SECCOMP_SUPPORT
 27 int seccomp_inject(pid_t pid, struct sock_fprog *prog);
 28 int seccomp_run_to_entry(pid_t pid);
 29 int seccomp_run_to_main(pid_t pid);
 30 int seccomp_run_to_main_from_entry(pid_t pid);
 31 int seccomp_read_syscall(pid_t pid, long *nr, long *args);
 32 int seccomp_marker_addrs(pid_t pid, unsigned long *at_entry, unsigned long *lsm, int *main_argidx);
 33 int seccomp_bp_arm(pid_t pid, unsigned long addr, struct seccomp_bp *bp);
 34 int seccomp_bp_match(pid_t pid, struct seccomp_bp **bps, int n);
 35 int seccomp_force_errno(pid_t pid, int err);
 36 int seccomp_force_errno_exit(pid_t pid, int err);
 37 #else
 38 static inline int seccomp_inject(pid_t pid, struct sock_fprog *prog) {
 39         return -1;
 40 }
 41 static inline int seccomp_run_to_entry(pid_t pid) {
 42         return -1;
 43 }
 44 static inline int seccomp_run_to_main(pid_t pid) {
 45         return -1;
 46 }
 47 static inline int seccomp_run_to_main_from_entry(pid_t pid) {
 48         return -1;
 49 }
 50 static inline int seccomp_read_syscall(pid_t pid, long *nr, long *args) {
 51         return -1;
 52 }
 53 static inline int seccomp_marker_addrs(pid_t pid, unsigned long *at_entry, unsigned long *lsm, int *main_argidx) {
 54         return -1;
 55 }
 56 static inline int seccomp_bp_arm(pid_t pid, unsigned long addr, struct seccomp_bp *bp) {
 57         return -1;
 58 }
 59 static inline int seccomp_bp_match(pid_t pid, struct seccomp_bp **bps, int n) {
 60         return -1;
 61 }
 62 static inline int seccomp_force_errno(pid_t pid, int err) {
 63         return -1;
 64 }
 65 static inline int seccomp_force_errno_exit(pid_t pid, int err) {
 66         return -1;
 67 }
 68 #endif
 69 
 70 #endif
 71 

This page was automatically generated by LXR 0.3.1.  •  OpenWrt