Skip to content

Commit

Permalink
fix(experimental/gotls): fix label of tls key log sometimes is empty (#…
Browse files Browse the repository at this point in the history
…146)

* fix(experimental): fix label of tls key log sometimes is empty

* enable test again

* fix ret offset was wrong on arm64
  • Loading branch information
mozillazg authored Sep 22, 2024
1 parent 00b9018 commit bdb5f10
Show file tree
Hide file tree
Showing 39 changed files with 24,835 additions and 205 deletions.
24 changes: 13 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,19 @@ jobs:
done
exit 1
# - run:
# name: e2e (test go tls keylog)
# command: |
# echo "wireshark-common wireshark-common/install-setuid boolean true" | sudo debconf-set-selections
# sudo DEBIAN_FRONTEND=noninteractive apt install -y tshark
# make -C testdata/gohttpapp build
#
# for i in {1..10}; do
# sudo bash testdata/test_gotls_keylog.sh ./ptcpdump && exit 0 || sleep 1
# done
# exit 1
- run:
name: e2e (test go tls keylog)
command: |
echo "wireshark-common wireshark-common/install-setuid boolean true" | sudo debconf-set-selections
sudo add-apt-repository -y ppa:wireshark-dev/stable
sudo apt update
sudo DEBIAN_FRONTEND=noninteractive apt install -y tshark
make -C testdata/gohttpapp build
for i in {1..10}; do
sudo bash testdata/test_gotls_keylog.sh ./ptcpdump && exit 0 || sleep 1
done
exit 1
docker-e2e:
machine:
Expand Down
42 changes: 21 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,24 +251,24 @@ jobs:
done
exit 1
# - name: build demo app
# run: |
# make -C testdata/gohttpapp build
#
# - name: Test go tls keylog
# uses: cilium/little-vm-helper@97c89f004bd0ab4caeacfe92ebc956e13e362e6b # v0.0.19
# with:
# provision: 'false'
# cmd: |
# set -ex
# uname -a
# cat /etc/issue
#
# ls -lh /host/testdata/gohttpapp
#
# apt update && yes | apt install -y tshark
#
# for i in {1..10}; do
# bash /host/testdata/test_gotls_keylog.sh /host/ptcpdump/ptcpdump && exit 0 || sleep 1
# done
# exit 1
- name: build demo app
run: |
make -C testdata/gohttpapp build
- name: Test go tls keylog
uses: cilium/little-vm-helper@97c89f004bd0ab4caeacfe92ebc956e13e362e6b # v0.0.19
with:
provision: 'false'
cmd: |
set -ex
uname -a
cat /etc/issue
ls -lh /host/testdata/gohttpapp
apt update && yes | apt install -y tshark
for i in {1..10}; do
bash /host/testdata/test_gotls_keylog.sh /host/ptcpdump/ptcpdump && exit 0 || sleep 1
done
exit 1
71 changes: 43 additions & 28 deletions bpf/bpf_arm64_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified bpf/bpf_arm64_bpfel.o
Binary file not shown.
26 changes: 14 additions & 12 deletions bpf/bpf_legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ import (
//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang -no-strip -no-global-types -target $TARGET bpf_legacy ./ptcpdump.c -- -I./headers -I./headers/$TARGET -I. -Wall -DLEGACY_KERNEL

type BpfObjectsForLegacyKernel struct {
KprobeTcpSendmsg *ebpf.Program `ebpf:"kprobe__tcp_sendmsg"`
KprobeUdpSendmsg *ebpf.Program `ebpf:"kprobe__udp_sendmsg"`
KprobeUdpSendSkb *ebpf.Program `ebpf:"kprobe__udp_send_skb"`
KprobeNfNatManipPkt *ebpf.Program `ebpf:"kprobe__nf_nat_manip_pkt"`
KprobeNfNatPacket *ebpf.Program `ebpf:"kprobe__nf_nat_packet"`
KprobeSecuritySkClassifyFlow *ebpf.Program `ebpf:"kprobe__security_sk_classify_flow"`
RawTracepointSchedProcessExec *ebpf.Program `ebpf:"raw_tracepoint__sched_process_exec"`
RawTracepointSchedProcessExit *ebpf.Program `ebpf:"raw_tracepoint__sched_process_exit"`
RawTracepointSchedProcessFork *ebpf.Program `ebpf:"raw_tracepoint__sched_process_fork"`
TcEgress *ebpf.Program `ebpf:"tc_egress"`
TcIngress *ebpf.Program `ebpf:"tc_ingress"`
UprobeGoBuiltinTlsWriteKeyLog *ebpf.Program `ebpf:"uprobe__go_builtin__tls__write_key_log"`
KprobeTcpSendmsg *ebpf.Program `ebpf:"kprobe__tcp_sendmsg"`
KprobeUdpSendmsg *ebpf.Program `ebpf:"kprobe__udp_sendmsg"`
KprobeUdpSendSkb *ebpf.Program `ebpf:"kprobe__udp_send_skb"`
KprobeNfNatManipPkt *ebpf.Program `ebpf:"kprobe__nf_nat_manip_pkt"`
KprobeNfNatPacket *ebpf.Program `ebpf:"kprobe__nf_nat_packet"`
KprobeSecuritySkClassifyFlow *ebpf.Program `ebpf:"kprobe__security_sk_classify_flow"`
RawTracepointSchedProcessExec *ebpf.Program `ebpf:"raw_tracepoint__sched_process_exec"`
RawTracepointSchedProcessExit *ebpf.Program `ebpf:"raw_tracepoint__sched_process_exit"`
RawTracepointSchedProcessFork *ebpf.Program `ebpf:"raw_tracepoint__sched_process_fork"`
TcEgress *ebpf.Program `ebpf:"tc_egress"`
TcIngress *ebpf.Program `ebpf:"tc_ingress"`
UprobeGoBuiltinTlsWriteKeyLog *ebpf.Program `ebpf:"uprobe__go_builtin__tls__write_key_log"`
UprobeGoBuiltinTlsWriteKeyLogRet *ebpf.Program `ebpf:"uprobe__go_builtin__tls__write_key_log__ret"`

BpfMaps
}
Expand All @@ -43,6 +44,7 @@ func (b *BpfObjects) FromLegacy(o *BpfObjectsForLegacyKernel) {
b.TcEgress = o.TcEgress
b.TcIngress = o.TcIngress
b.UprobeGoBuiltinTlsWriteKeyLog = o.UprobeGoBuiltinTlsWriteKeyLog
b.UprobeGoBuiltinTlsWriteKeyLogRet = o.UprobeGoBuiltinTlsWriteKeyLogRet

b.BpfMaps = o.BpfMaps
}
Expand Down
54 changes: 30 additions & 24 deletions bpf/bpf_legacy_arm64_bpfel.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified bpf/bpf_legacy_arm64_bpfel.o
Binary file not shown.
Loading

0 comments on commit bdb5f10

Please sign in to comment.