aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-09-06 17:45:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-06 17:45:08 -0400
commitaae3dbb4776e7916b6cd442d00159bea27a695c1 (patch)
treed074c5d783a81e7e2e084b1eba77f57459da7e37 /kernel/trace
parentec3604c7a5aae8953545b0d05495357009a960e5 (diff)
parent66bed8465a808400eb14562510e26c8818082cb8 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: 1) Support ipv6 checksum offload in sunvnet driver, from Shannon Nelson. 2) Move to RB-tree instead of custom AVL code in inetpeer, from Eric Dumazet. 3) Allow generic XDP to work on virtual devices, from John Fastabend. 4) Add bpf device maps and XDP_REDIRECT, which can be used to build arbitrary switching frameworks using XDP. From John Fastabend. 5) Remove UFO offloads from the tree, gave us little other than bugs. 6) Remove the IPSEC flow cache, from Florian Westphal. 7) Support ipv6 route offload in mlxsw driver. 8) Support VF representors in bnxt_en, from Sathya Perla. 9) Add support for forward error correction modes to ethtool, from Vidya Sagar Ravipati. 10) Add time filter for packet scheduler action dumping, from Jamal Hadi Salim. 11) Extend the zerocopy sendmsg() used by virtio and tap to regular sockets via MSG_ZEROCOPY. From Willem de Bruijn. 12) Significantly rework value tracking in the BPF verifier, from Edward Cree. 13) Add new jump instructions to eBPF, from Daniel Borkmann. 14) Rework rtnetlink plumbing so that operations can be run without taking the RTNL semaphore. From Florian Westphal. 15) Support XDP in tap driver, from Jason Wang. 16) Add 32-bit eBPF JIT for ARM, from Shubham Bansal. 17) Add Huawei hinic ethernet driver. 18) Allow to report MD5 keys in TCP inet_diag dumps, from Ivan Delalande. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1780 commits) i40e: point wb_desc at the nvm_wb_desc during i40e_read_nvm_aq i40e: avoid NVM acquire deadlock during NVM update drivers: net: xgene: Remove return statement from void function drivers: net: xgene: Configure tx/rx delay for ACPI drivers: net: xgene: Read tx/rx delay for ACPI rocker: fix kcalloc parameter order rds: Fix non-atomic operation on shared flag variable net: sched: don't use GFP_KERNEL under spin lock vhost_net: correctly check tx avail during rx busy polling net: mdio-mux: add mdio_mux parameter to mdio_mux_init() rxrpc: Make service connection lookup always check for retry net: stmmac: Delete dead code for MDIO registration gianfar: Fix Tx flow control deactivation cxgb4: Ignore MPS_TX_INT_CAUSE[Bubble] for T6 cxgb4: Fix pause frame count in t4_get_port_stats cxgb4: fix memory leak tun: rename generic_xdp to skb_xdp tun: reserve extra headroom only when XDP is set net: dsa: bcm_sf2: Configure IMP port TC2QOS mapping net: dsa: bcm_sf2: Advertise number of egress queues ...
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace_syscalls.c53
1 files changed, 51 insertions, 2 deletions
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index 74d9a86eccc0..9c4eef20301c 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -559,11 +559,29 @@ static DECLARE_BITMAP(enabled_perf_exit_syscalls, NR_syscalls);
559static int sys_perf_refcount_enter; 559static int sys_perf_refcount_enter;
560static int sys_perf_refcount_exit; 560static int sys_perf_refcount_exit;
561 561
562static int perf_call_bpf_enter(struct bpf_prog *prog, struct pt_regs *regs,
563 struct syscall_metadata *sys_data,
564 struct syscall_trace_enter *rec) {
565 struct syscall_tp_t {
566 unsigned long long regs;
567 unsigned long syscall_nr;
568 unsigned long args[sys_data->nb_args];
569 } param;
570 int i;
571
572 *(struct pt_regs **)&param = regs;
573 param.syscall_nr = rec->nr;
574 for (i = 0; i < sys_data->nb_args; i++)
575 param.args[i] = rec->args[i];
576 return trace_call_bpf(prog, &param);
577}
578
562static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id) 579static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id)
563{ 580{
564 struct syscall_metadata *sys_data; 581 struct syscall_metadata *sys_data;
565 struct syscall_trace_enter *rec; 582 struct syscall_trace_enter *rec;
566 struct hlist_head *head; 583 struct hlist_head *head;
584 struct bpf_prog *prog;
567 int syscall_nr; 585 int syscall_nr;
568 int rctx; 586 int rctx;
569 int size; 587 int size;
@@ -578,8 +596,9 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id)
578 if (!sys_data) 596 if (!sys_data)
579 return; 597 return;
580 598
599 prog = READ_ONCE(sys_data->enter_event->prog);
581 head = this_cpu_ptr(sys_data->enter_event->perf_events); 600 head = this_cpu_ptr(sys_data->enter_event->perf_events);
582 if (hlist_empty(head)) 601 if (!prog && hlist_empty(head))
583 return; 602 return;
584 603
585 /* get the size after alignment with the u32 buffer size field */ 604 /* get the size after alignment with the u32 buffer size field */
@@ -594,6 +613,13 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id)
594 rec->nr = syscall_nr; 613 rec->nr = syscall_nr;
595 syscall_get_arguments(current, regs, 0, sys_data->nb_args, 614 syscall_get_arguments(current, regs, 0, sys_data->nb_args,
596 (unsigned long *)&rec->args); 615 (unsigned long *)&rec->args);
616
617 if ((prog && !perf_call_bpf_enter(prog, regs, sys_data, rec)) ||
618 hlist_empty(head)) {
619 perf_swevent_put_recursion_context(rctx);
620 return;
621 }
622
597 perf_trace_buf_submit(rec, size, rctx, 623 perf_trace_buf_submit(rec, size, rctx,
598 sys_data->enter_event->event.type, 1, regs, 624 sys_data->enter_event->event.type, 1, regs,
599 head, NULL, NULL); 625 head, NULL, NULL);
@@ -633,11 +659,26 @@ static void perf_sysenter_disable(struct trace_event_call *call)
633 mutex_unlock(&syscall_trace_lock); 659 mutex_unlock(&syscall_trace_lock);
634} 660}
635 661
662static int perf_call_bpf_exit(struct bpf_prog *prog, struct pt_regs *regs,
663 struct syscall_trace_exit *rec) {
664 struct syscall_tp_t {
665 unsigned long long regs;
666 unsigned long syscall_nr;
667 unsigned long ret;
668 } param;
669
670 *(struct pt_regs **)&param = regs;
671 param.syscall_nr = rec->nr;
672 param.ret = rec->ret;
673 return trace_call_bpf(prog, &param);
674}
675
636static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret) 676static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret)
637{ 677{
638 struct syscall_metadata *sys_data; 678 struct syscall_metadata *sys_data;
639 struct syscall_trace_exit *rec; 679 struct syscall_trace_exit *rec;
640 struct hlist_head *head; 680 struct hlist_head *head;
681 struct bpf_prog *prog;
641 int syscall_nr; 682 int syscall_nr;
642 int rctx; 683 int rctx;
643 int size; 684 int size;
@@ -652,8 +693,9 @@ static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret)
652 if (!sys_data) 693 if (!sys_data)
653 return; 694 return;
654 695
696 prog = READ_ONCE(sys_data->exit_event->prog);
655 head = this_cpu_ptr(sys_data->exit_event->perf_events); 697 head = this_cpu_ptr(sys_data->exit_event->perf_events);
656 if (hlist_empty(head)) 698 if (!prog && hlist_empty(head))
657 return; 699 return;
658 700
659 /* We can probably do that at build time */ 701 /* We can probably do that at build time */
@@ -666,6 +708,13 @@ static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret)
666 708
667 rec->nr = syscall_nr; 709 rec->nr = syscall_nr;
668 rec->ret = syscall_get_return_value(current, regs); 710 rec->ret = syscall_get_return_value(current, regs);
711
712 if ((prog && !perf_call_bpf_exit(prog, regs, rec)) ||
713 hlist_empty(head)) {
714 perf_swevent_put_recursion_context(rctx);
715 return;
716 }
717
669 perf_trace_buf_submit(rec, size, rctx, sys_data->exit_event->event.type, 718 perf_trace_buf_submit(rec, size, rctx, sys_data->exit_event->event.type,
670 1, regs, head, NULL, NULL); 719 1, regs, head, NULL, NULL);
671} 720}