This project implements an automated evaluation pipeline for Linux character device driver code — including code generated by LLMs.
The system scores each driver file on:
- ✅ Compilation success
- ✅ Style compliance
- ✅ Security heuristics
It outputs a detailed JSON report with component-wise scores.
- ⚙️ Compilation check using
gcc - 🎯 Style compliance via
checkpatch.pl(Linux kernel style) - 🔐 Security scan for:
- Buffer overflows
- Race condition indicators
- Input validation issues
- 🤖 LLM-generated driver evaluation
- 🧮 Score calculation based on weighted metrics
- 🧪 Bonus: Runtime test simulation
- 💡 LLM fine-tuning suggestions
-
Upload your
.cdriver file in Colab (e.g.,char_driver_sample.c) -
Run each cell in
h2loop.ipynb:compile_driver()check_style()run_security_checks()calculate_score()
-
Final output:
📄evaluation_result.json
Includes compilation, style, and security scores with total
char_driver_sample.c— base test driverllm_generated_driver.c— ChatGPT-generated drivertest_driver_sim.c— simulates runtime test
{
"compilation": {"success": false, "warnings": 0, "errors": 1},
"code_quality": {"style_score": 1.0},
"security": {
"buffer_safety": 1.0,
"race_conditions": 0.5,
"input_validation": 0.4
},
"overall_score": 35.83
}A user-space simulation (test_driver_sim.c) mimics interaction with the driver (read/write buffer).
➡️ Output saved in results/runtime_test_output.txt
See: LLM_Suggestions file for notes on fine-tuning, prompt engineering, and evaluation loop design.
h2loop.ipynb → Colab-based evaluation pipeline
char_driver_sample.c → Sample driver file
llm_generated_driver.c → LLM-generated test driver
test_driver_sim.c → Runtime simulation test
evaluation_result.json → Sample output JSON
ARCHITECTURE / RUBRICS / USER_GUIDE / LLM_Suggestions → Documentation files
👉 Watch full walkthrough on Loom
Divyansh Gautam Automated evaluation pipeline for Linux device-driver code — including LLM-generated drivers.