diff --git a/pkg/sensors/tracing/enforcer.go b/pkg/sensors/tracing/enforcer.go index e5117f7bdb8..b576bef93cd 100644 --- a/pkg/sensors/tracing/enforcer.go +++ b/pkg/sensors/tracing/enforcer.go @@ -291,7 +291,8 @@ func (kp *enforcerPolicy) createEnforcerSensor( label, "kprobe", "enforcer"). - SetLoaderData(policyName) + SetLoaderData(policyName). + SetPolicy(policyName) progs = append(progs, load) case OverrideMethodFmodRet: @@ -304,7 +305,8 @@ func (kp *enforcerPolicy) createEnforcerSensor( "fmod_ret/security_task_prctl", fmt.Sprintf("fmod_ret_%s", syscallSym), "enforcer"). - SetLoaderData(policyName) + SetLoaderData(policyName). + SetPolicy(policyName) progs = append(progs, load) } default: diff --git a/pkg/sensors/tracing/genericlsm.go b/pkg/sensors/tracing/genericlsm.go index 78ede697b53..b5120807493 100644 --- a/pkg/sensors/tracing/genericlsm.go +++ b/pkg/sensors/tracing/genericlsm.go @@ -443,7 +443,8 @@ func createLsmSensorFromEntry(lsmEntry *genericLsm, "lsm/generic_lsm_output", lsmEntry.hook, "generic_lsm"). - SetLoaderData(lsmEntry.tableId) + SetLoaderData(lsmEntry.tableId). + SetPolicy(lsmEntry.policyName) progs = append(progs, loadOutput) load := program.Builder( @@ -452,7 +453,8 @@ func createLsmSensorFromEntry(lsmEntry *genericLsm, "lsm/generic_lsm_core", lsmEntry.hook, "generic_lsm"). - SetLoaderData(lsmEntry.tableId) + SetLoaderData(lsmEntry.tableId). + SetPolicy(lsmEntry.policyName) // Load ima program for hash calculating if lsmEntry.imaProgLoad { @@ -465,7 +467,8 @@ func createLsmSensorFromEntry(lsmEntry *genericLsm, "lsm.s/generic_lsm_ima_"+loadProgImaType, lsmEntry.hook, "generic_lsm"). - SetLoaderData(lsmEntry.tableId) + SetLoaderData(lsmEntry.tableId). + SetPolicy(lsmEntry.policyName) progs = append(progs, loadIma) imaHashMap := program.MapBuilderProgram("ima_hash_map", loadIma) maps = append(maps, imaHashMap) diff --git a/pkg/sensors/tracing/generictracepoint.go b/pkg/sensors/tracing/generictracepoint.go index 667c0149c26..d0cb760b3ce 100644 --- a/pkg/sensors/tracing/generictracepoint.go +++ b/pkg/sensors/tracing/generictracepoint.go @@ -400,7 +400,7 @@ func createGenericTracepointSensor( "tracepoint/generic_tracepoint", pinProg, "generic_tracepoint", - ) + ).SetPolicy(policyName) err := tp.InitKernelSelectors(lists) if err != nil { diff --git a/pkg/sensors/tracing/genericuprobe.go b/pkg/sensors/tracing/genericuprobe.go index 2df495f6b73..1990dd3bc5a 100644 --- a/pkg/sensors/tracing/genericuprobe.go +++ b/pkg/sensors/tracing/genericuprobe.go @@ -277,7 +277,7 @@ func createGenericUprobeSensor( } if in.useMulti { - progs, maps, err = createMultiUprobeSensor(name, ids) + progs, maps, err = createMultiUprobeSensor(name, ids, policyName) } else { progs, maps, err = createSingleUprobeSensor(ids) } @@ -397,7 +397,7 @@ func multiUprobePinPath(sensorPath string) string { return sensors.PathJoin(sensorPath, "multi_kprobe") } -func createMultiUprobeSensor(sensorPath string, multiIDs []idtable.EntryID) ([]*program.Program, []*program.Map, error) { +func createMultiUprobeSensor(sensorPath string, multiIDs []idtable.EntryID, policyName string) ([]*program.Program, []*program.Map, error) { var progs []*program.Program var maps []*program.Map @@ -411,7 +411,8 @@ func createMultiUprobeSensor(sensorPath string, multiIDs []idtable.EntryID) ([]* "uprobe.multi/generic_uprobe", pinPath, "generic_uprobe"). - SetLoaderData(multiIDs) + SetLoaderData(multiIDs). + SetPolicy(policyName) progs = append(progs, load) @@ -465,7 +466,8 @@ func createUprobeSensorFromEntry(uprobeEntry *genericUprobe, fmt.Sprintf("%d-%s", uprobeEntry.tableId.ID, uprobeEntry.symbol), "generic_uprobe"). SetAttachData(attachData). - SetLoaderData(uprobeEntry) + SetLoaderData(uprobeEntry). + SetPolicy(uprobeEntry.policyName) progs = append(progs, load)