Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Mizu
Commits
aa2b78a2
Unverified
Commit
aa2b78a2
authored
3 years ago
by
M. Mert Yildiran
Browse files
Options
Download
Email Patches
Plain Diff
Disable `get_goid_from_thread_local_storage` on ARM64 with a macro
parent
7425c713
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tap/tlstapper/bpf/go_uprobes.c
+15
-2
tap/tlstapper/bpf/go_uprobes.c
with
15 additions
and
2 deletions
+15
-2
tap/tlstapper/bpf/go_uprobes.c
+
15
-
2
View file @
aa2b78a2
...
...
@@ -73,6 +73,8 @@ enum ABI {
ABIInternal
=
1
,
};
#if defined(bpf_target_x86)
// get_goid_from_thread_local_storage function is x86 specific
static
__always_inline
__u32
get_goid_from_thread_local_storage
(
__u64
*
goroutine_id
)
{
int
zero
=
0
;
int
one
=
1
;
...
...
@@ -109,6 +111,7 @@ static __always_inline __u32 get_goid_from_thread_local_storage(__u64 *goroutine
bpf_ringbuf_discard
(
task
,
BPF_RB_FORCE_WAKEUP
);
return
1
;
}
#endif
static
__always_inline
__u32
go_crypto_tls_get_fd_from_tcp_conn
(
struct
pt_regs
*
ctx
,
enum
ABI
abi
)
{
struct
go_interface
conn
;
...
...
@@ -197,13 +200,18 @@ static __always_inline void go_crypto_tls_uprobe(struct pt_regs *ctx, struct bpf
__u64
goroutine_id
;
if
(
abi
==
ABI0
)
{
#if defined(bpf_target_arm64)
// In case of ABI0 and arm64, it's stored in the Goroutine register
goroutine_id
=
GO_ABI_0_PT_REGS_GP
(
ctx
);
#else
// In case of ABI0 and amd64, it's stored in the thread-local storage
int
status
=
get_goid_from_thread_local_storage
(
&
goroutine_id
);
if
(
!
status
)
{
return
;
}
#endif
}
else
{
// GO_ABI_INTERNAL_PT_REGS_GP is Goroutine address
// GO_ABI_INTERNAL_PT_REGS_GP is
the
Goroutine address
in ABIInternal
goroutine_id
=
GO_ABI_INTERNAL_PT_REGS_GP
(
ctx
);
}
__u64
pid_fp
=
pid
<<
32
|
goroutine_id
;
...
...
@@ -225,13 +233,18 @@ static __always_inline void go_crypto_tls_ex_uprobe(struct pt_regs *ctx, struct
__u64
goroutine_id
;
if
(
abi
==
ABI0
)
{
#if defined(bpf_target_arm64)
// In case of ABI0 and arm64, it's stored in the Goroutine register
goroutine_id
=
GO_ABI_0_PT_REGS_GP
(
ctx
);
#else
// In case of ABI0 and amd64, it's stored in the thread-local storage
int
status
=
get_goid_from_thread_local_storage
(
&
goroutine_id
);
if
(
!
status
)
{
return
;
}
#endif
}
else
{
// GO_ABI_INTERNAL_PT_REGS_GP is Goroutine address
// GO_ABI_INTERNAL_PT_REGS_GP is
the
Goroutine address
in ABIInternal
goroutine_id
=
GO_ABI_INTERNAL_PT_REGS_GP
(
ctx
);
}
__u64
pid_fp
=
pid
<<
32
|
goroutine_id
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help