From a821c72a0a34431f347ff235d7335c7bf920e8d9 Mon Sep 17 00:00:00 2001 From: cfc4n Date: Fri, 24 Nov 2023 21:43:01 +0800 Subject: [PATCH 1/3] ignore connect symbol cant found. Signed-off-by: cfc4n --- user/config/config_openssl_linux.go | 4 +++- user/module/probe_openssl.go | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/user/config/config_openssl_linux.go b/user/config/config_openssl_linux.go index c2167f655..9dbc3715f 100644 --- a/user/config/config_openssl_linux.go +++ b/user/config/config_openssl_linux.go @@ -139,6 +139,7 @@ func (oc *OpensslConfig) checkConnect() error { //如果没找到,则报错。 if !found || funcName == "" { + oc.Pthread = "" return errors.New(fmt.Sprintf("cant found 'connect' function to hook in files::%v", connectSharedObjects)) } return nil @@ -173,7 +174,8 @@ func (oc *OpensslConfig) Check() error { } if !checkedConnect { - return oc.checkConnect() + // Optional check + _ = oc.checkConnect() } s, e := checkCgroupPath(oc.CGroupPath) if e != nil { diff --git a/user/module/probe_openssl.go b/user/module/probe_openssl.go index e3311ae01..d5317e297 100644 --- a/user/module/probe_openssl.go +++ b/user/module/probe_openssl.go @@ -297,7 +297,8 @@ func (m *MOpenSSLProbe) setupManagersUprobe() error { libPthread = m.conf.(*config.OpensslConfig).Pthread if libPthread == "" { - libPthread = "/lib/x86_64-linux-gnu/libpthread.so.0" + //libPthread = "/lib/x86_64-linux-gnu/libpthread.so.0" + m.logger.Printf("%s\tlibPthread path not found, IP info lost.\n", m.Name(), libPthread) } _, err := os.Stat(binaryPath) From 12047e107f326d172e415d081c3842e1d95124cd Mon Sep 17 00:00:00 2001 From: cfc4n Date: Fri, 24 Nov 2023 22:03:59 +0800 Subject: [PATCH 2/3] call needs 1 arg but has 2 args. Signed-off-by: cfc4n --- user/module/probe_openssl.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user/module/probe_openssl.go b/user/module/probe_openssl.go index d5317e297..e74858d43 100644 --- a/user/module/probe_openssl.go +++ b/user/module/probe_openssl.go @@ -298,7 +298,7 @@ func (m *MOpenSSLProbe) setupManagersUprobe() error { libPthread = m.conf.(*config.OpensslConfig).Pthread if libPthread == "" { //libPthread = "/lib/x86_64-linux-gnu/libpthread.so.0" - m.logger.Printf("%s\tlibPthread path not found, IP info lost.\n", m.Name(), libPthread) + m.logger.Printf("%s\tlibPthread path not found, IP info lost.\n", m.Name()) } _, err := os.Stat(binaryPath) From 99cf8354e0cd80c5bba18128b6b6cb16450499a6 Mon Sep 17 00:00:00 2001 From: cfc4n Date: Sat, 25 Nov 2023 22:12:00 +0800 Subject: [PATCH 3/3] check libPthread value. Signed-off-by: cfc4n --- user/module/probe_openssl.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/user/module/probe_openssl.go b/user/module/probe_openssl.go index e74858d43..713f47c4e 100644 --- a/user/module/probe_openssl.go +++ b/user/module/probe_openssl.go @@ -393,17 +393,19 @@ func (m *MOpenSSLProbe) setupManagersUprobe() error { }, } - // detect libpthread.so path - _, err = os.Stat(libPthread) - if err == nil { - m.logger.Printf("%s\tlibPthread:%s\n", m.Name(), libPthread) - m.bpfManager.Probes = append(m.bpfManager.Probes, &manager.Probe{ - Section: "uprobe/connect", - EbpfFuncName: "probe_connect", - AttachToFuncName: "connect", - BinaryPath: libPthread, - UID: "uprobe_connect", - }) + if libPthread != "" { + // detect libpthread.so path + _, err = os.Stat(libPthread) + if err == nil { + m.logger.Printf("%s\tlibPthread:%s\n", m.Name(), libPthread) + m.bpfManager.Probes = append(m.bpfManager.Probes, &manager.Probe{ + Section: "uprobe/connect", + EbpfFuncName: "probe_connect", + AttachToFuncName: "connect", + BinaryPath: libPthread, + UID: "uprobe_connect", + }) + } } m.bpfManagerOptions = manager.Options{