aboutgitcodelistschat:MatrixIRC
path: root/cooker/example.hjson
diff options
context:
space:
mode:
authorAlice Frosi <afrosi@redhat.com>2023-03-28 16:48:58 +0200
committerAlice Frosi <afrosi@redhat.com>2023-03-28 17:05:54 +0200
commitb6c964fb5a00c8b8ab26a4678cdde24c3e9b1d9c (patch)
tree55449680aa735b529600b2b7927e160944685697 /cooker/example.hjson
parent21c4730f0cb020db3bdff22e347a52d012cc79fe (diff)
downloadseitan-b6c964fb5a00c8b8ab26a4678cdde24c3e9b1d9c.tar
seitan-b6c964fb5a00c8b8ab26a4678cdde24c3e9b1d9c.tar.gz
seitan-b6c964fb5a00c8b8ab26a4678cdde24c3e9b1d9c.tar.bz2
seitan-b6c964fb5a00c8b8ab26a4678cdde24c3e9b1d9c.tar.lz
seitan-b6c964fb5a00c8b8ab26a4678cdde24c3e9b1d9c.tar.xz
seitan-b6c964fb5a00c8b8ab26a4678cdde24c3e9b1d9c.tar.zst
seitan-b6c964fb5a00c8b8ab26a4678cdde24c3e9b1d9c.zip
Rename cooker and eater with seitan prefix
Diffstat (limited to 'cooker/example.hjson')
-rw-r--r--cooker/example.hjson67
1 files changed, 67 insertions, 0 deletions
diff --git a/cooker/example.hjson b/cooker/example.hjson
new file mode 100644
index 0000000..45ed339
--- /dev/null
+++ b/cooker/example.hjson
@@ -0,0 +1,67 @@
+[
+ {
+ "match": [ /* qemu-pr-helper and similar */
+ { "connect": { "addr": { "family": "unix", "path": "/var/run/pr-helper.sock" }, "fd": { "ref": "fd" } } }
+ ],
+ "call": { "connect": { "addr": { "family": "unix", "path": "/var/run/pr-helper.sock" }, "ret": "y" } },
+ "inject": { "what": "fd", "new": { "ref": "y" }, "old": { "ref": "fd" }, "return": 0 }
+ },
+ {
+ "match": [ /* qemu creates a tap interface */
+ { "ioctl": { "path": "/dev/net/tun", "request": "TUNSETIFF", "ifr": { "name": "tap0", "flags": "IFF_TUN" } } }
+ ],
+ "limit": { "scope": "process", "count": 1 },
+ "call": { "ioctl": { "request": "TUNSETIFF", "path": "/dev/net/tun", "ifr": { "name": "tap0", "flags": "IFF_TUN", "ret": "x" } } },
+ "return": { "ref": "x" }
+ },
+ {
+ "match": [ /* CVE-2022-0185-style */
+ { "unshare": { "flags": { "has": { "newuser": true, "newnet": false } } } }
+ ],
+ "block": { }
+ },
+ {
+ "match": [ /* passt */
+ { "unshare": { "flags": { "has": [ "ipc", "mount", "uts", "pid" ] } } }
+ ],
+ "block": { }
+ },
+ {
+ "match": [ /* Giuseppe's example */
+ { "mknod": { "path": { "ref": "path" }, "mode": "c", "major": 1, "minor": { "in": [ 3, 5, 7, 8, 9 ], "ref": "minor" } } }
+ ],
+ "context": { "userns": "init", "mountns": "caller" },
+ "call": { "mknod": { "path": { "ref": "path" }, "mode": "c", "major": 1, "minor": { "ref": "minor" }, "ret": "x" } },
+ "inject": { "what": "fd", "new": { "ref": "x" } },
+ "return": { "ref": "x" }
+ }
+]
+
+/*
+ * INTFLAGS, LONGFLAGS, U32FLAGS
+ *
+ * "field": { "in": [ "ipc", "mount", "uts" ] }
+ * flags & set
+ * !!(flags & (ipc | mount | ns))
+ *
+ * "field": { "all": [ "ipc", "mount", "uts" ] }
+ * flags & set == set
+ * flags & (ipc | mount | ns) == (ipc | mount | ns)
+ *
+ * "field": { "not": [ "ipc", "mount", "uts" ] }
+ * !(flags & set)
+ *
+ * "field": { "ipc": false, "mount": true, "uts": false }
+ * flags & set == set
+ * !(flags & ipc) && (flags & mount) && !(flags & utc)
+ *
+ * "field": { "ipc" }
+ * flags == ipc
+ *
+ * INTMASK
+ * value = (target value & known values)
+ *
+ * INT, LONG, U32
+ * "arg": { "in": [ 0, 1 ] }
+ * arg == 0 || arg == 1
+ */