/* eBPF example program: * * - Loads eBPF program * * The eBPF program loads a filter from file and attaches the * program to a cgroup using BPF_PROG_ATTACH */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include "libbpf.h" #include "bpf_load.h" static int usage(const char *argv0) { printf("Usage: %s cg-path filter-path [filter-id]\n", argv0); return EXIT_FAILURE; } int main(int argc, char **argv) { int cg_fd, ret, filter_id = 0; if (argc < 3) return usage(argv[0]); cg_fd = open(argv[1], O_DIRECTORY | O_RDONLY); if (cg_fd < 0) { printf("Failed to open cgroup path: '%s'\n", strerror(errno)); return EXIT_FAILURE; } if (load_bpf_file(argv[2])) return EXIT_FAILURE; printf("Output from kernel verifier:\n%s\n-------\n", bpf_log_buf); if (argc > 3) filter_id = atoi(argv[3]); if (filter_id > prog_cnt) { printf("Invalid program id; program not found in file\n"); return EXIT_FAILURE; } ret = bpf_prog_attach(prog_fd[filter_id], cg_fd, BPF_CGROUP_INET_SOCK_CREATE); if (ret < 0) { printf("Failed to attach prog to cgroup: '%s'\n", strerror(errno)); return EXIT_FAILURE; } return EXIT_SUCCESS; } ack net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiam R. Howlett <Liam.Howlett@Oracle.com>2017-01-17 10:59:03 -0500
committerDavid S. Miller <davem@davemloft.net>2017-01-30 14:27:54 -0800
commit047487241ff59374fded8c477f21453681f5995c (patch)
tree1c2616bd373ce5ea28aac2a53e32f5b5834901ce /net/rxrpc/utils.c
parent7a7dc961a28b965a0d0303c2e989df17b411708b (diff)
sparc64: Handle PIO & MEM non-resumable errors.
User processes trying to access an invalid memory address via PIO will receive a SIGBUS signal instead of causing a panic. Memory errors will receive a SIGKILL since a SIGBUS may result in a coredump which may attempt to repeat the faulting access. Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rxrpc/utils.c')