brintos

brintos / linux-shallow public Read only

0
0
Text · 557 B · 50e6677 Raw
30 lines · c
1// SPDX-License-Identifier: GPL-2.02// Copyright (c) 2019 Facebook3#include <linux/sched.h>4#include <linux/ptrace.h>5#include <stdint.h>6#include <stddef.h>7#include <stdbool.h>8#include <linux/bpf.h>9#include <bpf/bpf_helpers.h>10#include <bpf/bpf_tracing.h>11 12char _license[] SEC("license") = "GPL";13 14SEC("raw_tracepoint/kfree_skb")15int nested_loops(volatile struct pt_regs* ctx)16{17	int i, j, sum = 0, m;18 19	for (j = 0; j < 300; j++)20		for (i = 0; i < j; i++) {21			if (j & 1)22				m = PT_REGS_RC(ctx);23			else24				m = j;25			sum += i * m;26		}27 28	return sum;29}30