File size: 2,696 Bytes
ce2ebd5
6031a0e
727b3fe
6031a0e
 
727b3fe
6031a0e
727b3fe
 
 
 
 
 
 
6031a0e
727b3fe
ce2ebd5
6031a0e
fd9aabd
6031a0e
 
 
 
fd9aabd
 
 
6031a0e
 
 
 
 
fd9aabd
 
 
 
 
727b3fe
23200de
6031a0e
 
 
 
 
 
fd9aabd
 
 
 
 
 
6031a0e
 
 
 
 
 
 
 
 
23200de
 
 
6031a0e
 
 
 
 
 
 
fd9aabd
 
 
6031a0e
fd9aabd
6031a0e
fd9aabd
 
 
 
 
 
23200de
 
 
 
6031a0e
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
language:
  - en
license: mit
task_categories:
  - text-generation
tags:
  - assembly
  - transpilation
  - x86-to-arm
  - arm-to-x86
  - security
  - compiler-bugs
  - CISB
size_categories:
  - n<1K
---

# CISB-Bench LLVM-O2: Assembly Transpilation Benchmark

## Overview

This dataset is derived from the **Compiler-Introduced Security Bugs (CISB)** benchmark,
compiled with LLVM/Clang-17 at **-O2** optimization level. It supports **bidirectional
assembly transpilation** (x86-64 ↔ AArch64) and is designed for evaluating transpilation
models on security-critical code.

## Dataset Structure

| Column | Description |
|--------|-------------|
| `task_name` | Full task identifier including flag (e.g., `b-4-var-0-safe`, `b-4-var-0-unsafe`) |
| `flag` | `"safe"` or `"unsafe"` — whether the assembly preserves the security check |
| `source_code` | Original C source from `cisb-bench/<variant>/code.c` (shared by safe/unsafe pairs) |
| `x86_64` | x86-64 assembly (`code.s` from `.build_x86/`) |
| `aarch64_linux` | AArch64 assembly (`code.s` from `.build_arm_linux/`) |
| `test_c` | C source of the verifier harness (`test.c`) -- lets a consumer rebuild and rerun the verifier without needing local access to `benchmarks/cisb-bench-llvm-O2/` |
| `run_output` | Combined stdout+stderr of the verifier harness (`test.c`), run against the `x86_64` build |

## Statistics

- **Total records**: 72
- **Safe records**: 36
- **Unsafe records**: 36

## Transpilation Directions

This dataset supports both directions:
- **x86 → ARM**: Use `x86_64` as input, `aarch64_linux` as target
- **ARM → x86**: Use `aarch64_linux` as input, `x86_64` as target

## Security Oracle

The test harness returns exit codes:
- `0`**SAFE** (security check preserved)
- `1`**UNSAFE** (security check eliminated)
- `2`**HARNESS_ERROR** (transpilation error)
- `>128` → **CRASH**

The `run_output` column captures what the harness printed while producing that verdict for
the `safe`/`unsafe` `x86_64` build, so it can be fed to a model as additional context.

## Usage

```python
from datasets import load_dataset

ds = load_dataset("Akirayasha/cisb-bench-llvm-O2", split="test")

# Filter by flag
safe = ds.filter(lambda x: x["flag"] == "safe")
unsafe = ds.filter(lambda x: x["flag"] == "unsafe")

# x86 -> ARM transpilation
record = ds[0]
x86_input = record["x86_64"]
arm_target = record["aarch64_linux"]

# ARM -> x86 transpilation
arm_input = record["aarch64_linux"]
x86_target = record["x86_64"]

# Rebuild/rerun the verifier against a candidate
harness = record["test_c"]
failure = record["run_output"]
```

## Citation

Part of the CISC-to-RISC transpilation research project at MBZUAI.