MCPcopy
hub / github.com/cilium/ebpf / TestProgramAttachToKernel

Function TestProgramAttachToKernel

prog_test.go:696–772  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

694}
695
696func TestProgramAttachToKernel(t *testing.T) {
697 // See https://github.com/torvalds/linux/commit/290248a5b7d829871b3ea3c62578613a580a1744
698 testutils.SkipOnOldKernel(t, "5.5", "attach_btf_id")
699
700 tests := []struct {
701 attachTo string
702 programType ProgramType
703 attachType AttachType
704 flags uint32
705 }{
706 {
707 attachTo: "task_getpgid",
708 programType: LSM,
709 attachType: AttachLSMMac,
710 },
711 {
712 attachTo: "inet_dgram_connect",
713 programType: Tracing,
714 attachType: AttachTraceFEntry,
715 },
716 {
717 attachTo: "inet_dgram_connect",
718 programType: Tracing,
719 attachType: AttachTraceFExit,
720 },
721 {
722 attachTo: "bpf_modify_return_test",
723 programType: Tracing,
724 attachType: AttachModifyReturn,
725 },
726 {
727 attachTo: "kfree_skb",
728 programType: Tracing,
729 attachType: AttachTraceRawTp,
730 },
731 {
732 attachTo: "bpf_testmod_test_read",
733 programType: Tracing,
734 attachType: AttachTraceFEntry,
735 },
736 {
737 attachTo: "bpf_testmod_test_read",
738 programType: Tracing,
739 attachType: AttachTraceFExit,
740 },
741 {
742 attachTo: "bpf_testmod_test_read",
743 programType: Tracing,
744 attachType: AttachModifyReturn,
745 },
746 {
747 attachTo: "bpf_testmod_test_read",
748 programType: Tracing,
749 attachType: AttachTraceRawTp,
750 },
751 }
752 for _, test := range tests {
753 name := fmt.Sprintf("%s:%s", test.attachType, test.attachTo)

Callers

nothing calls this directly

Calls 6

SkipOnOldKernelFunction · 0.92
LoadImmFunction · 0.92
ReturnFunction · 0.92
requireTestmodFunction · 0.85
mustNewProgramFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…