Guanni Qu commited on
Commit
ed6dd65
·
1 Parent(s): 6315d71

Initial upload: 125k kernel vulnerabilities

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +168 -0
  3. vuln_commits_full.csv +3 -0
.gitattributes CHANGED
@@ -57,3 +57,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
60
+ *.csv filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories:
4
+ - text-classification
5
+ language:
6
+ - en
7
+ tags:
8
+ - linux-kernel
9
+ - security
10
+ - vulnerabilities
11
+ - code
12
+ - bugs
13
+ - software-engineering
14
+ pretty_name: Linux Kernel Vulnerability Dataset
15
+ size_categories:
16
+ - 100K<n<1M
17
+ ---
18
+
19
+ # Linux Kernel Vulnerability Dataset
20
+
21
+ **125,183 bug-introducing commits** mined from 20 years of Linux kernel git history (2005-2025).
22
+
23
+ ## Dataset Description
24
+
25
+ This dataset maps every kernel bug fix with a `Fixes:` tag back to the commit that introduced the bug. It enables research on:
26
+
27
+ - **Vulnerability detection**: Train models to identify bug-introducing commits
28
+ - **Bug lifetime analysis**: Study how long different bug types persist
29
+ - **Subsystem risk assessment**: Identify which kernel subsystems have the longest-lived bugs
30
+ - **Developer patterns**: Analyze who introduces and fixes bugs
31
+
32
+ ### Key Statistics
33
+
34
+ | Metric | Value |
35
+ |--------|-------|
36
+ | Total bug-fix pairs | 125,183 |
37
+ | Valid records (0 < lifetime < 27 years) | 123,696 |
38
+ | Average bug lifetime | 2.1 years |
39
+ | Median bug lifetime | 0.7 years |
40
+ | Longest-lived bug | 20.7 years |
41
+ | Bugs hiding 5+ years | 13.5% |
42
+ | Unique fixing commits | 119,449 |
43
+ | Unique bug-introducing authors | 9,159 |
44
+ | With CVE ID | 158 |
45
+ | With Cc: stable | 27,875 (22%) |
46
+
47
+ ## Dataset Structure
48
+
49
+ ### Data Fields
50
+
51
+ | Column | Type | Description |
52
+ |--------|------|-------------|
53
+ | `fixing_commit` | string | SHA of the commit that fixed the bug |
54
+ | `introducing_commit` | string | SHA of the commit that introduced the bug |
55
+ | `lifetime_days` | int | Days between introduction and fix |
56
+ | `subsystem` | string | Kernel subsystem (networking, drivers, fs, etc.) |
57
+ | `bug_type` | string | Detected bug type (race-condition, null-deref, etc.) |
58
+ | `fix_subject` | string | Commit message subject of the fix |
59
+ | `fixing_date` | datetime | When the fix was committed |
60
+ | `introducing_date` | datetime | When the bug was introduced |
61
+ | `files_changed` | string | Files modified in introducing commit |
62
+ | `insertions` | int | Lines added in introducing commit |
63
+ | `deletions` | int | Lines removed in introducing commit |
64
+ | `cve_id` | string | CVE ID if mentioned in fix commit (nullable) |
65
+ | `cc_stable` | bool | Whether fix was tagged for stable backport |
66
+ | `fix_author` | string | Author of the fix |
67
+ | `intro_author` | string | Author who introduced the bug |
68
+
69
+ ### Subsystem Distribution
70
+
71
+ | Subsystem | Count | Avg Lifetime |
72
+ |-----------|-------|--------------|
73
+ | drivers | 38,412 | 2.3 years |
74
+ | networking | 6,079 | 2.9 years |
75
+ | gpu | 5,212 | 1.4 years |
76
+ | filesystem | 4,891 | 2.6 years |
77
+ | sound | 3,847 | 2.1 years |
78
+ | usb | 2,505 | 3.5 years |
79
+ | memory | 2,459 | 1.8 years |
80
+ | bpf | 959 | 1.1 years |
81
+
82
+ ### Bug Type Distribution
83
+
84
+ | Bug Type | Count | Avg Lifetime |
85
+ |----------|-------|--------------|
86
+ | null-deref | 4,931 | 2.2 years |
87
+ | use-after-free | 2,963 | 3.2 years |
88
+ | memory-leak | 2,846 | 3.1 years |
89
+ | refcount | 2,209 | 2.8 years |
90
+ | deadlock | 1,683 | 2.2 years |
91
+ | race-condition | 1,188 | 5.1 years |
92
+ | buffer-overflow | 399 | 3.1 years |
93
+ | integer-overflow | 298 | 3.9 years |
94
+
95
+ ## Collection Methodology
96
+
97
+ ### Mining Process
98
+
99
+ 1. Clone Linux kernel repository at v6.19-rc3
100
+ 2. Run `git log --grep="Fixes:"` to find all fixing commits
101
+ 3. Extract the referenced commit hash from each `Fixes:` tag using regex
102
+ 4. Retrieve metadata (dates, authors, files) from both commits
103
+ 5. Classify subsystem from file paths using 70+ regex patterns
104
+ 6. Detect bug type from commit message keywords
105
+ 7. Calculate lifetime as `fixing_date - introducing_date`
106
+
107
+ ### Extraction Code
108
+
109
+ ```python
110
+ import re
111
+
112
+ def extract_fixes_tag(commit_msg: str) -> str | None:
113
+ """Extract the commit ID from a Fixes: tag"""
114
+ pattern = r'Fixes:\s*([a-f0-9]{12,40})'
115
+ match = re.search(pattern, commit_msg, re.IGNORECASE)
116
+ return match.group(1) if match else None
117
+ ```
118
+
119
+ ### Filtering
120
+
121
+ - Excluded commits where `Fixes:` tag points to non-existent hash
122
+ - Excluded merge commits
123
+ - For lifetime analysis: excluded same-day fixes (lifetime_days = 0)
124
+ - For lifetime analysis: excluded outliers (lifetime > 10,000 days)
125
+
126
+ ## Limitations
127
+
128
+ - **Selection bias**: Only ~28% of fix commits use `Fixes:` tags. Well-documented bugs (likely more serious) are overrepresented.
129
+ - **Mainline only**: Doesn't include bugs fixed only in stable branches or vendor kernels.
130
+ - **Subsystem classification**: Heuristic-based on file paths; some bugs span multiple subsystems.
131
+ - **Bug type detection**: Keyword-based; many bugs classified as "unknown".
132
+ - **Timestamp accuracy**: Uses author dates, not commit dates. Rebasing can skew.
133
+
134
+ ## Intended Uses
135
+
136
+ ### Recommended
137
+
138
+ - Training vulnerability detection models (e.g., VulnBERT)
139
+ - Analyzing bug lifetime patterns across subsystems
140
+ - Studying the evolution of kernel security over time
141
+ - Research on code review and testing effectiveness
142
+
143
+ ### Out of Scope
144
+
145
+ - Direct exploit development (commits don't include full code context)
146
+ - Claiming completeness of kernel vulnerability data
147
+
148
+ ## Citation
149
+
150
+ ```bibtex
151
+ @dataset{qu2026kernelvuln,
152
+ author = {Qu, Jenny Guanni},
153
+ title = {Linux Kernel Vulnerability Dataset},
154
+ year = {2026},
155
+ publisher = {HuggingFace},
156
+ url = {https://huggingface.co/datasets/quguanni/kernel-vuln-dataset}
157
+ }
158
+ ```
159
+
160
+ ## License
161
+
162
+ MIT License
163
+
164
+ ## Contact
165
+
166
+ - **Author**: Jenny Guanni Qu
167
+ - **Email**: jenny@pebblebed.com
168
+ - **Blog post**: [Kernel bugs hide for 2 years on average](https://pebblebed.com/blog/kernel-bugs)
vuln_commits_full.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3bd7cca24736a41dde44fdda973a19b06095cfa6dad843aca9cd245a2c955307
3
+ size 43294959