summaryrefslogtreecommitdiff
path: root/src/sys/procfile/kcoreprocfile.cil
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys/procfile/kcoreprocfile.cil')
-rw-r--r--src/sys/procfile/kcoreprocfile.cil48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/sys/procfile/kcoreprocfile.cil b/src/sys/procfile/kcoreprocfile.cil
new file mode 100644
index 0000000..c367f51
--- /dev/null
+++ b/src/sys/procfile/kcoreprocfile.cil
@@ -0,0 +1,48 @@
+;; SPDX-FileCopyrightText: © 2023 Dominick Grift <dominick.grift@defensec.nl>
+;; SPDX-License-Identifier: Unlicense
+
+(block kcore
+
+ (genfscon "proc" "/kcore" procfile_context)
+
+ (blockinherit .procfile.template)
+
+ (call .procfile.exception.type (procfile))
+
+ (block read
+
+ (macro type ((type ARG1))
+ (typeattributeset typeattr ARG1))
+
+ (typeattribute not_typeattr)
+ (typeattribute typeattr)
+
+ (typeattributeset not_typeattr (not typeattr))
+
+ (neverallow not_typeattr procfile (file (read))))
+
+ (block readwrite
+
+ (macro type ((type ARG1))
+ (typeattributeset typeattr ARG1))
+
+ (typeattribute typeattr)
+
+ (call read.type (typeattr))
+ (call write.type (typeattr)))
+
+ (block write
+
+ (macro type ((type ARG1))
+ (typeattributeset typeattr ARG1))
+
+ (typeattribute not_typeattr)
+ (typeattribute typeattr)
+
+ (typeattributeset not_typeattr (not typeattr))
+
+ (neverallow not_typeattr procfile (file (append write)))))
+
+(in procfile.unconfined
+
+ (call .kcore.readwrite.type (typeattr)))