forked from falcosecurity/libs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ppm_events_public.h
2380 lines (2239 loc) · 80.7 KB
/
ppm_events_public.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// SPDX-License-Identifier: GPL-2.0-only OR MIT
/*
Copyright (C) 2023 The Falco Authors.Copyright (C) 2023 The Falco Authors.
This file is dual licensed under either the MIT or GPL 2. See MIT.txt
or GPL2.txt for full copies of the license.
*/
#ifndef EVENTS_PUBLIC_H_
#define EVENTS_PUBLIC_H_
#ifdef __KERNEL__
#include <linux/types.h>
#elif defined(__USE_VMLINUX__)
/* In the modern probe, if we have the vmlinux.h we need nothing here. */
#else
#include <stdint.h>
#endif
#include "./feature_gates.h"
#ifndef UINT32_MAX
#define UINT32_MAX (4294967295U)
#endif
/*
* Macros for packing in different build environments
*/
#if defined(_WIN32)
#define _packed \
__pragma(pack(push, 1)); \
__pragma(pack(pop))
#else
#define _packed __attribute__((packed))
#endif
/*
* Limits
*/
#define PPM_MAX_EVENT_PARAMS (1 << 5) /* Max number of parameters an event can have */
#define PPM_MAX_NAME_LEN 32
/*
* Socket families
*/
#define PPM_AF_UNSPEC 0
#define PPM_AF_UNIX 1 /* Unix domain sockets */
#define PPM_AF_LOCAL 1 /* POSIX name for PPM_AF_UNIX */
#define PPM_AF_INET 2 /* Internet IP Protocol */
#define PPM_AF_AX25 3 /* Amateur Radio AX.25 */
#define PPM_AF_IPX 4 /* Novell IPX */
#define PPM_AF_APPLETALK 5 /* AppleTalk DDP */
#define PPM_AF_NETROM 6 /* Amateur Radio NET/ROM */
#define PPM_AF_BRIDGE 7 /* Multiprotocol bridge */
#define PPM_AF_ATMPVC 8 /* ATM PVCs */
#define PPM_AF_X25 9 /* Reserved for X.25 project */
#define PPM_AF_INET6 10 /* IP version 6 */
#define PPM_AF_ROSE 11 /* Amateur Radio X.25 PLP */
#define PPM_AF_DECnet 12 /* Reserved for DECnet project */
#define PPM_AF_NETBEUI 13 /* Reserved for 802.2LLC project*/
#define PPM_AF_SECURITY 14 /* Security callback pseudo AF */
#define PPM_AF_KEY 15 /* PF_KEY key management API */
#define PPM_AF_NETLINK 16
#define PPM_AF_ROUTE PPM_AF_NETLINK /* Alias to emulate 4.4BSD */
#define PPM_AF_PACKET 17 /* Packet family */
#define PPM_AF_ASH 18 /* Ash */
#define PPM_AF_ECONET 19 /* Acorn Econet */
#define PPM_AF_ATMSVC 20 /* ATM SVCs */
#define PPM_AF_RDS 21 /* RDS sockets */
#define PPM_AF_SNA 22 /* Linux SNA Project (nutters!) */
#define PPM_AF_IRDA 23 /* IRDA sockets */
#define PPM_AF_PPPOX 24 /* PPPoX sockets */
#define PPM_AF_WANPIPE 25 /* Wanpipe API Sockets */
#define PPM_AF_LLC 26 /* Linux LLC */
#define PPM_AF_CAN 29 /* Controller Area Network */
#define PPM_AF_TIPC 30 /* TIPC sockets */
#define PPM_AF_BLUETOOTH 31 /* Bluetooth sockets */
#define PPM_AF_IUCV 32 /* IUCV sockets */
#define PPM_AF_RXRPC 33 /* RxRPC sockets */
#define PPM_AF_ISDN 34 /* mISDN sockets */
#define PPM_AF_PHONET 35 /* Phonet sockets */
#define PPM_AF_IEEE802154 36 /* IEEE802154 sockets */
#define PPM_AF_CAIF 37 /* CAIF sockets */
#define PPM_AF_ALG 38 /* Algorithm sockets */
#define PPM_AF_NFC 39 /* NFC sockets */
/*
* File flags
*/
#define PPM_O_NONE 0
#define PPM_O_RDONLY (1 << 0) /* Open for reading only */
#define PPM_O_WRONLY (1 << 1) /* Open for writing only */
#define PPM_O_RDWR (PPM_O_RDONLY | PPM_O_WRONLY) /* Open for reading and writing */
#define PPM_O_CREAT (1 << 2) /* Create a new file if it doesn't exist. */
#define PPM_O_APPEND \
(1 << 3) /* If set, the file offset shall be set to the end of the file prior to each write. \
*/
#define PPM_O_DSYNC (1 << 4)
#define PPM_O_EXCL (1 << 5)
#define PPM_O_NONBLOCK (1 << 6)
#define PPM_O_SYNC (1 << 7)
#define PPM_O_TRUNC (1 << 8)
#define PPM_O_DIRECT (1 << 9)
#define PPM_O_DIRECTORY (1 << 10)
#define PPM_O_LARGEFILE (1 << 11)
#define PPM_O_CLOEXEC (1 << 12)
#define PPM_O_TMPFILE (1 << 13)
/* Flags added by syscall probe: */
#define PPM_O_F_CREATED (1 << 14) /* file created during the syscall */
#define PPM_FD_UPPER_LAYER (1 << 15) /* file is from upper layer */
#define PPM_FD_LOWER_LAYER (1 << 16) /* file is from upper layer */
/*
* creat flags
*/
/* These flags serve the same puropse as the flags PPM_FD_UPPER_LAYER and PPM_FD_LOWER_LAYER in the
* 'File flags' section. They are used in creat system call because it doesn't have a 'flags'
* parameter that can be used. This redifintion is needed because this 'creat_flags' parameter is 16
* bits and the aforementioned flags are over 16 bits.
*/
#define PPM_FD_UPPER_LAYER_CREAT \
(1 << 0) /* file is from upper layer. Equivalent to PPM_FD_UPPER_LAYER */
#define PPM_FD_LOWER_LAYER_CREAT \
(1 << 1) /* file is from upper layer. Equivalent to PPM_FD_LOWER_LAYER */
/*
* File modes
*/
#define PPM_S_NONE 0
#define PPM_S_IXOTH (1 << 0)
#define PPM_S_IWOTH (1 << 1)
#define PPM_S_IROTH (1 << 2)
#define PPM_S_IXGRP (1 << 3)
#define PPM_S_IWGRP (1 << 4)
#define PPM_S_IRGRP (1 << 5)
#define PPM_S_IXUSR (1 << 6)
#define PPM_S_IWUSR (1 << 7)
#define PPM_S_IRUSR (1 << 8)
#define PPM_S_ISVTX (1 << 9)
#define PPM_S_ISGID (1 << 10)
#define PPM_S_ISUID (1 << 11)
/*
* mknod() modes
*/
#define PPM_S_IFREG 0100000
#define PPM_S_IFCHR 0020000
#define PPM_S_IFBLK 0060000
#define PPM_S_IFIFO 0010000
#define PPM_S_IFSOCK 0140000
/*
* flock() flags
*/
#define PPM_LOCK_NONE 0
#define PPM_LOCK_SH (1 << 0)
#define PPM_LOCK_EX (1 << 1)
#define PPM_LOCK_NB (1 << 2)
#define PPM_LOCK_UN (1 << 3)
/*
* Clone flags
*/
#define PPM_CL_NONE 0
#define PPM_CL_CLONE_FILES (1 << 0)
#define PPM_CL_CLONE_FS (1 << 1)
#define PPM_CL_CLONE_IO (1 << 2)
#define PPM_CL_CLONE_NEWIPC (1 << 3)
#define PPM_CL_CLONE_NEWNET (1 << 4)
#define PPM_CL_CLONE_NEWNS (1 << 5)
#define PPM_CL_CLONE_NEWPID (1 << 6)
#define PPM_CL_CLONE_NEWUTS (1 << 7)
#define PPM_CL_CLONE_PARENT (1 << 8)
#define PPM_CL_CLONE_PARENT_SETTID (1 << 9)
#define PPM_CL_CLONE_PTRACE (1 << 10)
#define PPM_CL_CLONE_SIGHAND (1 << 11)
#define PPM_CL_CLONE_SYSVSEM (1 << 12)
#define PPM_CL_CLONE_THREAD (1 << 13)
#define PPM_CL_CLONE_UNTRACED (1 << 14)
#define PPM_CL_CLONE_VM (1 << 15)
#define PPM_CL_CLONE_INVERTED \
(1 << 16) /* libsinsp-specific flag. It's set if clone() returned in */
/* the child process before than in the parent process. */
#define PPM_CL_NAME_CHANGED \
(1 << 17) /* libsinsp-specific flag. Set when the thread name changes \
*/
/* (for example because execve was called) */
#define PPM_CL_CLOSED (1 << 18) /* thread has been closed. */
#define PPM_CL_ACTIVE \
(1 << 19) /* libsinsp-specific flag. Set in the first non-clone event for \
this thread. */
#define PPM_CL_CLONE_NEWUSER (1 << 20)
#define PPM_CL_PIPE_SRC \
(1 << 21) /* libsinsp-specific flag. Set if this thread has been \
detected to be the source in a shell pipe. */
#define PPM_CL_PIPE_DST \
(1 << 22) /* libsinsp-specific flag. Set if this thread has been \
detected to be the destination in a shell pipe. */
#define PPM_CL_CLONE_CHILD_CLEARTID (1 << 23)
#define PPM_CL_CLONE_CHILD_SETTID (1 << 24)
#define PPM_CL_CLONE_SETTLS (1 << 25)
#define PPM_CL_CLONE_STOPPED (1 << 26)
#define PPM_CL_CLONE_VFORK (1 << 27)
#define PPM_CL_CLONE_NEWCGROUP (1 << 28)
#define PPM_CL_CHILD_IN_PIDNS \
(1 << 29) /* true if the thread created by clone() is *not* \
in the init pid namespace */
#define PPM_CL_IS_MAIN_THREAD \
(1 << 30) /* libsinsp-specific flag. Set if this is the main thread \
*/
/* in envs where main thread tid != pid.*/
/*
* Futex Operations
*/
#define PPM_FU_FUTEX_WAIT 0
#define PPM_FU_FUTEX_WAKE 1
#define PPM_FU_FUTEX_FD 2
#define PPM_FU_FUTEX_REQUEUE 3
#define PPM_FU_FUTEX_CMP_REQUEUE 4
#define PPM_FU_FUTEX_WAKE_OP 5
#define PPM_FU_FUTEX_LOCK_PI 6
#define PPM_FU_FUTEX_UNLOCK_PI 7
#define PPM_FU_FUTEX_TRYLOCK_PI 8
#define PPM_FU_FUTEX_WAIT_BITSET 9
#define PPM_FU_FUTEX_WAKE_BITSET 10
#define PPM_FU_FUTEX_WAIT_REQUEUE_PI 11
#define PPM_FU_FUTEX_CMP_REQUEUE_PI 12
#define PPM_FU_FUTEX_PRIVATE_FLAG 128
#define PPM_FU_FUTEX_CLOCK_REALTIME 256
/*
* lseek() and llseek() whence
*/
#define PPM_SEEK_SET 0
#define PPM_SEEK_CUR 1
#define PPM_SEEK_END 2
/*
* poll() flags
*/
#define PPM_POLLIN (1 << 0)
#define PPM_POLLPRI (1 << 1)
#define PPM_POLLOUT (1 << 2)
#define PPM_POLLRDHUP (1 << 3)
#define PPM_POLLERR (1 << 4)
#define PPM_POLLHUP (1 << 5)
#define PPM_POLLNVAL (1 << 6)
#define PPM_POLLRDNORM (1 << 7)
#define PPM_POLLRDBAND (1 << 8)
#define PPM_POLLWRNORM (1 << 9)
#define PPM_POLLWRBAND (1 << 10)
/*
* mount() flags
*/
#define PPM_MS_RDONLY (1 << 0)
#define PPM_MS_NOSUID (1 << 1)
#define PPM_MS_NODEV (1 << 2)
#define PPM_MS_NOEXEC (1 << 3)
#define PPM_MS_SYNCHRONOUS (1 << 4)
#define PPM_MS_REMOUNT (1 << 5)
#define PPM_MS_MANDLOCK (1 << 6)
#define PPM_MS_DIRSYNC (1 << 7)
#define PPM_MS_NOATIME (1 << 10)
#define PPM_MS_NODIRATIME (1 << 11)
#define PPM_MS_BIND (1 << 12)
#define PPM_MS_MOVE (1 << 13)
#define PPM_MS_REC (1 << 14)
#define PPM_MS_SILENT (1 << 15)
#define PPM_MS_POSIXACL (1 << 16)
#define PPM_MS_UNBINDABLE (1 << 17)
#define PPM_MS_PRIVATE (1 << 18)
#define PPM_MS_SLAVE (1 << 19)
#define PPM_MS_SHARED (1 << 20)
#define PPM_MS_RELATIME (1 << 21)
#define PPM_MS_KERNMOUNT (1 << 22)
#define PPM_MS_I_VERSION (1 << 23)
#define PPM_MS_STRICTATIME (1 << 24)
#define PPM_MS_LAZYTIME (1 << 25)
#define PPM_MS_NOSEC (1 << 28)
#define PPM_MS_BORN (1 << 29)
#define PPM_MS_ACTIVE (1 << 30)
#define PPM_MS_NOUSER (1 << 31)
/*
* umount() flags
*/
#define PPM_MNT_FORCE (1 << 0)
#define PPM_MNT_DETACH (1 << 1)
#define PPM_MNT_EXPIRE (1 << 2)
#define PPM_UMOUNT_NOFOLLOW (1 << 3)
/*
* shutdown() how
*/
#define PPM_SHUT_RD 0
#define PPM_SHUT_WR 1
#define PPM_SHUT_RDWR 2
#define PPM_SHUT_UNKNOWN 0xffff
/*
* fs *at() flags
*/
#define PPM_AT_FDCWD -100
/*
* unlinkat() flags
*/
#define PPM_AT_REMOVEDIR 0x200
/*
* linkat() flags
*/
#define PPM_AT_SYMLINK_FOLLOW 0x400
#define PPM_AT_EMPTY_PATH 0x1000
/*
* newfstatat() flags
*/
#define PPM_AT_NO_AUTOMOUNT 0x800
#define PPM_AT_SYMLINK_NOFOLLOW 0x100
/*
* rlimit resources
*/
#define PPM_RLIMIT_CPU 0 /* CPU time in sec */
#define PPM_RLIMIT_FSIZE 1 /* Maximum filesize */
#define PPM_RLIMIT_DATA 2 /* max data size */
#define PPM_RLIMIT_STACK 3 /* max stack size */
#define PPM_RLIMIT_CORE 4 /* max core file size */
#define PPM_RLIMIT_RSS 5 /* max resident set size */
#define PPM_RLIMIT_NPROC 6 /* max number of processes */
#define PPM_RLIMIT_NOFILE 7 /* max number of open files */
#define PPM_RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */
#define PPM_RLIMIT_AS 9 /* address space limit */
#define PPM_RLIMIT_LOCKS 10 /* maximum file locks held */
#define PPM_RLIMIT_SIGPENDING 11 /* max number of pending signals */
#define PPM_RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */
#define PPM_RLIMIT_NICE 13 /* max nice prio allowed to raise to 0-39 for nice level 19 .. -20 */
#define PPM_RLIMIT_RTPRIO 14 /* maximum realtime priority */
#define PPM_RLIMIT_RTTIME 15 /* timeout for RT tasks in us */
#define PPM_RLIMIT_UNKNOWN 255 /* CPU time in sec */
/*
* fcntl commands
*/
#define PPM_FCNTL_UNKNOWN 0
#define PPM_FCNTL_F_DUPFD 1
#define PPM_FCNTL_F_GETFD 2
#define PPM_FCNTL_F_SETFD 3
#define PPM_FCNTL_F_GETFL 4
#define PPM_FCNTL_F_SETFL 5
#define PPM_FCNTL_F_GETLK 6
#define PPM_FCNTL_F_SETLK 8
#define PPM_FCNTL_F_SETLKW 9
#define PPM_FCNTL_F_SETOWN 10
#define PPM_FCNTL_F_GETOWN 12
#define PPM_FCNTL_F_SETSIG 13
#define PPM_FCNTL_F_GETSIG 15
#ifndef CONFIG_64BIT
#define PPM_FCNTL_F_GETLK64 17
#define PPM_FCNTL_F_SETLK64 18
#define PPM_FCNTL_F_SETLKW64 19
#endif
#define PPM_FCNTL_F_SETOWN_EX 21
#define PPM_FCNTL_F_GETOWN_EX 22
#define PPM_FCNTL_F_SETLEASE 23
#define PPM_FCNTL_F_GETLEASE 24
#define PPM_FCNTL_F_CANCELLK 25
#define PPM_FCNTL_F_DUPFD_CLOEXEC 26
#define PPM_FCNTL_F_NOTIFY 27
#define PPM_FCNTL_F_SETPIPE_SZ 28
#define PPM_FCNTL_F_GETPIPE_SZ 29
#define PPM_FCNTL_F_OFD_GETLK 30
#define PPM_FCNTL_F_OFD_SETLK 31
#define PPM_FCNTL_F_OFD_SETLKW 32
/*
* getsockopt/setsockopt levels
*/
#define PPM_SOCKOPT_LEVEL_UNKNOWN 0
#define PPM_SOCKOPT_LEVEL_SOL_SOCKET 1
#define PPM_SOCKOPT_LEVEL_SOL_TCP 2
/*
* getsockopt/setsockopt options
* SOL_SOCKET only currently
*/
#define PPM_SOCKOPT_UNKNOWN 0
#define PPM_SOCKOPT_SO_DEBUG 1
#define PPM_SOCKOPT_SO_REUSEADDR 2
#define PPM_SOCKOPT_SO_TYPE 3
#define PPM_SOCKOPT_SO_ERROR 4
#define PPM_SOCKOPT_SO_DONTROUTE 5
#define PPM_SOCKOPT_SO_BROADCAST 6
#define PPM_SOCKOPT_SO_SNDBUF 7
#define PPM_SOCKOPT_SO_RCVBUF 8
#define PPM_SOCKOPT_SO_SNDBUFFORCE 32
#define PPM_SOCKOPT_SO_RCVBUFFORCE 33
#define PPM_SOCKOPT_SO_KEEPALIVE 9
#define PPM_SOCKOPT_SO_OOBINLINE 10
#define PPM_SOCKOPT_SO_NO_CHECK 11
#define PPM_SOCKOPT_SO_PRIORITY 12
#define PPM_SOCKOPT_SO_LINGER 13
#define PPM_SOCKOPT_SO_BSDCOMPAT 14
#define PPM_SOCKOPT_SO_REUSEPORT 15
#define PPM_SOCKOPT_SO_PASSCRED 16
#define PPM_SOCKOPT_SO_PEERCRED 17
#define PPM_SOCKOPT_SO_RCVLOWAT 18
#define PPM_SOCKOPT_SO_SNDLOWAT 19
#define PPM_SOCKOPT_SO_RCVTIMEO 20
#define PPM_SOCKOPT_SO_SNDTIMEO 21
#define PPM_SOCKOPT_SO_SECURITY_AUTHENTICATION 22
#define PPM_SOCKOPT_SO_SECURITY_ENCRYPTION_TRANSPORT 23
#define PPM_SOCKOPT_SO_SECURITY_ENCRYPTION_NETWORK 24
#define PPM_SOCKOPT_SO_BINDTODEVICE 25
#define PPM_SOCKOPT_SO_ATTACH_FILTER 26
#define PPM_SOCKOPT_SO_DETACH_FILTER 27
#define PPM_SOCKOPT_SO_PEERNAME 28
#define PPM_SOCKOPT_SO_TIMESTAMP 29
#define PPM_SOCKOPT_SO_ACCEPTCONN 30
#define PPM_SOCKOPT_SO_PEERSEC 31
#define PPM_SOCKOPT_SO_PASSSEC 34
#define PPM_SOCKOPT_SO_TIMESTAMPNS 35
#define PPM_SOCKOPT_SO_MARK 36
#define PPM_SOCKOPT_SO_TIMESTAMPING 37
#define PPM_SOCKOPT_SO_PROTOCOL 38
#define PPM_SOCKOPT_SO_DOMAIN 39
#define PPM_SOCKOPT_SO_RXQ_OVFL 40
#define PPM_SOCKOPT_SO_WIFI_STATUS 41
#define PPM_SOCKOPT_SO_PEEK_OFF 42
#define PPM_SOCKOPT_SO_NOFCS 43
#define PPM_SOCKOPT_SO_LOCK_FILTER 44
#define PPM_SOCKOPT_SO_SELECT_ERR_QUEUE 45
#define PPM_SOCKOPT_SO_BUSY_POLL 46
#define PPM_SOCKOPT_SO_MAX_PACING_RATE 47
#define PPM_SOCKOPT_SO_BPF_EXTENSIONS 48
#define PPM_SOCKOPT_SO_INCOMING_CPU 49
#define PPM_SOCKOPT_SO_ATTACH_BPF 50
#define PPM_SOCKOPT_SO_PEERGROUPS 51
#define PPM_SOCKOPT_SO_MEMINFO 52
#define PPM_SOCKOPT_SO_COOKIE 53
/*
* getsockopt/setsockopt dynamic params
*/
#define PPM_SOCKOPT_IDX_UNKNOWN 0
#define PPM_SOCKOPT_IDX_ERRNO 1
#define PPM_SOCKOPT_IDX_UINT32 2
#define PPM_SOCKOPT_IDX_UINT64 3
#define PPM_SOCKOPT_IDX_TIMEVAL 4
#define PPM_SOCKOPT_IDX_MAX 5
/*
* ptrace requests
*/
#define PPM_PTRACE_UNKNOWN 0
#define PPM_PTRACE_TRACEME 1
#define PPM_PTRACE_PEEKTEXT 2
#define PPM_PTRACE_PEEKDATA 3
#define PPM_PTRACE_PEEKUSR 4
#define PPM_PTRACE_POKETEXT 5
#define PPM_PTRACE_POKEDATA 6
#define PPM_PTRACE_POKEUSR 7
#define PPM_PTRACE_CONT 8
#define PPM_PTRACE_KILL 9
#define PPM_PTRACE_SINGLESTEP 10
#define PPM_PTRACE_ATTACH 11
#define PPM_PTRACE_DETACH 12
#define PPM_PTRACE_SYSCALL 13
#define PPM_PTRACE_SETOPTIONS 14
#define PPM_PTRACE_GETEVENTMSG 15
#define PPM_PTRACE_GETSIGINFO 16
#define PPM_PTRACE_SETSIGINFO 17
#define PPM_PTRACE_GETREGSET 18
#define PPM_PTRACE_SETREGSET 19
#define PPM_PTRACE_SEIZE 20
#define PPM_PTRACE_INTERRUPT 21
#define PPM_PTRACE_LISTEN 22
#define PPM_PTRACE_PEEKSIGINFO 23
#define PPM_PTRACE_GETSIGMASK 24
#define PPM_PTRACE_SETSIGMASK 25
#define PPM_PTRACE_GETREGS 26
#define PPM_PTRACE_SETREGS 27
#define PPM_PTRACE_GETFPREGS 28
#define PPM_PTRACE_SETFPREGS 29
#define PPM_PTRACE_GETFPXREGS 30
#define PPM_PTRACE_SETFPXREGS 31
#define PPM_PTRACE_OLDSETOPTIONS 32
#define PPM_PTRACE_GET_THREAD_AREA 33
#define PPM_PTRACE_SET_THREAD_AREA 34
#define PPM_PTRACE_ARCH_PRCTL 35
#define PPM_PTRACE_SYSEMU 36
#define PPM_PTRACE_SYSEMU_SINGLESTEP 37
#define PPM_PTRACE_SINGLEBLOCK 38
/*
* ptrace dynamic table indexes
*/
#define PPM_PTRACE_IDX_UINT64 0
#define PPM_PTRACE_IDX_SIGTYPE 1
#define PPM_PTRACE_IDX_MAX 2
#define PPM_BPF_IDX_FD 0
#define PPM_BPF_IDX_RES 1
#define PPM_BPF_IDX_MAX 2
/*
* memory protection flags
*/
#define PPM_PROT_NONE 0
#define PPM_PROT_READ (1 << 0)
#define PPM_PROT_WRITE (1 << 1)
#define PPM_PROT_EXEC (1 << 2)
#define PPM_PROT_SEM (1 << 3)
#define PPM_PROT_GROWSDOWN (1 << 4)
#define PPM_PROT_GROWSUP (1 << 5)
#define PPM_PROT_SAO (1 << 6)
/*
* mmap flags
*/
#define PPM_MAP_SHARED (1 << 0)
#define PPM_MAP_PRIVATE (1 << 1)
#define PPM_MAP_FIXED (1 << 2)
#define PPM_MAP_ANONYMOUS (1 << 3)
#define PPM_MAP_32BIT (1 << 4)
#define PPM_MAP_RENAME (1 << 5)
#define PPM_MAP_NORESERVE (1 << 6)
#define PPM_MAP_POPULATE (1 << 7)
#define PPM_MAP_NONBLOCK (1 << 8)
#define PPM_MAP_GROWSDOWN (1 << 9)
#define PPM_MAP_DENYWRITE (1 << 10)
#define PPM_MAP_EXECUTABLE (1 << 11)
#define PPM_MAP_INHERIT (1 << 12)
#define PPM_MAP_FILE (1 << 13)
#define PPM_MAP_LOCKED (1 << 14)
/*
* splice flags
*/
#define PPM_SPLICE_F_MOVE (1 << 0)
#define PPM_SPLICE_F_NONBLOCK (1 << 1)
#define PPM_SPLICE_F_MORE (1 << 2)
#define PPM_SPLICE_F_GIFT (1 << 3)
/*
* quotactl cmds
*/
#define PPM_Q_QUOTAON (1 << 0)
#define PPM_Q_QUOTAOFF (1 << 1)
#define PPM_Q_GETFMT (1 << 2)
#define PPM_Q_GETINFO (1 << 3)
#define PPM_Q_SETINFO (1 << 4)
#define PPM_Q_GETQUOTA (1 << 5)
#define PPM_Q_SETQUOTA (1 << 6)
#define PPM_Q_SYNC (1 << 7)
#define PPM_Q_XQUOTAON (1 << 8)
#define PPM_Q_XQUOTAOFF (1 << 9)
#define PPM_Q_XGETQUOTA (1 << 10)
#define PPM_Q_XSETQLIM (1 << 11)
#define PPM_Q_XGETQSTAT (1 << 12)
#define PPM_Q_XQUOTARM (1 << 13)
#define PPM_Q_XQUOTASYNC (1 << 14)
#define PPM_Q_XGETQSTATV (1 << 15)
/*
* quotactl types
*/
#define PPM_USRQUOTA (1 << 0)
#define PPM_GRPQUOTA (1 << 1)
/*
* quotactl dqi_flags
*/
#define PPM_DQF_NONE (1 << 0)
#define PPM_V1_DQF_RSQUASH (1 << 1)
/*
* quotactl quotafmts
*/
#define PPM_QFMT_NOT_USED (1 << 0)
#define PPM_QFMT_VFS_OLD (1 << 1)
#define PPM_QFMT_VFS_V0 (1 << 2)
#define PPM_QFMT_VFS_V1 (1 << 3)
/*
* Semop flags
*/
#define PPM_IPC_NOWAIT (1 << 0)
#define PPM_SEM_UNDO (1 << 1)
/*
* Semget flags
*/
#define PPM_IPC_CREAT (1 << 13)
#define PPM_IPC_EXCL (1 << 14)
#define PPM_IPC_STAT (1 << 0)
#define PPM_IPC_SET (1 << 1)
#define PPM_IPC_RMID (1 << 2)
#define PPM_IPC_INFO (1 << 3)
#define PPM_SEM_INFO (1 << 4)
#define PPM_SEM_STAT (1 << 5)
#define PPM_GETALL (1 << 6)
#define PPM_GETNCNT (1 << 7)
#define PPM_GETPID (1 << 8)
#define PPM_GETVAL (1 << 9)
#define PPM_GETZCNT (1 << 10)
#define PPM_SETALL (1 << 11)
#define PPM_SETVAL (1 << 12)
/*
* Access flags
*/
#define PPM_F_OK (0)
#define PPM_X_OK (1 << 0)
#define PPM_W_OK (1 << 1)
#define PPM_R_OK (1 << 2)
/*
* Page fault flags
*/
#define PPM_PF_PROTECTION_VIOLATION (1 << 0)
#define PPM_PF_PAGE_NOT_PRESENT (1 << 1)
#define PPM_PF_WRITE_ACCESS (1 << 2)
#define PPM_PF_READ_ACCESS (1 << 3)
#define PPM_PF_USER_FAULT (1 << 4)
#define PPM_PF_SUPERVISOR_FAULT (1 << 5)
#define PPM_PF_RESERVED_PAGE (1 << 6)
#define PPM_PF_INSTRUCTION_FETCH (1 << 7)
/*
* Rename flags
*/
#define PPM_RENAME_NOREPLACE (1 << 0) /* Don't overwrite target */
#define PPM_RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */
#define PPM_RENAME_WHITEOUT (1 << 2) /* Whiteout source */
/*
* Openat2 resolve flags
*/
#define PPM_RESOLVE_BENEATH (1 << 0)
#define PPM_RESOLVE_IN_ROOT (1 << 1)
#define PPM_RESOLVE_NO_MAGICLINKS (1 << 2)
#define PPM_RESOLVE_NO_SYMLINKS (1 << 3)
#define PPM_RESOLVE_NO_XDEV (1 << 4)
#define PPM_RESOLVE_CACHED (1 << 5)
/*
* Execve family additional flags.
*/
#define PPM_EXE_WRITABLE (1 << 0)
#define PPM_EXE_UPPER_LAYER (1 << 1)
#define PPM_EXE_FROM_MEMFD (1 << 2)
#define PPM_EXE_LOWER_LAYER (1 << 3)
/*
* Execveat flags
*/
#define PPM_EXVAT_AT_EMPTY_PATH \
(1 << 0) /* If pathname is an empty string, operate on the file referred to by dirfd */
#define PPM_EXVAT_AT_SYMLINK_NOFOLLOW \
(1 << 1) /* If the file is a symbolic link, then the call fails */
/*
* Io_uring_setup flags
*/
#define PPM_IORING_SETUP_IOPOLL (1 << 0)
#define PPM_IORING_SETUP_SQPOLL (1 << 1)
#define PPM_IORING_SQ_NEED_WAKEUP (1 << 2)
#define PPM_IORING_SETUP_SQ_AFF (1 << 3)
#define PPM_IORING_SETUP_CQSIZE (1 << 4)
#define PPM_IORING_SETUP_CLAMP (1 << 5)
#define PPM_IORING_SETUP_ATTACH_WQ (1 << 6)
#define PPM_IORING_SETUP_R_DISABLED (1 << 7)
/*
* Io_uring_setup feats
*/
#define PPM_IORING_FEAT_SINGLE_MMAP (1 << 0)
#define PPM_IORING_FEAT_NODROP (1 << 1)
#define PPM_IORING_FEAT_SUBMIT_STABLE (1 << 2)
#define PPM_IORING_FEAT_RW_CUR_POS (1 << 3)
#define PPM_IORING_FEAT_CUR_PERSONALITY (1 << 4)
#define PPM_IORING_FEAT_FAST_POLL (1 << 5)
#define PPM_IORING_FEAT_POLL_32BITS (1 << 6)
#define PPM_IORING_FEAT_SQPOLL_NONFIXED (1 << 7)
#define PPM_IORING_FEAT_ENTER_EXT_ARG (1 << 8)
#define PPM_IORING_FEAT_NATIVE_WORKERS (1 << 9)
#define PPM_IORING_FEAT_RSRC_TAGS (1 << 10)
/*
* Io_uring_enter flags
*/
#define PPM_IORING_ENTER_GETEVENTS (1 << 0)
#define PPM_IORING_ENTER_SQ_WAKEUP (1 << 1)
#define PPM_IORING_ENTER_SQ_WAIT (1 << 2)
#define PPM_IORING_ENTER_EXT_ARG (1 << 3)
/*
* Io_uring_register opcodes
*/
#define PPM_IORING_REGISTER_BUFFERS 0
#define PPM_IORING_UNREGISTER_BUFFERS 1
#define PPM_IORING_REGISTER_FILES 2
#define PPM_IORING_UNREGISTER_FILES 3
#define PPM_IORING_REGISTER_EVENTFD 4
#define PPM_IORING_UNREGISTER_EVENTFD 5
#define PPM_IORING_REGISTER_FILES_UPDATE 6
#define PPM_IORING_REGISTER_EVENTFD_ASYNC 7
#define PPM_IORING_REGISTER_PROBE 8
#define PPM_IORING_REGISTER_PERSONALITY 9
#define PPM_IORING_UNREGISTER_PERSONALITY 10
#define PPM_IORING_REGISTER_RESTRICTIONS 11
#define PPM_IORING_REGISTER_ENABLE_RINGS 12
#define PPM_IORING_REGISTER_FILES2 13
#define PPM_IORING_REGISTER_FILES_UPDATE2 14
#define PPM_IORING_REGISTER_BUFFERS2 15
#define PPM_IORING_REGISTER_BUFFERS_UPDATE 16
#define PPM_IORING_REGISTER_IOWQ_AFF 17
#define PPM_IORING_UNREGISTER_IOWQ_AFF 18
#define PPM_IORING_REGISTER_IOWQ_MAX_WORKERS 19
#define PPM_IORING_REGISTER_RING_FDS 20
#define PPM_IORING_UNREGISTER_RING_FDS 21
/*
* MlocKall flags
*/
#define PPM_MLOCKALL_MCL_CURRENT (1 << 0)
#define PPM_MLOCKALL_MCL_FUTURE (1 << 1)
#define PPM_MLOCKALL_MCL_ONFAULT (1 << 2)
/*
* Mlock2 flags
*/
#define PPM_MLOCK_ONFAULT (1 << 0)
/*
* Memfd_create flags
*/
#define PPM_MFD_CLOEXEC (1 << 0)
#define PPM_MFD_ALLOW_SEALING (1 << 1)
#define PPM_MFD_HUGETLB (1 << 2)
/*
* Fsconfig flags
*/
#define PPM_FSCONFIG_SET_FLAG 0
#define PPM_FSCONFIG_SET_STRING 1
#define PPM_FSCONFIG_SET_BINARY 2
#define PPM_FSCONFIG_SET_PATH 3
#define PPM_FSCONFIG_SET_PATH_EMPTY 4
#define PPM_FSCONFIG_SET_FD 5
#define PPM_FSCONFIG_CMD_CREATE 6
#define PPM_FSCONFIG_CMD_RECONFIGURE 7
/*
* Epoll_create1 flags
*/
#define PPM_EPOLL_CLOEXEC (1 << 0)
/*
* Prctl flags
*/
// taken from https://github.com/torvalds/linux/blob/master/include/uapi/linux/prctl.h
/* Values to pass as first argument to prctl() */
#define PPM_PR_SET_PDEATHSIG 1 /* Second arg is a signal */
#define PPM_PR_GET_PDEATHSIG 2 /* Second arg is a ptr to return the signal */
/* Get/set current->mm->dumpable */
#define PPM_PR_GET_DUMPABLE 3
#define PPM_PR_SET_DUMPABLE 4
/* Get/set unaligned access control bits (if meaningful) */
#define PPM_PR_GET_UNALIGN 5
#define PPM_PR_SET_UNALIGN 6
/* Get/set whether or not to drop capabilities on setuid() away from
* uid 0 (as per security/commoncap.c) */
#define PPM_PR_GET_KEEPCAPS 7
#define PPM_PR_SET_KEEPCAPS 8
/* Get/set floating-point emulation control bits (if meaningful) */
#define PPM_PR_GET_FPEMU 9
#define PPM_PR_SET_FPEMU 10
/* Get/set floating-point exception mode (if meaningful) */
#define PPM_PR_GET_FPEXC 11
#define PPM_PR_SET_FPEXC 12
/* Get/set whether we use statistical process timing or accurate timestamp
* based process timing */
#define PPM_PR_GET_TIMING 13
#define PPM_PR_SET_TIMING 14
#define PPM_PR_SET_NAME 15 /* Set process name */
#define PPM_PR_GET_NAME 16 /* Get process name */
/* Get/set process endian */
#define PPM_PR_GET_ENDIAN 19
#define PPM_PR_SET_ENDIAN 20
/* Get/set process seccomp mode */
#define PPM_PR_GET_SECCOMP 21
#define PPM_PR_SET_SECCOMP 22
/* Get/set the capability bounding set (as per security/commoncap.c) */
#define PPM_PR_CAPBSET_READ 23
#define PPM_PR_CAPBSET_DROP 24
/* Get/set the process' ability to use the timestamp counter instruction */
#define PPM_PR_GET_TSC 25
#define PPM_PR_SET_TSC 26
/* Get/set securebits (as per security/commoncap.c) */
#define PPM_PR_GET_SECUREBITS 27
#define PPM_PR_SET_SECUREBITS 28
/*
* pidfd_open flags
*/
#define PPM_PIDFD_NONBLOCK (1 << 0)
/*
* finit_module flags
*/
#define PPM_MODULE_INIT_IGNORE_MODVERSIONS 1
#define PPM_MODULE_INIT_IGNORE_VERMAGIC 2
#define PPM_MODULE_INIT_COMPRESSED_FILE 4
/*
* delete_module flags
*/
#define PPM_DELETE_MODULE_O_TRUNC (1 << 0)
#define PPM_DELETE_MODULE_O_NONBLOCK (1 << 1)
/*
* bpf_commands
*/
#define PPM_BPF_MAP_CREATE 0
#define PPM_BPF_MAP_LOOKUP_ELEM 1
#define PPM_BPF_MAP_UPDATE_ELEM 2
#define PPM_BPF_MAP_DELETE_ELEM 3
#define PPM_BPF_MAP_GET_NEXT_KEY 4
#define PPM_BPF_PROG_LOAD 5
#define PPM_BPF_OBJ_PIN 6
#define PPM_BPF_OBJ_GET 7
#define PPM_BPF_PROG_ATTACH 8
#define PPM_BPF_PROG_DETACH 9
#define PPM_BPF_PROG_TEST_RUN 10
#define PPM_BPF_PROG_RUN PPM_BPF_PROG_TEST_RUN
#define PPM_BPF_PROG_GET_NEXT_ID 11
#define PPM_BPF_MAP_GET_NEXT_ID 12
#define PPM_BPF_PROG_GET_FD_BY_ID 13
#define PPM_BPF_MAP_GET_FD_BY_ID 14
#define PPM_BPF_OBJ_GET_INFO_BY_FD 15
#define PPM_BPF_PROG_QUERY 16
#define PPM_BPF_RAW_TRACEPOINT_OPEN 17
#define PPM_BPF_BTF_LOAD 18
#define PPM_BPF_BTF_GET_FD_BY_ID 19
#define PPM_BPF_TASK_FD_QUERY 20
#define PPM_BPF_MAP_LOOKUP_AND_DELETE_ELEM 21
#define PPM_BPF_MAP_FREEZE 22
#define PPM_BPF_BTF_GET_NEXT_ID 23
#define PPM_BPF_MAP_LOOKUP_BATCH 24
#define PPM_BPF_MAP_LOOKUP_AND_DELETE_BATCH 25
#define PPM_BPF_MAP_UPDATE_BATCH 26
#define PPM_BPF_MAP_DELETE_BATCH 27
#define PPM_BPF_LINK_CREATE 28
#define PPM_BPF_LINK_UPDATE 29
#define PPM_BPF_LINK_GET_FD_BY_ID 30
#define PPM_BPF_LINK_GET_NEXT_ID 31
#define PPM_BPF_ENABLE_STATS 32
#define PPM_BPF_ITER_CREATE 33
#define PPM_BPF_LINK_DETACH 34
#define PPM_BPF_PROG_BIND_MAP 35
/*
* Get/set the timerslack as used by poll/select/nanosleep
* A value of 0 means "use default"
*/
#define PPM_PR_SET_TIMERSLACK 29
#define PPM_PR_GET_TIMERSLACK 30
#define PPM_PR_TASK_PERF_EVENTS_DISABLE 31
#define PPM_PR_TASK_PERF_EVENTS_ENABLE 32
/*
* Set early/late kill mode for hwpoison memory corruption.
* This influences when the process gets killed on a memory corruption.
*/
#define PPM_PR_MCE_KILL 33
#define PPM_PR_MCE_KILL_GET 34
/*
* Tune up process memory map specifics.
*/
#define PPM_PR_SET_MM 35
/*
* Set specific pid that is allowed to ptrace the current task.
* A value of 0 mean "no process".
*/
#define PPM_PR_SET_PTRACER 0x59616d61
#define PPM_PR_SET_CHILD_SUBREAPER 36
#define PPM_PR_GET_CHILD_SUBREAPER 37
/*
* If no_new_privs is set, then operations that grant new privileges (i.e.
* execve) will either fail or not grant them. This affects suid/sgid,
* file capabilities, and LSMs.
*
* Operations that merely manipulate or drop existing privileges (setresuid,
* capset, etc.) will still work. Drop those privileges if you want them gone.
*
* Changing LSM security domain is considered a new privilege. So, for example,
* asking selinux for a specific new context (e.g. with runcon) will result
* in execve returning -EPERM.
*
* See Documentation/userspace-api/no_new_privs.rst for more details.
*/
#define PPM_PR_SET_NO_NEW_PRIVS 38
#define PPM_PR_GET_NO_NEW_PRIVS 39
#define PPM_PR_GET_TID_ADDRESS 40
#define PPM_PR_SET_THP_DISABLE 41
#define PPM_PR_GET_THP_DISABLE 42
/*
* No longer implemented, but left here to ensure the numbers stay reserved:
*/
#define PPM_PR_MPX_ENABLE_MANAGEMENT 43
#define PPM_PR_MPX_DISABLE_MANAGEMENT 44
#define PPM_PR_SET_FP_MODE 45
#define PPM_PR_GET_FP_MODE 46
/* Control the ambient capability set */
#define PPM_PR_CAP_AMBIENT 47
/* arm64 Scalable Vector Extension controls */
/* Flag values must be kept in sync with ptrace NT_ARM_SVE interface */
#define PPM_PR_SVE_SET_VL 50 /* set task vector length */
#define PPM_PR_SVE_GET_VL 51 /* get task vector length */
/* Per task speculation control */
#define PPM_PR_GET_SPECULATION_CTRL 52
#define PPM_PR_SET_SPECULATION_CTRL 53
/* Reset arm64 pointer authentication keys */
#define PPM_PR_PAC_RESET_KEYS 54
/* Tagged user address controls for arm64 */
#define PPM_PR_SET_TAGGED_ADDR_CTRL 55
#define PPM_PR_GET_TAGGED_ADDR_CTRL 56
/* Control reclaim behavior when allocating memory */
#define PPM_PR_SET_IO_FLUSHER 57
#define PPM_PR_GET_IO_FLUSHER 58
/* Dispatch syscalls to a userspace handler */
#define PPM_PR_SET_SYSCALL_USER_DISPATCH 59
/* Set/get enabled arm64 pointer authentication keys */
#define PPM_PR_PAC_SET_ENABLED_KEYS 60
#define PPM_PR_PAC_GET_ENABLED_KEYS 61
/* Request the scheduler to share a core */
#define PPM_PR_SCHED_CORE 62
/* arm64 Scalable Matrix Extension controls */
/* Flag values must be in sync with SVE versions */
#define PPM_PR_SME_SET_VL 63 /* set task vector length */
#define PPM_PR_SME_GET_VL 64 /* get task vector length */
/* Bits common to PR_SME_SET_VL and PR_SME_GET_VL */
#define PPM_PR_SET_VMA 0x53564d41
/*
* SuS says limits have to be unsigned.
* Which makes a ton more sense anyway.
*
* Some architectures override this (for compatibility reasons):
*/
#ifndef RLIM_INFINITY
#define RLIM_INFINITY (~0UL)
#endif
/*
* Capabilities