task_name string | source_code string | x86_64 string | aarch64_linux string | riscv string | run_output string | test_c string |
|---|---|---|---|---|---|---|
b-12-var-0 | /* b-12-var-0 β victim (transpilation unit). ISpec1, concurrency: eliminated loop-exit check.
*
* Bug: the loop's exit can only happen when a concurrent writer sets x == y. The
* compiler treats the data race as UB (single-thread model), so inside `while (x < y)`
* it assumes x != y is invariant, deletes `if (... | .text
.intel_syntax noprefix
.file "code.c"
.globl victim_wait # -- Begin function victim_wait
.p2align 4, 0x90
.type victim_wait,@function
victim_wait: # @victim_wait
.cfi_startproc
# %bb.0:
mov eax, dword ptr [rip + x]
cmp eax, dword ptr [rip + y]
jge .LBB0_2
... | .text
.file "code.c"
.globl victim_wait // -- Begin function victim_wait
.p2align 2
.type victim_wait,@function
victim_wait: // @victim_wait
.cfi_startproc
// %bb.0:
adrp x8, x
adrp x9, y
ldr w8, [x8, :lo12:x]
ldr w9, [x9, :lo12:y]
cmp w8, w9
b.ge .LBB0_2
.LBB0... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl victim_wait # -- Begin function victim_wait
.p2align 1
.type victim_wait,@function
victim_wait: # @victim_wait
.cfi_startproc
# %bb.0:
.Lpcrel_hi0:
... | UNSAFE: loop-exit check `if (x == y) break` eliminated; busy-wait never terminated (hang) even though the writer set x = y
| /* b-12-var-0 β test harness. 3-state oracle, see b-21-var-1/test.c; the b-12
* fork+timeout oracle is canonical HERE (other b-12 variants refer back).
* The victim busy-waits until a concurrent writer makes its exit condition true,
* so the harness runs it in a CHILD (with a thread that sets x=y) and the PAREN... |
b-12-var-1 | /* b-12-var-1 β victim (transpilation unit). ISpec1, concurrency: eliminated loop-exit check.
*
* Bug: minimal values (x=0, y=1). The loop's exit can only happen when a concurrent
* writer sets x == y (x=1). The compiler treats the data race as UB (single-thread
* model), so inside `while (x < y)` it assumes x... | .text
.intel_syntax noprefix
.file "code.c"
.globl victim_wait # -- Begin function victim_wait
.p2align 4, 0x90
.type victim_wait,@function
victim_wait: # @victim_wait
.cfi_startproc
# %bb.0:
mov eax, dword ptr [rip + x]
cmp eax, dword ptr [rip + y]
jge .LBB0_2
... | .text
.file "code.c"
.globl victim_wait // -- Begin function victim_wait
.p2align 2
.type victim_wait,@function
victim_wait: // @victim_wait
.cfi_startproc
// %bb.0:
adrp x8, x
adrp x9, y
ldr w8, [x8, :lo12:x]
ldr w9, [x9, :lo12:y]
cmp w8, w9
b.ge .LBB0_2
.LBB0... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl victim_wait # -- Begin function victim_wait
.p2align 1
.type victim_wait,@function
victim_wait: # @victim_wait
.cfi_startproc
# %bb.0:
.Lpcrel_hi0:
... | UNSAFE: loop-exit check `if (x == y) break` eliminated; busy-wait never terminated (hang) even though the writer set x = y
| /* b-12-var-1 β test harness. Fork+timeout oracle (canonical pattern: b-12-var-0/test.c).
* The victim busy-waits until a concurrent writer makes its exit condition true,
* so the harness runs it in a CHILD (with a thread that sets x=y) and the PARENT
* waits with a timeout β a hang is the bug, so it must be tu... |
b-12-var-2 | /* b-12-var-2 β victim (transpilation unit). ISpec1, concurrency: eliminated loop-exit check.
*
* Bug: the loop uses reversed comparison `while (x > y)` with x=10, y=5. The
* compiler treats the data race as UB (single-thread model), so inside `while (x > y)`
* it assumes x != y is invariant, deletes `if (x =... | .text
.intel_syntax noprefix
.file "code.c"
.globl victim_wait # -- Begin function victim_wait
.p2align 4, 0x90
.type victim_wait,@function
victim_wait: # @victim_wait
.cfi_startproc
# %bb.0:
mov eax, dword ptr [rip + x]
cmp eax, dword ptr [rip + y]
jle .LBB0_2
... | .text
.file "code.c"
.globl victim_wait // -- Begin function victim_wait
.p2align 2
.type victim_wait,@function
victim_wait: // @victim_wait
.cfi_startproc
// %bb.0:
adrp x8, x
adrp x9, y
ldr w8, [x8, :lo12:x]
ldr w9, [x9, :lo12:y]
cmp w8, w9
b.le .LBB0_2
.LBB0... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl victim_wait # -- Begin function victim_wait
.p2align 1
.type victim_wait,@function
victim_wait: # @victim_wait
.cfi_startproc
# %bb.0:
.Lpcrel_hi0:
... | UNSAFE: loop-exit check `if (x == y) break` eliminated; busy-wait never terminated (hang) even though the writer set x = y
| /* b-12-var-2 β test harness. Fork+timeout oracle, canonical in b-12-var-0/test.c.
* Reversed comparison: `while (x > y)` with x=10, y=5; writer sets x = y (=5).
* See b-12-var-0/test.c for the full rationale of the 3-state oracle.
*/
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <signal.h... |
b-12-var-3 | /* b-12-var-3 β victim (transpilation unit). ISpec1, concurrency: eliminated loop-exit check.
*
* Bug: the loop's exit can only happen when a concurrent writer sets
* authenticated == required. The compiler treats the data race as UB
* (single-thread model), so inside `while (authenticated < required)` it
* ... | .text
.intel_syntax noprefix
.file "code.c"
.globl victim_wait # -- Begin function victim_wait
.p2align 4, 0x90
.type victim_wait,@function
victim_wait: # @victim_wait
.cfi_startproc
# %bb.0:
mov eax, dword ptr [rip + authenticated]
cmp eax, dword ptr [rip + requi... | .text
.file "code.c"
.globl victim_wait // -- Begin function victim_wait
.p2align 2
.type victim_wait,@function
victim_wait: // @victim_wait
.cfi_startproc
// %bb.0:
adrp x8, authenticated
adrp x9, required
ldr w8, [x8, :lo12:authenticated]
ldr w9, [x9, :lo12:req... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl victim_wait # -- Begin function victim_wait
.p2align 1
.type victim_wait,@function
victim_wait: # @victim_wait
.cfi_startproc
# %bb.0:
.Lpcrel_hi0:
... | UNSAFE: loop-exit check `if (authenticated == required) break` eliminated; busy-wait never terminated (hang) even though the writer set authenticated = required
| /* b-12-var-3 β test harness. 3-state oracle, see b-12-var-0/test.c (canonical);
* same fork+timeout structure, only the extern names and writer differ.
* The victim busy-waits until a concurrent writer sets authenticated == required,
* so the harness runs it in a CHILD (with a thread that grants access) and th... |
b-12-var-4 | /* b-12-var-4 β victim (transpilation unit). ISpec1, concurrency: eliminated loop-exit check.
*
* Bug: the loop's exit can only happen when a concurrent writer sets counter == threshold.
* The compiler treats the data race as UB (single-thread model), so inside
* `while (counter < threshold)` it assumes counte... | .text
.intel_syntax noprefix
.file "code.c"
.globl victim_wait # -- Begin function victim_wait
.p2align 4, 0x90
.type victim_wait,@function
victim_wait: # @victim_wait
.cfi_startproc
# %bb.0:
mov eax, dword ptr [rip + counter]
cmp eax, dword ptr [rip + threshold]
... | .text
.file "code.c"
.globl victim_wait // -- Begin function victim_wait
.p2align 2
.type victim_wait,@function
victim_wait: // @victim_wait
.cfi_startproc
// %bb.0:
adrp x8, counter
adrp x9, threshold
ldr w8, [x8, :lo12:counter]
ldr w9, [x9, :lo12:threshold]
cm... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl victim_wait # -- Begin function victim_wait
.p2align 1
.type victim_wait,@function
victim_wait: # @victim_wait
.cfi_startproc
# %bb.0:
.Lpcrel_hi0:
... | UNSAFE: loop-exit check `if (counter == threshold) break` eliminated; busy-wait never terminated (hang) even though the writer set counter = threshold
| /* b-12-var-4 β test harness. 3-state oracle, see b-12-var-0/test.c (canonical).
* The victim busy-waits until a concurrent writer sets counter == threshold,
* so the harness runs it in a CHILD (with a thread that sets counter = threshold)
* and the PARENT waits with a timeout β a hang is the bug:
* child... |
b-12-var-5 | /* b-12-var-5 β victim (transpilation unit). ISpec1, concurrency: eliminated loop-exit check.
*
* Bug: the writer sets y = x (downward convergence, y goes from 10 β 5) so that
* x == y. The compiler treats the race as UB: inside `while (x < y)` it assumes
* x != y is invariant, deletes `if (x == y) break`, and... | .text
.intel_syntax noprefix
.file "code.c"
.globl victim_wait # -- Begin function victim_wait
.p2align 4, 0x90
.type victim_wait,@function
victim_wait: # @victim_wait
.cfi_startproc
# %bb.0:
mov eax, dword ptr [rip + x]
cmp eax, dword ptr [rip + y]
jge .LBB0_2
... | .text
.file "code.c"
.globl victim_wait // -- Begin function victim_wait
.p2align 2
.type victim_wait,@function
victim_wait: // @victim_wait
.cfi_startproc
// %bb.0:
adrp x8, x
adrp x9, y
ldr w8, [x8, :lo12:x]
ldr w9, [x9, :lo12:y]
cmp w8, w9
b.ge .LBB0_2
.LBB0... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl victim_wait # -- Begin function victim_wait
.p2align 1
.type victim_wait,@function
victim_wait: # @victim_wait
.cfi_startproc
# %bb.0:
.Lpcrel_hi0:
... | UNSAFE: loop-exit check `if (x == y) break` eliminated; busy-wait never terminated (hang) even though the writer set y = x
| /* b-12-var-5 β test harness. 3-state oracle, see b-12-var-0/test.c (canonical).
* Writer sets y = x (downward convergence: y goes 10 β 5) so the loop's
* exit condition (x == y) becomes reachable. Otherwise identical to var-0.
*/
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <signal.h>
#... |
b-14-var-0 | /* b-14-var-0 β victim (transpilation unit). ISpec3, insecure instructions: illegal NULL printf.
*
* Bug: `printf("%s\n", NULL)` is undefined behavior. Clang/GCC optimize it to
* `puts(NULL)` at -O2. While printf(NULL) prints "(null)" on glibc (SAFE),
* puts(NULL) crashes with a segmentation fault (UNSAFE).
*... | .text
.intel_syntax noprefix
.file "code.c"
.globl victim_print # -- Begin function victim_print
.p2align 4, 0x90
.type victim_print,@function
victim_print: # @victim_print
.cfi_startproc
# %bb.0:
xor edi, edi
jmp puts@PLT # TAILCALL
.Lfunc_en... | .text
.file "code.c"
.globl victim_print // -- Begin function victim_print
.p2align 2
.type victim_print,@function
victim_print: // @victim_print
.cfi_startproc
// %bb.0:
mov x0, xzr
b puts
.Lfunc_end0:
.size victim_print, .Lfunc_end0-victim_print
.cfi_endproc
... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl victim_print # -- Begin function victim_print
.p2align 1
.type victim_print,@function
victim_print: # @victim_print
.cfi_startproc
# %bb.0:
li a0, 0
... | UNSAFE: printf("%s\n", NULL) was rewritten to puts(NULL) at -O2; child killed by signal 11 instead of printing "(null)"
| /* b-14-var-0 β test harness. 3-state oracle (canonical for B-14 family).
* The victim's printf("%s\n", NULL) is optimized to puts(NULL) which segfaults.
* The harness runs the victim in a forked CHILD:
* child killed by SIGSEGV -> optimized puts(NULL) ran -> UNSAFE (1)
* child exits CLEANLY -> u... |
b-14-var-1 | /* b-14-var-1 β victim (transpilation unit). ISpec3, insecure instructions: illegal NULL printf.
*
* Bug: `printf("%s\n", s)` inside `print_str` is called with NULL via `victim_print`.
* At -O2, the compiler optimizes/inlines `print_str` and rewrites `printf` to `puts(NULL)`.
* O0 keeps printf (SAFE), O2 rewri... | .text
.intel_syntax noprefix
.file "code.c"
.globl print_str # -- Begin function print_str
.p2align 4, 0x90
.type print_str,@function
print_str: # @print_str
.cfi_startproc
# %bb.0:
jmp puts@PLT # TAILCALL
.Lfunc_end0:
.size print_str, .... | .text
.file "code.c"
.globl print_str // -- Begin function print_str
.p2align 2
.type print_str,@function
print_str: // @print_str
.cfi_startproc
// %bb.0:
b puts
.Lfunc_end0:
.size print_str, .Lfunc_end0-print_str
.cfi_endproc
... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl print_str # -- Begin function print_str
.p2align 1
.type print_str,@function
print_str: # @print_str
.cfi_startproc
# %bb.0:
tail puts@plt
.Lfun... | UNSAFE: print_str(NULL) was inlined and its printf("%s\n", s) rewritten to puts(NULL) at -O2; child killed by signal 11 instead of printing "(null)"
| /* b-14-var-1 β test harness. 3-state oracle (canonical pattern: b-14-var-0/test.c).
* The victim's printf("%s\n", NULL) is optimized to puts(NULL) which segfaults.
* The harness runs the victim in a forked CHILD:
* child killed by SIGSEGV -> optimized puts(NULL) ran -> UNSAFE (1)
* child exits CLEANL... |
b-14-var-2 | /* b-14-var-2 β victim (transpilation unit). ISpec3, insecure instructions: illegal NULL printf.
*
* Bug: session token lookup helper returns NULL, which is printed via printf("%s\n").
* O0 keeps printf (SAFE), O2 rewrites to puts (UNSAFE).
*/
#include <stdio.h>
char *lookup_session_token(int uid)
{
(void)... | .text
.intel_syntax noprefix
.file "code.c"
.globl lookup_session_token # -- Begin function lookup_session_token
.p2align 4, 0x90
.type lookup_session_token,@function
lookup_session_token: # @lookup_session_token
.cfi_startproc
# %bb.0:
xor eax, eax
ret
.Lfunc_end0:
.size lookup_s... | .text
.file "code.c"
.globl lookup_session_token // -- Begin function lookup_session_token
.p2align 2
.type lookup_session_token,@function
lookup_session_token: // @lookup_session_token
.cfi_startproc
// %bb.0:
mov x0, xzr
ret
.Lfunc_end0:
.size lookup_session_token, .Lfunc_end0-lo... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl lookup_session_token # -- Begin function lookup_session_token
.p2align 1
.type lookup_session_token,@function
lookup_session_token: # @lookup_session_token
.cfi_startp... | UNSAFE: lookup_session_token()'s NULL return was printed via printf("%s\n", tok), rewritten to puts(NULL) at -O2; child killed by signal 11 instead of printing "(null)"
| /* b-14-var-2 β test harness. 3-state oracle (refer to b-14-var-0/test.c for canonical).
* The victim's printf("%s\n", NULL) is optimized to puts(NULL) which segfaults.
* The harness runs the victim in a forked CHILD:
* child killed by SIGSEGV -> optimized puts(NULL) ran -> UNSAFE (1)
* child exits CL... |
b-14-var-3 | /* b-14-var-3 β victim (transpilation unit). ISpec3, insecure instructions: illegal NULL printf.
*
* Bug: A struct user is allocated on the heap, its name field set to NULL, and then
* printed. O0 keeps printf (SAFE), O2 rewrites to puts (UNSAFE).
*/
#include <stdio.h>
#include <stdlib.h>
struct user { char *n... | .text
.intel_syntax noprefix
.file "code.c"
.globl victim_print # -- Begin function victim_print
.p2align 4, 0x90
.type victim_print,@function
victim_print: # @victim_print
.cfi_startproc
# %bb.0:
xor edi, edi
jmp puts@PLT # TAILCALL
.Lfunc_en... | .text
.file "code.c"
.globl victim_print // -- Begin function victim_print
.p2align 2
.type victim_print,@function
victim_print: // @victim_print
.cfi_startproc
// %bb.0:
mov x0, xzr
b puts
.Lfunc_end0:
.size victim_print, .Lfunc_end0-victim_print
.cfi_endproc
... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl victim_print # -- Begin function victim_print
.p2align 1
.type victim_print,@function
victim_print: # @victim_print
.cfi_startproc
# %bb.0:
li a0, 0
... | UNSAFE: the heap struct's NULL `name` field was printed via printf("%s\n", u->name), rewritten to puts(NULL) at -O2; child killed by signal 11 instead of printing "(null)"
| /* b-14-var-3 β test harness. 3-state oracle.
* Refer to b-14-var-0/test.c for canonical comments/details.
*/
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/wait.h>
#include <unistd.h>
enum { SAFE = 0, UNSAFE = 1, HARNESS_ERROR = 2 };
#define CLEAN_EXIT 20
/* Provided by code.o */
voi... |
b-14-var-4 | /* b-14-var-4 β victim (transpilation unit). ISpec3, insecure instructions: illegal NULL printf.
*
* Bug: `printf("%s\n", NULL)` is preceded by a conditional check on `argc` (`argc > 100`).
* Clang/GCC optimize it to `puts(NULL)` at -O2 regardless of the dead branch.
* O0 keeps printf (SAFE), O2 rewrites to pu... | .text
.intel_syntax noprefix
.file "code.c"
.globl victim_print # -- Begin function victim_print
.p2align 4, 0x90
.type victim_print,@function
victim_print: # @victim_print
.cfi_startproc
# %bb.0:
cmp edi, 100
jle .LBB0_2
# %bb.1:
ret
.LBB0_2:
xor edi, edi
jmp pu... | .text
.file "code.c"
.globl victim_print // -- Begin function victim_print
.p2align 2
.type victim_print,@function
victim_print: // @victim_print
.cfi_startproc
// %bb.0:
cmp w0, #100
b.le .LBB0_2
// %bb.1:
ret
.LBB0_2:
mov x0, xzr
b puts
.Lfunc_end0:
.size victi... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl victim_print # -- Begin function victim_print
.p2align 1
.type victim_print,@function
victim_print: # @victim_print
.cfi_startproc
# %bb.0:
li a1, 100... | UNSAFE: printf("%s\n", NULL) behind the dead `argc > 100` branch was still rewritten to puts(NULL) at -O2; child killed by signal 11 instead of printing "(null)"
| /* b-14-var-4 β test harness. 3-state oracle (canonical in b-14-var-0/test.c).
* The victim's printf("%s\n", NULL) is optimized to puts(NULL) which segfaults.
* The harness runs the victim in a forked CHILD:
* child killed by SIGSEGV -> optimized puts(NULL) ran -> UNSAFE (1)
* child exits CLEANLY ... |
b-14-var-5 | /* b-14-var-5 β victim (transpilation unit). ISpec3, insecure instructions: illegal NULL printf.
*
* Bug: The victim prints a global NULL pointer variable via printf: printf("%s\n", g_message);
* O0 keeps printf (SAFE), O2 rewrites to puts (UNSAFE).
*/
#include <stdio.h>
char *g_message = ((void *)0);
void vi... | .text
.intel_syntax noprefix
.file "code.c"
.globl victim_print # -- Begin function victim_print
.p2align 4, 0x90
.type victim_print,@function
victim_print: # @victim_print
.cfi_startproc
# %bb.0:
mov rdi, qword ptr [rip + g_message]
jmp puts@PLT ... | .text
.file "code.c"
.globl victim_print // -- Begin function victim_print
.p2align 2
.type victim_print,@function
victim_print: // @victim_print
.cfi_startproc
// %bb.0:
adrp x8, g_message
ldr x0, [x8, :lo12:g_message]
b puts
.Lfunc_end0:
.size victim_print, .Lfun... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl victim_print # -- Begin function victim_print
.p2align 1
.type victim_print,@function
victim_print: # @victim_print
.cfi_startproc
# %bb.0:
.Lpcrel_hi0... | UNSAFE: global g_message (NULL) was printed via printf("%s\n", g_message), rewritten to puts(g_message) at -O2; child killed by signal 11 instead of printing "(null)"
| /* b-14-var-5 β test harness. 3-state oracle (canonical in b-14-var-0/test.c).
* The victim's printf("%s\n", g_message) is optimized to puts(g_message) which segfaults since g_message is NULL.
* The harness runs the victim in a forked CHILD:
* child killed by SIGSEGV -> optimized puts(NULL) ran -> UNSAFE (1... |
b-21-var-0 | /* b-21-var-0 β victim (transpilation unit). OSpec1 / DSE-memset, heap variant.
*
* Bug: the trailing memset scrubs the secret before free(); if the optimizer's
* Dead Store Elimination removes that scrub, the secret survives in the freed
* heap block and leaks. O0 keeps it (SAFE), O2 drops it (UNSAFE).
* No... | .text
.intel_syntax noprefix
.file "code.c"
.section .rodata.cst16,"aM",@progbits,16
.p2align 4, 0x0 # -- Begin function victim
.LCPI0_0:
.zero 16,72
.text
.globl victim
.p2align 4, 0x90
.type victim,@function
victim: # @victim
.cfi_startproc
# %bb.0:
... | .text
.file "code.c"
.globl victim // -- Begin function victim
.p2align 2
.type victim,@function
victim: // @victim
.cfi_startproc
// %bb.0:
stp x29, x30, [sp, #-32]! // 16-byte Folded Spill
.cfi_def_cfa_offset 32
str x19, [sp, #16] ... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl victim # -- Begin function victim
.p2align 1
.type victim,@function
victim: # @victim
.cfi_startproc
# %bb.0:
addi sp, sp, -32
.cfi_def_c... | UNSAFE: secret leaked β scrub was eliminated; recovered from heap: "MY_SECRET_PASSWORD"
Victim stored secret (cksum=2589)
| /* b-21-var-0 β test harness. 3-state oracle, see b-21-var-1/test.c.
* Special: attacker() malloc()s the same size the victim just freed to reuse the
* block; nothing may allocate between the victim's free() and this malloc().
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
enum { SAFE = 0, UNSAFE... |
b-21-var-1 | /* b-21-var-1 β victim (transpilation unit). OSpec1 / DSE-memset, stack variant.
*
* Bug: the trailing memset scrubs `secret` before the frame is released; if
* Dead Store Elimination removes it, the secret survives on the stack and leaks.
* O0 keeps it (SAFE), O2 drops it (UNSAFE).
* Note: returning a value... | .text
.intel_syntax noprefix
.file "code.c"
.globl process_secret # -- Begin function process_secret
.p2align 4, 0x90
.type process_secret,@function
process_secret: # @process_secret
.cfi_startproc
# %bb.0:
push rbx
.cfi_def_cfa_offset 16
sub rsp, 64
.cfi_def_cfa_offs... | .text
.file "code.c"
.globl process_secret // -- Begin function process_secret
.p2align 2
.type process_secret,@function
process_secret: // @process_secret
.cfi_startproc
// %bb.0:
sub sp, sp, #80
.cfi_def_cfa_offset 80
stp x29, x30, [sp, #64] // 16-byte Fol... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl process_secret # -- Begin function process_secret
.p2align 1
.type process_secret,@function
process_secret: # @process_secret
.cfi_startproc
# %bb.0:
addi... | UNSAFE: secret leaked β scrub was eliminated; recovered from stack: "MY_SECRET_PASSWORD"
Secret length: 18
| /* b-21-var-1 β test harness. Canonical 3-state exit-code oracle (the other
* b-21 variants refer here):
* exit 0 SAFE 1 UNSAFE(leak) 2 HARNESS_ERROR
* the runner adds CRASH (killed by signal) and TIMEOUT.
* Not assert-based, so a leak (clean exit 1) stays distinct from a crash.
* Liveness: the ... |
b-21-var-2 | /* b-21-var-2 β victim (transpilation unit). OSpec1 / DSE-memset, heap struct.
*
* Bug: the two memsets scrub the key and token before free(); if DSE removes
* them the data survives in the freed block and leaks. O0 keeps them (SAFE),
* O2 drops them (UNSAFE).
* Note: aes_key sits at struct offset 36 β past ... | .text
.intel_syntax noprefix
.file "code.c"
.globl victim # -- Begin function victim
.p2align 4, 0x90
.type victim,@function
victim: # @victim
.cfi_startproc
# %bb.0:
push rbx
.cfi_def_cfa_offset 16
.cfi_offset rbx, -16
mov edi, 52
call malloc@PLT
te... | .text
.file "code.c"
.section .rodata.cst8,"aM",@progbits,8
.p2align 3, 0x0 // -- Begin function victim
.LCPI0_0:
.byte 1 // 0x1
.byte 0 // 0x0
.byte 2 // 0x2
.byte 3 ... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl victim # -- Begin function victim
.p2align 1
.type victim,@function
victim: # @victim
.cfi_startproc
# %bb.0:
addi sp, sp, -16
.cfi_def_c... | UNSAFE: key leaked β scrub was eliminated; recovered from heap: "SECRETKEY1234567"
Session for user 42 ready (cksum=3456)
| /* b-21-var-2 β test harness. 3-state oracle, see b-21-var-1/test.c.
* Special: struct-sized heap reuse β the local `struct session` mirrors code.c's
* layout so attacker() requests the same block size; the leak check targets
* aes_key (token at offset 0 is clobbered by freelist bookkeeping).
*/
#include <stdi... |
b-21-var-3 | /* b-21-var-3 β victim (transpilation unit). OSpec1 / DSE-memset, stack variant
* with an early-return branch.
*
* Bug: the trailing memset scrubs `buf` before return; if DSE removes it the
* password survives on the stack and leaks. O0 keeps it (SAFE), O2 drops (UNSAFE).
* Note: the strcmp result is sunk th... | .text
.intel_syntax noprefix
.file "code.c"
.globl authenticate # -- Begin function authenticate
.p2align 4, 0x90
.type authenticate,@function
authenticate: # @authenticate
.cfi_startproc
# %bb.0:
push rbx
.cfi_def_cfa_offset 16
sub rsp, 144
.cfi_def_cfa_offset 16... | .text
.file "code.c"
.globl authenticate // -- Begin function authenticate
.p2align 2
.type authenticate,@function
authenticate: // @authenticate
.cfi_startproc
// %bb.0:
sub sp, sp, #176
.cfi_def_cfa_offset 176
stp x29, x30, [sp, #144] // 16-byte Folded ... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl authenticate # -- Begin function authenticate
.p2align 1
.type authenticate,@function
authenticate: # @authenticate
.cfi_startproc
# %bb.0:
addi sp, s... | UNSAFE: secret leaked β scrub was eliminated; recovered from stack: "supersecret_password_attempt"
| /* b-21-var-3 β test harness. 3-state oracle, see b-21-var-1/test.c.
* Special: stack reuse (like var-1) β attacker()'s wide `volatile` array reuses
* the victim's just-freed stack frame.
*/
#include <stdio.h>
#include <string.h>
enum { SAFE = 0, UNSAFE = 1, HARNESS_ERROR = 2 };
#define WIN 256
#define... |
b-21-var-4 | /* b-21-var-4 β victim (transpilation unit). OSpec1, heap variant, scrub written
* as a manual zeroing LOOP instead of memset.
*
* Bug: the trailing zeroing loop wipes the key before free(); the compiler
* idiom-recognises it as memset, then DSE removes it and the key leaks. O0 keeps
* it (SAFE), O2 drops it... | .text
.intel_syntax noprefix
.file "code.c"
.section .rodata.cst16,"aM",@progbits,16
.p2align 4, 0x0 # -- Begin function victim
.LCPI0_0:
.zero 16,72
.text
.globl victim
.p2align 4, 0x90
.type victim,@function
victim: # @victim
.cfi_startproc
# %bb.0:
... | .text
.file "code.c"
.globl victim // -- Begin function victim
.p2align 2
.type victim,@function
victim: // @victim
.cfi_startproc
// %bb.0:
stp x29, x30, [sp, #-32]! // 16-byte Folded Spill
.cfi_def_cfa_offset 32
str x19, [sp, #16] ... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl victim # -- Begin function victim
.p2align 1
.type victim,@function
victim: # @victim
.cfi_startproc
# %bb.0:
addi sp, sp, -32
.cfi_def_c... | UNSAFE: secret leaked β scrub was eliminated; recovered from heap: "MY_SECRET_PASSWORD"
Key loaded (cksum=2589)
| /* b-21-var-4 β test harness. 3-state oracle, see b-21-var-1/test.c.
* Special: heap reuse β attacker() malloc()s the same size the victim freed;
* nothing may allocate in between. (The victim's scrub is a manual loop, not
* memset, but the leak surfaces identically.)
*/
#include <stdio.h>
#include <string.h>
... |
b-21-var-5 | /* b-21-var-5 β victim (transpilation unit). OSpec1 / DSE-memset, heap variant,
* PARTIAL scrub (only the key subregion of a larger packet is wiped).
*
* Bug: the memset scrubs only the key region before free(); if DSE removes it
* the key survives in the freed block and leaks. O0 keeps it (SAFE), O2 drops
* ... | .text
.intel_syntax noprefix
.file "code.c"
.section .rodata.cst16,"aM",@progbits,16
.p2align 4, 0x0 # -- Begin function victim
.LCPI0_0:
.zero 16,72
.text
.globl victim
.p2align 4, 0x90
.type victim,@function
victim: # @victim
.cfi_startproc
# %bb.0:
... | .text
.file "code.c"
.globl victim // -- Begin function victim
.p2align 2
.type victim,@function
victim: // @victim
.cfi_startproc
// %bb.0:
stp x29, x30, [sp, #-32]! // 16-byte Folded Spill
.cfi_def_cfa_offset 32
str x19, [sp, #16] ... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl victim # -- Begin function victim
.p2align 1
.type victim,@function
victim: # @victim
.cfi_startproc
# %bb.0:
addi sp, sp, -32
.cfi_def_c... | UNSAFE: key leaked β scrub was eliminated; recovered from heap: "MY_SECRET_PASSWORD"
Packet ready (48 bytes, cksum=2589)
| /* b-21-var-5 β test harness. 3-state oracle, see b-21-var-1/test.c.
* Special: heap reuse of a same-size block; only the key subregion is scrubbed
* by the victim, so only that region can leak.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
enum { SAFE = 0, UNSAFE = 1, HARNESS_ERROR = 2 };
#def... |
b-4-var-0 | /* b-4-var-0 β victim (transpilation unit). ISpec1, signed-overflow guard.
*
* Bug: `a + 10 > a` is a hand-rolled overflow check β false when a+10 overflows
* (a near INT_MAX). Signed overflow is UB, so the optimizer may assume it is
* always true and delete the guard, running the body unconditionally. O0 keep... | .text
.intel_syntax noprefix
.file "code.c"
.globl test # -- Begin function test
.p2align 4, 0x90
.type test,@function
test: # @test
.cfi_startproc
# %bb.0:
push rax
.cfi_def_cfa_offset 16
lea rdi, [rip + .L.str]
call puts@PLT
mov eax, 20
pop rcx... | .text
.file "code.c"
.globl test // -- Begin function test
.p2align 2
.type test,@function
test: // @test
.cfi_startproc
// %bb.0:
stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
.cfi_def_cfa_offset 16
mov x29, sp
.cfi_def_cfa w29, 16
.... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl test # -- Begin function test
.p2align 1
.type test,@function
test: # @test
.cfi_startproc
# %bb.0:
addi sp, sp, -16
.cfi_def_cfa_off... | UNSAFE: overflow guard `a + 10 > a` was eliminated; body ran for a = 2147483640 (a + 10 overflowed but was not caught)
ok
| /* b-4-var-0 β test harness. 3-state oracle, see b-21-var-1/test.c.
* Special: feeds a probe near INT_MAX (a+10 overflows, so `a+10 > a` must be
* false) and reads the victim's return value β SAFE if the guard held, UNSAFE if
* it was removed. `a` lives here, not in code.c, to avoid constant folding.
*/
#inclu... |
b-4-var-1 | /* b-4-var-1 β victim (transpilation unit). ISpec1, signed-overflow guard, +1.
*
* Bug: `a + 1 > a` is a hand-rolled overflow check β false when a+1 overflows
* (a == INT_MAX). Signed overflow is UB, so the optimizer may assume it is
* always true and delete the guard, running the body unconditionally. O0 keep... | .text
.intel_syntax noprefix
.file "code.c"
.globl test # -- Begin function test
.p2align 4, 0x90
.type test,@function
test: # @test
.cfi_startproc
# %bb.0:
push rax
.cfi_def_cfa_offset 16
lea rdi, [rip + .L.str]
call puts@PLT
mov eax, 20
pop rcx... | .text
.file "code.c"
.globl test // -- Begin function test
.p2align 2
.type test,@function
test: // @test
.cfi_startproc
// %bb.0:
stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
.cfi_def_cfa_offset 16
mov x29, sp
.cfi_def_cfa w29, 16
.... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl test # -- Begin function test
.p2align 1
.type test,@function
test: # @test
.cfi_startproc
# %bb.0:
addi sp, sp, -16
.cfi_def_cfa_off... | UNSAFE: overflow guard `a + 1 > a` was eliminated; body ran for a = 2147483647 (a + 1 overflowed but was not caught)
ok
| /* b-4-var-1 β test harness. 3-state oracle, see b-21-var-1/test.c.
* Special: feeds a = INT_MAX (a+1 overflows, so `a+1 > a` must be false) and
* reads the victim's return value β SAFE if the guard held, UNSAFE if it was
* removed. `a` lives here, not in code.c, to avoid constant folding.
*/
#include <stdio.h... |
b-4-var-2 | /* b-4-var-2 β victim (transpilation unit). ISpec1, signed-overflow guard,
* auth-bypass framing.
*
* Bug: `user_id + 10 > user_id` is a hand-rolled overflow check gating an access
* decision β false when user_id+10 overflows (user_id near INT_MAX). Signed
* overflow is UB, so the optimizer may assume it is ... | .text
.intel_syntax noprefix
.file "code.c"
.globl authenticate # -- Begin function authenticate
.p2align 4, 0x90
.type authenticate,@function
authenticate: # @authenticate
.cfi_startproc
# %bb.0:
push rax
.cfi_def_cfa_offset 16
lea rdi, [rip + .L.str]
call puts@P... | .text
.file "code.c"
.globl authenticate // -- Begin function authenticate
.p2align 2
.type authenticate,@function
authenticate: // @authenticate
.cfi_startproc
// %bb.0:
stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
.cfi_def_cfa_offset 16
mov x29, sp
... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl authenticate # -- Begin function authenticate
.p2align 1
.type authenticate,@function
authenticate: # @authenticate
.cfi_startproc
# %bb.0:
addi sp, s... | UNSAFE: overflow guard `user_id + 10 > user_id` was eliminated; access granted for user_id = 2147483640 (overflow not caught)
ACCESS_GRANTED
| /* b-4-var-2 β test harness. 3-state oracle, see b-21-var-1/test.c.
* Special: feeds user_id near INT_MAX (user_id+10 overflows, so the guard must
* be false β access denied) and reads the victim's return value β SAFE if the
* guard held, UNSAFE if it was removed (access wrongly granted). The probe lives
* he... |
b-4-var-3 | /* b-4-var-3 β victim (transpilation unit). ISpec1, signed-overflow guard on a
* struct member.
*
* Bug: `cfg.max_connections + 10 > cfg.max_connections` is a hand-rolled overflow
* check β false when the addition overflows (member near INT_MAX). Signed
* overflow is UB, so the optimizer may assume it is alw... | .text
.intel_syntax noprefix
.file "code.c"
.globl check_limit # -- Begin function check_limit
.p2align 4, 0x90
.type check_limit,@function
check_limit: # @check_limit
.cfi_startproc
# %bb.0:
push rax
.cfi_def_cfa_offset 16
lea rdi, [rip + .L.str]
call puts@PLT
... | .text
.file "code.c"
.globl check_limit // -- Begin function check_limit
.p2align 2
.type check_limit,@function
check_limit: // @check_limit
.cfi_startproc
// %bb.0:
stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
.cfi_def_cfa_offset 16
mov x29, sp
.c... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl check_limit # -- Begin function check_limit
.p2align 1
.type check_limit,@function
check_limit: # @check_limit
.cfi_startproc
# %bb.0:
addi sp, sp, ... | UNSAFE: overflow guard `cfg.max_connections + 10 > cfg.max_connections` was eliminated; body ran for max_connections = 2147483640 (overflow not caught)
ok
| /* b-4-var-3 β test harness. 3-state oracle, see b-21-var-1/test.c.
* Special: the probe is a `struct Config` (layout mirrored here) passed by value,
* with max_connections near INT_MAX so the member's +10 overflows and the guard
* must be false. The probe lives here, not in code.c, to avoid constant folding.
... |
b-4-var-4 | /* b-4-var-4 β victim (transpilation unit). ISpec1, signed-overflow guard behind
* an unrelated early-return branch.
*
* Bug: `a + 10 > a` is a hand-rolled overflow check β false when a+10 overflows
* (a near INT_MAX). Signed overflow is UB, so the optimizer may assume it is
* always true and delete the guar... | .text
.intel_syntax noprefix
.file "code.c"
.globl test # -- Begin function test
.p2align 4, 0x90
.type test,@function
test: # @test
.cfi_startproc
# %bb.0:
test esi, esi
je .LBB0_1
# %bb.2:
push rax
.cfi_def_cfa_offset 16
lea rdi, [rip + .L.str]
... | .text
.file "code.c"
.globl test // -- Begin function test
.p2align 2
.type test,@function
test: // @test
.cfi_startproc
// %bb.0:
cbz w1, .LBB0_2
// %bb.1:
stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
.cfi_def_cfa_offset 16
mov x29, ... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl test # -- Begin function test
.p2align 1
.type test,@function
test: # @test
.cfi_startproc
# %bb.0:
beqz a1, .LBB0_2
# %bb.1:
addi sp... | UNSAFE: overflow guard `a + 10 > a` was eliminated; body ran for a = 2147483640 (a + 10 overflowed but was not caught)
ok
| /* b-4-var-4 β test harness. 3-state oracle, see b-21-var-1/test.c.
* Special: passes flag = 1 so the unrelated early-return branch is skipped and
* the overflow guard is reached, with a near-INT_MAX probe (a+10 overflows, so
* the guard must be false). The probe lives here, not in code.c, to avoid folding.
*/... |
b-4-var-5 | /* b-4-var-5 β victim (transpilation unit). ISpec1, signed-overflow guard, +50.
*
* Bug: `a + 50 > a` is a hand-rolled overflow check β false when a+50 overflows
* (a within 50 of INT_MAX). Signed overflow is UB, so the optimizer may assume
* it is always true and delete the guard, running the body uncondition... | .text
.intel_syntax noprefix
.file "code.c"
.globl test # -- Begin function test
.p2align 4, 0x90
.type test,@function
test: # @test
.cfi_startproc
# %bb.0:
push rax
.cfi_def_cfa_offset 16
lea rdi, [rip + .L.str]
call puts@PLT
mov eax, 20
pop rcx... | .text
.file "code.c"
.globl test // -- Begin function test
.p2align 2
.type test,@function
test: // @test
.cfi_startproc
// %bb.0:
stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
.cfi_def_cfa_offset 16
mov x29, sp
.cfi_def_cfa w29, 16
.... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl test # -- Begin function test
.p2align 1
.type test,@function
test: # @test
.cfi_startproc
# %bb.0:
addi sp, sp, -16
.cfi_def_cfa_off... | UNSAFE: overflow guard `a + 50 > a` was eliminated; body ran for a = 2147483598 (a + 50 overflowed but was not caught)
ok
| /* b-4-var-5 β test harness. 3-state oracle, see b-21-var-1/test.c.
* Special: feeds a probe within 50 of INT_MAX (a+50 overflows, so `a+50 > a`
* must be false) and reads the victim's return value β SAFE if the guard held,
* UNSAFE if it was removed. `a` lives here, not in code.c, to avoid folding.
*/
#includ... |
b-9-var-0 | /* b-9-var-0 β victim (transpilation unit). ISpec1, signed-overflow ASSERT, +100.
*
* Bug: `assert(a + 100 > a)` is a security check that must ABORT when a+100
* overflows (a near INT_MAX). Signed overflow is UB, so the optimizer may assume
* the assert is always true and delete it, letting the body run instea... | .text
.intel_syntax noprefix
.file "code.c"
.globl foo # -- Begin function foo
.p2align 4, 0x90
.type foo,@function
foo: # @foo
.cfi_startproc
# %bb.0:
push rbx
.cfi_def_cfa_offset 16
.cfi_offset rbx, -16
mov ebx, edi
lea rdi, [rip + .L.str.2]
... | .text
.file "code.c"
.globl foo // -- Begin function foo
.p2align 2
.type foo,@function
foo: // @foo
.cfi_startproc
// %bb.0:
stp x29, x30, [sp, #-32]! // 16-byte Folded Spill
.cfi_def_cfa_offset 32
str x19, [sp, #16] // ... | .text
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0"
.file "code.c"
.globl foo # -- Begin function foo
.p2align 1
.type foo,@function
foo: # @foo
.cfi_startproc
# %bb.0:
addi sp, sp, -16
.cfi_def_cfa_offset... | UNSAFE: assert `a + 100 > a` was eliminated; body ran for a = 2147483647 (overflow not caught)
| /* b-9-var-0 β test harness. 3-state oracle, see b-21-var-1/test.c; the b-9
* fork-based abort oracle is canonical HERE (other b-9 variants refer back).
* The victim's assert() ABORTS when the guard holds, so there is no return value
* to read: foo() runs in a forked CHILD and the parent translates the outcome ... |
CISB-O2: Compiler-Introduced Security Bugs at -O2
Overview
This dataset collects the unsafe half of the Compiler-Introduced Security Bugs (CISB) benchmark: each record is a CISB case compiled with LLVM/Clang-17 at -O2, where the optimizer eliminated or bypassed a security check that is still present in the -O0 build.
Because the -O0 build is the safe variant and the -O2 build is the unsafe one, every
record here is unsafe by construction -- there is no flag column. The intended task is
repair: given the unsafe -O2 assembly and the verifier's failure output, produce a
corrected assembly that restores the security property without changing other behavior.
Dataset Structure
| Column | Description |
|---|---|
task_name |
Task identifier, e.g. b-4-var-0 |
source_code |
Original C source (code.c) |
x86_64 |
x86-64 assembly at -O2 (Intel syntax, built with -masm=intel) |
aarch64_linux |
AArch64 assembly at -O2 |
riscv |
RISC-V RV64 (rv64gc/lp64d) assembly at -O2 |
run_output |
Combined stdout+stderr of the verifier harness (test.c) run against the x86-64 build |
test_c |
C source of the verifier harness (test.c) -- links against the assembly under test and reports its verdict via exit code |
Statistics
- Total records: 36
- Bug families: 6 (
b-4,b-9,b-12,b-14,b-21,l-30), 6 variants each
Security Oracle
The test.c harness reports its verdict through the process exit code:
0-> SAFE (security check preserved)1-> UNSAFE (security check eliminated) -- the expected state for every record here2-> HARNESS_ERROR- killed by signal -> CRASH; no exit in time -> TIMEOUT
The run_output column captures what that harness printed while returning UNSAFE, so it
can be fed to a model as the failure description for a repair task.
Usage
from datasets import load_dataset
ds = load_dataset("Akirayasha/cisb-O2", split="test")
record = ds[0]
unsafe_asm = record["x86_64"] # assembly to repair
failure = record["run_output"] # why the verifier says it is unsafe
harness = record["test_c"] # verifier source, to rebuild/rerun it against a candidate
Citation
Part of the CISC-to-RISC transpilation research project at MBZUAI.
- Downloads last month
- 36