Debian Codegraph @

docs/po/ceccomp.pot

raw
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2026-03-30 00:28+0800\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <[email protected]>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: Title =
20 #: ceccomp.adoc:1
21 #, no-wrap
22 msgid "ceccomp(1)"
23 msgstr ""
24
25 #. type: Plain text
26 #: ceccomp.adoc:3
27 msgid "dbgbgtf <[email protected]>; RocketDev <[email protected]>"
28 msgstr ""
29
30 #. type: Title ==
31 #: ceccomp.adoc:11
32 #, no-wrap
33 msgid "NAME"
34 msgstr ""
35
36 #. type: Plain text
37 #: ceccomp.adoc:14
38 msgid "ceccomp - A tool to analyze seccomp filters"
39 msgstr ""
40
41 #. type: Title ==
42 #: ceccomp.adoc:15
43 #, no-wrap
44 msgid "SYNOPSIS"
45 msgstr ""
46
47 #. type: Plain text
48 #: ceccomp.adoc:20
49 #, no-wrap
50 msgid ""
51 " usage: ceccomp <asm|disasm|emu|trace|probe|version|help> [FILE] "
52 "[-q|--quiet]\n"
53 " [-f|--format FMT] [-a|--arch ARCH] [-p|--pid PID] "
54 "[-s|--seize]\n"
55 " [-o|--output FILE] [-c|--color WHEN] ...\n"
56 msgstr ""
57
58 #. type: Title ==
59 #: ceccomp.adoc:21
60 #, no-wrap
61 msgid "CONCEPT"
62 msgstr ""
63
64 #. type: Plain text
65 #: ceccomp.adoc:26
66 msgid ""
67 "Kernel use BPF filters to limit syscall rules, applied via `seccomp` or "
68 "`prctl` syscall. For example, down below is a simple filter to block "
69 "`execve` syscall in hex format:"
70 msgstr ""
71
72 #. type: Plain text
73 #: ceccomp.adoc:31
74 #, no-wrap
75 msgid ""
76 " 1: 20 00 00 00 00 00 00 00 $A = $syscall_nr\n"
77 " 2: 15 00 00 01 3b 00 00 00 if ($A != execve) goto 4\n"
78 " 3: 06 00 00 00 00 00 00 00 return KILL\n"
79 " 4: 06 00 00 00 00 00 ff 7f return ALLOW\n"
80 msgstr ""
81
82 #. type: Plain text
83 #: ceccomp.adoc:35
84 msgid ""
85 "The part presented in hex is what kernel received, and `ceccomp` take it to "
86 "disassemble back to human readable text. For instance the *lineno* in the "
87 "left and *statement* in the right."
88 msgstr ""
89
90 #. type: Plain text
91 #: ceccomp.adoc:38
92 msgid ""
93 "Later I'll use _TEXT_ in short for BPF human readable text, and use _RAW_ in "
94 "short for BPF raw format, please keep that in mind."
95 msgstr ""
96
97 #. type: Title ==
98 #: ceccomp.adoc:39
99 #, no-wrap
100 msgid "DESCRIPTION"
101 msgstr ""
102
103 #. type: Plain text
104 #: ceccomp.adoc:44
105 msgid ""
106 "`ceccomp` have 5 main functions, basically it's a C version of "
107 "`seccomp-tools`, however, there are some breaking changes you need to know, "
108 "which will be highlighted in each subcommand section."
109 msgstr ""
110
111 #. type: Title ===
112 #: ceccomp.adoc:45
113 #, no-wrap
114 msgid "asm - ASSEMBLE"
115 msgstr ""
116
117 #. type: Plain text
118 #: ceccomp.adoc:48
119 #, no-wrap
120 msgid " ceccomp asm [-c WHEN] [-a ARCH] [-f FMT] [TEXT]\n"
121 msgstr ""
122
123 #. type: Plain text
124 #: ceccomp.adoc:51
125 msgid ""
126 "Assemble _TEXT_ to _RAW_. Use it to embed hand written filter rules into C "
127 "code or to see the original code of some _TEXT_."
128 msgstr ""
129
130 #. type: Labeled list
131 #: ceccomp.adoc:52 ceccomp.adoc:101 ceccomp.adoc:144 ceccomp.adoc:194
132 #, no-wrap
133 msgid "WHEN"
134 msgstr ""
135
136 #. type: Plain text
137 #: ceccomp.adoc:56
138 msgid ""
139 "Determines when to display warnings and errors in color. If the value is "
140 "_auto_, ceccomp will display color when the output target is a \"tty\". Can "
141 "be _auto_, _never_ or _always_. The default value is _auto_."
142 msgstr ""
143
144 #. type: Labeled list
145 #: ceccomp.adoc:57 ceccomp.adoc:105 ceccomp.adoc:159
146 #, no-wrap
147 msgid "ARCH"
148 msgstr ""
149
150 #. type: Plain text
151 #: ceccomp.adoc:62
152 msgid ""
153 "Set to any architecture libseccomp supports. Will be used to determine the "
154 "actual syscall number behind the name (for example, on x86_64, you could "
155 "write `\"execve\"` instead of `59` like the basic example above). Your "
156 "system arch will be taken if not set via `uname`. The default value on your "
157 "system is {ARCH}."
158 msgstr ""
159
160 #. type: Plain text
161 #: ceccomp.adoc:66
162 msgid ""
163 "Since _version 4.0_, endianness is considered. If target endianness *ARCH* "
164 "is different from machine endianness, the filters will be reversed (CODE and "
165 "K) before outputting."
166 msgstr ""
167
168 #. type: Labeled list
169 #: ceccomp.adoc:67
170 #, no-wrap
171 msgid "FMT"
172 msgstr ""
173
174 #. type: Plain text
175 #: ceccomp.adoc:71
176 msgid ""
177 "Determines how `ceccomp` produces binary-format bpf code. Can be _hexfmt_, "
178 "_hexline_ or _raw_. You could find sample output in <<EXAMPLES>> section. "
179 "The default value is _hexline_."
180 msgstr ""
181
182 #. type: Labeled list
183 #: ceccomp.adoc:72 ceccomp.adoc:162
184 #, no-wrap
185 msgid "TEXT"
186 msgstr ""
187
188 #. type: Plain text
189 #: ceccomp.adoc:75
190 msgid ""
191 "Take a optional filename to determine which file containing _TEXT_ will be "
192 "assembled. Will read from _stdin_ if not set. `-` is treated as _stdin_."
193 msgstr ""
194
195 #. type: Plain text
196 #: ceccomp.adoc:78
197 msgid ""
198 "The assembly syntax was changed greatly since _version 4.0_, please checkout "
199 "grammar reference below!"
200 msgstr ""
201
202 #. type: Plain text
203 #: ceccomp.adoc:81
204 msgid ""
205 "Please check out <<TEXT GRAMMAR REFERENCE>> section to see how to write a "
206 "rule by hand. Some examples will be displayed in <<EXAMPLES>> section."
207 msgstr ""
208
209 #. type: Table
210 #: ceccomp.adoc:92
211 #, no-wrap
212 msgid ""
213 "|Command|Difference\n"
214 "\n"
215 "|`seccomp-tools asm`\n"
216 "|Use its own grammar to assemble, a bit script like; can assemble invalid "
217 "_TEXT_\n"
218 "which will be rejected by kernel\n"
219 "\n"
220 "|`ceccomp asm`\n"
221 "|You can just take `disasm` output to `asm`, no new grammar is needed to "
222 "learn;\n"
223 "take `stdin` as input by default\n"
224 msgstr ""
225
226 #. type: Title ===
227 #: ceccomp.adoc:94
228 #, no-wrap
229 msgid "disasm - DISASSEMBLE"
230 msgstr ""
231
232 #. type: Plain text
233 #: ceccomp.adoc:97
234 #, no-wrap
235 msgid " ceccomp disasm [-c WHEN] [-a ARCH] [RAW]\n"
236 msgstr ""
237
238 #. type: Plain text
239 #: ceccomp.adoc:100
240 msgid ""
241 "Disassemble _RAW_ to _TEXT_. Use it to see what does a filter do if you "
242 "could not access filter via `trace` and have to manually extract the filter "
243 "out."
244 msgstr ""
245
246 #. type: Plain text
247 #: ceccomp.adoc:104
248 msgid ""
249 "Argument description can be found in <<asm - ASSEMBLE>> section. `disasm` "
250 "may print more text in color including syntax highlighting for _TEXT_."
251 msgstr ""
252
253 #. type: Plain text
254 #: ceccomp.adoc:110
255 msgid ""
256 "Set to any architecture libseccomp supports. Will be used to determine how "
257 "filtered syscall number in _RAW_ filter is translated to syscall name (for "
258 "example, on x86_64, the number `0x3b` is translated to `execve` if is "
259 "comparing syscall_nr, see the basic example above). The default value on "
260 "your system is {ARCH}."
261 msgstr ""
262
263 #. type: Labeled list
264 #: ceccomp.adoc:111
265 #, no-wrap
266 msgid "RAW"
267 msgstr ""
268
269 #. type: Plain text
270 #: ceccomp.adoc:114
271 msgid ""
272 "A binary file with raw BPF codes. Takes _stdin_ as input if not set. Treat "
273 "`-` as _stdin_. The file is arch-revelent, so it may not be portable on "
274 "different archs."
275 msgstr ""
276
277 #. type: Plain text
278 #: ceccomp.adoc:118
279 msgid ""
280 "Since _version 4.0_, endianness is considered. If target endianness *ARCH* "
281 "is different from machine endianness, the filters will be reversed (CODE and "
282 "K) before decoding."
283 msgstr ""
284
285 #. type: Plain text
286 #: ceccomp.adoc:123
287 msgid ""
288 "ceccomp will try to resolve syscall number under an arch ONLY IF that at "
289 "that line, arch can be determined. On foreign arch (not equal to the arch "
290 "you set), the foreign arch will be prepended to syscall name. You may notice "
291 "that in some cases, seccomp-tools is able to resolve the name while ceccomp "
292 "is not, that may be intended as the arch is not determined."
293 msgstr ""
294
295 #. type: Table
296 #: ceccomp.adoc:133
297 #, no-wrap
298 msgid ""
299 "|Command|Difference\n"
300 "\n"
301 "|`seccomp-tools disasm`\n"
302 "|Disassembles in its format; never check if the filter is valid\n"
303 "\n"
304 "|`ceccomp disasm`\n"
305 "|Disassembles in ceccomp format, and takes `stdin` as input by default; "
306 "check arch strictly\n"
307 "and always display foreign arch name\n"
308 msgstr ""
309
310 #. type: Title ===
311 #: ceccomp.adoc:135
312 #, no-wrap
313 msgid "emu - EMULATE"
314 msgstr ""
315
316 #. type: Plain text
317 #: ceccomp.adoc:138
318 #, no-wrap
319 msgid ""
320 " ceccomp emu [-c WHEN] [-a ARCH] [-q] TEXT SYSCALL_NAME/SYSCALL_NR "
321 "[ARGS[0] ARGS[1] ... ARGS[5] PC]\n"
322 msgstr ""
323
324 #. type: Plain text
325 #: ceccomp.adoc:143
326 msgid ""
327 "Emulate what will happen if `syscall(SYSCALL_NR, ARGS[0], ARGS[1], ..., "
328 "ARGS[5])` from `PC` is called following rules described in _TEXT_. Use it to "
329 "see the result without actually running it in program or you don't want to "
330 "examine the filter rule manually. This subcommand can be used to "
331 "automatically examining a filter."
332 msgstr ""
333
334 #. type: Plain text
335 #: ceccomp.adoc:147
336 msgid ""
337 "Argument description can be found in <<asm - ASSEMBLE>> section. `emu` may "
338 "print more text in color including syntax highlighting for _TEXT_ and "
339 "skipped statements."
340 msgstr ""
341
342 #. type: Labeled list
343 #: ceccomp.adoc:148
344 #, no-wrap
345 msgid "SYSCALL_NAME/SYSCALL_NR"
346 msgstr ""
347
348 #. type: Plain text
349 #: ceccomp.adoc:153
350 msgid ""
351 "If you set *SYSCALL_NAME* (like `execve`), it will be translated to "
352 "*SYSCALL_NR* under *ARCH* first. Or else set *SYSCALL_NR* directly (like "
353 "`59`). Then the nr will be tested against the bpf filter to see the result "
354 "of that syscall. This argument is NOT optional."
355 msgstr ""
356
357 #. type: Labeled list
358 #: ceccomp.adoc:154
359 #, no-wrap
360 msgid "ARGS[0-5] and PC"
361 msgstr ""
362
363 #. type: Plain text
364 #: ceccomp.adoc:158
365 msgid ""
366 "Register values when calling syscall. For example, on x86_64, these are "
367 "equivalent to `rdi`, `rsi`, `rdx`, `r10`, `r8`, `r9` and `rip`. Their "
368 "default value is 0."
369 msgstr ""
370
371 #. type: Plain text
372 #: ceccomp.adoc:161
373 msgid "Argument description can be found in <<asm - ASSEMBLE>> section."
374 msgstr ""
375
376 #. type: Plain text
377 #: ceccomp.adoc:166
378 msgid ""
379 "Take a filename to determine which file containing _TEXT_ rule will be "
380 "tested. Note that filename CAN NOT be ignored as ceccomp can not determine "
381 "if a positional argument is syscall or filename. Use `-` to refer to "
382 "_stdin_."
383 msgstr ""
384
385 #. type: Labeled list
386 #: ceccomp.adoc:167 ceccomp.adoc:219
387 #, no-wrap
388 msgid "-q, --quiet"
389 msgstr ""
390
391 #. type: Plain text
392 #: ceccomp.adoc:170
393 msgid ""
394 "Only print the eval result of the filter. For example, if last statement "
395 "emulated is `return KILL`, then `KILL` is printed."
396 msgstr ""
397
398 #. type: Table
399 #: ceccomp.adoc:180
400 #, no-wrap
401 msgid ""
402 "|Command|Difference\n"
403 "\n"
404 "|`seccomp-tools emu`\n"
405 "|Take a _RAW_ as input\n"
406 "\n"
407 "|`ceccomp emu`\n"
408 "|Take a _TEXT_ as input and take `stdin` as input by default; set *PC* is\n"
409 "possible\n"
410 msgstr ""
411
412 #. type: Title ===
413 #: ceccomp.adoc:182
414 #, no-wrap
415 msgid "trace - TRACE FILTER IN RUNTIME"
416 msgstr ""
417
418 #. type: Plain text
419 #: ceccomp.adoc:186
420 #, no-wrap
421 msgid ""
422 " ceccomp trace [-c WHEN] [-q] [-o FILE] PROGRAM [program-args]\n"
423 " [-c WHEN] [-q] -p PID [-s]\n"
424 msgstr ""
425
426 #. type: Plain text
427 #: ceccomp.adoc:193
428 msgid ""
429 "The first line captures filters *PROGRAM* loads in runtime by tracing it; "
430 "the second line extract seccomp filters from *PID*, or trace *PID* to "
431 "capture subsequent seccomp filters; once fetched filters, print them in "
432 "_TEXT_. You can only choose one of the two formats above. Use this if "
433 "running the program is the simplest way to fetch bpf filters or a program "
434 "with seccomp filters installed is waiting for input."
435 msgstr ""
436
437 #. type: Plain text
438 #: ceccomp.adoc:197
439 msgid ""
440 "Argument description can be found in <<asm - ASSEMBLE>> section. `trace` may "
441 "print more text in color including syntax highlighting for _TEXT_."
442 msgstr ""
443
444 #. type: Labeled list
445 #: ceccomp.adoc:198
446 #, no-wrap
447 msgid "FILE"
448 msgstr ""
449
450 #. type: Plain text
451 #: ceccomp.adoc:203
452 msgid ""
453 "May be useful when *PROGRAM* produces quite a lot output in _stderr_. "
454 "`ceccomp` allow user to close _stdin_ and _stdout_ to limit *PROGRAM* input "
455 "and output, so `ceccomp` use _stderr_ to print messages when running "
456 "*PROGRAM*, set *FILE* if you want to see _TEXT_ in some other file. Treat "
457 "`-` as _stdout_."
458 msgstr ""
459
460 #. type: Labeled list
461 #: ceccomp.adoc:204
462 #, no-wrap
463 msgid "PROGRAM"
464 msgstr ""
465
466 #. type: Plain text
467 #: ceccomp.adoc:207
468 msgid ""
469 "Set to the program you want to run, and *program-args* are its arguments "
470 "just like running shell command `exec PROGRAM program-args`."
471 msgstr ""
472
473 #. type: Labeled list
474 #: ceccomp.adoc:208
475 #, no-wrap
476 msgid "PID"
477 msgstr ""
478
479 #. type: Plain text
480 #: ceccomp.adoc:213
481 msgid ""
482 "Set to the pid you want to inspect. *PID* is conflict with *PROGRAM*; you "
483 "could either run a program dynamically or examine a pid in one command. "
484 "Without `-s` flag, trace pid will try to extract seccomp filter in *PID* via "
485 "`ptrace(PTRACE_SECCOMP_GET_FILTER)`, which may not be available in some "
486 "systems."
487 msgstr ""
488
489 #. type: Labeled list
490 #: ceccomp.adoc:214
491 #, no-wrap
492 msgid "-s, --seize"
493 msgstr ""
494
495 #. type: Plain text
496 #: ceccomp.adoc:218
497 msgid ""
498 "*ONLY AVAILABLE FOR TRACE PID MODE.* Set this flag will override trace pid "
499 "behavior to attach to *PID* and keep tracing for seccomp filter loading like "
500 "trace prog mode. _This flag was introduced in version 4.0._"
501 msgstr ""
502
503 #. type: Plain text
504 #: ceccomp.adoc:222
505 msgid ""
506 "Set to suppress the extra *[INFO]* prints when detect process forking, "
507 "exiting or seccomp filter loading. _This flag was introduced in version "
508 "4.0._"
509 msgstr ""
510
511 #. type: Plain text
512 #: ceccomp.adoc:226
513 msgid ""
514 "To extract filters from *PID*, `CAP_SYS_ADMIN` is needed (without `-s` flag) "
515 "and `CAP_SYS_PTRACE` may also be needed, the easiest way to acquire them is "
516 "calling `ceccomp` with `sudo`."
517 msgstr ""
518
519 #. type: Plain text
520 #: ceccomp.adoc:230
521 msgid ""
522 "Since _version 3.1_, multiple process tracing is introduced, and when tracee "
523 "forking/resolving/exiting, an extra INFO message is printed. You can discard "
524 "it by running command like `ceccomp trace -q PROG 2>/dev/null`."
525 msgstr ""
526
527 #. type: Plain text
528 #: ceccomp.adoc:233
529 msgid ""
530 "Since _version 4.2_, `dump` sub command is added as an alias of `trace`, to "
531 "keep compatibility with `seccomp-tools`."
532 msgstr ""
533
534 #. type: Table
535 #: ceccomp.adoc:246
536 #, no-wrap
537 msgid ""
538 "|Command|Difference\n"
539 "\n"
540 "|`seccomp-tools dump`\n"
541 "|Setting output format is possible; each filter can be output to a "
542 "different\n"
543 "file; killing *PROGRAM* once *LIMIT* times of filters loaded; wrapping "
544 "*PROGRAM*\n"
545 "in `sh -c`\n"
546 "\n"
547 "|`ceccomp trace` or `ceccomp dump`\n"
548 "|All filters are output to a single file; never kill *PROGRAM*; *PROGRAM* "
549 "is\n"
550 "launched directly, so `./` is not needed; explicitly print when forking;\n"
551 "able to attach to pid for dynamic seccomp filter capturing\n"
552 msgstr ""
553
554 #. type: Title ===
555 #: ceccomp.adoc:248
556 #, no-wrap
557 msgid "probe - TEST COMMON SYSCALLS INSTANTLY"
558 msgstr ""
559
560 #. type: Plain text
561 #: ceccomp.adoc:251
562 #, no-wrap
563 msgid " ceccomp probe [-c WHEN] [-o FILE] [-q] PROGRAM [program-args]\n"
564 msgstr ""
565
566 #. type: Plain text
567 #: ceccomp.adoc:255
568 msgid ""
569 "Run *PROGRAM* with *program-args* to captures *FIRST* seccomp filter, and "
570 "then kill all children. Use it when a quick check against a program is "
571 "needed, and detect potential seccomp rule issues."
572 msgstr ""
573
574 #. type: Plain text
575 #: ceccomp.adoc:257
576 msgid ""
577 "All argument descriptions can be found in <<trace - TRACE FILTER IN "
578 "RUNTIME>> section."
579 msgstr ""
580
581 #. type: Plain text
582 #: ceccomp.adoc:261
583 msgid ""
584 "The output for this subcommand is the emulating result of common syscalls "
585 "like `execve`, `open` and so on. If the filter itself is not capable of "
586 "blocking syscalls, you could know that with a glance."
587 msgstr ""
588
589 #. type: Plain text
590 #: ceccomp.adoc:264
591 msgid ""
592 "Typical output for this subcommand is described below, more detailed example "
593 "could be found in <<EXAMPLES>> section."
594 msgstr ""
595
596 #. type: Plain text
597 #: ceccomp.adoc:276
598 #, no-wrap
599 msgid ""
600 " open -> ALLOW\n"
601 " read -> ALLOW\n"
602 " write -> ALLOW\n"
603 " execve -> KILL\n"
604 " execveat -> KILL\n"
605 " mmap -> ALLOW\n"
606 " mprotect -> ALLOW\n"
607 " openat -> ALLOW\n"
608 " sendfile -> ALLOW\n"
609 " ptrace -> ERRNO(1)\n"
610 " fork -> ALLOW\n"
611 msgstr ""
612
613 #. type: Plain text
614 #: ceccomp.adoc:278
615 msgid "`seccomp-tools` don't have this subcommand."
616 msgstr ""
617
618 #. type: Title ==
619 #: ceccomp.adoc:279
620 #, no-wrap
621 msgid "TEXT GRAMMAR REFERENCE"
622 msgstr ""
623
624 #. type: Plain text
625 #: ceccomp.adoc:286
626 msgid ""
627 "The grammar changed greatly since _version 4.0_ as we refactored lexer for "
628 "better human readability. The wrapper now prefixed by `#` as it's a comment "
629 "now. And _line_ is replaced by _label_, so now lexer depends on label "
630 "declaration to decide where to jump, instead of lineno in _TEXT_ file."
631 msgstr ""
632
633 #. type: Plain text
634 #: ceccomp.adoc:291
635 msgid ""
636 "A valid _TEXT_ format is described in EBNF-like declaration here: "
637 "https://github.com/dbgbgtf1/Ceccomp/issues/17#issuecomment-3610531705. If "
638 "you have no interest to know what EBNF is, please keep reading for examples."
639 msgstr ""
640
641 #. type: Plain text
642 #: ceccomp.adoc:293
643 msgid "BPF ops which are not described below are banned by kernel."
644 msgstr ""
645
646 #. type: Title ===
647 #: ceccomp.adoc:294
648 #, no-wrap
649 msgid "Comment and Label"
650 msgstr ""
651
652 #. type: Plain text
653 #: ceccomp.adoc:298
654 msgid ""
655 "`ceccomp disasm` displays a lot of things, but some of them are optional for "
656 "asm."
657 msgstr ""
658
659 #. type: Plain text
660 #: ceccomp.adoc:303
661 #, no-wrap
662 msgid ""
663 " #Label CODE JT JF K\n"
664 " #---------------------------------\n"
665 " L0001: 0x06 0x00 0x00 0x7fff0000 return ALLOW\n"
666 " #---------------------------------\n"
667 msgstr ""
668
669 #. type: Plain text
670 #: ceccomp.adoc:305
671 msgid "Any text after `#` will be discarded by asm like some script languages."
672 msgstr ""
673
674 #. type: Plain text
675 #: ceccomp.adoc:307
676 msgid "Empty lines are accepted."
677 msgstr ""
678
679 #. type: Plain text
680 #: ceccomp.adoc:315
681 msgid ""
682 "Label declaration is an identifier at the beginning of line and suffixed by "
683 "`:` like `L0001`. An identifier is a string starts with alpha and contains "
684 "with only alphanumeric characters and underscore `_`. Label is only "
685 "necessary if it's the destination of `goto`, these redundant labels added by "
686 "disasm are for readability. E.g. in `if ($A == 0) goto somewhere`, "
687 "`somewhere` is a label and must be declared after the statement. Label "
688 "declaration can take a line separately, or be put in front of statement."
689 msgstr ""
690
691 #. type: Plain text
692 #: ceccomp.adoc:318
693 msgid ""
694 "The `CODE`, `JT`, `JF` and `K` value generated by disasm will be discarded "
695 "by asm, asm only parse the effective statement after `K`."
696 msgstr ""
697
698 #. type: Plain text
699 #: ceccomp.adoc:323
700 msgid ""
701 "There are some slight difference between `ceccomp disasm` and `seccomp-tools "
702 "disasm`, down below is a general example. And some statements are different, "
703 "so don't pipe seccomp-tools output to ceccomp blindly."
704 msgstr ""
705
706 #. type: Plain text
707 #: ceccomp.adoc:327
708 #, no-wrap
709 msgid ""
710 " line CODE JT JF K\n"
711 " =================================\n"
712 " 0000: 0x06 0x00 0x00 0x7fff0000 return ALLOW\n"
713 msgstr ""
714
715 #. type: Title ===
716 #: ceccomp.adoc:328
717 #, no-wrap
718 msgid "Assignment"
719 msgstr ""
720
721 #. type: Plain text
722 #: ceccomp.adoc:332
723 msgid ""
724 "`A` can be set to seccomp attributes directly. But `X` can not be assigned "
725 "with seccomp attributes directly due to kernel limit."
726 msgstr ""
727
728 #. type: Plain text
729 #: ceccomp.adoc:335
730 #, no-wrap
731 msgid ""
732 " $A = $arch\n"
733 " $A = $syscall_nr\n"
734 msgstr ""
735
736 #. type: Plain text
737 #: ceccomp.adoc:337
738 msgid ""
739 "To assign `A` with those 64-bit long fields, `low_` or `high_` prefix is "
740 "needed."
741 msgstr ""
742
743 #. type: Plain text
744 #: ceccomp.adoc:345
745 #, no-wrap
746 msgid ""
747 " $A = $low_pc\n"
748 " $A = $high_pc\n"
749 " $A = $low_args[0]\n"
750 " $A = $high_args[0]\n"
751 " ...\n"
752 " $A = $low_args[5]\n"
753 " $A = $high_args[5]\n"
754 msgstr ""
755
756 #. type: Plain text
757 #: ceccomp.adoc:348
758 msgid ""
759 "A special attribute is `sizeof(struct seccomp_data)`, that can be assigned "
760 "to `A` or `X` directly."
761 msgstr ""
762
763 #. type: Plain text
764 #: ceccomp.adoc:351
765 #, no-wrap
766 msgid ""
767 " $A = $scmp_data_len\n"
768 " $X = $scmp_data_len\n"
769 msgstr ""
770
771 #. type: Plain text
772 #: ceccomp.adoc:355
773 msgid ""
774 "Temporary memory is 32-bit, to access them, you could use hex or dec as "
775 "index. Both `A` and `X` is assignable. Assigning immediate values to `A` or "
776 "`X` accepts any format of number if you imply the correct base by \"0x\" or "
777 "\"0b\"."
778 msgstr ""
779
780 #. type: Plain text
781 #: ceccomp.adoc:363
782 #, no-wrap
783 msgid ""
784 " $X = $mem[0]\n"
785 " $A = $mem[0xf]\n"
786 " $A = $mem[15] # both hex and dec index are OK\n"
787 " $A = 0\n"
788 " $X = 0x3b\n"
789 " $A = 0b1111\n"
790 " $A = 0333\n"
791 msgstr ""
792
793 #. type: Plain text
794 #: ceccomp.adoc:366
795 msgid ""
796 "You could also assign `X` to `A` or in the reverse order. Assign `X` or `A` "
797 "to temporary memory is definitely okay."
798 msgstr ""
799
800 #. type: Plain text
801 #: ceccomp.adoc:371
802 #, no-wrap
803 msgid ""
804 " $A = $X\n"
805 " $X = $A\n"
806 " $mem[3] = $X\n"
807 " $mem[0x4] = $A\n"
808 msgstr ""
809
810 #. type: Title ===
811 #: ceccomp.adoc:372
812 #, no-wrap
813 msgid "Arithmetic Operations"
814 msgstr ""
815
816 #. type: Plain text
817 #: ceccomp.adoc:375
818 msgid "Various operations can be applied to `A`."
819 msgstr ""
820
821 #. type: Plain text
822 #: ceccomp.adoc:382
823 #, no-wrap
824 msgid ""
825 " $A += 30\n"
826 " $A -= 4\n"
827 " $A *= 9\n"
828 " $A /= 1\n"
829 " $A &= 7\n"
830 " $A >>= 6\n"
831 msgstr ""
832
833 #. type: Plain text
834 #: ceccomp.adoc:384
835 msgid "The right value can be `X`."
836 msgstr ""
837
838 #. type: Plain text
839 #: ceccomp.adoc:389
840 #, no-wrap
841 msgid ""
842 " $A &= $X\n"
843 " $A |= $X\n"
844 " $A ^= $X\n"
845 " $A <<= $X\n"
846 msgstr ""
847
848 #. type: Plain text
849 #: ceccomp.adoc:391
850 msgid "And there is a way to negativate `A`."
851 msgstr ""
852
853 #. type: Plain text
854 #: ceccomp.adoc:393
855 #, no-wrap
856 msgid " $A = -$A\n"
857 msgstr ""
858
859 #. type: Title ===
860 #: ceccomp.adoc:394
861 #, no-wrap
862 msgid "Jump Downwards If ..."
863 msgstr ""
864
865 #. type: Plain text
866 #: ceccomp.adoc:397
867 msgid "Unconditional jump:"
868 msgstr ""
869
870 #. type: Plain text
871 #: ceccomp.adoc:399
872 #, no-wrap
873 msgid " goto L3\n"
874 msgstr ""
875
876 #. type: Plain text
877 #: ceccomp.adoc:401
878 msgid "Jump if:"
879 msgstr ""
880
881 #. type: Plain text
882 #: ceccomp.adoc:407
883 #, no-wrap
884 msgid ""
885 " if ($A == execve) goto L3\n"
886 " if ($A != 1234) goto L4\n"
887 " if ($A & $X) goto L5\n"
888 " if !($A & 7) goto L6\n"
889 " if ($A <= $X) goto L7\n"
890 msgstr ""
891
892 #. type: Plain text
893 #: ceccomp.adoc:409
894 msgid "If true jump to ... if false jump to...:"
895 msgstr ""
896
897 #. type: Plain text
898 #: ceccomp.adoc:412
899 #, no-wrap
900 msgid ""
901 " if ($A > $X) goto L3, else goto L4\n"
902 " if ($A >= 4567) goto L5, else goto L6\n"
903 msgstr ""
904
905 #. type: Plain text
906 #: ceccomp.adoc:419
907 msgid ""
908 "ONLY in conditions, you CAN replace number with syscall name or arch name. "
909 "In example above, `0x3b` is replaced by `execve`. All the syscall name will "
910 "be resolved to syscall number under your selected arch. If you want to "
911 "resolve a syscall name in foreign arch (not equal to your selected arch), "
912 "please prepend a arch and dot. For example, your arch is x86_64, and you are "
913 "writing _aarch64_ rules, then please write like:"
914 msgstr ""
915
916 #. type: Plain text
917 #: ceccomp.adoc:421
918 #, no-wrap
919 msgid " if ($A == aarch64.read) goto 5\n"
920 msgstr ""
921
922 #. type: Plain text
923 #: ceccomp.adoc:424
924 msgid ""
925 "Note that if you manually set arch to _aarch64_ with `-a aarch64`, you can "
926 "omit `aarch64.` in statement."
927 msgstr ""
928
929 #. type: Title ===
930 #: ceccomp.adoc:425
931 #, no-wrap
932 msgid "Return Code"
933 msgstr ""
934
935 #. type: Plain text
936 #: ceccomp.adoc:428
937 msgid "Return value of register `A`:"
938 msgstr ""
939
940 #. type: Plain text
941 #: ceccomp.adoc:430
942 #, no-wrap
943 msgid " return $A\n"
944 msgstr ""
945
946 #. type: Plain text
947 #: ceccomp.adoc:434
948 msgid ""
949 "Or return a immediate value, with extra field in `()`. Actions including "
950 "`TRACE`, `TRAP` and `ERRNO` accept an extra field, without `()`, they are "
951 "treated as `action(0)`."
952 msgstr ""
953
954 #. type: Plain text
955 #: ceccomp.adoc:444
956 #, no-wrap
957 msgid ""
958 " return 0x13371337\n"
959 " return KILL\n"
960 " return KILL_PROCESS\n"
961 " return TRAP(123)\n"
962 " return ERRNO(0)\n"
963 " return TRACE\n"
964 " return TRACE(3)\n"
965 " return LOG\n"
966 " return NOTIFY\n"
967 msgstr ""
968
969 #. type: Title ===
970 #: ceccomp.adoc:445
971 #, no-wrap
972 msgid "Short Example"
973 msgstr ""
974
975 #. type: Plain text
976 #: ceccomp.adoc:449
977 msgid ""
978 "The following _TEXT_ is valid for asm, which blocks `execve` and `execveat` "
979 "for amd64 syscalls:"
980 msgstr ""
981
982 #. type: Plain text
983 #: ceccomp.adoc:455
984 #, no-wrap
985 msgid ""
986 " $A = $syscall_nr\n"
987 " if ($A == execve) goto forbid\n"
988 " if ($A == execveat) goto forbid\n"
989 " return ALLOW\n"
990 " forbid: return KILL\n"
991 msgstr ""
992
993 #. type: Title ==
994 #: ceccomp.adoc:456
995 #, no-wrap
996 msgid "RESTRICTIONS"
997 msgstr ""
998
999 #. type: Plain text
1000 #: ceccomp.adoc:459
1001 msgid "Ceccomp asm put some restrictions on _TEXT_ for better performance."
1002 msgstr ""
1003
1004 #. type: Plain text
1005 #: ceccomp.adoc:461
1006 msgid "`'\\0'` must not be found in _TEXT_ since it's a text file."
1007 msgstr ""
1008
1009 #. type: Plain text
1010 #: ceccomp.adoc:462
1011 msgid "A line must be shorter than 384 *bytes*."
1012 msgstr ""
1013
1014 #. type: Plain text
1015 #: ceccomp.adoc:463
1016 msgid "A _TEXT_ file must have less than 16384 lines."
1017 msgstr ""
1018
1019 #. type: Plain text
1020 #: ceccomp.adoc:464
1021 msgid "A _TEXT_ file must be smaller than 4 MiB."
1022 msgstr ""
1023
1024 #. type: Plain text
1025 #: ceccomp.adoc:467
1026 msgid ""
1027 "And for both asm and disasm, effective statements (that can be encoded or "
1028 "decoded into BPF) must be less or equal than 4096, this is enforced by "
1029 "kernel."
1030 msgstr ""
1031
1032 #. type: Plain text
1033 #: ceccomp.adoc:470
1034 msgid ""
1035 "A fun fact about ceccomp asm: any basic ANSI color in _TEXT_ file, e.g., "
1036 "`\\x1b[31m`, will be discarded when processing."
1037 msgstr ""
1038
1039 #. type: Title ==
1040 #: ceccomp.adoc:471
1041 #, no-wrap
1042 msgid "EXAMPLES"
1043 msgstr ""
1044
1045 #. type: Plain text
1046 #: ceccomp.adoc:476
1047 msgid ""
1048 "Manpage can not display images, so please check out html version of this "
1049 "page to see examples."
1050 msgstr ""
1051
1052 #. type: Title ===
1053 #: ceccomp.adoc:479
1054 #, no-wrap
1055 msgid "asm example"
1056 msgstr ""
1057
1058 #. type: Target for macro image
1059 #: ceccomp.adoc:480
1060 #, no-wrap
1061 msgid "asm.webp"
1062 msgstr ""
1063
1064 #. type: Title ===
1065 #: ceccomp.adoc:481
1066 #, no-wrap
1067 msgid "disasm example"
1068 msgstr ""
1069
1070 #. type: Target for macro image
1071 #: ceccomp.adoc:482
1072 #, no-wrap
1073 msgid "disasm.webp"
1074 msgstr ""
1075
1076 #. type: Title ===
1077 #: ceccomp.adoc:483
1078 #, no-wrap
1079 msgid "emu example"
1080 msgstr ""
1081
1082 #. type: Target for macro image
1083 #: ceccomp.adoc:484
1084 #, no-wrap
1085 msgid "emu.webp"
1086 msgstr ""
1087
1088 #. type: Title ===
1089 #: ceccomp.adoc:485
1090 #, no-wrap
1091 msgid "trace example"
1092 msgstr ""
1093
1094 #. type: Plain text
1095 #: ceccomp.adoc:487
1096 msgid "Running program:"
1097 msgstr ""
1098
1099 #. type: Target for macro image
1100 #: ceccomp.adoc:488
1101 #, no-wrap
1102 msgid "trace.webp"
1103 msgstr ""
1104
1105 #. type: Plain text
1106 #: ceccomp.adoc:491
1107 msgid "If set `-o FILE`:"
1108 msgstr ""
1109
1110 #. type: Target for macro image
1111 #: ceccomp.adoc:492
1112 #, no-wrap
1113 msgid "output_trick.webp"
1114 msgstr ""
1115
1116 #. type: Plain text
1117 #: ceccomp.adoc:495
1118 msgid "Trace pid mode:"
1119 msgstr ""
1120
1121 #. type: Target for macro image
1122 #: ceccomp.adoc:496
1123 #, no-wrap
1124 msgid "trace_pid.webp"
1125 msgstr ""
1126
1127 #. type: Plain text
1128 #: ceccomp.adoc:499
1129 msgid "Seize pid mode:"
1130 msgstr ""
1131
1132 #. type: Target for macro image
1133 #: ceccomp.adoc:500
1134 #, no-wrap
1135 msgid "trace_seize.webp"
1136 msgstr ""
1137
1138 #. type: Plain text
1139 #: ceccomp.adoc:503
1140 msgid "Completion for pid mode is available under zsh:"
1141 msgstr ""
1142
1143 #. type: Target for macro image
1144 #: ceccomp.adoc:504
1145 #, no-wrap
1146 msgid "trace_completion.webp"
1147 msgstr ""
1148
1149 #. type: Title ===
1150 #: ceccomp.adoc:506
1151 #, no-wrap
1152 msgid "probe example"
1153 msgstr ""
1154
1155 #. type: Target for macro image
1156 #: ceccomp.adoc:507
1157 #, no-wrap
1158 msgid "probe.webp"
1159 msgstr ""
1160
1161 #. type: Title ==
1162 #: ceccomp.adoc:510
1163 #, no-wrap
1164 msgid "REPO"
1165 msgstr ""
1166
1167 #. type: Plain text
1168 #: ceccomp.adoc:514
1169 msgid ""
1170 "Visit https://github.com/dbgbgtf1/Ceccomp to find the code. Pull Requests "
1171 "and Issues are welcome!"
1172 msgstr ""
1173
1174 #. type: Plain text
1175 #: ceccomp.adoc:515
1176 msgid "Copyright (C) 2025-present, distributed under GPLv3 or later."
1177 msgstr ""