straces / README.md
andrew000's picture
Update name
7960cd3 verified
---
license: mit
task_categories:
- text-generation
- feature-extraction
language:
- en
tags:
- system-calls
- strace
- linux
- syscalls
- operating-systems
- code
pretty_name: Linux Strace Traces Dataset
size_categories:
- n<1K
---
# Linux Strace Traces Dataset
A comprehensive collection of strace traces from common Linux utilities, designed for training AI models on system call patterns, program behavior analysis, and operating system interactions.
## Dataset Description
This dataset contains **357 strace traces** captured from 119 different Linux command-line utilities, with each utility executed 3 times to capture runtime variations. Each trace includes detailed system call information with timestamps, arguments, and execution times.
### Dataset Statistics
- **Total traces**: 357 (119 unique commands × 3 runs each)
- **Categories**: 8
- **Format**: Parquet (Hugging Face native)
- **Raw size**: ~40 MB
- **Compressed size**: ~5 MB (Parquet)
- **License**: MIT
### Runtime Diversity
Each command was executed 3 times to capture natural variations in program execution:
- Different process IDs (PIDs)
- Different memory addresses (ASLR randomization)
- Different timestamps with microsecond precision
- Slight variations in syscall timing
This diversity helps train more robust AI models that can generalize across different execution contexts.
### Categories
1. **File I/O Operations** (75 traces = 25 commands × 3 runs)
- File reading: `cat`, `head`, `tail`, `less`
- File manipulation: `cp`, `mv`, `touch`, `rm`
- Directory operations: `mkdir`, `rmdir`, `find`
- File information: `stat`, `file`, `ls`, `du`, `df`
2. **Text Processing** (69 traces = 23 commands × 3 runs)
- Pattern matching: `grep` (simple, case-insensitive, recursive, count)
- Text transformation: `sed`, `awk`, `tr`
- Sorting & filtering: `sort`, `uniq`, `cut`, `paste`
- Analysis: `wc`, `diff`, `cmp`
3. **Process & System Info** (51 traces = 17 commands × 3 runs)
- Process listing: `ps`, `top`, `pgrep`
- System information: `uptime`, `who`, `whoami`, `id`, `uname`, `hostname`
- Environment: `env`, `printenv`
- Time: `date`, `cal`
- Resources: `free`, `vmstat`
4. **Networking** (33 traces = 11 commands × 3 runs)
- Network requests: `ping`, `curl`, `wget`
- DNS queries: `host`, `dig`, `nslookup`
- Network info: `ip`, `ss`, `netstat`
5. **Compression & Archives** (36 traces = 12 commands × 3 runs)
- Tar operations: create, extract, list (with/without gzip)
- Compression: `gzip`, `bzip2`
- Zip operations: `zip`, `unzip`
6. **Scripting & Execution** (45 traces = 15 commands × 3 runs)
- Shell execution: `bash`, `sh`
- Python execution: scripts and inline commands
- Utilities: `sleep`, `echo`, `printf`, `yes`, `seq`
- Tests: `true`, `false`, `test`, `expr`
7. **Permissions & Ownership** (18 traces = 6 commands × 3 runs)
- Permission modification: `chmod` (numeric, symbolic, recursive)
- Permission viewing: `ls -l`
- Umask operations
8. **Data Operations** (30 traces = 10 commands × 3 runs)
- Random data: `dd` with `/dev/urandom` and `/dev/zero`
- Encoding: `base64` (encode/decode)
- Hashing: `md5sum`, `sha1sum`, `sha256sum`
- Binary analysis: `hexdump`, `od`, `strings`
## Dataset Structure
### Data Fields
- `id` (string): Unique identifier for the trace (e.g., "cat_simple_run1")
- `category` (string): Category of the utility (e.g., "file_io")
- `command` (string): Full command executed (e.g., "cat test.txt")
- `strace` (string): Complete strace output with system calls
- `duration` (float): Execution time in seconds
- `timestamp` (string): ISO 8601 timestamp of trace capture
- `num_lines` (int): Number of lines in the strace output
- `size_bytes` (int): Size of the strace output in bytes
- `run_number` (int): Run iteration (1, 2, or 3)
### Data Splits
This dataset contains a single split:
- `train`: 357 examples (119 unique commands × 3 runs)
### Example
```python
from datasets import load_dataset
dataset = load_dataset("YOUR_USERNAME/strace-dataset")
# View first example
example = dataset['train'][0]
print(f"Command: {example['command']}")
print(f"Category: {example['category']}")
print(f"Duration: {example['duration']}s")
print(f"Strace output (first 500 chars):\n{example['strace'][:500]}")
```
## Dataset Creation
### Source Data
All traces were generated in a controlled, isolated environment using the `strace` utility with the following flags:
- `-f`: Follow child processes
- `-s 256`: Capture up to 256 bytes of string arguments
- `-tt`: Absolute timestamps with microsecond precision
- `-T`: Show time spent in each syscall
### Data Collection Process
1. Temporary workspace created with test files (text, binary, CSV, etc.)
2. Each utility executed with typical arguments/use cases
3. Strace captured all system calls during execution
4. Test data cleaned up after collection
5. No sensitive information or system-specific paths included
### Safety & Privacy
- ✅ No sensitive data (passwords, keys, tokens)
- ✅ No user-specific information
- ✅ No production system paths
- ✅ All operations performed in temporary directories
- ✅ Safe for open-source release
## Use Cases
### Training AI Models
- **System call prediction**: Predict next system calls based on program behavior
- **Anomaly detection**: Identify unusual syscall patterns
- **Program behavior modeling**: Learn normal execution patterns
- **Security analysis**: Detect potential malicious behavior
### Analysis & Research
- Understanding program execution flows
- Comparing syscall patterns across utilities
- Educational resource for OS concepts
- Benchmark for trace analysis tools
### Code Examples
#### Load and explore the dataset
```python
from datasets import load_dataset
import pandas as pd
# Load dataset
ds = load_dataset("andrew000/straces")
# Convert to pandas for analysis
df = pd.DataFrame(ds['train'])
# Group by category
print(df.groupby('category').size())
# Find longest-running commands
print(df.nlargest(5, 'duration')[['command', 'duration']])
# Analyze strace patterns
for example in ds['train']:
if 'openat' in example['strace']:
print(f"{example['command']} opens files")
```
#### Extract specific syscalls
```python
import re
def extract_syscalls(strace_output):
"""Extract syscall names from strace output."""
pattern = r'\d+\s+[\d:.]+\s+(\w+)\('
return list(set(re.findall(pattern, strace_output)))
# Find all syscalls used by cat
cat_example = [ex for ex in ds['train'] if ex['id'] == 'cat_simple'][0]
syscalls = extract_syscalls(cat_example['strace'])
print(f"cat uses these syscalls: {syscalls}")
```
## Limitations
- Traces captured on a specific Linux system (kernel version may affect syscalls)
- Limited to common command-line utilities
- No multi-threaded or complex concurrent workloads
- Dataset size: 357 traces (medium-sized dataset)
## Future Work
- Add more utilities and use cases
- Include long-running processes
- Multi-threaded application traces
- Different input sizes for scalability analysis
- Traces from different Linux distributions/kernels
## Citation
If you use this dataset in your research, please cite:
```bibtex
@dataset{strace_traces_2025,
title={Linux Strace Traces Dataset},
author={Andrew Fasano},
year={2025},
publisher={Hugging Face},
howpublished={\url{https://huggingface.co/datasets/andrew000/straces}}
}
```
## License
MIT License - See LICENSE file for details
## Acknowledgments
Generated using the `strace` utility on Linux. All traces are from standard open-source utilities.