~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/bpf/progs/epilogue_exit.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/testing/selftests/bpf/progs/epilogue_exit.c (Architecture i386) and /tools/testing/selftests/bpf/progs/epilogue_exit.c (Architecture alpha)


  1 // SPDX-License-Identifier: GPL-2.0                 1 // SPDX-License-Identifier: GPL-2.0
  2 /* Copyright (c) 2024 Meta Platforms, Inc. and      2 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
  3                                                     3 
  4 #include <vmlinux.h>                                4 #include <vmlinux.h>
  5 #include <bpf/bpf_tracing.h>                        5 #include <bpf/bpf_tracing.h>
  6 #include "bpf_misc.h"                               6 #include "bpf_misc.h"
  7 #include "../bpf_testmod/bpf_testmod.h"             7 #include "../bpf_testmod/bpf_testmod.h"
  8 #include "../bpf_testmod/bpf_testmod_kfunc.h"       8 #include "../bpf_testmod/bpf_testmod_kfunc.h"
  9                                                     9 
 10 char _license[] SEC("license") = "GPL";            10 char _license[] SEC("license") = "GPL";
 11                                                    11 
 12 __success                                          12 __success
 13 /* save __u64 *ctx to stack */                     13 /* save __u64 *ctx to stack */
 14 __xlated("0: *(u64 *)(r10 -8) = r1")               14 __xlated("0: *(u64 *)(r10 -8) = r1")
 15 /* main prog */                                    15 /* main prog */
 16 __xlated("1: r1 = *(u64 *)(r1 +0)")                16 __xlated("1: r1 = *(u64 *)(r1 +0)")
 17 __xlated("2: r2 = *(u64 *)(r1 +0)")                17 __xlated("2: r2 = *(u64 *)(r1 +0)")
 18 __xlated("3: r3 = 0")                              18 __xlated("3: r3 = 0")
 19 __xlated("4: r4 = 1")                              19 __xlated("4: r4 = 1")
 20 __xlated("5: if r2 == 0x0 goto pc+10")             20 __xlated("5: if r2 == 0x0 goto pc+10")
 21 __xlated("6: r0 = 0")                              21 __xlated("6: r0 = 0")
 22 __xlated("7: *(u64 *)(r1 +0) = r3")                22 __xlated("7: *(u64 *)(r1 +0) = r3")
 23 /* epilogue */                                     23 /* epilogue */
 24 __xlated("8: r1 = *(u64 *)(r10 -8)")               24 __xlated("8: r1 = *(u64 *)(r10 -8)")
 25 __xlated("9: r1 = *(u64 *)(r1 +0)")                25 __xlated("9: r1 = *(u64 *)(r1 +0)")
 26 __xlated("10: r6 = *(u64 *)(r1 +0)")               26 __xlated("10: r6 = *(u64 *)(r1 +0)")
 27 __xlated("11: r6 += 10000")                        27 __xlated("11: r6 += 10000")
 28 __xlated("12: *(u64 *)(r1 +0) = r6")               28 __xlated("12: *(u64 *)(r1 +0) = r6")
 29 __xlated("13: r0 = r6")                            29 __xlated("13: r0 = r6")
 30 __xlated("14: r0 *= 2")                            30 __xlated("14: r0 *= 2")
 31 __xlated("15: exit")                               31 __xlated("15: exit")
 32 /* 2nd part of the main prog after the first e     32 /* 2nd part of the main prog after the first exit */
 33 __xlated("16: *(u64 *)(r1 +0) = r4")               33 __xlated("16: *(u64 *)(r1 +0) = r4")
 34 __xlated("17: r0 = 1")                             34 __xlated("17: r0 = 1")
 35 /* Clear the r1 to ensure it does not have         35 /* Clear the r1 to ensure it does not have
 36  * off-by-1 error and ensure it jumps back to      36  * off-by-1 error and ensure it jumps back to the
 37  * beginning of epilogue which initializes         37  * beginning of epilogue which initializes
 38  * the r1 with the ctx ptr.                        38  * the r1 with the ctx ptr.
 39  */                                                39  */
 40 __xlated("18: r1 = 0")                             40 __xlated("18: r1 = 0")
 41 __xlated("19: gotol pc-12")                        41 __xlated("19: gotol pc-12")
 42 SEC("struct_ops/test_epilogue_exit")               42 SEC("struct_ops/test_epilogue_exit")
 43 __naked int test_epilogue_exit(void)               43 __naked int test_epilogue_exit(void)
 44 {                                                  44 {
 45         asm volatile (                             45         asm volatile (
 46         "r1 = *(u64 *)(r1 +0);"                    46         "r1 = *(u64 *)(r1 +0);"
 47         "r2 = *(u64 *)(r1 +0);"                    47         "r2 = *(u64 *)(r1 +0);"
 48         "r3 = 0;"                                  48         "r3 = 0;"
 49         "r4 = 1;"                                  49         "r4 = 1;"
 50         "if r2 == 0 goto +3;"                      50         "if r2 == 0 goto +3;"
 51         "r0 = 0;"                                  51         "r0 = 0;"
 52         "*(u64 *)(r1 + 0) = r3;"                   52         "*(u64 *)(r1 + 0) = r3;"
 53         "exit;"                                    53         "exit;"
 54         "*(u64 *)(r1 + 0) = r4;"                   54         "*(u64 *)(r1 + 0) = r4;"
 55         "r0 = 1;"                                  55         "r0 = 1;"
 56         "r1 = 0;"                                  56         "r1 = 0;"
 57         "exit;"                                    57         "exit;"
 58         ::: __clobber_all);                        58         ::: __clobber_all);
 59 }                                                  59 }
 60                                                    60 
 61 SEC(".struct_ops.link")                            61 SEC(".struct_ops.link")
 62 struct bpf_testmod_st_ops epilogue_exit = {        62 struct bpf_testmod_st_ops epilogue_exit = {
 63         .test_epilogue = (void *)test_epilogue     63         .test_epilogue = (void *)test_epilogue_exit,
 64 };                                                 64 };
 65                                                    65 
 66 SEC("syscall")                                     66 SEC("syscall")
 67 __retval(20000)                                    67 __retval(20000)
 68 int syscall_epilogue_exit0(void *ctx)              68 int syscall_epilogue_exit0(void *ctx)
 69 {                                                  69 {
 70         struct st_ops_args args = { .a = 1 };      70         struct st_ops_args args = { .a = 1 };
 71                                                    71 
 72         return bpf_kfunc_st_ops_test_epilogue(     72         return bpf_kfunc_st_ops_test_epilogue(&args);
 73 }                                                  73 }
 74                                                    74 
 75 SEC("syscall")                                     75 SEC("syscall")
 76 __retval(20002)                                    76 __retval(20002)
 77 int syscall_epilogue_exit1(void *ctx)              77 int syscall_epilogue_exit1(void *ctx)
 78 {                                                  78 {
 79         struct st_ops_args args = {};              79         struct st_ops_args args = {};
 80                                                    80 
 81         return bpf_kfunc_st_ops_test_epilogue(     81         return bpf_kfunc_st_ops_test_epilogue(&args);
 82 }                                                  82 }
 83                                                    83 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php