instruction
stringlengths
82
202
input
stringclasses
1 value
output
stringlengths
73
23.9M
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall2' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> struct { __uint(type, BPF_MAP_TYPE_PROG_ARRAY); __uint(max_entries, 5); __uint(key_size, sizeof(__u32)); __uint(value_size, sizeof(__u32)); } jmp_table SEC(".maps"); SEC("tc") int classifier_0(struct __sk_buff *skb) { b...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_value_or_null' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/value_or_null.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #define MAX_ENTRIES 11 struct test_val { unsigned int index; int foo[MAX_ENTRIES]; }; struct { __uint(type, BPF_MAP_TYPE_HAS...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/iters' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #include <stdbool.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "bpf_compiler.h" static volatile int zero = 0; int my_pid; int arr[256]; int small_arr[16] SEC(".data.small_ar...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_l4lb_noinline_dynptr' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2017 Facebook #include <stddef.h> #include <stdbool.h> #include <string.h> #include <linux/pkt_cls.h> #include <linux/bpf.h> #include <linux/in.h> #include <linux/if_ether.h> #include <linux/ip.h> #include <linux/ipv6.h> #include <linux/icmp.h> #include <linux/i...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/atomics' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <stdbool.h> #ifdef ENABLE_ATOMICS_TESTS bool skip_tests __attribute((__section__(".data"))) = false; #else bool skip_tests = true; #endif __u32 pid = 0; __u64 add64_value = 1; __u64 add6...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/mem_rdonly_untrusted' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_core_read.h> #include "bpf_misc.h" #include "../test_kmods/bpf_testmod_kfunc.h" SEC("tp_btf/sys_enter") __success __log_level(2) __msg("r8 = *(u64 *)(r7 +0) ; R7=ptr_nameidata(imm={{[0-9]+}}) R8=rdonly_untrusted_mem(sz=0)") __msg...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_task_local_data' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <errno.h> #include <bpf/bpf_helpers.h> #include "task_local_data.bpf.h" struct tld_keys { tld_key_t value0; tld_key_t value1; tld_key_t value2; tld_key_t value_not_exist; }; struct test_tld_struct { __u64 a; __u64 b; __u64 c; __u64 d; };...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/linked_list_fail' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_experimental.h" #include "linked_list.h" #define INIT \ struct map_value *v, *v2, *iv, *iv2; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/freplace_connect_v4_prog' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Facebook #include <linux/stddef.h> #include <linux/ipv6.h> #include <linux/bpf.h> #include <linux/in.h> #include <sys/socket.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> SEC("freplace/connect_v4_prog") int new_connect_v4_prog(struct bpf_soc...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/pyperf600_bpf_loop' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #define STACK_MAX_LEN 600 #define USE_BPF_LOOP #include "pyperf.h" ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_bits_iter' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2024 Yafang Shao <laoar.shao@gmail.com> */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "task_kfunc_common.h" char _license[] SEC("license") = "GPL"; int bpf_iter_bits_new(struct bpf_iter_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_bpf_fastcall' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "../../../include/linux/filter.h" #include "bpf_misc.h" #include <stdbool.h> #include "bpf_kfuncs.h" SEC("raw_tp") __arch_x86_64 __log_level(4) __msg("stack depth 8") __xlated("4: r5 = ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_jit_convergence' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" struct value_t { long long a[32]; }; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 1); __type(key, ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/fmod_ret_freplace' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> volatile __u64 test_fmod_ret = 0; SEC("fmod_ret/security_new_get_constant") int BPF_PROG(fmod_ret_test, long val, int ret) { test_fmod_ret = 1; return 120; } char _license[] SEC("license") = "GP...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bind_perm' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/stddef.h> #include <linux/bpf.h> #include <sys/types.h> #include <sys/socket.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> static __always_inline int bind_prog(struct bpf_sock_addr *ctx, int family) { struct bpf_sock *sk; sk = ctx->sk; if (!sk...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/freplace_int_with_void' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <linux/pkt_cls.h> #include <bpf/bpf_helpers.h> SEC("freplace/global_func2") void test_freplace_int_with_void(struct __sk_buff *skb) { } char _license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/sock_iter_batch' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2024 Meta #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include <bpf/bpf_endian.h> #include "bpf_tracing_net.h" #include "bpf_kfuncs.h" #define ATTR __always_inline #include "test_jhash.h" static bool ipv6_addr_loopback(con...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_detach' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include "../test_kmods/bpf_testmod.h" char _license[] SEC("license") = "GPL"; /* * This subprogram validates that libbpf handles the situation in which BPF * obje...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_ipv6_route' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <vmlinux.h> #include "bpf_tracing_net.h" #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; extern bool CONFIG_IPV6_SUBTREES __kconfig __weak; SEC("iter/ipv6_route") int dump_ipv6_route(struct bpf_iter__ipv6_route *...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_setsockopt_unix' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright Amazon.com Inc. or its affiliates. */ #include <vmlinux.h> #include "bpf_tracing_net.h" #include <bpf/bpf_helpers.h> #include <limits.h> #define AUTOBIND_LEN 6 char sun_path[AUTOBIND_LEN]; #define NR_CASES 5 int sndbuf_setsockopt[NR_CASES] = {-1, 0, 8192, INT_MAX ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/exhandler_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021, Oracle and/or its affiliates. */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> char _license[] SEC("license") = "GPL"; unsigned int exception_triggered; int test_pid; /* TRACE_EVENT(task_...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/getpeername_unix_prog' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #include "vmlinux.h" #include <string.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_kfuncs.h" __u8 SERVUN_REWRITE_ADDRESS[] = "\0bpf_cgroup_unix_test_rewrite"; SEC("cgroup/getpeernam...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_trace_ext' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #include <linux/bpf.h> #include <stdbool.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include <bpf/bpf_tracing.h> __u64 ext_called = 0; SEC("freplace/test_pkt_md_access") int test_pkt_md_access_new(struct __sk_buff *skb) { ext_ca...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/lwt_misc' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("lwt_xmit") __success __retval(0) int test_missing_dst(struct __sk_buff *skb) { struct iphdr iph; __builtin_memset(&iph, 0, sizeof(struct iphdr)); iph.ihl = 5; iph.version = 4; bpf_lwt_push_enca...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_skeleton' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019 Facebook */ #include <stdbool.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #define __read_mostly SEC(".data.read_mostly") struct s { int a; long long b; } __attribute__((packed)); /* .data section */ int in1 = -1; long long in2 = -1; /* .bs...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/pro_epilogue_with_kfunc' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */ #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "../test_kmods/bpf_testmod.h" #include "../test_kmods/bpf_testmod_kfunc.h" char _license[] SEC("license") = "GPL"; void __kfunc_btf_r...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_global_ptr_args' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> #include "bpf_misc.h" #include "xdp_metadata.h" #include "bpf_kfuncs.h" extern struct task_struct *bpf_ta...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/loop5' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #include <linux/bpf.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; SEC("socket") int while_true(volatile struct __sk_buff* skb) { int i = 0; while (1) { if (skb->len) i += 3; else i += 7; if (i == 9) bre...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/getsockname_unix_prog' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #include "vmlinux.h" #include <string.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_kfuncs.h" __u8 SERVUN_REWRITE_ADDRESS[] = "\0bpf_cgroup_unix_test_rewrite"; SEC("cgroup/getsocknam...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_nulled_out_cb' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include "../test_kmods/bpf_testmod.h" char _license[] SEC("license") = "GPL"; int rand; int arr[1]; SEC("struct_ops/test_1") int BPF_PROG(test_1_turn_off) { retur...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func_args' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> struct S { int v; }; struct S global_variable = {}; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 7); __type(key, __u32); __type(value, int); } values SEC(".maps"); static void save_value(__u32 index...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/dummy_st_ops_success' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2021. Huawei Technologies Co., Ltd */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; SEC("struct_ops/test_1") int BPF_PROG(test_1, struct bpf_dummy_ops_state *state) { int ret; /* Check...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kprobe_multi_session_cookie' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <stdbool.h> char _license[] SEC("license") = "GPL"; int pid = 0; __u64 test_kprobe_1_result = 0; __u64 test_kprobe_2_result = 0; __u64 test_kprobe_3_result = 0; /* * No tests in here, ju...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/tailcall_bpf2bpf4' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __uint(key_size, sizeof(__u32)); __uint(value_size, sizeof(__u32)); } nop_table SEC(".maps"); struct { __uint(type, BPF_MAP_TYPE_PROG_ARRAY); __uint(max...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func_deep_stack' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2026 Meta Platforms, Inc and affiliates. */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" /* * Macro tricks to tersely define for long non-recursive call chains. Add * computation to the functions prevent tail recursion from r...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/dmabuf_iter' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2025 Google LLC */ #include <vmlinux.h> #include <bpf/bpf_core_read.h> #include <bpf/bpf_helpers.h> /* From uapi/linux/dma-buf.h */ #define DMA_BUF_NAME_LEN 32 char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(key_size...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_bpf_map' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; SEC("iter/bpf_map") int dump_bpf_map(struct bpf_iter__bpf_map *ctx) { struct seq_file *seq = ctx->meta->seq; __u64 seq_num = ctx->meta->seq_num; struc...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_map_lock' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #include <linux/bpf.h> #include <linux/version.h> #include <bpf/bpf_helpers.h> #define VAR_NUM 16 struct hmap_elem { struct bpf_spin_lock lock; int var[VAR_NUM]; }; struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 1); __type(ke...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/get_func_ip_uprobe_test' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; unsigned long uprobe_trigger_body; __u64 test1_result = 0; SEC("uprobe//proc/self/exe:uprobe_trigger_body+1") int BPF_UPROBE(test1) { __u64 addr = bpf_get_f...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/user_ringbuf_success' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "test_user_ringbuf.h" char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_USER_RINGBUF); } user_ringbuf SEC...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_bpf_percpu_hash_map' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; struct key_t { int a; int b; int c; }; struct { __uint(type, BPF_MAP_TYPE_PERCPU_HASH); __uint(max_entries, 3); __typ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kprobe_multi_verifier' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <bpf/usdt.bpf.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; SEC("kprobe.session") __success int kprobe_session_return_0(struct pt_regs *ctx) { return 0; } SEC("kprobe....
Linux kernel'inin 'tools/testing/selftests/bpf/progs/local_storage' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright 2020 Google LLC. */ #include "vmlinux.h" #include <errno.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; #define DUMMY_STORAGE_VALUE 0xdeadbeef __u32 monitored_pid = 0; int inode_storage_result = -1; int ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/sendmsg_unix_prog' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #include "vmlinux.h" #include <string.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_core_read.h> #include "bpf_kfuncs.h" __u8 SERVUN_REWRITE_ADDRESS[] = "\0bpf_cgroup_unix_test_rewrite"; SEC("cgroup/sendmsg_un...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_default_trusted_ptr' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright 2026 Google LLC. */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "../test_kmods/bpf_testmod_kfunc.h" SEC("syscall") __success __retval(0) int test_default_trusted_ptr(void *ctx) { struct prog_t...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/udp_limit' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <sys/socket.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> int invocations = 0, in_use = 0; struct { __uint(type, BPF_MAP_TYPE_SK_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __type(key, int); __type(value, int); } sk_map SEC(".maps"); SEC("cgrou...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_tc_bpf' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <linux/if_ether.h> #include <linux/ip.h> /* Dummy prog to test TC-BPF API */ SEC("tc") int cls(struct __sk_buff *skb) { return 0; } /* Prog to verify tc-bpf without cap_sys_admin and cap_perfmon */ SEC("tcx/ingres...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/vrf_socket_lookup' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #include <linux/ip.h> #include <linux/in.h> #include <linux/if_ether.h> #include <linux/pkt_cls.h> #include <stdbool.h> int lookup_status; bool test_xdp; bool tcp_skc; #define CUR_NS BPF_F_CURRENT...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_id_ops_mapping1' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "../test_kmods/bpf_testmod.h" #include "../test_kmods/bpf_testmod_kfunc.h" char _license[] SEC("license") = "GPL"; #define bpf_kfunc_multi_st_ops_test_1(args) bpf_kfunc_multi_st_ops_test_1(args, ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_rdonly_maps' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #include <linux/ptrace.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" const struct { unsigned a[4]; /* * if the struct's size is multiple of 16, compiler will put it into * .rodata.cst16 section, which is not r...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/iters_css' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2023 Chuyi Zhou <zhouchuyi@bytedance.com> */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "bpf_experimental.h" char _license[] SEC("license") = "GPL"; pid_t target_pid; u64 root_cg_id, leaf_cg_i...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_assoc_reuse' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "../test_kmods/bpf_testmod.h" #include "../test_kmods/bpf_testmod_kfunc.h" char _license[] SEC("license") = "GPL"; #define MAP_A_MAGIC 1234 int test_err_a; int recur; /* * test_1_a is reused. T...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_task_file' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; int count = 0; int tgid = 0; int last_tgid = 0; int unique_tgid_count = 0; SEC("iter/task_file") int dump_task_file(struct bpf_iter__task_file *ctx) { ...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/lpm_trie' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0-only */ #ifndef __PROGS_LPM_TRIE_H #define __PROGS_LPM_TRIE_H struct trie_key { __u32 prefixlen; __u32 data; }; /* Benchmark operations */ enum { LPM_OP_NOOP = 0, LPM_OP_BASELINE, LPM_OP_LOOKUP, LPM_OP_INSERT, LPM_OP_UPDATE, LPM_OP_DELETE, LPM_OP_FREE }; /* * Retur...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_netlink' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <vmlinux.h> #include "bpf_tracing_net.h" #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; static __attribute__((noinline)) struct inode *SOCK_INODE(struct socket *socket) { return &container_of(socket, struct sock...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/metadata_used' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <linux/bpf.h> #include <bpf/bpf_helpers.h> volatile const char bpf_metadata_a[] SEC(".rodata") = "bar"; volatile const int bpf_metadata_b SEC(".rodata") = 2; SEC("cgroup_skb/egress") int prog(struct xdp_md *ctx) { return bpf_metadata_b ? 1 : 0; } char _license...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/core_kern_overflow' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_core_read.h> typedef int (*func_proto_typedef)(long); typedef int (*func_proto_typedef_nested1)(func_proto_typedef); typedef int (*func_proto_typedef_nested2)(func_proto_typedef_ne...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/fentry_recursive' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Red Hat, Inc. */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; /* Dummy fentry bpf prog for testing fentry attachment chains */ SEC("fentry/XXX") int BPF_PROG(recursive_attach, int...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/bpf_misc' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ #ifndef __BPF_MISC_H__ #define __BPF_MISC_H__ #define XSTR(s) STR(s) #define STR(s) #s /* Expand a macro and then stringize the expansion */ #define QUOTE(str) #str #define EXPAND_QUOTE(str) QUOTE(str) /* This set of attributes controls behavior of the * test_loader.c:tes...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func1' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2020 Facebook */ #include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #define MAX_STACK 260 static __attribute__ ((noinline)) int f0(int var, struct __sk_buff *skb) { asm volatile (""); return skb->len; } __att...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func17' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" __noinline int foo(int *p) { barrier_var(p); return p ? (*p = 42) : 0; } const volatile int i; SEC("tc") __failure __msg("Caller passes invalid args into func#1") int global_func17(struct __sk_buff...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/net_timestamping' alt sistemi için gerekli C kaynak kodunu implemente et.
```c #include "vmlinux.h" #include "bpf_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" #include "bpf_kfuncs.h" #include <errno.h> __u32 monitored_pid = 0; int nr_active; int nr_snd; int nr_passive; int nr_sched; int nr_txsw; int nr_ack; struct sk_stg { __u64 sendmsg_n...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/iter_buf_null_fail' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2026 Qi Tang */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; /* Verify that the verifier rejects direct access to nullable PTR_TO_BUF. */ SEC("iter/bpf_map_elem") __failure __msg("invalid mem ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/dummy_st_ops_fail' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; SEC("struct_ops.s/test_2") __failure __msg("attach to unsupported member...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_iter_ksym' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022, Oracle and/or its affiliates. */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> char _license[] SEC("license") = "GPL"; unsigned long last_sym_value = 0; static inline char to_lower(char c) { if (c >= 'A' && c <= 'Z') c += ('a' - 'A'); return c; ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/iters_testmod' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include "bpf_experimental.h" #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "../test_kmods/bpf_testmod_kfunc.h" char _license[] SEC("license") = "GPL"; SEC("raw_tp/sys_enter") __success int iter_next_trusted(const void *ctx) { struct task_s...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_ctx_sk_msg' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/ctx_sk_msg.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("sk_msg") __description("valid access family in SK_MSG") __success __naked void access_family_in_sk_msg(void) { asm volatile ("...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/iters_num' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ #include <limits.h> #include <linux/errno.h> #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include "bpf_misc.h" const volatile __s64 exp_empty_zero = 0 + 1; __s64 res_empty_zero; SEC("raw_tp/sys_enter") int nu...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/btf_ptr' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2020, Oracle and/or its affiliates. */ /* "undefine" structs in vmlinux.h, because we "override" them below */ #define btf_ptr btf_ptr___not_used #define BTF_F_COMPACT BTF_F_COMPACT___not_used #define BTF_F_NONAME BTF_F_NONAME___not_used #define BTF_F_PTR_RAW...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/dev_cgroup' alt sistemi için gerekli C kaynak kodunu implemente et.
```c /* Copyright (c) 2017 Facebook * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. */ #include <linux/bpf.h> #include <linux/version.h> #include <bpf/bpf_helpers.h> SEC("c...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_liveness_exp' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2026 Meta Platforms, Inc. and affiliates. */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" /* * Exponential complexity in analyze_subprog() liveness analysis. * * analyze_subprog() recurses into each call site that passes FP-deri...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/bpf_syscall_macro' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright 2022 Sony Group Corporation */ #include <vmlinux.h> #include <bpf/bpf_core_read.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" int arg1 = 0; unsigned long arg2 = 0; unsigned long arg3 = 0; unsigned long arg4_cx = 0; unsigned lon...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_link_pinning' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <stdbool.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> int in = 0; int out = 0; SEC("raw_tp/sys_enter") int raw_tp_prog(const void *ctx) { out = in; return 0; } SEC("tp_btf/sys_enter") int tp_btf_prog(const void *ctx) { ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_global_func11' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0-only #include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" struct S { int x; }; __noinline int foo(const struct S *s) { return s ? bpf_get_prandom_u32() < s->x : 0; } SEC("cgroup_skb/ingress") __failure __msg("Caller passes invalid ar...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/pyperf' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #include <linux/sched.h> #include <linux/ptrace.h> #include <stdint.h> #include <stddef.h> #include <stdbool.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "bpf_compiler.h" #define FUNCTION_NAME_LEN 64 #defin...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/stream' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */ #include <vmlinux.h> #include <bpf/bpf_tracing.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" #include "bpf_experimental.h" #include "bpf_arena_common.h" struct arr_elem { struct bpf_res_spin_lock lock; }; s...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_sockmap_listen' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2020 Cloudflare #include <errno.h> #include <stdbool.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> struct { __uint(type, BPF_MAP_TYPE_SOCKMAP); __uint(max_entries, 2); __type(key, __u32); __type(value, __u64); } sock_map SEC(".maps"); struct { ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_bounds_deduction_non_const' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" SEC("socket") __description("check deducing bounds from non-const, jmp64, <non_const> == <const>, 1") __success __retval(0) __naked void deducing_bounds_from_non_const_1(void) { asm volatile (" \ c...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/stacktrace_map_skip' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <vmlinux.h> #include <bpf/bpf_helpers.h> #define TEST_STACK_DEPTH 2 #define TEST_MAX_ENTRIES 16384 typedef __u64 stack_trace_t[TEST_STACK_DEPTH]; struct { __uint(type, BPF_MAP_TYPE_STACK_TRACE); __uint(max_entries, TEST_MAX_ENTRIES); __type(key, __u32); __type(va...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/cgrp_ls_recursion' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_CGRP_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __ty...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/timer_start_delete_race' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2026 Meta Platforms, Inc. and affiliates. */ #include <linux/bpf.h> #include <time.h> #include <bpf/bpf_helpers.h> #define ITER_CNT 2000 struct map_value { struct bpf_timer timer; }; struct { __uint(type, BPF_MAP_TYPE_ARRAY); __type(key, int); __type(valu...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kmem_cache_iter' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2024 Google */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_experimental.h" char _license[] SEC("license") = "GPL"; #define SLAB_NAME_MAX 32 struct kmem_cache_result { char name[SLAB_NAME_MAX]; long obj_size;...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_cls_redirect_dynptr' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause // Copyright (c) 2019, 2020 Cloudflare #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <string.h> #include <linux/bpf.h> #include <linux/icmp.h> #include <linux/icmpv6.h> #include <linux/if_ether.h> #include <linux/in.h> #include <linux/ip...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_ringbuf_overwrite' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2025. Huawei Technologies Co., Ltd */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_RINGBUF); __uint(map_flags, BPF_F_RB_OVERWRITE); } ringbuf SEC(".maps"...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/kprobe_multi' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include <stdbool.h> char _license[] SEC("license") = "GPL"; extern const void bpf_fentry_test1 __ksym; extern const void bpf_fentry_test2 __ksym; extern const void bpf_fentry_test3 __ksym; extern...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_stack_ptr' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/stack_ptr.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <limits.h> #include "bpf_misc.h" #define MAX_ENTRIES 11 struct test_val { unsigned int index; int foo[MAX_ENTRIES]; }; struct { __uint(type, ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/task_local_storage' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_TASK_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __type(key, int); __type(value,...
Linux işletim sistemi çekirdeği için 'tools/testing/selftests/bpf/progs/profiler.inc' yapılarının ve prototiplerinin bulunduğu C Header dosyasını yaz.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include <vmlinux.h> #include <bpf/bpf_core_read.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "profiler.h" #include "err.h" #include "bpf_experimental.h" #include "bpf_compiler.h" #include "bpf_misc.h" #ifndef NULL #de...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_pinning_invalid' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include <linux/bpf.h> #include <bpf/bpf_helpers.h> struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 1); __type(key, __u32); __type(value, __u64); __uint(pinning, 2); /* invalid */ } nopinmap3 SEC(".maps"); char _license[] SEC("license") = "GPL"; ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/netns_cookie_prog' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #include "vmlinux.h" #include <bpf/bpf_helpers.h> #define AF_INET6 10 struct { __uint(type, BPF_MAP_TYPE_SK_STORAGE); __uint(map_flags, BPF_F_NO_PREALLOC); __type(key, int); __type(value, int); } sockops_netns_cookies SEC(".maps"); struct { __uint(type, BPF_MAP_TYPE_SK...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/fexit_sleep' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2021 Facebook */ #include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "bpf_misc.h" char LICENSE[] SEC("license") = "GPL"; int pid = 0; int fentry_cnt = 0; int fexit_cnt = 0; SEC("fentry/" SYS_PREFIX "sys_nanosleep") int nano...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/struct_ops_multi_args' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2026 Varun R Mallya */ #include <vmlinux.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #include "../test_kmods/bpf_testmod.h" #include "bpf_misc.h" char _license[] SEC("license") = "GPL"; struct { __uint(type, BPF_MAP_TYPE_PROG_ARRAY); __uint...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/strobemeta_nounroll2' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) // Copyright (c) 2019 Facebook #define STROBE_MAX_INTS 2 #define STROBE_MAX_STRS 25 #define STROBE_MAX_MAPS 30 #define STROBE_MAX_MAP_ENTRIES 20 #define NO_UNROLL #include "strobemeta.h" ```
Linux kernel'inin 'tools/testing/selftests/bpf/progs/modify_return' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* * Copyright 2020 Google LLC. */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; static int sequence = 0; __s32 input_retval = 0; __u32 test_pid = 0; __u64 fentry_result = 0; SEC("fentry/bpf_modify...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/xdp_redirect_multi_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 #define KBUILD_MODNAME "foo" #include <string.h> #include <linux/in.h> #include <linux/if_ether.h> #include <linux/if_packet.h> #include <linux/ip.h> #include <linux/ipv6.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> /* One map use devmap, ...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_send_signal_kern' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 // Copyright (c) 2019 Facebook #include <vmlinux.h> #include <linux/version.h> #include <bpf/bpf_helpers.h> struct task_struct *bpf_task_from_pid(int pid) __ksym; void bpf_task_release(struct task_struct *p) __ksym; int bpf_send_signal_task(struct task_struct *task, int sig, en...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/test_btf_skc_cls_ingress' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2020 Facebook */ #include "bpf_tracing_net.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_endian.h> #ifndef ENOENT #define ENOENT 2 #endif struct sockaddr_in6 srv_sa6 = {}; struct sockaddr_in srv_sa4 = {}; __u16 listen_tp_sport = 0; __u16 req_sk_sport = 0;...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/verifier_map_ret_val' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Converted from tools/testing/selftests/bpf/verifier/map_ret_val.c */ #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include "../../../include/linux/filter.h" #include "bpf_misc.h" struct { __uint(type, BPF_MAP_TYPE_HASH); __uint(max_entries, 1); __type(key, long lo...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/lsm_bdev' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2026 Christian Brauner <brauner@kernel.org> */ /* * BPF LSM block device integrity tracker for dm-verity. * * Tracks block devices in a hashmap keyed by bd_dev. When dm-verity * calls security_bdev_setintegrity() during verity_preresume(), the * setintegr...
Linux kernel'inin 'tools/testing/selftests/bpf/progs/htab_mem_bench' alt sistemi için gerekli C kaynak kodunu implemente et.
```c // SPDX-License-Identifier: GPL-2.0 /* Copyright (C) 2023. Huawei Technologies Co., Ltd */ #include <stdbool.h> #include <errno.h> #include <linux/types.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> #define OP_BATCH 64 struct update_ctx { unsigned int from; unsigned int st...