Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,33 +1,89 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
-
|
| 7 |
-
|
| 8 |
-
-
|
| 9 |
-
|
| 10 |
-
-
|
| 11 |
-
|
| 12 |
-
-
|
| 13 |
-
|
| 14 |
-
-
|
| 15 |
-
dtype: string
|
| 16 |
-
- name: aarch64_linux
|
| 17 |
-
dtype: string
|
| 18 |
-
- name: riscv
|
| 19 |
-
dtype: string
|
| 20 |
-
- name: test_c
|
| 21 |
-
dtype: string
|
| 22 |
-
splits:
|
| 23 |
-
- name: test
|
| 24 |
-
num_bytes: 765634
|
| 25 |
-
num_examples: 10
|
| 26 |
-
download_size: 120241
|
| 27 |
-
dataset_size: 765634
|
| 28 |
-
configs:
|
| 29 |
-
- config_name: default
|
| 30 |
-
data_files:
|
| 31 |
-
- split: test
|
| 32 |
-
path: data/test-*
|
| 33 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: mit
|
| 5 |
+
task_categories:
|
| 6 |
+
- text-generation
|
| 7 |
+
tags:
|
| 8 |
+
- assembly
|
| 9 |
+
- security
|
| 10 |
+
- constant-time
|
| 11 |
+
- side-channels
|
| 12 |
+
- binsec
|
| 13 |
+
size_categories:
|
| 14 |
+
- n<1K
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
---
|
| 16 |
+
|
| 17 |
+
# RelBench-O2: Constant-Time Assembly at -O2
|
| 18 |
+
|
| 19 |
+
## Overview
|
| 20 |
+
|
| 21 |
+
This dataset collects the **rel_bench** constant-time programs, re-cut into one
|
| 22 |
+
self-contained program per record, compiled with LLVM/Clang-17 at **-O2** for three
|
| 23 |
+
targets, and checked for constant-timeness with `binsec -sse -checkct`.
|
| 24 |
+
|
| 25 |
+
Constant-time source code is not enough: the optimizer can reintroduce a secret-dependent
|
| 26 |
+
branch or memory access that the -O0 build does not have, and it does so *differently per
|
| 27 |
+
target*. The intended tasks are **transpilation** (translate the assembly to another ISA)
|
| 28 |
+
and **classification/repair** (decide whether a build leaks, and fix it if it does).
|
| 29 |
+
|
| 30 |
+
## Dataset Structure
|
| 31 |
+
|
| 32 |
+
| Column | Description |
|
| 33 |
+
|--------|-------------|
|
| 34 |
+
| `task_name` | Sample identifier, e.g. `ct_select_1` |
|
| 35 |
+
| `flag` | BinSec constant-time verdict: `secure`, `insecure`, or `unknown` -- the `x86_64` build's verdict |
|
| 36 |
+
| `flag_x86_64` | BinSec verdict for the x86-64 `-O2` build |
|
| 37 |
+
| `flag_aarch64_linux` | BinSec verdict for the AArch64 `-O2` build |
|
| 38 |
+
| `flag_riscv` | BinSec verdict for the RISC-V `-O2` build |
|
| 39 |
+
| `x86_64` | x86-64 assembly at -O2 (**Intel syntax**, built with `-masm=intel`) |
|
| 40 |
+
| `aarch64_linux` | AArch64 assembly at -O2 |
|
| 41 |
+
| `riscv` | RISC-V RV64 (`rv64gc`/`lp64d`) assembly at -O2 |
|
| 42 |
+
| `test_c` | C source of the BinSec harness (`test.c`) -- tags inputs secret/public through the `high_input_N` / `low_input_N` markers and calls the function under analysis |
|
| 43 |
+
|
| 44 |
+
## Statistics
|
| 45 |
+
|
| 46 |
+
- **Total records**: 10
|
| 47 |
+
|
| 48 |
+
| flag | count |
|
| 49 |
+
|---|---|
|
| 50 |
+
| `secure` | 7 |
|
| 51 |
+
| `insecure` | 3 |
|
| 52 |
+
|
| 53 |
+
## The constant-time oracle
|
| 54 |
+
|
| 55 |
+
Each build is analysed by BinSec's `checkct` plugin:
|
| 56 |
+
|
| 57 |
+
```bash
|
| 58 |
+
binsec -sse -checkct -sse-script "libsym.ini,checkct.cfg" -sse-depth 50000 test_bin
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
`libsym.ini` replaces the `high_input_N` markers with `secret` and the `low_input_N`
|
| 62 |
+
markers with `nondet` (public), so BinSec knows which bytes are secret. It then reports:
|
| 63 |
+
|
| 64 |
+
- `secure` -- no control flow or memory access depends on a secret
|
| 65 |
+
- `insecure` -- at least one secret-dependent branch or address was found
|
| 66 |
+
- `unknown` -- BinSec could not decide (path cut, depth limit, unresolved symbol)
|
| 67 |
+
|
| 68 |
+
**The verdict is per build.** The same program can be secure on one target and insecure on
|
| 69 |
+
another, because the three backends make different branch/`cmov`/`csel` choices at -O2.
|
| 70 |
+
This dataset's single `flag` column reports the `x86_64` build's verdict; the per-build verdicts are kept
|
| 71 |
+
in `flag_x86_64`, `flag_aarch64_linux` and `flag_riscv`.
|
| 72 |
+
|
| 73 |
+
## Usage
|
| 74 |
+
|
| 75 |
+
```python
|
| 76 |
+
from datasets import load_dataset
|
| 77 |
+
|
| 78 |
+
ds = load_dataset("Akirayasha/relbench_O2", split="test")
|
| 79 |
+
|
| 80 |
+
record = ds[0]
|
| 81 |
+
src_asm = record["x86_64"] # source-side assembly
|
| 82 |
+
tgt_asm = record["riscv"] # reference target-side assembly
|
| 83 |
+
leaky = record["flag_riscv"] == "insecure" # or flag / flag_x86_64 / flag_aarch64_linux
|
| 84 |
+
harness = record["test_c"] # rebuild + recheck a candidate against BinSec
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
## Citation
|
| 88 |
+
|
| 89 |
+
Part of the CISC-to-RISC transpilation research project at MBZUAI.
|