1 | /** |
2 | * Seccomp Library |
3 | * |
4 | * Copyright (c) 2012,2013 Red Hat <pmoore@redhat.com> |
5 | * Author: Paul Moore <paul@paul-moore.com> |
6 | */ |
7 | |
8 | /* |
9 | * This library is free software; you can redistribute it and/or modify it |
10 | * under the terms of version 2.1 of the GNU Lesser General Public License as |
11 | * published by the Free Software Foundation. |
12 | * |
13 | * This library is distributed in the hope that it will be useful, but WITHOUT |
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License |
16 | * for more details. |
17 | * |
18 | * You should have received a copy of the GNU Lesser General Public License |
19 | * along with this library; if not, see <http://www.gnu.org/licenses>. |
20 | */ |
21 | |
22 | #ifndef _SECCOMP_H |
23 | #define _SECCOMP_H |
24 | |
25 | #include <elf.h> |
26 | #include <inttypes.h> |
27 | #include <asm/unistd.h> |
28 | #include <linux/audit.h> |
29 | |
30 | #ifdef __cplusplus |
31 | extern "C" { |
32 | #endif |
33 | |
34 | /* |
35 | * version information |
36 | */ |
37 | |
38 | #define SCMP_VER_MAJOR 2 |
39 | #define SCMP_VER_MINOR 3 |
40 | #define SCMP_VER_MICRO 1 |
41 | |
42 | struct scmp_version { |
43 | unsigned int major; |
44 | unsigned int minor; |
45 | unsigned int micro; |
46 | }; |
47 | |
48 | /* |
49 | * types |
50 | */ |
51 | |
52 | /** |
53 | * Filter context/handle |
54 | */ |
55 | typedef void *scmp_filter_ctx; |
56 | |
57 | /** |
58 | * Filter attributes |
59 | */ |
60 | enum scmp_filter_attr { |
61 | _SCMP_FLTATR_MIN = 0, |
62 | SCMP_FLTATR_ACT_DEFAULT = 1, /**< default filter action */ |
63 | SCMP_FLTATR_ACT_BADARCH = 2, /**< bad architecture action */ |
64 | SCMP_FLTATR_CTL_NNP = 3, /**< set NO_NEW_PRIVS on filter load */ |
65 | SCMP_FLTATR_CTL_TSYNC = 4, /**< sync threads on filter load */ |
66 | _SCMP_FLTATR_MAX, |
67 | }; |
68 | |
69 | /** |
70 | * Comparison operators |
71 | */ |
72 | enum scmp_compare { |
73 | _SCMP_CMP_MIN = 0, |
74 | SCMP_CMP_NE = 1, /**< not equal */ |
75 | SCMP_CMP_LT = 2, /**< less than */ |
76 | SCMP_CMP_LE = 3, /**< less than or equal */ |
77 | SCMP_CMP_EQ = 4, /**< equal */ |
78 | SCMP_CMP_GE = 5, /**< greater than or equal */ |
79 | SCMP_CMP_GT = 6, /**< greater than */ |
80 | SCMP_CMP_MASKED_EQ = 7, /**< masked equality */ |
81 | _SCMP_CMP_MAX, |
82 | }; |
83 | |
84 | /** |
85 | * Argument datum |
86 | */ |
87 | typedef uint64_t scmp_datum_t; |
88 | |
89 | /** |
90 | * Argument / Value comparison definition |
91 | */ |
92 | struct scmp_arg_cmp { |
93 | unsigned int arg; /**< argument number, starting at 0 */ |
94 | enum scmp_compare op; /**< the comparison op, e.g. SCMP_CMP_* */ |
95 | scmp_datum_t datum_a; |
96 | scmp_datum_t datum_b; |
97 | }; |
98 | |
99 | /* |
100 | * macros/defines |
101 | */ |
102 | |
103 | /** |
104 | * The native architecture token |
105 | */ |
106 | #define SCMP_ARCH_NATIVE 0 |
107 | |
108 | /** |
109 | * The x86 (32-bit) architecture token |
110 | */ |
111 | #define SCMP_ARCH_X86 AUDIT_ARCH_I386 |
112 | |
113 | /** |
114 | * The x86-64 (64-bit) architecture token |
115 | */ |
116 | #define SCMP_ARCH_X86_64 AUDIT_ARCH_X86_64 |
117 | |
118 | /** |
119 | * The x32 (32-bit x86_64) architecture token |
120 | * |
121 | * NOTE: this is different from the value used by the kernel because we need to |
122 | * be able to distinguish between x32 and x86_64 |
123 | */ |
124 | #define SCMP_ARCH_X32 (EM_X86_64|__AUDIT_ARCH_LE) |
125 | |
126 | /** |
127 | * The ARM architecture tokens |
128 | */ |
129 | #define SCMP_ARCH_ARM AUDIT_ARCH_ARM |
130 | /* AArch64 support for audit was merged in 3.17-rc1 */ |
131 | #ifndef AUDIT_ARCH_AARCH64 |
132 | #ifndef EM_AARCH64 |
133 | #define EM_AARCH64 183 |
134 | #endif /* EM_AARCH64 */ |
135 | #define AUDIT_ARCH_AARCH64 (EM_AARCH64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) |
136 | #endif /* AUDIT_ARCH_AARCH64 */ |
137 | #define SCMP_ARCH_AARCH64 AUDIT_ARCH_AARCH64 |
138 | |
139 | /** |
140 | * The MIPS architecture tokens |
141 | */ |
142 | #ifndef __AUDIT_ARCH_CONVENTION_MIPS64_N32 |
143 | #define __AUDIT_ARCH_CONVENTION_MIPS64_N32 0x20000000 |
144 | #endif |
145 | #ifndef EM_MIPS |
146 | #define EM_MIPS 8 |
147 | #endif |
148 | #ifndef AUDIT_ARCH_MIPS |
149 | #define AUDIT_ARCH_MIPS (EM_MIPS) |
150 | #endif |
151 | #ifndef AUDIT_ARCH_MIPS64 |
152 | #define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT) |
153 | #endif |
154 | /* MIPS64N32 support was merged in 3.15 */ |
155 | #ifndef AUDIT_ARCH_MIPS64N32 |
156 | #define AUDIT_ARCH_MIPS64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|\ |
157 | __AUDIT_ARCH_CONVENTION_MIPS64_N32) |
158 | #endif |
159 | /* MIPSEL64N32 support was merged in 3.15 */ |
160 | #ifndef AUDIT_ARCH_MIPSEL64N32 |
161 | #define AUDIT_ARCH_MIPSEL64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE|\ |
162 | __AUDIT_ARCH_CONVENTION_MIPS64_N32) |
163 | #endif |
164 | #define SCMP_ARCH_MIPS AUDIT_ARCH_MIPS |
165 | #define SCMP_ARCH_MIPS64 AUDIT_ARCH_MIPS64 |
166 | #define SCMP_ARCH_MIPS64N32 AUDIT_ARCH_MIPS64N32 |
167 | #define SCMP_ARCH_MIPSEL AUDIT_ARCH_MIPSEL |
168 | #define SCMP_ARCH_MIPSEL64 AUDIT_ARCH_MIPSEL64 |
169 | #define SCMP_ARCH_MIPSEL64N32 AUDIT_ARCH_MIPSEL64N32 |
170 | |
171 | /** |
172 | * The PowerPC architecture tokens |
173 | */ |
174 | #define SCMP_ARCH_PPC AUDIT_ARCH_PPC |
175 | #define SCMP_ARCH_PPC64 AUDIT_ARCH_PPC64 |
176 | #ifndef AUDIT_ARCH_PPC64LE |
177 | #define AUDIT_ARCH_PPC64LE (EM_PPC64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) |
178 | #endif |
179 | #define SCMP_ARCH_PPC64LE AUDIT_ARCH_PPC64LE |
180 | |
181 | /** |
182 | * The S390 architecture tokens |
183 | */ |
184 | #define SCMP_ARCH_S390 AUDIT_ARCH_S390 |
185 | #define SCMP_ARCH_S390X AUDIT_ARCH_S390X |
186 | |
187 | /** |
188 | * The PA-RISC hppa architecture tokens |
189 | */ |
190 | #define SCMP_ARCH_PARISC AUDIT_ARCH_PARISC |
191 | #define SCMP_ARCH_PARISC64 AUDIT_ARCH_PARISC64 |
192 | |
193 | /** |
194 | * Convert a syscall name into the associated syscall number |
195 | * @param x the syscall name |
196 | */ |
197 | #define SCMP_SYS(x) (__NR_##x) |
198 | |
199 | /** |
200 | * Specify an argument comparison struct for use in declaring rules |
201 | * @param arg the argument number, starting at 0 |
202 | * @param op the comparison operator, e.g. SCMP_CMP_* |
203 | * @param datum_a dependent on comparison |
204 | * @param datum_b dependent on comparison, optional |
205 | */ |
206 | #define SCMP_CMP(...) ((struct scmp_arg_cmp){__VA_ARGS__}) |
207 | |
208 | /** |
209 | * Specify an argument comparison struct for argument 0 |
210 | */ |
211 | #define SCMP_A0(...) SCMP_CMP(0, __VA_ARGS__) |
212 | |
213 | /** |
214 | * Specify an argument comparison struct for argument 1 |
215 | */ |
216 | #define SCMP_A1(...) SCMP_CMP(1, __VA_ARGS__) |
217 | |
218 | /** |
219 | * Specify an argument comparison struct for argument 2 |
220 | */ |
221 | #define SCMP_A2(...) SCMP_CMP(2, __VA_ARGS__) |
222 | |
223 | /** |
224 | * Specify an argument comparison struct for argument 3 |
225 | */ |
226 | #define SCMP_A3(...) SCMP_CMP(3, __VA_ARGS__) |
227 | |
228 | /** |
229 | * Specify an argument comparison struct for argument 4 |
230 | */ |
231 | #define SCMP_A4(...) SCMP_CMP(4, __VA_ARGS__) |
232 | |
233 | /** |
234 | * Specify an argument comparison struct for argument 5 |
235 | */ |
236 | #define SCMP_A5(...) SCMP_CMP(5, __VA_ARGS__) |
237 | |
238 | /* |
239 | * seccomp actions |
240 | */ |
241 | |
242 | /** |
243 | * Kill the process |
244 | */ |
245 | #define SCMP_ACT_KILL 0x00000000U |
246 | /** |
247 | * Throw a SIGSYS signal |
248 | */ |
249 | #define SCMP_ACT_TRAP 0x00030000U |
250 | /** |
251 | * Return the specified error code |
252 | */ |
253 | #define SCMP_ACT_ERRNO(x) (0x00050000U | ((x) & 0x0000ffffU)) |
254 | /** |
255 | * Notify a tracing process with the specified value |
256 | */ |
257 | #define SCMP_ACT_TRACE(x) (0x7ff00000U | ((x) & 0x0000ffffU)) |
258 | /** |
259 | * Allow the syscall to be executed after the action has been logged |
260 | */ |
261 | #define SCMP_ACT_LOG 0x7ffc0000U |
262 | /** |
263 | * Allow the syscall to be executed |
264 | */ |
265 | #define SCMP_ACT_ALLOW 0x7fff0000U |
266 | |
267 | /* |
268 | * functions |
269 | */ |
270 | |
271 | /** |
272 | * Query the library version information |
273 | * |
274 | * This function returns a pointer to a populated scmp_version struct, the |
275 | * caller does not need to free the structure when finished. |
276 | * |
277 | */ |
278 | const struct scmp_version *seccomp_version(void); |
279 | |
280 | /** |
281 | * Initialize the filter state |
282 | * @param def_action the default filter action |
283 | * |
284 | * This function initializes the internal seccomp filter state and should |
285 | * be called before any other functions in this library to ensure the filter |
286 | * state is initialized. Returns a filter context on success, NULL on failure. |
287 | * |
288 | */ |
289 | scmp_filter_ctx seccomp_init(uint32_t def_action); |
290 | |
291 | /** |
292 | * Reset the filter state |
293 | * @param ctx the filter context |
294 | * @param def_action the default filter action |
295 | * |
296 | * This function resets the given seccomp filter state and ensures the |
297 | * filter state is reinitialized. This function does not reset any seccomp |
298 | * filters already loaded into the kernel. Returns zero on success, negative |
299 | * values on failure. |
300 | * |
301 | */ |
302 | int seccomp_reset(scmp_filter_ctx ctx, uint32_t def_action); |
303 | |
304 | /** |
305 | * Destroys the filter state and releases any resources |
306 | * @param ctx the filter context |
307 | * |
308 | * This functions destroys the given seccomp filter state and releases any |
309 | * resources, including memory, associated with the filter state. This |
310 | * function does not reset any seccomp filters already loaded into the kernel. |
311 | * The filter context can no longer be used after calling this function. |
312 | * |
313 | */ |
314 | void seccomp_release(scmp_filter_ctx ctx); |
315 | |
316 | /** |
317 | * Merge two filters |
318 | * @param ctx_dst the destination filter context |
319 | * @param ctx_src the source filter context |
320 | * |
321 | * This function merges two filter contexts into a single filter context and |
322 | * destroys the second filter context. The two filter contexts must have the |
323 | * same attribute values and not contain any of the same architectures; if they |
324 | * do, the merge operation will fail. On success, the source filter context |
325 | * will be destroyed and should no longer be used; it is not necessary to |
326 | * call seccomp_release() on the source filter context. Returns zero on |
327 | * success, negative values on failure. |
328 | * |
329 | */ |
330 | int seccomp_merge(scmp_filter_ctx ctx_dst, scmp_filter_ctx ctx_src); |
331 | |
332 | /** |
333 | * Resolve the architecture name to a architecture token |
334 | * @param arch_name the architecture name |
335 | * |
336 | * This function resolves the given architecture name to a token suitable for |
337 | * use with libseccomp, returns zero on failure. |
338 | * |
339 | */ |
340 | uint32_t seccomp_arch_resolve_name(const char *arch_name); |
341 | |
342 | /** |
343 | * Return the native architecture token |
344 | * |
345 | * This function returns the native architecture token value, e.g. SCMP_ARCH_*. |
346 | * |
347 | */ |
348 | uint32_t seccomp_arch_native(void); |
349 | |
350 | /** |
351 | * Check to see if an existing architecture is present in the filter |
352 | * @param ctx the filter context |
353 | * @param arch_token the architecture token, e.g. SCMP_ARCH_* |
354 | * |
355 | * This function tests to see if a given architecture is included in the filter |
356 | * context. If the architecture token is SCMP_ARCH_NATIVE then the native |
357 | * architecture will be assumed. Returns zero if the architecture exists in |
358 | * the filter, -EEXIST if it is not present, and other negative values on |
359 | * failure. |
360 | * |
361 | */ |
362 | int seccomp_arch_exist(const scmp_filter_ctx ctx, uint32_t arch_token); |
363 | |
364 | /** |
365 | * Adds an architecture to the filter |
366 | * @param ctx the filter context |
367 | * @param arch_token the architecture token, e.g. SCMP_ARCH_* |
368 | * |
369 | * This function adds a new architecture to the given seccomp filter context. |
370 | * Any new rules added after this function successfully returns will be added |
371 | * to this architecture but existing rules will not be added to this |
372 | * architecture. If the architecture token is SCMP_ARCH_NATIVE then the native |
373 | * architecture will be assumed. Returns zero on success, negative values on |
374 | * failure. |
375 | * |
376 | */ |
377 | int seccomp_arch_add(scmp_filter_ctx ctx, uint32_t arch_token); |
378 | |
379 | /** |
380 | * Removes an architecture from the filter |
381 | * @param ctx the filter context |
382 | * @param arch_token the architecture token, e.g. SCMP_ARCH_* |
383 | * |
384 | * This function removes an architecture from the given seccomp filter context. |
385 | * If the architecture token is SCMP_ARCH_NATIVE then the native architecture |
386 | * will be assumed. Returns zero on success, negative values on failure. |
387 | * |
388 | */ |
389 | int seccomp_arch_remove(scmp_filter_ctx ctx, uint32_t arch_token); |
390 | |
391 | /** |
392 | * Loads the filter into the kernel |
393 | * @param ctx the filter context |
394 | * |
395 | * This function loads the given seccomp filter context into the kernel. If |
396 | * the filter was loaded correctly, the kernel will be enforcing the filter |
397 | * when this function returns. Returns zero on success, negative values on |
398 | * error. |
399 | * |
400 | */ |
401 | int seccomp_load(const scmp_filter_ctx ctx); |
402 | |
403 | /** |
404 | * Get the value of a filter attribute |
405 | * @param ctx the filter context |
406 | * @param attr the filter attribute name |
407 | * @param value the filter attribute value |
408 | * |
409 | * This function fetches the value of the given attribute name and returns it |
410 | * via @value. Returns zero on success, negative values on failure. |
411 | * |
412 | */ |
413 | int seccomp_attr_get(const scmp_filter_ctx ctx, |
414 | enum scmp_filter_attr attr, uint32_t *value); |
415 | |
416 | /** |
417 | * Set the value of a filter attribute |
418 | * @param ctx the filter context |
419 | * @param attr the filter attribute name |
420 | * @param value the filter attribute value |
421 | * |
422 | * This function sets the value of the given attribute. Returns zero on |
423 | * success, negative values on failure. |
424 | * |
425 | */ |
426 | int seccomp_attr_set(scmp_filter_ctx ctx, |
427 | enum scmp_filter_attr attr, uint32_t value); |
428 | |
429 | /** |
430 | * Resolve a syscall number to a name |
431 | * @param arch_token the architecture token, e.g. SCMP_ARCH_* |
432 | * @param num the syscall number |
433 | * |
434 | * Resolve the given syscall number to the syscall name for the given |
435 | * architecture; it is up to the caller to free the returned string. Returns |
436 | * the syscall name on success, NULL on failure. |
437 | * |
438 | */ |
439 | char *seccomp_syscall_resolve_num_arch(uint32_t arch_token, int num); |
440 | |
441 | /** |
442 | * Resolve a syscall name to a number |
443 | * @param arch_token the architecture token, e.g. SCMP_ARCH_* |
444 | * @param name the syscall name |
445 | * |
446 | * Resolve the given syscall name to the syscall number for the given |
447 | * architecture. Returns the syscall number on success, including negative |
448 | * pseudo syscall numbers (e.g. __PNR_*); returns __NR_SCMP_ERROR on failure. |
449 | * |
450 | */ |
451 | int seccomp_syscall_resolve_name_arch(uint32_t arch_token, const char *name); |
452 | |
453 | /** |
454 | * Resolve a syscall name to a number and perform any rewriting necessary |
455 | * @param arch_token the architecture token, e.g. SCMP_ARCH_* |
456 | * @param name the syscall name |
457 | * |
458 | * Resolve the given syscall name to the syscall number for the given |
459 | * architecture and do any necessary syscall rewriting needed by the |
460 | * architecture. Returns the syscall number on success, including negative |
461 | * pseudo syscall numbers (e.g. __PNR_*); returns __NR_SCMP_ERROR on failure. |
462 | * |
463 | */ |
464 | int seccomp_syscall_resolve_name_rewrite(uint32_t arch_token, const char *name); |
465 | |
466 | /** |
467 | * Resolve a syscall name to a number |
468 | * @param name the syscall name |
469 | * |
470 | * Resolve the given syscall name to the syscall number. Returns the syscall |
471 | * number on success, including negative pseudo syscall numbers (e.g. __PNR_*); |
472 | * returns __NR_SCMP_ERROR on failure. |
473 | * |
474 | */ |
475 | int seccomp_syscall_resolve_name(const char *name); |
476 | |
477 | /** |
478 | * Set the priority of a given syscall |
479 | * @param ctx the filter context |
480 | * @param syscall the syscall number |
481 | * @param priority priority value, higher value == higher priority |
482 | * |
483 | * This function sets the priority of the given syscall; this value is used |
484 | * when generating the seccomp filter code such that higher priority syscalls |
485 | * will incur less filter code overhead than the lower priority syscalls in the |
486 | * filter. Returns zero on success, negative values on failure. |
487 | * |
488 | */ |
489 | int seccomp_syscall_priority(scmp_filter_ctx ctx, |
490 | int syscall, uint8_t priority); |
491 | |
492 | /** |
493 | * Add a new rule to the filter |
494 | * @param ctx the filter context |
495 | * @param action the filter action |
496 | * @param syscall the syscall number |
497 | * @param arg_cnt the number of argument filters in the argument filter chain |
498 | * @param ... scmp_arg_cmp structs (use of SCMP_ARG_CMP() recommended) |
499 | * |
500 | * This function adds a series of new argument/value checks to the seccomp |
501 | * filter for the given syscall; multiple argument/value checks can be |
502 | * specified and they will be chained together (AND'd together) in the filter. |
503 | * If the specified rule needs to be adjusted due to architecture specifics it |
504 | * will be adjusted without notification. Returns zero on success, negative |
505 | * values on failure. |
506 | * |
507 | */ |
508 | int seccomp_rule_add(scmp_filter_ctx ctx, |
509 | uint32_t action, int syscall, unsigned int arg_cnt, ...); |
510 | |
511 | |
512 | /** |
513 | * Add a new rule to the filter |
514 | * @param ctx the filter context |
515 | * @param action the filter action |
516 | * @param syscall the syscall number |
517 | * @param arg_cnt the number of elements in the arg_array parameter |
518 | * @param arg_array array of scmp_arg_cmp structs |
519 | * |
520 | * This function adds a series of new argument/value checks to the seccomp |
521 | * filter for the given syscall; multiple argument/value checks can be |
522 | * specified and they will be chained together (AND'd together) in the filter. |
523 | * If the specified rule needs to be adjusted due to architecture specifics it |
524 | * will be adjusted without notification. Returns zero on success, negative |
525 | * values on failure. |
526 | * |
527 | */ |
528 | int seccomp_rule_add_array(scmp_filter_ctx ctx, |
529 | uint32_t action, int syscall, unsigned int arg_cnt, |
530 | const struct scmp_arg_cmp *arg_array); |
531 | |
532 | /** |
533 | * Add a new rule to the filter |
534 | * @param ctx the filter context |
535 | * @param action the filter action |
536 | * @param syscall the syscall number |
537 | * @param arg_cnt the number of argument filters in the argument filter chain |
538 | * @param ... scmp_arg_cmp structs (use of SCMP_ARG_CMP() recommended) |
539 | * |
540 | * This function adds a series of new argument/value checks to the seccomp |
541 | * filter for the given syscall; multiple argument/value checks can be |
542 | * specified and they will be chained together (AND'd together) in the filter. |
543 | * If the specified rule can not be represented on the architecture the |
544 | * function will fail. Returns zero on success, negative values on failure. |
545 | * |
546 | */ |
547 | int seccomp_rule_add_exact(scmp_filter_ctx ctx, uint32_t action, |
548 | int syscall, unsigned int arg_cnt, ...); |
549 | |
550 | /** |
551 | * Add a new rule to the filter |
552 | * @param ctx the filter context |
553 | * @param action the filter action |
554 | * @param syscall the syscall number |
555 | * @param arg_cnt the number of elements in the arg_array parameter |
556 | * @param arg_array array of scmp_arg_cmp structs |
557 | * |
558 | * This function adds a series of new argument/value checks to the seccomp |
559 | * filter for the given syscall; multiple argument/value checks can be |
560 | * specified and they will be chained together (AND'd together) in the filter. |
561 | * If the specified rule can not be represented on the architecture the |
562 | * function will fail. Returns zero on success, negative values on failure. |
563 | * |
564 | */ |
565 | int seccomp_rule_add_exact_array(scmp_filter_ctx ctx, |
566 | uint32_t action, int syscall, |
567 | unsigned int arg_cnt, |
568 | const struct scmp_arg_cmp *arg_array); |
569 | |
570 | /** |
571 | * Generate seccomp Pseudo Filter Code (PFC) and export it to a file |
572 | * @param ctx the filter context |
573 | * @param fd the destination fd |
574 | * |
575 | * This function generates seccomp Pseudo Filter Code (PFC) and writes it to |
576 | * the given fd. Returns zero on success, negative values on failure. |
577 | * |
578 | */ |
579 | int seccomp_export_pfc(const scmp_filter_ctx ctx, int fd); |
580 | |
581 | /** |
582 | * Generate seccomp Berkley Packet Filter (BPF) code and export it to a file |
583 | * @param ctx the filter context |
584 | * @param fd the destination fd |
585 | * |
586 | * This function generates seccomp Berkley Packer Filter (BPF) code and writes |
587 | * it to the given fd. Returns zero on success, negative values on failure. |
588 | * |
589 | */ |
590 | int seccomp_export_bpf(const scmp_filter_ctx ctx, int fd); |
591 | |
592 | /* |
593 | * pseudo syscall definitions |
594 | */ |
595 | |
596 | /* NOTE - pseudo syscall values {-1..-99} are reserved */ |
597 | #define __NR_SCMP_ERROR -1 |
598 | #define __NR_SCMP_UNDEF -2 |
599 | |
600 | /* socket syscalls */ |
601 | |
602 | #define __PNR_socket -101 |
603 | #ifndef __NR_socket |
604 | #define __NR_socket __PNR_socket |
605 | #endif /* __NR_socket */ |
606 | |
607 | #define __PNR_bind -102 |
608 | #ifndef __NR_bind |
609 | #define __NR_bind __PNR_bind |
610 | #endif /* __NR_bind */ |
611 | |
612 | #define __PNR_connect -103 |
613 | #ifndef __NR_connect |
614 | #define __NR_connect __PNR_connect |
615 | #endif /* __NR_connect */ |
616 | |
617 | #define __PNR_listen -104 |
618 | #ifndef __NR_listen |
619 | #define __NR_listen __PNR_listen |
620 | #endif /* __NR_listen */ |
621 | |
622 | #define __PNR_accept -105 |
623 | #ifndef __NR_accept |
624 | #define __NR_accept __PNR_accept |
625 | #endif /* __NR_accept */ |
626 | |
627 | #define __PNR_getsockname -106 |
628 | #ifndef __NR_getsockname |
629 | #define __NR_getsockname __PNR_getsockname |
630 | #endif /* __NR_getsockname */ |
631 | |
632 | #define __PNR_getpeername -107 |
633 | #ifndef __NR_getpeername |
634 | #define __NR_getpeername __PNR_getpeername |
635 | #endif /* __NR_getpeername */ |
636 | |
637 | #define __PNR_socketpair -108 |
638 | #ifndef __NR_socketpair |
639 | #define __NR_socketpair __PNR_socketpair |
640 | #endif /* __NR_socketpair */ |
641 | |
642 | #define __PNR_send -109 |
643 | #ifndef __NR_send |
644 | #define __NR_send __PNR_send |
645 | #endif /* __NR_send */ |
646 | |
647 | #define __PNR_recv -110 |
648 | #ifndef __NR_recv |
649 | #define __NR_recv __PNR_recv |
650 | #endif /* __NR_recv */ |
651 | |
652 | #define __PNR_sendto -111 |
653 | #ifndef __NR_sendto |
654 | #define __NR_sendto __PNR_sendto |
655 | #endif /* __NR_sendto */ |
656 | |
657 | #define __PNR_recvfrom -112 |
658 | #ifndef __NR_recvfrom |
659 | #define __NR_recvfrom __PNR_recvfrom |
660 | #endif /* __NR_recvfrom */ |
661 | |
662 | #define __PNR_shutdown -113 |
663 | #ifndef __NR_shutdown |
664 | #define __NR_shutdown __PNR_shutdown |
665 | #endif /* __NR_shutdown */ |
666 | |
667 | #define __PNR_setsockopt -114 |
668 | #ifndef __NR_setsockopt |
669 | #define __NR_setsockopt __PNR_setsockopt |
670 | #endif /* __NR_getsockopt */ |
671 | |
672 | #define __PNR_getsockopt -115 |
673 | #ifndef __NR_getsockopt |
674 | #define __NR_getsockopt __PNR_getsockopt |
675 | #endif /* __NR_getsockopt */ |
676 | |
677 | #define __PNR_sendmsg -116 |
678 | #ifndef __NR_sendmsg |
679 | #define __NR_sendmsg __PNR_sendmsg |
680 | #endif /* __NR_sendmsg */ |
681 | |
682 | #define __PNR_recvmsg -117 |
683 | #ifndef __NR_recvmsg |
684 | #define __NR_recvmsg __PNR_recvmsg |
685 | #endif /* __NR_recvmsg */ |
686 | |
687 | #define __PNR_accept4 -118 |
688 | #ifndef __NR_accept4 |
689 | #define __NR_accept4 __PNR_accept4 |
690 | #endif /* __NR_accept4 */ |
691 | |
692 | #define __PNR_recvmmsg -119 |
693 | #ifndef __NR_recvmmsg |
694 | #define __NR_recvmmsg __PNR_recvmmsg |
695 | #endif /* __NR_recvmmsg */ |
696 | |
697 | #define __PNR_sendmmsg -120 |
698 | #ifndef __NR_sendmmsg |
699 | #define __NR_sendmmsg __PNR_sendmmsg |
700 | #endif /* __NR_sendmmsg */ |
701 | |
702 | /* ipc syscalls */ |
703 | |
704 | #define __PNR_semop -201 |
705 | #ifndef __NR_semop |
706 | #define __NR_semop __PNR_semop |
707 | #endif /* __NR_semop */ |
708 | |
709 | #define __PNR_semget -202 |
710 | #ifndef __NR_semget |
711 | #define __NR_semget __PNR_semget |
712 | #endif /* __NR_semget */ |
713 | |
714 | #define __PNR_semctl -203 |
715 | #ifndef __NR_semctl |
716 | #define __NR_semctl __PNR_semctl |
717 | #endif /* __NR_semctl */ |
718 | |
719 | #define __PNR_semtimedop -204 |
720 | #ifndef __NR_semtimedop |
721 | #define __NR_semtimedop __PNR_semtimedop |
722 | #endif /* __NR_semtime */ |
723 | |
724 | #define __PNR_msgsnd -211 |
725 | #ifndef __NR_msgsnd |
726 | #define __NR_msgsnd __PNR_msgsnd |
727 | #endif /* __NR_msgsnd */ |
728 | |
729 | #define __PNR_msgrcv -212 |
730 | #ifndef __NR_msgrcv |
731 | #define __NR_msgrcv __PNR_msgrcv |
732 | #endif /* __NR_msgrcv */ |
733 | |
734 | #define __PNR_msgget -213 |
735 | #ifndef __NR_msgget |
736 | #define __NR_msgget __PNR_msgget |
737 | #endif /* __NR_msgget */ |
738 | |
739 | #define __PNR_msgctl -214 |
740 | #ifndef __NR_msgctl |
741 | #define __NR_msgctl __PNR_msgctl |
742 | #endif /* __NR_msgctl */ |
743 | |
744 | #define __PNR_shmat -221 |
745 | #ifndef __NR_shmat |
746 | #define __NR_shmat __PNR_shmat |
747 | #endif /* __NR_shmat */ |
748 | |
749 | #define __PNR_shmdt -222 |
750 | #ifndef __NR_shmdt |
751 | #define __NR_shmdt __PNR_shmdt |
752 | #endif /* __NR_shmdt */ |
753 | |
754 | #define __PNR_shmget -223 |
755 | #ifndef __NR_shmget |
756 | #define __NR_shmget __PNR_shmget |
757 | #endif /* __NR_shmget */ |
758 | |
759 | #define __PNR_shmctl -224 |
760 | #ifndef __NR_shmctl |
761 | #define __NR_shmctl __PNR_shmctl |
762 | #endif /* __NR_shmctl */ |
763 | |
764 | /* single syscalls */ |
765 | |
766 | #define __PNR_arch_prctl -10001 |
767 | #ifndef __NR_arch_prctl |
768 | #define __NR_arch_prctl __PNR_arch_prctl |
769 | #endif /* __NR_arch_prctl */ |
770 | |
771 | #define __PNR_bdflush -10002 |
772 | #ifndef __NR_bdflush |
773 | #define __NR_bdflush __PNR_bdflush |
774 | #endif /* __NR_bdflush */ |
775 | |
776 | #define __PNR_break -10003 |
777 | #ifndef __NR_break |
778 | #define __NR_break __PNR_break |
779 | #endif /* __NR_break */ |
780 | |
781 | #define __PNR_chown32 -10004 |
782 | #ifndef __NR_chown32 |
783 | #define __NR_chown32 __PNR_chown32 |
784 | #endif /* __NR_chown32 */ |
785 | |
786 | #define __PNR_epoll_ctl_old -10005 |
787 | #ifndef __NR_epoll_ctl_old |
788 | #define __NR_epoll_ctl_old __PNR_epoll_ctl_old |
789 | #endif /* __NR_epoll_ctl_old */ |
790 | |
791 | #define __PNR_epoll_wait_old -10006 |
792 | #ifndef __NR_epoll_wait_old |
793 | #define __NR_epoll_wait_old __PNR_epoll_wait_old |
794 | #endif /* __NR_epoll_wait_old */ |
795 | |
796 | #define __PNR_fadvise64_64 -10007 |
797 | #ifndef __NR_fadvise64_64 |
798 | #define __NR_fadvise64_64 __PNR_fadvise64_64 |
799 | #endif /* __NR_fadvise64_64 */ |
800 | |
801 | #define __PNR_fchown32 -10008 |
802 | #ifndef __NR_fchown32 |
803 | #define __NR_fchown32 __PNR_fchown32 |
804 | #endif /* __NR_fchown32 */ |
805 | |
806 | #define __PNR_fcntl64 -10009 |
807 | #ifndef __NR_fcntl64 |
808 | #define __NR_fcntl64 __PNR_fcntl64 |
809 | #endif /* __NR_fcntl64 */ |
810 | |
811 | #define __PNR_fstat64 -10010 |
812 | #ifndef __NR_fstat64 |
813 | #define __NR_fstat64 __PNR_fstat64 |
814 | #endif /* __NR_fstat64 */ |
815 | |
816 | #define __PNR_fstatat64 -10011 |
817 | #ifndef __NR_fstatat64 |
818 | #define __NR_fstatat64 __PNR_fstatat64 |
819 | #endif /* __NR_fstatat64 */ |
820 | |
821 | #define __PNR_fstatfs64 -10012 |
822 | #ifndef __NR_fstatfs64 |
823 | #define __NR_fstatfs64 __PNR_fstatfs64 |
824 | #endif /* __NR_fstatfs64 */ |
825 | |
826 | #define __PNR_ftime -10013 |
827 | #ifndef __NR_ftime |
828 | #define __NR_ftime __PNR_ftime |
829 | #endif /* __NR_ftime */ |
830 | |
831 | #define __PNR_ftruncate64 -10014 |
832 | #ifndef __NR_ftruncate64 |
833 | #define __NR_ftruncate64 __PNR_ftruncate64 |
834 | #endif /* __NR_ftruncate64 */ |
835 | |
836 | #define __PNR_getegid32 -10015 |
837 | #ifndef __NR_getegid32 |
838 | #define __NR_getegid32 __PNR_getegid32 |
839 | #endif /* __NR_getegid32 */ |
840 | |
841 | #define __PNR_geteuid32 -10016 |
842 | #ifndef __NR_geteuid32 |
843 | #define __NR_geteuid32 __PNR_geteuid32 |
844 | #endif /* __NR_geteuid32 */ |
845 | |
846 | #define __PNR_getgid32 -10017 |
847 | #ifndef __NR_getgid32 |
848 | #define __NR_getgid32 __PNR_getgid32 |
849 | #endif /* __NR_getgid32 */ |
850 | |
851 | #define __PNR_getgroups32 -10018 |
852 | #ifndef __NR_getgroups32 |
853 | #define __NR_getgroups32 __PNR_getgroups32 |
854 | #endif /* __NR_getgroups32 */ |
855 | |
856 | #define __PNR_getresgid32 -10019 |
857 | #ifndef __NR_getresgid32 |
858 | #define __NR_getresgid32 __PNR_getresgid32 |
859 | #endif /* __NR_getresgid32 */ |
860 | |
861 | #define __PNR_getresuid32 -10020 |
862 | #ifndef __NR_getresuid32 |
863 | #define __NR_getresuid32 __PNR_getresuid32 |
864 | #endif /* __NR_getresuid32 */ |
865 | |
866 | #define __PNR_getuid32 -10021 |
867 | #ifndef __NR_getuid32 |
868 | #define __NR_getuid32 __PNR_getuid32 |
869 | #endif /* __NR_getuid32 */ |
870 | |
871 | #define __PNR_gtty -10022 |
872 | #ifndef __NR_gtty |
873 | #define __NR_gtty __PNR_gtty |
874 | #endif /* __NR_gtty */ |
875 | |
876 | #define __PNR_idle -10023 |
877 | #ifndef __NR_idle |
878 | #define __NR_idle __PNR_idle |
879 | #endif /* __NR_idle */ |
880 | |
881 | #define __PNR_ipc -10024 |
882 | #ifndef __NR_ipc |
883 | #define __NR_ipc __PNR_ipc |
884 | #endif /* __NR_ipc */ |
885 | |
886 | #define __PNR_lchown32 -10025 |
887 | #ifndef __NR_lchown32 |
888 | #define __NR_lchown32 __PNR_lchown32 |
889 | #endif /* __NR_lchown32 */ |
890 | |
891 | #define __PNR__llseek -10026 |
892 | #ifndef __NR__llseek |
893 | #define __NR__llseek __PNR__llseek |
894 | #endif /* __NR__llseek */ |
895 | |
896 | #define __PNR_lock -10027 |
897 | #ifndef __NR_lock |
898 | #define __NR_lock __PNR_lock |
899 | #endif /* __NR_lock */ |
900 | |
901 | #define __PNR_lstat64 -10028 |
902 | #ifndef __NR_lstat64 |
903 | #define __NR_lstat64 __PNR_lstat64 |
904 | #endif /* __NR_lstat64 */ |
905 | |
906 | #define __PNR_mmap2 -10029 |
907 | #ifndef __NR_mmap2 |
908 | #define __NR_mmap2 __PNR_mmap2 |
909 | #endif /* __NR_mmap2 */ |
910 | |
911 | #define __PNR_mpx -10030 |
912 | #ifndef __NR_mpx |
913 | #define __NR_mpx __PNR_mpx |
914 | #endif /* __NR_mpx */ |
915 | |
916 | #define __PNR_newfstatat -10031 |
917 | #ifndef __NR_newfstatat |
918 | #define __NR_newfstatat __PNR_newfstatat |
919 | #endif /* __NR_newfstatat */ |
920 | |
921 | #define __PNR__newselect -10032 |
922 | #ifndef __NR__newselect |
923 | #define __NR__newselect __PNR__newselect |
924 | #endif /* __NR__newselect */ |
925 | |
926 | #define __PNR_nice -10033 |
927 | #ifndef __NR_nice |
928 | #define __NR_nice __PNR_nice |
929 | #endif /* __NR_nice */ |
930 | |
931 | #define __PNR_oldfstat -10034 |
932 | #ifndef __NR_oldfstat |
933 | #define __NR_oldfstat __PNR_oldfstat |
934 | #endif /* __NR_oldfstat */ |
935 | |
936 | #define __PNR_oldlstat -10035 |
937 | #ifndef __NR_oldlstat |
938 | #define __NR_oldlstat __PNR_oldlstat |
939 | #endif /* __NR_oldlstat */ |
940 | |
941 | #define __PNR_oldolduname -10036 |
942 | #ifndef __NR_oldolduname |
943 | #define __NR_oldolduname __PNR_oldolduname |
944 | #endif /* __NR_oldolduname */ |
945 | |
946 | #define __PNR_oldstat -10037 |
947 | #ifndef __NR_oldstat |
948 | #define __NR_oldstat __PNR_oldstat |
949 | #endif /* __NR_oldstat */ |
950 | |
951 | #define __PNR_olduname -10038 |
952 | #ifndef __NR_olduname |
953 | #define __NR_olduname __PNR_olduname |
954 | #endif /* __NR_olduname */ |
955 | |
956 | #define __PNR_prof -10039 |
957 | #ifndef __NR_prof |
958 | #define __NR_prof __PNR_prof |
959 | #endif /* __NR_prof */ |
960 | |
961 | #define __PNR_profil -10040 |
962 | #ifndef __NR_profil |
963 | #define __NR_profil __PNR_profil |
964 | #endif /* __NR_profil */ |
965 | |
966 | #define __PNR_readdir -10041 |
967 | #ifndef __NR_readdir |
968 | #define __NR_readdir __PNR_readdir |
969 | #endif /* __NR_readdir */ |
970 | |
971 | #define __PNR_security -10042 |
972 | #ifndef __NR_security |
973 | #define __NR_security __PNR_security |
974 | #endif /* __NR_security */ |
975 | |
976 | #define __PNR_sendfile64 -10043 |
977 | #ifndef __NR_sendfile64 |
978 | #define __NR_sendfile64 __PNR_sendfile64 |
979 | #endif /* __NR_sendfile64 */ |
980 | |
981 | #define __PNR_setfsgid32 -10044 |
982 | #ifndef __NR_setfsgid32 |
983 | #define __NR_setfsgid32 __PNR_setfsgid32 |
984 | #endif /* __NR_setfsgid32 */ |
985 | |
986 | #define __PNR_setfsuid32 -10045 |
987 | #ifndef __NR_setfsuid32 |
988 | #define __NR_setfsuid32 __PNR_setfsuid32 |
989 | #endif /* __NR_setfsuid32 */ |
990 | |
991 | #define __PNR_setgid32 -10046 |
992 | #ifndef __NR_setgid32 |
993 | #define __NR_setgid32 __PNR_setgid32 |
994 | #endif /* __NR_setgid32 */ |
995 | |
996 | #define __PNR_setgroups32 -10047 |
997 | #ifndef __NR_setgroups32 |
998 | #define __NR_setgroups32 __PNR_setgroups32 |
999 | #endif /* __NR_setgroups32 */ |
1000 | |
1001 | #define __PNR_setregid32 -10048 |
1002 | #ifndef __NR_setregid32 |
1003 | #define __NR_setregid32 __PNR_setregid32 |
1004 | #endif /* __NR_setregid32 */ |
1005 | |
1006 | #define __PNR_setresgid32 -10049 |
1007 | #ifndef __NR_setresgid32 |
1008 | #define __NR_setresgid32 __PNR_setresgid32 |
1009 | #endif /* __NR_setresgid32 */ |
1010 | |
1011 | #define __PNR_setresuid32 -10050 |
1012 | #ifndef __NR_setresuid32 |
1013 | #define __NR_setresuid32 __PNR_setresuid32 |
1014 | #endif /* __NR_setresuid32 */ |
1015 | |
1016 | #define __PNR_setreuid32 -10051 |
1017 | #ifndef __NR_setreuid32 |
1018 | #define __NR_setreuid32 __PNR_setreuid32 |
1019 | #endif /* __NR_setreuid32 */ |
1020 | |
1021 | #define __PNR_setuid32 -10052 |
1022 | #ifndef __NR_setuid32 |
1023 | #define __NR_setuid32 __PNR_setuid32 |
1024 | #endif /* __NR_setuid32 */ |
1025 | |
1026 | #define __PNR_sgetmask -10053 |
1027 | #ifndef __NR_sgetmask |
1028 | #define __NR_sgetmask __PNR_sgetmask |
1029 | #endif /* __NR_sgetmask */ |
1030 | |
1031 | #define __PNR_sigaction -10054 |
1032 | #ifndef __NR_sigaction |
1033 | #define __NR_sigaction __PNR_sigaction |
1034 | #endif /* __NR_sigaction */ |
1035 | |
1036 | #define __PNR_signal -10055 |
1037 | #ifndef __NR_signal |
1038 | #define __NR_signal __PNR_signal |
1039 | #endif /* __NR_signal */ |
1040 | |
1041 | #define __PNR_sigpending -10056 |
1042 | #ifndef __NR_sigpending |
1043 | #define __NR_sigpending __PNR_sigpending |
1044 | #endif /* __NR_sigpending */ |
1045 | |
1046 | #define __PNR_sigprocmask -10057 |
1047 | #ifndef __NR_sigprocmask |
1048 | #define __NR_sigprocmask __PNR_sigprocmask |
1049 | #endif /* __NR_sigprocmask */ |
1050 | |
1051 | #define __PNR_sigreturn -10058 |
1052 | #ifndef __NR_sigreturn |
1053 | #define __NR_sigreturn __PNR_sigreturn |
1054 | #endif /* __NR_sigreturn */ |
1055 | |
1056 | #define __PNR_sigsuspend -10059 |
1057 | #ifndef __NR_sigsuspend |
1058 | #define __NR_sigsuspend __PNR_sigsuspend |
1059 | #endif /* __NR_sigsuspend */ |
1060 | |
1061 | #define __PNR_socketcall -10060 |
1062 | #ifndef __NR_socketcall |
1063 | #define __NR_socketcall __PNR_socketcall |
1064 | #endif /* __NR_socketcall */ |
1065 | |
1066 | #define __PNR_ssetmask -10061 |
1067 | #ifndef __NR_ssetmask |
1068 | #define __NR_ssetmask __PNR_ssetmask |
1069 | #endif /* __NR_ssetmask */ |
1070 | |
1071 | #define __PNR_stat64 -10062 |
1072 | #ifndef __NR_stat64 |
1073 | #define __NR_stat64 __PNR_stat64 |
1074 | #endif /* __NR_stat64 */ |
1075 | |
1076 | #define __PNR_statfs64 -10063 |
1077 | #ifndef __NR_statfs64 |
1078 | #define __NR_statfs64 __PNR_statfs64 |
1079 | #endif /* __NR_statfs64 */ |
1080 | |
1081 | #define __PNR_stime -10064 |
1082 | #ifndef __NR_stime |
1083 | #define __NR_stime __PNR_stime |
1084 | #endif /* __NR_stime */ |
1085 | |
1086 | #define __PNR_stty -10065 |
1087 | #ifndef __NR_stty |
1088 | #define __NR_stty __PNR_stty |
1089 | #endif /* __NR_stty */ |
1090 | |
1091 | #define __PNR_truncate64 -10066 |
1092 | #ifndef __NR_truncate64 |
1093 | #define __NR_truncate64 __PNR_truncate64 |
1094 | #endif /* __NR_truncate64 */ |
1095 | |
1096 | #define __PNR_tuxcall -10067 |
1097 | #ifndef __NR_tuxcall |
1098 | #define __NR_tuxcall __PNR_tuxcall |
1099 | #endif /* __NR_tuxcall */ |
1100 | |
1101 | #define __PNR_ugetrlimit -10068 |
1102 | #ifndef __NR_ugetrlimit |
1103 | #define __NR_ugetrlimit __PNR_ugetrlimit |
1104 | #endif /* __NR_ugetrlimit */ |
1105 | |
1106 | #define __PNR_ulimit -10069 |
1107 | #ifndef __NR_ulimit |
1108 | #define __NR_ulimit __PNR_ulimit |
1109 | #endif /* __NR_ulimit */ |
1110 | |
1111 | #define __PNR_umount -10070 |
1112 | #ifndef __NR_umount |
1113 | #define __NR_umount __PNR_umount |
1114 | #endif /* __NR_umount */ |
1115 | |
1116 | #define __PNR_vm86 -10071 |
1117 | #ifndef __NR_vm86 |
1118 | #define __NR_vm86 __PNR_vm86 |
1119 | #endif /* __NR_vm86 */ |
1120 | |
1121 | #define __PNR_vm86old -10072 |
1122 | #ifndef __NR_vm86old |
1123 | #define __NR_vm86old __PNR_vm86old |
1124 | #endif /* __NR_vm86old */ |
1125 | |
1126 | #define __PNR_waitpid -10073 |
1127 | #ifndef __NR_waitpid |
1128 | #define __NR_waitpid __PNR_waitpid |
1129 | #endif /* __NR_waitpid */ |
1130 | |
1131 | #define __PNR_create_module -10074 |
1132 | #ifndef __NR_create_module |
1133 | #define __NR_create_module __PNR_create_module |
1134 | #endif /* __NR_create_module */ |
1135 | |
1136 | #define __PNR_get_kernel_syms -10075 |
1137 | #ifndef __NR_get_kernel_syms |
1138 | #define __NR_get_kernel_syms __PNR_get_kernel_syms |
1139 | #endif /* __NR_get_kernel_syms */ |
1140 | |
1141 | #define __PNR_get_thread_area -10076 |
1142 | #ifndef __NR_get_thread_area |
1143 | #define __NR_get_thread_area __PNR_get_thread_area |
1144 | #endif /* __NR_get_thread_area */ |
1145 | |
1146 | #define __PNR_nfsservctl -10077 |
1147 | #ifndef __NR_nfsservctl |
1148 | #define __NR_nfsservctl __PNR_nfsservctl |
1149 | #endif /* __NR_nfsservctl */ |
1150 | |
1151 | #define __PNR_query_module -10078 |
1152 | #ifndef __NR_query_module |
1153 | #define __NR_query_module __PNR_query_module |
1154 | #endif /* __NR_query_module */ |
1155 | |
1156 | #define __PNR_set_thread_area -10079 |
1157 | #ifndef __NR_set_thread_area |
1158 | #define __NR_set_thread_area __PNR_set_thread_area |
1159 | #endif /* __NR_set_thread_area */ |
1160 | |
1161 | #define __PNR__sysctl -10080 |
1162 | #ifndef __NR__sysctl |
1163 | #define __NR__sysctl __PNR__sysctl |
1164 | #endif /* __NR__sysctl */ |
1165 | |
1166 | #define __PNR_uselib -10081 |
1167 | #ifndef __NR_uselib |
1168 | #define __NR_uselib __PNR_uselib |
1169 | #endif /* __NR_uselib */ |
1170 | |
1171 | #define __PNR_vserver -10082 |
1172 | #ifndef __NR_vserver |
1173 | #define __NR_vserver __PNR_vserver |
1174 | #endif /* __NR_vserver */ |
1175 | |
1176 | #define __PNR_arm_fadvise64_64 -10083 |
1177 | #ifndef __NR_arm_fadvise64_64 |
1178 | #define __NR_arm_fadvise64_64 __PNR_arm_fadvise64_64 |
1179 | #endif /* __NR_arm_fadvise64_64 */ |
1180 | |
1181 | #define __PNR_arm_sync_file_range -10084 |
1182 | #ifndef __NR_arm_sync_file_range |
1183 | #define __NR_arm_sync_file_range __PNR_arm_sync_file_range |
1184 | #endif /* __NR_arm_sync_file_range */ |
1185 | |
1186 | #define __PNR_pciconfig_iobase -10086 |
1187 | #ifndef __NR_pciconfig_iobase |
1188 | #define __NR_pciconfig_iobase __PNR_pciconfig_iobase |
1189 | #endif /* __NR_pciconfig_iobase */ |
1190 | |
1191 | #define __PNR_pciconfig_read -10087 |
1192 | #ifndef __NR_pciconfig_read |
1193 | #define __NR_pciconfig_read __PNR_pciconfig_read |
1194 | #endif /* __NR_pciconfig_read */ |
1195 | |
1196 | #define __PNR_pciconfig_write -10088 |
1197 | #ifndef __NR_pciconfig_write |
1198 | #define __NR_pciconfig_write __PNR_pciconfig_write |
1199 | #endif /* __NR_pciconfig_write */ |
1200 | |
1201 | #define __PNR_sync_file_range2 -10089 |
1202 | #ifndef __NR_sync_file_range2 |
1203 | #define __NR_sync_file_range2 __PNR_sync_file_range2 |
1204 | #endif /* __NR_sync_file_range2 */ |
1205 | |
1206 | #define __PNR_syscall -10090 |
1207 | #ifndef __NR_syscall |
1208 | #define __NR_syscall __PNR_syscall |
1209 | #endif /* __NR_syscall */ |
1210 | |
1211 | #define __PNR_afs_syscall -10091 |
1212 | #ifndef __NR_afs_syscall |
1213 | #define __NR_afs_syscall __PNR_afs_syscall |
1214 | #endif /* __NR_afs_syscall */ |
1215 | |
1216 | #define __PNR_fadvise64 -10092 |
1217 | #ifndef __NR_fadvise64 |
1218 | #define __NR_fadvise64 __PNR_fadvise64 |
1219 | #endif /* __NR_fadvise64 */ |
1220 | |
1221 | #define __PNR_getpmsg -10093 |
1222 | #ifndef __NR_getpmsg |
1223 | #define __NR_getpmsg __PNR_getpmsg |
1224 | #endif /* __NR_getpmsg */ |
1225 | |
1226 | #define __PNR_ioperm -10094 |
1227 | #ifndef __NR_ioperm |
1228 | #define __NR_ioperm __PNR_ioperm |
1229 | #endif /* __NR_ioperm */ |
1230 | |
1231 | #define __PNR_iopl -10095 |
1232 | #ifndef __NR_iopl |
1233 | #define __NR_iopl __PNR_iopl |
1234 | #endif /* __NR_iopl */ |
1235 | |
1236 | #define __PNR_migrate_pages -10097 |
1237 | #ifndef __NR_migrate_pages |
1238 | #define __NR_migrate_pages __PNR_migrate_pages |
1239 | #endif /* __NR_migrate_pages */ |
1240 | |
1241 | #define __PNR_modify_ldt -10098 |
1242 | #ifndef __NR_modify_ldt |
1243 | #define __NR_modify_ldt __PNR_modify_ldt |
1244 | #endif /* __NR_modify_ldt */ |
1245 | |
1246 | #define __PNR_putpmsg -10099 |
1247 | #ifndef __NR_putpmsg |
1248 | #define __NR_putpmsg __PNR_putpmsg |
1249 | #endif /* __NR_putpmsg */ |
1250 | |
1251 | #define __PNR_sync_file_range -10100 |
1252 | #ifndef __NR_sync_file_range |
1253 | #define __NR_sync_file_range __PNR_sync_file_range |
1254 | #endif /* __NR_sync_file_range */ |
1255 | |
1256 | #define __PNR_select -10101 |
1257 | #ifndef __NR_select |
1258 | #define __NR_select __PNR_select |
1259 | #endif /* __NR_select */ |
1260 | |
1261 | #define __PNR_vfork -10102 |
1262 | #ifndef __NR_vfork |
1263 | #define __NR_vfork __PNR_vfork |
1264 | #endif /* __NR_vfork */ |
1265 | |
1266 | #define __PNR_cachectl -10103 |
1267 | #ifndef __NR_cachectl |
1268 | #define __NR_cachectl __PNR_cachectl |
1269 | #endif /* __NR_cachectl */ |
1270 | |
1271 | #define __PNR_cacheflush -10104 |
1272 | #ifndef __NR_cacheflush |
1273 | #ifdef __ARM_NR_cacheflush |
1274 | #define __NR_cacheflush __ARM_NR_cacheflush |
1275 | #else |
1276 | #define __NR_cacheflush __PNR_cacheflush |
1277 | #endif |
1278 | #endif /* __NR_cacheflush */ |
1279 | |
1280 | #define __PNR_sysmips -10106 |
1281 | #ifndef __NR_sysmips |
1282 | #define __NR_sysmips __PNR_sysmips |
1283 | #endif /* __NR_sysmips */ |
1284 | |
1285 | #define __PNR_timerfd -10107 |
1286 | #ifndef __NR_timerfd |
1287 | #define __NR_timerfd __PNR_timerfd |
1288 | #endif /* __NR_timerfd */ |
1289 | |
1290 | #define __PNR_time -10108 |
1291 | #ifndef __NR_time |
1292 | #define __NR_time __PNR_time |
1293 | #endif /* __NR_time */ |
1294 | |
1295 | #define __PNR_getrandom -10109 |
1296 | #ifndef __NR_getrandom |
1297 | #define __NR_getrandom __PNR_getrandom |
1298 | #endif /* __NR_getrandom - NO LONGER NEEDED */ |
1299 | |
1300 | #define __PNR_memfd_create -10110 |
1301 | #ifndef __NR_memfd_create |
1302 | #define __NR_memfd_create __PNR_memfd_create |
1303 | #endif /* __NR_memfd_create - NO LONGER NEEDED */ |
1304 | |
1305 | #define __PNR_kexec_file_load -10111 |
1306 | #ifndef __NR_kexec_file_load |
1307 | #define __NR_kexec_file_load __PNR_kexec_file_load |
1308 | #endif /* __NR_kexec_file_load */ |
1309 | |
1310 | #define __PNR_sysfs -10145 |
1311 | #ifndef __NR_sysfs |
1312 | #define __NR_sysfs __PNR_sysfs |
1313 | #endif /* __NR_sysfs */ |
1314 | |
1315 | #define __PNR_oldwait4 -10146 |
1316 | #ifndef __NR_oldwait4 |
1317 | #define __NR_oldwait4 __PNR_oldwait4 |
1318 | #endif /* __NR_sysfs */ |
1319 | |
1320 | #define __PNR_access -10147 |
1321 | #ifndef __NR_access |
1322 | #define __NR_access __PNR_access |
1323 | #endif /* __NR_access */ |
1324 | |
1325 | #define __PNR_alarm -10148 |
1326 | #ifndef __NR_alarm |
1327 | #define __NR_alarm __PNR_alarm |
1328 | #endif /* __NR_alarm */ |
1329 | |
1330 | #define __PNR_chmod -10149 |
1331 | #ifndef __NR_chmod |
1332 | #define __NR_chmod __PNR_chmod |
1333 | #endif /* __NR_chmod */ |
1334 | |
1335 | #define __PNR_chown -10150 |
1336 | #ifndef __NR_chown |
1337 | #define __NR_chown __PNR_chown |
1338 | #endif /* __NR_chown */ |
1339 | |
1340 | #define __PNR_creat -10151 |
1341 | #ifndef __NR_creat |
1342 | #define __NR_creat __PNR_creat |
1343 | #endif /* __NR_creat */ |
1344 | |
1345 | #define __PNR_dup2 -10152 |
1346 | #ifndef __NR_dup2 |
1347 | #define __NR_dup2 __PNR_dup2 |
1348 | #endif /* __NR_dup2 */ |
1349 | |
1350 | #define __PNR_epoll_create -10153 |
1351 | #ifndef __NR_epoll_create |
1352 | #define __NR_epoll_create __PNR_epoll_create |
1353 | #endif /* __NR_epoll_create */ |
1354 | |
1355 | #define __PNR_epoll_wait -10154 |
1356 | #ifndef __NR_epoll_wait |
1357 | #define __NR_epoll_wait __PNR_epoll_wait |
1358 | #endif /* __NR_epoll_wait */ |
1359 | |
1360 | #define __PNR_eventfd -10155 |
1361 | #ifndef __NR_eventfd |
1362 | #define __NR_eventfd __PNR_eventfd |
1363 | #endif /* __NR_eventfd */ |
1364 | |
1365 | #define __PNR_fork -10156 |
1366 | #ifndef __NR_fork |
1367 | #define __NR_fork __PNR_fork |
1368 | #endif /* __NR_fork */ |
1369 | |
1370 | #define __PNR_futimesat -10157 |
1371 | #ifndef __NR_futimesat |
1372 | #define __NR_futimesat __PNR_futimesat |
1373 | #endif /* __NR_futimesat */ |
1374 | |
1375 | #define __PNR_getdents -10158 |
1376 | #ifndef __NR_getdents |
1377 | #define __NR_getdents __PNR_getdents |
1378 | #endif /* __NR_getdents */ |
1379 | |
1380 | #define __PNR_getpgrp -10159 |
1381 | #ifndef __NR_getpgrp |
1382 | #define __NR_getpgrp __PNR_getpgrp |
1383 | #endif /* __NR_getpgrp */ |
1384 | |
1385 | #define __PNR_inotify_init -10160 |
1386 | #ifndef __NR_inotify_init |
1387 | #define __NR_inotify_init __PNR_inotify_init |
1388 | #endif /* __NR_inotify_init */ |
1389 | |
1390 | #define __PNR_lchown -10161 |
1391 | #ifndef __NR_lchown |
1392 | #define __NR_lchown __PNR_lchown |
1393 | #endif /* __NR_lchown */ |
1394 | |
1395 | #define __PNR_link -10162 |
1396 | #ifndef __NR_link |
1397 | #define __NR_link __PNR_link |
1398 | #endif /* __NR_link */ |
1399 | |
1400 | #define __PNR_lstat -10163 |
1401 | #ifndef __NR_lstat |
1402 | #define __NR_lstat __PNR_lstat |
1403 | #endif /* __NR_lstat */ |
1404 | |
1405 | #define __PNR_mkdir -10164 |
1406 | #ifndef __NR_mkdir |
1407 | #define __NR_mkdir __PNR_mkdir |
1408 | #endif /* __NR_mkdir */ |
1409 | |
1410 | #define __PNR_mknod -10165 |
1411 | #ifndef __NR_mknod |
1412 | #define __NR_mknod __PNR_mknod |
1413 | #endif /* __NR_mknod */ |
1414 | |
1415 | #define __PNR_open -10166 |
1416 | #ifndef __NR_open |
1417 | #define __NR_open __PNR_open |
1418 | #endif /* __NR_open */ |
1419 | |
1420 | #define __PNR_pause -10167 |
1421 | #ifndef __NR_pause |
1422 | #define __NR_pause __PNR_pause |
1423 | #endif /* __NR_pause */ |
1424 | |
1425 | #define __PNR_pipe -10168 |
1426 | #ifndef __NR_pipe |
1427 | #define __NR_pipe __PNR_pipe |
1428 | #endif /* __NR_pipe */ |
1429 | |
1430 | #define __PNR_poll -10169 |
1431 | #ifndef __NR_poll |
1432 | #define __NR_poll __PNR_poll |
1433 | #endif /* __NR_poll */ |
1434 | |
1435 | #define __PNR_readlink -10170 |
1436 | #ifndef __NR_readlink |
1437 | #define __NR_readlink __PNR_readlink |
1438 | #endif /* __NR_readlink */ |
1439 | |
1440 | #define __PNR_rename -10171 |
1441 | #ifndef __NR_rename |
1442 | #define __NR_rename __PNR_rename |
1443 | #endif /* __NR_rename */ |
1444 | |
1445 | #define __PNR_rmdir -10172 |
1446 | #ifndef __NR_rmdir |
1447 | #define __NR_rmdir __PNR_rmdir |
1448 | #endif /* __NR_rmdir */ |
1449 | |
1450 | #define __PNR_signalfd -10173 |
1451 | #ifndef __NR_signalfd |
1452 | #define __NR_signalfd __PNR_signalfd |
1453 | #endif /* __NR_signalfd */ |
1454 | |
1455 | #define __PNR_stat -10174 |
1456 | #ifndef __NR_stat |
1457 | #define __NR_stat __PNR_stat |
1458 | #endif /* __NR_stat */ |
1459 | |
1460 | #define __PNR_symlink -10175 |
1461 | #ifndef __NR_symlink |
1462 | #define __NR_symlink __PNR_symlink |
1463 | #endif /* __NR_symlink */ |
1464 | |
1465 | #define __PNR_unlink -10176 |
1466 | #ifndef __NR_unlink |
1467 | #define __NR_unlink __PNR_unlink |
1468 | #endif /* __NR_unlink */ |
1469 | |
1470 | #define __PNR_ustat -10177 |
1471 | #ifndef __NR_ustat |
1472 | #define __NR_ustat __PNR_ustat |
1473 | #endif /* __NR_ustat */ |
1474 | |
1475 | #define __PNR_utime -10178 |
1476 | #ifndef __NR_utime |
1477 | #define __NR_utime __PNR_utime |
1478 | #endif /* __NR_utime */ |
1479 | |
1480 | #define __PNR_utimes -10179 |
1481 | #ifndef __NR_utimes |
1482 | #define __NR_utimes __PNR_utimes |
1483 | #endif /* __NR_utimes */ |
1484 | |
1485 | #define __PNR_getrlimit -10180 |
1486 | #ifndef __NR_getrlimit |
1487 | #define __NR_getrlimit __PNR_getrlimit |
1488 | #endif /* __NR_utimes */ |
1489 | |
1490 | #define __PNR_mmap -10181 |
1491 | #ifndef __NR_mmap |
1492 | #define __NR_mmap __PNR_mmap |
1493 | #endif /* __NR_utimes */ |
1494 | |
1495 | #define __PNR_breakpoint -10182 |
1496 | #ifndef __NR_breakpoint |
1497 | #ifdef __ARM_NR_breakpoint |
1498 | #define __NR_breakpoint __ARM_NR_breakpoint |
1499 | #else |
1500 | #define __NR_breakpoint __PNR_breakpoint |
1501 | #endif |
1502 | #endif /* __NR_breakpoint */ |
1503 | |
1504 | #define __PNR_set_tls -10183 |
1505 | #ifndef __NR_set_tls |
1506 | #ifdef __ARM_NR_set_tls |
1507 | #define __NR_set_tls __ARM_NR_set_tls |
1508 | #else |
1509 | #define __NR_set_tls __PNR_set_tls |
1510 | #endif |
1511 | #endif /* __NR_set_tls */ |
1512 | |
1513 | #define __PNR_usr26 -10184 |
1514 | #ifndef __NR_usr26 |
1515 | #ifdef __ARM_NR_usr26 |
1516 | #define __NR_usr26 __ARM_NR_usr26 |
1517 | #else |
1518 | #define __NR_usr26 __PNR_usr26 |
1519 | #endif |
1520 | #endif /* __NR_usr26 */ |
1521 | |
1522 | #define __PNR_usr32 -10185 |
1523 | #ifndef __NR_usr32 |
1524 | #ifdef __ARM_NR_usr32 |
1525 | #define __NR_usr32 __ARM_NR_usr32 |
1526 | #else |
1527 | #define __NR_usr32 __PNR_usr32 |
1528 | #endif |
1529 | #endif /* __NR_usr32 */ |
1530 | |
1531 | #define __PNR_multiplexer -10186 |
1532 | #ifndef __NR_multiplexer |
1533 | #define __NR_multiplexer __PNR_multiplexer |
1534 | #endif /* __NR_multiplexer */ |
1535 | |
1536 | #define __PNR_rtas -10187 |
1537 | #ifndef __NR_rtas |
1538 | #define __NR_rtas __PNR_rtas |
1539 | #endif /* __NR_rtas */ |
1540 | |
1541 | #define __PNR_spu_create -10188 |
1542 | #ifndef __NR_spu_create |
1543 | #define __NR_spu_create __PNR_spu_create |
1544 | #endif /* __NR_spu_create */ |
1545 | |
1546 | #define __PNR_spu_run -10189 |
1547 | #ifndef __NR_spu_run |
1548 | #define __NR_spu_run __PNR_spu_run |
1549 | #endif /* __NR_spu_run */ |
1550 | |
1551 | #define __PNR_subpage_prot -10189 |
1552 | #ifndef __NR_subpage_prot |
1553 | #define __NR_subpage_prot __PNR_subpage_prot |
1554 | #endif /* __NR_subpage_prot */ |
1555 | |
1556 | #define __PNR_swapcontext -10190 |
1557 | #ifndef __NR_swapcontext |
1558 | #define __NR_swapcontext __PNR_swapcontext |
1559 | #endif /* __NR_swapcontext */ |
1560 | |
1561 | #define __PNR_sys_debug_setcontext -10191 |
1562 | #ifndef __NR_sys_debug_setcontext |
1563 | #define __NR_sys_debug_setcontext __PNR_sys_debug_setcontext |
1564 | #endif /* __NR_sys_debug_setcontext */ |
1565 | |
1566 | #define __PNR_switch_endian -10191 |
1567 | #ifndef __NR_switch_endian |
1568 | #define __NR_switch_endian __PNR_switch_endian |
1569 | #endif /* __NR_switch_endian */ |
1570 | |
1571 | #define __PNR_get_mempolicy -10192 |
1572 | #ifndef __NR_get_mempolicy |
1573 | #define __NR_get_mempolicy __PNR_get_mempolicy |
1574 | #endif /* __NR_get_mempolicy */ |
1575 | |
1576 | #define __PNR_move_pages -10193 |
1577 | #ifndef __NR_move_pages |
1578 | #define __NR_move_pages __PNR_move_pages |
1579 | #endif /* __NR_move_pages */ |
1580 | |
1581 | #define __PNR_mbind -10194 |
1582 | #ifndef __NR_mbind |
1583 | #define __NR_mbind __PNR_mbind |
1584 | #endif /* __NR_mbind */ |
1585 | |
1586 | #define __PNR_set_mempolicy -10195 |
1587 | #ifndef __NR_set_mempolicy |
1588 | #define __NR_set_mempolicy __PNR_set_mempolicy |
1589 | #endif /* __NR_set_mempolicy */ |
1590 | |
1591 | #define __PNR_s390_runtime_instr -10196 |
1592 | #ifndef __NR_s390_runtime_instr |
1593 | #define __NR_s390_runtime_instr __PNR_s390_runtime_instr |
1594 | #endif /* __NR_s390_runtime_instr */ |
1595 | |
1596 | #define __PNR_s390_pci_mmio_read -10197 |
1597 | #ifndef __NR_s390_pci_mmio_read |
1598 | #define __NR_s390_pci_mmio_read __PNR_s390_pci_mmio_read |
1599 | #endif /* __NR_s390_pci_mmio_read */ |
1600 | |
1601 | #define __PNR_s390_pci_mmio_write -10198 |
1602 | #ifndef __NR_s390_pci_mmio_write |
1603 | #define __NR_s390_pci_mmio_write __PNR_s390_pci_mmio_write |
1604 | #endif /* __NR_s390_pci_mmio_write */ |
1605 | |
1606 | #define __PNR_membarrier -10199 |
1607 | #ifndef __NR_membarrier |
1608 | #define __NR_membarrier __PNR_membarrier |
1609 | #endif /* __NR_membarrier */ |
1610 | |
1611 | #define __PNR_userfaultfd -10200 |
1612 | #ifndef __NR_userfaultfd |
1613 | #define __NR_userfaultfd __PNR_userfaultfd |
1614 | #endif /* __NR_userfaultfd */ |
1615 | |
1616 | #define __PNR_pkey_mprotect -10201 |
1617 | #ifndef __NR_pkey_mprotect |
1618 | #define __NR_pkey_mprotect __PNR_pkey_mprotect |
1619 | #endif /* __NR_pkey_mprotect */ |
1620 | |
1621 | #define __PNR_pkey_alloc -10202 |
1622 | #ifndef __NR_pkey_alloc |
1623 | #define __NR_pkey_alloc __PNR_pkey_alloc |
1624 | #endif /* __NR_pkey_alloc */ |
1625 | |
1626 | #define __PNR_pkey_free -10203 |
1627 | #ifndef __NR_pkey_free |
1628 | #define __NR_pkey_free __PNR_pkey_free |
1629 | #endif /* __NR_pkey_free */ |
1630 | |
1631 | #define __PNR_get_tls -10204 |
1632 | #ifndef __NR_get_tls |
1633 | #ifdef __ARM_NR_get_tls |
1634 | #define __NR_get_tls __ARM_NR_get_tls |
1635 | #else |
1636 | #define __NR_get_tls __PNR_get_tls |
1637 | #endif |
1638 | #endif /* __NR_get_tls */ |
1639 | |
1640 | #define __PNR_s390_guarded_storage -10205 |
1641 | #ifndef __NR_s390_guarded_storage |
1642 | #define __NR_s390_guarded_storage __PNR_s390_guarded_storage |
1643 | #endif /* __NR_s390_guarded_storage */ |
1644 | |
1645 | #define __PNR_s390_sthyi -10206 |
1646 | #ifndef __NR_s390_sthyi |
1647 | #define __NR_s390_sthyi __PNR_s390_sthyi |
1648 | #endif /* __NR_s390_sthyi */ |
1649 | |
1650 | #ifdef __cplusplus |
1651 | } |
1652 | #endif |
1653 | |
1654 | #endif |
1655 | |