quguanni commited on
Commit
1fbfd60
·
verified ·
1 Parent(s): 2f8bea7

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +100 -0
  2. test.parquet +3 -0
  3. train.parquet +3 -0
  4. validation.parquet +3 -0
README.md ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: gpl-2.0
3
+ task_categories:
4
+ - text-classification
5
+ language:
6
+ - en
7
+ tags:
8
+ - code
9
+ - security
10
+ - vulnerability-detection
11
+ - linux-kernel
12
+ - git-commits
13
+ size_categories:
14
+ - 1M<n<10M
15
+ ---
16
+
17
+ # Linux Kernel Vulnerability-Introducing Commits Dataset
18
+
19
+ ## Dataset Description
20
+
21
+ A labeled dataset of **1,426,202 Linux kernel git commits** with full metadata, diffs, and binary labels indicating whether each commit introduced a vulnerability that was later fixed.
22
+
23
+ **Intended use:** Training and evaluating models for vulnerability-introducing commit detection — predicting whether a given code change will later require a security or bug fix.
24
+
25
+ ## How the Data Was Collected
26
+
27
+ 1. **Repository:** The full Linux kernel git history was cloned from `git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git` (all branches and tags, complete history).
28
+
29
+ 2. **Metadata extraction:** A single `git log --all` pass extracted structured metadata for every reachable commit (1,426,202 total), including author/committer info, dates, and the full commit message parsed into subject, body, and trailers.
30
+
31
+ 3. **Diff extraction:** A single `git log --all -p --numstat` pass extracted the complete unified diff and per-file insertion/deletion counts for every commit.
32
+
33
+ 4. **Labeling via Fixes tag mining:** The `vuln_commits_full.csv` dataset maps fixing commits to the commits they fix, identified through the kernel's `Fixes:` trailer convention. Each commit whose abbreviated hash appears as an `introducing_commit` in that mapping receives `label=1`; all others receive `label=0`.
34
+
35
+ 5. **Stratified splitting:** The dataset was split 80/10/10 into train/validation/test with stratified sampling (seed=42) to preserve the label distribution across splits.
36
+
37
+ ## Column Descriptions
38
+
39
+ | Column | Type | Description |
40
+ |--------|------|-------------|
41
+ | `hash` | string | Full 40-character commit SHA-1 |
42
+ | `abbreviated_hash` | string | Short commit hash (typically 12 characters) |
43
+ | `parent_hashes` | string | Space-separated full hashes of parent commits |
44
+ | `parent_count` | int32 | Number of parent commits (0=root, 1=normal, 2+=merge) |
45
+ | `author_name` | string | Original author's name |
46
+ | `author_email` | string | Original author's email |
47
+ | `author_date` | string | Author timestamp in strict ISO 8601 format |
48
+ | `committer_name` | string | Committer's name (person who applied the patch) |
49
+ | `committer_email` | string | Committer's email |
50
+ | `committer_date` | string | Committer timestamp in strict ISO 8601 format |
51
+ | `subject` | string | First line of the commit message |
52
+ | `body` | string | Commit message text between subject and trailers |
53
+ | `trailers` | string | Structured trailer lines (Signed-off-by, Fixes, Reviewed-by, Cc, Link, etc.) joined by newlines |
54
+ | `diff_raw` | large_string | Complete unified diff output (diff headers, hunks, context lines, etc.) |
55
+ | `insertions` | int64 | Total lines added across all files (from numstat) |
56
+ | `deletions` | int64 | Total lines removed across all files (from numstat) |
57
+ | `files_changed` | int32 | Number of files modified |
58
+ | `label` | int8 | 1 = vulnerability-introducing commit, 0 = clean |
59
+
60
+ ## Split Sizes and Label Distribution
61
+
62
+ | Split | Rows | Label=1 | Label=0 | Positive % |
63
+ |-------|------|---------|---------|------------|
64
+ | train | 1,140,962 | 64,002 | 1,076,960 | 5.61% |
65
+ | validation | 142,620 | 8,000 | 134,620 | 5.61% |
66
+ | test | 142,620 | 8,000 | 134,620 | 5.61% |
67
+ | **total** | **1,426,202** | **80,002** | **1,346,200** | **5.61%** |
68
+
69
+ ## Known Limitations
70
+
71
+ 1. **Fixes tags capture all bugs, not just security vulnerabilities.** The kernel's `Fixes:` trailer is used for all bug fixes — logic errors, performance regressions, build failures, and similar — not exclusively for security-critical vulnerabilities. The label therefore reflects "introduced a defect that was later fixed" rather than "introduced a security vulnerability" specifically.
72
+
73
+ 2. **Label noise from catch-all hashes.** Some `Fixes:` tags point to very early commits (e.g., `1da177e4c3f4` — the initial Linux 2.6.12-rc2 import) when the actual introducing commit is unknown or predates git history. These commits receive `label=1` despite not being the true root cause.
74
+
75
+ 3. **Right-censoring of recent commits.** Commits near the HEAD of the repository have had less time to be identified as bug-introducing. Some recent `label=0` commits may in fact contain undiscovered bugs, introducing a systematic false-negative bias toward the end of the timeline.
76
+
77
+ 4. **Merge commits have empty diffs.** By default, `git log -p` does not produce diffs for merge commits. Of the 80,002 label=1 commits, 155 (0.19%) are merges with empty `diff_raw`. These should be excluded or handled specially in modeling.
78
+
79
+ 5. **Feature distribution skew.** Label=1 commits tend to be larger than label=0 commits (mean diff length 3.8x, mean insertions 8.3x). Models may learn to use commit size as a shortcut rather than understanding code semantics. Consider controlling for commit size in evaluation.
80
+
81
+ 6. **Single-project bias.** All data comes from one project (the Linux kernel). Models trained on this data may not generalize to other codebases with different coding conventions, review processes, or commit practices.
82
+
83
+ 7. **Incomplete Fixes tag coverage.** Not all bug-fixing commits in the kernel carry a `Fixes:` trailer. The labeled set of introducing commits is therefore a lower bound — the true number of bug-introducing commits is likely higher, meaning some `label=0` commits are mislabeled.
84
+
85
+ ## Citation
86
+
87
+ If you use this dataset, please cite:
88
+
89
+ ```bibtex
90
+ @misc{linux_vuln_commits_2026,
91
+ title={Linux Kernel Vulnerability-Introducing Commits Dataset},
92
+ year={2026},
93
+ note={Derived from the Linux kernel git history and Fixes-tag mining},
94
+ url={https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git}
95
+ }
96
+ ```
97
+
98
+ ## License
99
+
100
+ The Linux kernel is licensed under **GPL-2.0**. Commit metadata and diffs are derived from the kernel source repository and are distributed under the same license.
test.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6156eeb912ff9a4550d53c555dad7e5eb1df645a903f7d63d314aaae3f88adae
3
+ size 197481855
train.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00c38182afe719bbc078075518d8ac700675a356887d1d70e64506d5b711619c
3
+ size 1506085641
validation.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b508ba6a62eb322d072d47ae1de879508412c5227c443b1a8938844ee0a5252c
3
+ size 205506160