blob: 5264cdd28af1c6d06369ce99d6138e4088757b83 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef _UAPI_LINUX_SECCOMP_H
8#define _UAPI_LINUX_SECCOMP_H
9#include <linux/compiler.h>
10#include <linux/types.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070011#define SECCOMP_MODE_DISABLED 0
12#define SECCOMP_MODE_STRICT 1
13#define SECCOMP_MODE_FILTER 2
Christopher Ferris82d75042015-01-26 10:57:07 -080014#define SECCOMP_SET_MODE_STRICT 0
Christopher Ferris82d75042015-01-26 10:57:07 -080015#define SECCOMP_SET_MODE_FILTER 1
Christopher Ferris1308ad32017-11-14 17:32:13 -080016#define SECCOMP_GET_ACTION_AVAIL 2
Christopher Ferrisd842e432019-03-07 10:21:59 -080017#define SECCOMP_GET_NOTIF_SIZES 3
Christopher Ferris76a1d452018-06-27 14:12:29 -070018#define SECCOMP_FILTER_FLAG_TSYNC (1UL << 0)
19#define SECCOMP_FILTER_FLAG_LOG (1UL << 1)
20#define SECCOMP_FILTER_FLAG_SPEC_ALLOW (1UL << 2)
Christopher Ferrisd842e432019-03-07 10:21:59 -080021#define SECCOMP_FILTER_FLAG_NEW_LISTENER (1UL << 3)
Christopher Ferrisaf09c702020-06-01 20:29:29 -070022#define SECCOMP_FILTER_FLAG_TSYNC_ESRCH (1UL << 4)
Christopher Ferris80ae69d2022-08-02 16:32:21 -070023#define SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV (1UL << 5)
Christopher Ferris1308ad32017-11-14 17:32:13 -080024#define SECCOMP_RET_KILL_PROCESS 0x80000000U
25#define SECCOMP_RET_KILL_THREAD 0x00000000U
26#define SECCOMP_RET_KILL SECCOMP_RET_KILL_THREAD
Ben Cheng655a7c02013-10-16 16:09:24 -070027#define SECCOMP_RET_TRAP 0x00030000U
28#define SECCOMP_RET_ERRNO 0x00050000U
Christopher Ferrisd842e432019-03-07 10:21:59 -080029#define SECCOMP_RET_USER_NOTIF 0x7fc00000U
Ben Cheng655a7c02013-10-16 16:09:24 -070030#define SECCOMP_RET_TRACE 0x7ff00000U
Christopher Ferris1308ad32017-11-14 17:32:13 -080031#define SECCOMP_RET_LOG 0x7ffc0000U
Ben Cheng655a7c02013-10-16 16:09:24 -070032#define SECCOMP_RET_ALLOW 0x7fff0000U
Christopher Ferris1308ad32017-11-14 17:32:13 -080033#define SECCOMP_RET_ACTION_FULL 0xffff0000U
Ben Cheng655a7c02013-10-16 16:09:24 -070034#define SECCOMP_RET_ACTION 0x7fff0000U
35#define SECCOMP_RET_DATA 0x0000ffffU
36struct seccomp_data {
Tao Baod7db5942015-01-28 10:07:51 -080037 int nr;
38 __u32 arch;
Tao Baod7db5942015-01-28 10:07:51 -080039 __u64 instruction_pointer;
40 __u64 args[6];
Ben Cheng655a7c02013-10-16 16:09:24 -070041};
Christopher Ferrisd842e432019-03-07 10:21:59 -080042struct seccomp_notif_sizes {
43 __u16 seccomp_notif;
44 __u16 seccomp_notif_resp;
45 __u16 seccomp_data;
46};
47struct seccomp_notif {
48 __u64 id;
49 __u32 pid;
50 __u32 flags;
51 struct seccomp_data data;
52};
Christopher Ferrisd32ca142020-02-04 16:16:51 -080053#define SECCOMP_USER_NOTIF_FLAG_CONTINUE (1UL << 0)
Christopher Ferrisd842e432019-03-07 10:21:59 -080054struct seccomp_notif_resp {
55 __u64 id;
56 __s64 val;
57 __s32 error;
58 __u32 flags;
59};
Christopher Ferris67d1e5e2023-10-31 13:36:37 -070060#define SECCOMP_USER_NOTIF_FD_SYNC_WAKE_UP (1UL << 0)
Christopher Ferris25c18d42020-10-14 17:42:58 -070061#define SECCOMP_ADDFD_FLAG_SETFD (1UL << 0)
Christopher Ferris3a39c0b2021-09-02 00:03:38 +000062#define SECCOMP_ADDFD_FLAG_SEND (1UL << 1)
Christopher Ferris25c18d42020-10-14 17:42:58 -070063struct seccomp_notif_addfd {
64 __u64 id;
65 __u32 flags;
66 __u32 srcfd;
67 __u32 newfd;
68 __u32 newfd_flags;
69};
Christopher Ferrisd842e432019-03-07 10:21:59 -080070#define SECCOMP_IOC_MAGIC '!'
71#define SECCOMP_IO(nr) _IO(SECCOMP_IOC_MAGIC, nr)
72#define SECCOMP_IOR(nr,type) _IOR(SECCOMP_IOC_MAGIC, nr, type)
73#define SECCOMP_IOW(nr,type) _IOW(SECCOMP_IOC_MAGIC, nr, type)
74#define SECCOMP_IOWR(nr,type) _IOWR(SECCOMP_IOC_MAGIC, nr, type)
75#define SECCOMP_IOCTL_NOTIF_RECV SECCOMP_IOWR(0, struct seccomp_notif)
76#define SECCOMP_IOCTL_NOTIF_SEND SECCOMP_IOWR(1, struct seccomp_notif_resp)
Christopher Ferris25c18d42020-10-14 17:42:58 -070077#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOW(2, __u64)
78#define SECCOMP_IOCTL_NOTIF_ADDFD SECCOMP_IOW(3, struct seccomp_notif_addfd)
Christopher Ferris67d1e5e2023-10-31 13:36:37 -070079#define SECCOMP_IOCTL_NOTIF_SET_FLAGS SECCOMP_IOW(4, __u64)
Nick Kralevicha67e4de2013-01-14 11:28:26 -080080#endif