1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (C) 2023 SUSE LLC */
4 #include <bpf/bpf_helpers.h>
8 __success __log_level(2)
9 __msg("mark_precise: frame0: regs=r2 stack= before 3: (bf) r1 = r10")
10 __msg("mark_precise: frame0: regs=r2 stack= before 2: (55) if r2 != 0xfffffff8 goto pc+2")
11 __msg("mark_precise: frame0: regs=r2 stack= before 1: (87) r2 = -r2")
12 __msg("mark_precise: frame0: regs=r2 stack= before 0: (b7) r2 = 8")
13 __naked int bpf_neg(void)
18 "if r2 != -8 goto 1f;"
28 __success __log_level(2)
29 __msg("mark_precise: frame0: regs=r2 stack= before 3: (bf) r1 = r10")
30 __msg("mark_precise: frame0: regs=r2 stack= before 2: (55) if r2 != 0x0 goto pc+2")
31 __msg("mark_precise: frame0: regs=r2 stack= before 1: (d4) r2 = le16 r2")
32 __msg("mark_precise: frame0: regs=r2 stack= before 0: (b7) r2 = 0")
33 __naked int bpf_end_to_le(void)
49 __success __log_level(2)
50 __msg("mark_precise: frame0: regs=r2 stack= before 3: (bf) r1 = r10")
51 __msg("mark_precise: frame0: regs=r2 stack= before 2: (55) if r2 != 0x0 goto pc+2")
52 __msg("mark_precise: frame0: regs=r2 stack= before 1: (dc) r2 = be16 r2")
53 __msg("mark_precise: frame0: regs=r2 stack= before 0: (b7) r2 = 0")
54 __naked int bpf_end_to_be(void)
68 #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \
69 (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \
70 defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \
74 __success __log_level(2)
75 __msg("mark_precise: frame0: regs=r2 stack= before 3: (bf) r1 = r10")
76 __msg("mark_precise: frame0: regs=r2 stack= before 2: (55) if r2 != 0x0 goto pc+2")
77 __msg("mark_precise: frame0: regs=r2 stack= before 1: (d7) r2 = bswap16 r2")
78 __msg("mark_precise: frame0: regs=r2 stack= before 0: (b7) r2 = 0")
79 __naked int bpf_end_bswap(void)
93 #endif /* v4 instruction */
96 __success __log_level(2)
98 * Without the bug fix there will be no history between "last_idx 3 first_idx 3"
99 * and "parent state regs=" lines. "R0_w=6" parts are here to help anchor
100 * expected log messages to the one specific mark_chain_precision operation.
102 * This is quite fragile: if verifier checkpointing heuristic changes, this
103 * might need adjusting.
105 __msg("2: (07) r0 += 1 ; R0_w=6")
106 __msg("3: (35) if r0 >= 0xa goto pc+1")
107 __msg("mark_precise: frame0: last_idx 3 first_idx 3 subseq_idx -1")
108 __msg("mark_precise: frame0: regs=r0 stack= before 2: (07) r0 += 1")
109 __msg("mark_precise: frame0: regs=r0 stack= before 1: (07) r0 += 1")
110 __msg("mark_precise: frame0: regs=r0 stack= before 4: (05) goto pc-4")
111 __msg("mark_precise: frame0: regs=r0 stack= before 3: (35) if r0 >= 0xa goto pc+1")
112 __msg("mark_precise: frame0: parent state regs= stack=: R0_rw=P4")
114 __naked int state_loop_first_last_equal(void)
121 /* every few iterations we'll have a checkpoint here with
122 * first_idx == last_idx, potentially confusing precision
125 "if r0 >= 10 goto l1_%=;" /* checkpoint + mark_precise */
133 char _license[] SEC("license") = "GPL";