Skip to content

Commit

Permalink
bpf: Dual-license the code as GPL-2.0 OR BSD-2-Clause (update markers)
Browse files Browse the repository at this point in the history
Relicense most code under the "bpf/" directory as dual-licensed under
the terms of both the GPL 2.0 license and the 2-Clause BSD license.

The files were processed with a sed script, as follows:

    $ cat license.sed
    # C sources and sed scripts that are GPL-2.0
    s=^\(\(#\|//\|/\*\) *SPDX-License-Identifier: \)GPL-2.0\(\( \*/\)\?\)$=\1(GPL-2.0-only OR BSD-2-Clause)\3=
    # License section for ELF objects
    s=\(__attribute__((section("license"), used)).*\)"GPL"=\1"Dual BSD/GPL"=

    $ find bpf -type f -print0 | xargs -0 -P8 sed -i -f ./license.sed

Files in bpf/include were left intact.

Signed-off-by: Kornilios Kourtis <[email protected]>
  • Loading branch information
kkourt committed Oct 24, 2023
1 parent c54e461 commit e27112c
Show file tree
Hide file tree
Showing 48 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion bpf/cgroup/bpf_cgroup_events.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Tetragon */

#ifndef _BPF_CGROUP_EVENTS__
Expand Down
2 changes: 1 addition & 1 deletion bpf/cgroup/bpf_cgroup_mkdir.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Tetragon */

#include "vmlinux.h"
Expand Down
2 changes: 1 addition & 1 deletion bpf/cgroup/bpf_cgroup_release.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Tetragon */

#include "vmlinux.h"
Expand Down
2 changes: 1 addition & 1 deletion bpf/cgroup/bpf_cgroup_rmdir.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Tetragon */

#include "vmlinux.h"
Expand Down
2 changes: 1 addition & 1 deletion bpf/lib/bpf_cgroup.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Tetragon */

#ifndef __BPF_CGROUP_
Expand Down
2 changes: 1 addition & 1 deletion bpf/lib/bpf_cred.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Tetragon */

#ifndef __BPF_CRED_
Expand Down
2 changes: 1 addition & 1 deletion bpf/lib/bpf_event.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef __BPF_EVENT_H
Expand Down
2 changes: 1 addition & 1 deletion bpf/lib/bpf_helpers.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef __BPF_HELPERS_
Expand Down
2 changes: 1 addition & 1 deletion bpf/lib/bpf_task.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef _BPF_TASK_H
Expand Down
2 changes: 1 addition & 1 deletion bpf/lib/common.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

#ifndef _MSG_COMMON__
#define _MSG_COMMON__
Expand Down
2 changes: 1 addition & 1 deletion bpf/lib/data_msg.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
/* Copyright Authors of Cilium */

#ifndef __DATA_MSG_
Expand Down
2 changes: 1 addition & 1 deletion bpf/lib/environ_conf.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Tetragon */

#ifndef __ENVIRON_CONF_
Expand Down
2 changes: 1 addition & 1 deletion bpf/lib/generic.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef _GENERIC__
Expand Down
2 changes: 1 addition & 1 deletion bpf/lib/globals.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef _GLOBALS__
Expand Down
2 changes: 1 addition & 1 deletion bpf/lib/msg_types.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef _MSG_TYPES_
Expand Down
2 changes: 1 addition & 1 deletion bpf/lib/process.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef _PROCESS__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/addr_lpm_maps.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef ADDR_LPM_MAPS_H__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/argfilter_maps.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef ARGFILTER_MAPS_H__
Expand Down
4 changes: 2 additions & 2 deletions bpf/process/bpf_execve_bprm_commit_creds.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Tetragon */

#include "vmlinux.h"
Expand All @@ -8,7 +8,7 @@
#include "common.h"
#include "process.h"

char _license[] __attribute__((section("license"), used)) = "GPL";
char _license[] __attribute__((section("license"), used)) = "Dual BSD/GPL";

/*
* Process execution is installing the new credentials and security attributes
Expand Down
4 changes: 2 additions & 2 deletions bpf/process/bpf_execve_event.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#include "vmlinux.h"
Expand All @@ -9,7 +9,7 @@
#include "bpf_process_event.h"
#include "bpf_helpers.h"

char _license[] __attribute__((section("license"), used)) = "GPL";
char _license[] __attribute__((section("license"), used)) = "Dual BSD/GPL";

struct {
__uint(type, BPF_MAP_TYPE_PROG_ARRAY);
Expand Down
4 changes: 2 additions & 2 deletions bpf/process/bpf_exit.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#include "vmlinux.h"
#include "bpf_exit.h"
#include "bpf_tracing.h"

char _license[] __attribute__((section("license"), used)) = "GPL";
char _license[] __attribute__((section("license"), used)) = "Dual BSD/GPL";

/*
* Hooking on acct_process kernel function, which is called on the task's
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/bpf_exit.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
/* Copyright Authors of Cilium */

#ifndef __EXIT_H__
Expand Down
4 changes: 2 additions & 2 deletions bpf/process/bpf_fork.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#include "vmlinux.h"
Expand All @@ -11,7 +11,7 @@
#include "environ_conf.h"
#include "bpf_process_event.h"

char _license[] __attribute__((section("license"), used)) = "GPL";
char _license[] __attribute__((section("license"), used)) = "Dual BSD/GPL";
#ifdef VMLINUX_KERNEL_VERSION
int _version __attribute__((section(("version")), used)) =
VMLINUX_KERNEL_VERSION;
Expand Down
4 changes: 2 additions & 2 deletions bpf/process/bpf_generic_kprobe.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#include "vmlinux.h"
Expand All @@ -15,7 +15,7 @@
#include "pfilter.h"
#include "policy_filter.h"

char _license[] __attribute__((section("license"), used)) = "GPL";
char _license[] __attribute__((section("license"), used)) = "Dual BSD/GPL";

struct {
__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
Expand Down
4 changes: 2 additions & 2 deletions bpf/process/bpf_generic_retkprobe.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#include "vmlinux.h"
Expand All @@ -12,7 +12,7 @@

#define MAX_FILENAME 8096

char _license[] __attribute__((section("license"), used)) = "GPL";
char _license[] __attribute__((section("license"), used)) = "Dual BSD/GPL";

struct {
__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
Expand Down
4 changes: 2 additions & 2 deletions bpf/process/bpf_generic_tracepoint.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#include "vmlinux.h"
Expand Down Expand Up @@ -324,4 +324,4 @@ generic_tracepoint_output(void *ctx)
return generic_output(ctx, (struct bpf_map_def *)&tp_heap);
}

char _license[] __attribute__((section("license"), used)) = "GPL";
char _license[] __attribute__((section("license"), used)) = "Dual BSD/GPL";
4 changes: 2 additions & 2 deletions bpf/process/bpf_generic_uprobe.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#include "vmlinux.h"
Expand All @@ -14,7 +14,7 @@
#include "generic_calls.h"
#include "pfilter.h"

char _license[] __attribute__((section("license"), used)) = "GPL";
char _license[] __attribute__((section("license"), used)) = "Dual BSD/GPL";

struct {
__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/bpf_killer.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "bpf_killer.h"

char _license[] __attribute__((section("license"), used)) = "GPL";
char _license[] __attribute__((section("license"), used)) = "Dual BSD/GPL";

#ifdef __MULTI_KPROBE
#define MAIN "kprobe.multi/killer"
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/bpf_killer.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef __KILLER_H__
Expand Down
4 changes: 2 additions & 2 deletions bpf/process/bpf_loader.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#include "vmlinux.h"
Expand All @@ -19,7 +19,7 @@ struct msg_loader {
void *pe;
};

char _license[] __attribute__((section("license"), used)) = "GPL";
char _license[] __attribute__((section("license"), used)) = "Dual BSD/GPL";

struct {
__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/bpf_process_event.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef _BPF_PROCESS_EVENT__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/data_event.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
/* Copyright Authors of Cilium */

#ifndef __DATA_EVENT_H__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/generic_calls.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef __GENERIC_CALLS_H__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/policy_filter.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef POLICY_FILTER_MAPS_H__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/retprobe_map.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef __RETPROBE_MAP_H__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/string_maps.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef STRING_MAPS_H__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/types/basic.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef __BASIC_H__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/types/bpfattr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef __BPFATTR_H__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/types/bpfmap.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef __BPFMAP_H__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/types/capabilities.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef __CAPABILITIES_H__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/types/module.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Tetragon */

#ifndef __LINUX_MODULE_H__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/types/operations.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef __OPERATIONS_H__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/types/perfevent.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef __PERFEVENT_H__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/types/skb.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef __SKB_H__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/types/sock.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef __SOCK_H__
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/types/tuple.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#ifndef __TUPLE_H__
Expand Down
4 changes: 2 additions & 2 deletions bpf/test/bpf_globals.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#include "vmlinux.h"
Expand All @@ -8,7 +8,7 @@
#include "bpf_task.h"
#include "globals.h"

char _license[] __attribute__((section("license"), used)) = "GPL";
char _license[] __attribute__((section("license"), used)) = "Dual BSD/GPL";

GLOBAL_U16 g_u16;
GLOBAL_I16 g_i16;
Expand Down
4 changes: 2 additions & 2 deletions bpf/test/bpf_lseek.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright Authors of Cilium */

#include "vmlinux.h"
Expand Down Expand Up @@ -35,7 +35,7 @@ struct sys_enter_lseek_args {
__u64 whence;
};

char _license[] __attribute__((section("license"), used)) = "GPL";
char _license[] __attribute__((section("license"), used)) = "Dual BSD/GPL";

__attribute__((section("tracepoint/sys_enter_lseek"), used)) int
test_lseek(struct sys_enter_lseek_args *ctx)
Expand Down

0 comments on commit e27112c

Please sign in to comment.