mjbommar commited on
Commit
10e1ea9
·
verified ·
1 Parent(s): f42e4a2

Public structural tier: Linux IOCTL Census (v7.0-rc7)

Browse files
MANIFEST.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "dataset": "linux-ioctl-census",
3
+ "tier": "public-structural",
4
+ "kernel": "v7.0-rc7",
5
+ "license": "CC-BY-4.0",
6
+ "tables": {
7
+ "binaries": 878,
8
+ "dispatchers": 2914,
9
+ "ioctl_codes": 1289,
10
+ "handlers": 2914,
11
+ "gates": 1298,
12
+ "kb_meta": 8
13
+ },
14
+ "withheld_targeting_tier": [
15
+ "taint_sinks",
16
+ "handler_enrichment",
17
+ "findings",
18
+ "bugclass_hits",
19
+ "functions",
20
+ "call_edges",
21
+ "extraction_runs",
22
+ "v_unaudited_unpriv_surface"
23
+ ]
24
+ }
README.md ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ language:
4
+ - en
5
+ pretty_name: Linux IOCTL Census (public structural tier)
6
+ tags:
7
+ - linux-kernel
8
+ - ioctl
9
+ - attack-surface
10
+ - security
11
+ - static-analysis
12
+ - census
13
+ task_categories:
14
+ - tabular-classification
15
+ configs:
16
+ - config_name: binaries
17
+ data_files: binaries.parquet
18
+ - config_name: dispatchers
19
+ data_files: dispatchers.parquet
20
+ - config_name: ioctl_codes
21
+ data_files: ioctl_codes.parquet
22
+ - config_name: handlers
23
+ data_files: handlers.parquet
24
+ - config_name: gates
25
+ data_files: gates.parquet
26
+ ---
27
+
28
+ # Linux IOCTL Census -- public structural tier
29
+
30
+ A source-derived census of the Linux kernel local ioctl/proc/sysfs handler
31
+ surface: for each registered handler, its decoded `_IOC` command table, the
32
+ permission gates on its path, and a capability-ungated reachability upper
33
+ bound. The schema is **identical to the Windows IOCTL Census**
34
+ (`mjbommar/ioctl-census`), so the two can be queried and compared together.
35
+
36
+ This is the **public structural tier**: everything derivable from the
37
+ already-public kernel source. The targeting tier (controlled-input sinks,
38
+ LLM triage, ranked unaudited surface) is intentionally withheld.
39
+
40
+ ## Tables
41
+
42
+ | table | rows | what |
43
+ |---|---|---|
44
+ | `binaries` | 878 | one row per driver source file that registers a handler (module granularity) |
45
+ | `dispatchers` | 2914 | registered handler entries (`unlocked_ioctl`, `proc_write`, `store`, ...) |
46
+ | `ioctl_codes` | 1289 | decoded `_IOC` commands (dir/type/nr/size + arg struct + cmd symbol) |
47
+ | `handlers` | 2914 | handler functions (symbol + file:line) |
48
+ | `gates` | 1298 | capability / f_mode / field-check permission gates on handler paths |
49
+
50
+ `*_va` columns hold a stable 64-bit `hash(usr)` (a symbol id, not an address;
51
+ Linux is relocatable). The human location is in the companion `name`/`file`/
52
+ `line` columns with `loc_kind in {symbol, site}`. `imagebase = 0`.
53
+
54
+ ## Provenance
55
+
56
+ - Source: in-tree Linux kernel source (kg snapshot; exact `git describe`
57
+ recorded in `kb_meta`).
58
+ - Coverage: **169 in-tree subtrees, 878 modules** -- the whole source an
59
+ `x86_64` `allmodconfig` build compiles (84% of source `.c` files; the
60
+ uncompiled remainder is other-architecture platform code). A second build for `arm64` adds only 1 ioctl module and no new command codes.
61
+ - Determinism: the structural tables are content-hash byte-identical across
62
+ two independent rebuilds (provenance timestamps excluded).
63
+ - Extraction: libclang over the kernel source (registrations, sinks, gates,
64
+ reachability) + a `clang -E -dM` `_IOC` command-code resolver. Resolution
65
+ rate 80% (1289 of 1614 switch-case symbols; the remainder are dominated by
66
+ legacy non-`_IOC` numeric command constants that carry no decodable structure).
67
+
68
+ ## Important caveats (read before using)
69
+
70
+ - **`user_reachable` is an UPPER BOUND**, not a proof of unprivileged
71
+ reach: it means "no hard init-namespace capability gate on the handler
72
+ path." Precise node DAC (device-node mode/owner via udev/devtmpfs) is
73
+ resolved only for a curated subset; a `user_reachable=true` row may still
74
+ be gated by a root/hardware-only device node.
75
+ - **Registration-type coverage**: handlers registered via `file_operations`/
76
+ `proc_ops`/`block_device_operations`/sysfs attrs are captured. NOT yet
77
+ captured: ops-table dispatch (DRM/V4L2/ALSA route per-command handlers
78
+ through tables such as `drm_ioctl_desc`/`v4l2_ioctl_ops`, so for those
79
+ subsystems only the fops-level dispatcher is recovered, not the per-command
80
+ surface), tty line disciplines (`tty_ldisc_ops`), the core `blkdev_ioctl`
81
+ switch, and netlink.
82
+ - Static analysis only; no runtime confirmation.
83
+
84
+ ## Companion
85
+
86
+ Schema-compatible sibling: the Windows IOCTL Census
87
+ (`huggingface.co/datasets/mjbommar/ioctl-census`). See the paper *Toward a
88
+ Linux IOCTL Census* for method, validation, and the cross-OS comparison.
89
+
90
+ ## License
91
+
92
+ CC-BY-4.0 (data). The census tooling is released separately under the
93
+ project's source license.
data/binaries.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:60844d982290caea987b9efbd78bffd76b0933912de837955b9513250a03394c
3
+ size 57253
data/dispatchers.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ba9e9d788dd6da3fd06382c677ad557e722effaf41cffb3ad18893ea0920d85
3
+ size 125284
data/gates.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a726ebcfd54d2f511cf628bb149d3ec89d54f07ac3c533ad555bfa800ffedaf
3
+ size 21709
data/handlers.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:218e60fccd528e4fa938f054fc9f5cfaa660db0c77ad72fd5235967bc0545cbc
3
+ size 124241
data/ioctl_codes.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ffddea034b7d74854c26da0aea1c09863199d9fa27afe14de57ed99c287e073b
3
+ size 37539
data/kb_meta.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0fcbca4d8701124ffd2ca1d7e7c8818975c433feaf4dbfc61423dd0bb102b75d
3
+ size 563
schema.json ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/mjbommar/linux-ioctl-census-paper/data/schema.json",
4
+ "title": "Linux IOCTL Census -- public structural tier",
5
+ "description": "JSON-Schema describing the PUBLIC structural release tier of the Linux IOCTL Census. Mirrors the export allowlist in the engine (tools/linux_ioctl/export_census_release.py) and the DuckDB DDL in bot/linux_ioctl_kb/schema.py. Only tables/columns derivable from already-public kernel source appear here; the targeting tier (taint_sinks, handler_enrichment, bugclass_hits, findings, functions, call_edges, extraction_runs) is withheld and MUST NOT appear. Schema-compatible with the Windows IOCTL Census: identical table and column names so the corpora are query-compatible. Linux concession: every *_va column is a stable 64-bit id (hash of the kg USR), and human location lives in companion name/file/line columns with loc_kind in {symbol, site}; imagebase is 0.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["kb_meta", "binaries", "dispatchers", "ioctl_codes", "handlers", "gates"],
9
+ "properties": {
10
+ "kb_meta": {
11
+ "type": "array",
12
+ "description": "Key/value provenance. Includes schema_version and release_tier=public-structural.",
13
+ "items": {
14
+ "type": "object",
15
+ "additionalProperties": false,
16
+ "required": ["key", "value"],
17
+ "properties": {
18
+ "key": {"type": "string"},
19
+ "value": {"type": "string"}
20
+ }
21
+ }
22
+ },
23
+ "binaries": {
24
+ "type": "array",
25
+ "description": "One row per analyzed module. 'binaries' name retained for query-compatibility with the Windows KB; on Linux a row is a kernel module/built-in source unit.",
26
+ "items": {
27
+ "type": "object",
28
+ "additionalProperties": false,
29
+ "required": ["sha256", "name"],
30
+ "properties": {
31
+ "sha256": {"type": "string", "description": "Content hash, primary key."},
32
+ "name": {"type": "string", "description": "Module name (e.g. ipmi_devintf)."},
33
+ "corpus": {"type": ["string", "null"], "description": "Corpus tag for the extraction run."},
34
+ "build": {"type": ["string", "null"], "description": "Build identifier (kernel tag/config)."},
35
+ "arch": {"type": ["string", "null"], "description": "Architecture (e.g. x86_64)."},
36
+ "driver_type": {"type": ["string", "null"], "enum": ["char_dev", "blockdev", "sysfs", "proc", null], "description": "Surface class of the module's registration."},
37
+ "device_names": {"type": ["array", "null"], "items": {"type": "string"}, "description": "Device node names where recovered (node DAC coverage is partial; see data dictionary)."},
38
+ "device_sddl": {"type": ["string", "null"], "description": "Gate summary. On Linux holds 'caps:CAP_...' when a hard init-ns capability gate is on the ioctl path."},
39
+ "user_reachable": {"type": ["boolean", "null"], "description": "Static verdict: ioctl path has no hard init-ns capability gate (heuristic; see PLAN node-DAC caveat)."},
40
+ "in_threat_model": {"type": ["boolean", "null"], "description": "True unless the module is out of the kernel's documented threat model (e.g. staging)."},
41
+ "out_of_model_reason": {"type": ["string", "null"], "description": "Why a module is out of model (e.g. 'staging')."},
42
+ "n_dispatchers": {"type": ["integer", "null"]},
43
+ "n_codes": {"type": ["integer", "null"]},
44
+ "n_handlers": {"type": ["integer", "null"]},
45
+ "surface_recovered": {"type": ["boolean", "null"], "description": "True if a dispatch surface was recovered for this module."},
46
+ "rel_path": {"type": ["string", "null"], "description": "Tree-relative source path (e.g. drivers/char/ipmi/ipmi_devintf.c)."},
47
+ "subtree": {"type": ["string", "null"], "description": "Coverage subtree label (e.g. drivers-misc)."},
48
+ "staging": {"type": ["boolean", "null"], "description": "True if under drivers/staging."}
49
+ }
50
+ }
51
+ },
52
+ "dispatchers": {
53
+ "type": "array",
54
+ "description": "One row per ioctl dispatch entry point (file_operations.unlocked_ioctl / compat_ioctl / proc_ops.proc_ioctl etc.).",
55
+ "items": {
56
+ "type": "object",
57
+ "additionalProperties": false,
58
+ "required": ["sha256", "dispatcher_va"],
59
+ "properties": {
60
+ "sha256": {"type": "string"},
61
+ "dispatcher_va": {"type": "integer", "description": "Stable 64-bit id (hash of kg USR), NOT a load address. imagebase=0."},
62
+ "role": {"type": ["string", "null"], "description": "Dispatcher role classification."},
63
+ "name": {"type": ["string", "null"], "description": "Function symbol name."},
64
+ "file": {"type": ["string", "null"]},
65
+ "line": {"type": ["integer", "null"]},
66
+ "ops_struct": {"type": ["string", "null"], "description": "Owning ops struct (e.g. file_operations)."},
67
+ "ops_field": {"type": ["string", "null"], "enum": ["unlocked_ioctl", "compat_ioctl", "ioctl", "proc_ioctl", null], "description": "Ops-struct field the dispatcher fills."}
68
+ }
69
+ }
70
+ },
71
+ "ioctl_codes": {
72
+ "type": "array",
73
+ "description": "One row per decoded ioctl command code. Decoded via the _IOC resolver: access direction, _IOC_TYPE, _IOC_NR, _IOC_SIZE, arg-struct type.",
74
+ "items": {
75
+ "type": "object",
76
+ "additionalProperties": false,
77
+ "required": ["sha256", "dispatcher_va", "code"],
78
+ "properties": {
79
+ "sha256": {"type": "string"},
80
+ "dispatcher_va": {"type": "integer"},
81
+ "code": {"type": "integer", "description": "The 32-bit ioctl command number."},
82
+ "device_type": {"type": ["integer", "null"], "description": "_IOC_TYPE (the magic byte)."},
83
+ "method": {"type": ["string", "null"], "description": "Windows-schema parity field; usually null on Linux."},
84
+ "access": {"type": ["string", "null"], "enum": ["r", "w", "rw", "none", null], "description": "_IOC_DIR decoded."},
85
+ "function_code": {"type": ["integer", "null"], "description": "_IOC_NR (the command ordinal)."},
86
+ "cmd_symbol": {"type": ["string", "null"], "description": "The macro/symbol the case label resolved from (e.g. FS_IOC_GETFLAGS)."},
87
+ "ioc_size": {"type": ["integer", "null"], "description": "_IOC_SIZE in bytes."},
88
+ "arg_struct_type": {"type": ["string", "null"], "description": "Decoded argument struct type where recoverable."}
89
+ }
90
+ }
91
+ },
92
+ "handlers": {
93
+ "type": "array",
94
+ "description": "One row per ioctl command handler (the per-command body reached from a dispatcher).",
95
+ "items": {
96
+ "type": "object",
97
+ "additionalProperties": false,
98
+ "required": ["sha256", "handler_va"],
99
+ "properties": {
100
+ "sha256": {"type": "string"},
101
+ "handler_va": {"type": "integer", "description": "Stable 64-bit id (hash of kg USR)."},
102
+ "name": {"type": ["string", "null"]},
103
+ "reachable": {"type": ["boolean", "null"], "description": "Reachable from a dispatcher within the closure depth bound."},
104
+ "ioctl_distance": {"type": ["integer", "null"], "description": "Call-graph distance from the dispatcher."},
105
+ "file": {"type": ["string", "null"]},
106
+ "line": {"type": ["integer", "null"]}
107
+ }
108
+ }
109
+ },
110
+ "gates": {
111
+ "type": "array",
112
+ "description": "One row per permission gate on a handler's path. Capability checks, LSM hooks, f_mode/field checks, fd lookups.",
113
+ "items": {
114
+ "type": "object",
115
+ "additionalProperties": false,
116
+ "required": ["sha256", "handler_va", "gate_kind"],
117
+ "properties": {
118
+ "sha256": {"type": "string"},
119
+ "handler_va": {"type": "integer"},
120
+ "gate_kind": {"type": "string", "enum": ["cap_check", "lsm_hook", "field_check", "fd_lookup", "protocol_state_check"], "description": "The gate class."},
121
+ "cap_constant": {"type": ["string", "null"], "description": "The CAP_* constant for cap_check gates."},
122
+ "mask_constant": {"type": ["string", "null"], "description": "The f_mode / field mask for field_check gates."},
123
+ "is_hard_gate": {"type": ["boolean", "null"], "description": "True if the gate hard-blocks unprivileged reach in init-ns."},
124
+ "gate_ns": {"type": ["string", "null"], "description": "Namespace the gate is evaluated in."},
125
+ "file": {"type": ["string", "null"]},
126
+ "line": {"type": ["integer", "null"]}
127
+ }
128
+ }
129
+ }
130
+ }
131
+ }