Skip to content

Commit 9fb5ddf

Browse files
authored
Merge pull request #65 from sysflow-telemetry/release/0.6.2
fix(segfault): fixed segfaults related to missing main threads and th…
2 parents 07f8e1c + 40e57ee commit 9fb5ddf

6 files changed

Lines changed: 30 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
1515
1616
## [Unreleased]
1717

18+
## [0.6.2] - 2024-03-04
19+
20+
### Fixed
21+
22+
- Fix segfaulting issues in k8s/kind
23+
1824
## [0.6.1] - 2024-02-23
1925

2026
### Added
@@ -289,7 +295,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
289295

290296
- First release candidate of SysFlow Collector.
291297

292-
[Unreleased]: https://github.com/sysflow-telemetry/sf-collector/compare/0.6.1...HEAD
298+
[Unreleased]: https://github.com/sysflow-telemetry/sf-collector/compare/0.6.2...HEAD
299+
[0.6.2]: https://github.com/sysflow-telemetry/sf-collector/compare/0.6.1...0.6.2
293300
[0.6.1]: https://github.com/sysflow-telemetry/sf-collector/compare/0.6.0...0.6.1
294301
[0.6.0]: https://github.com/sysflow-telemetry/sf-collector/compare/0.5.1...0.6.0
295302
[0.5.1]: https://github.com/sysflow-telemetry/sf-collector/compare/0.5.0...0.5.1

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Supported tags and respective `Dockerfile` links
88

9-
- [`0.6.1`, `latest`](https://github.com/sysflow-telemetry/sf-collector/blob/0.6.1/Dockerfile), [`edge`](https://github.com/sysflow-telemetry/sf-collector/blob/master/Dockerfile), [`dev`](https://github.com/sysflow-telemetry/sf-collector/blob/dev/Dockerfile)
9+
- [`0.6.2`, `latest`](https://github.com/sysflow-telemetry/sf-collector/blob/0.6.2/Dockerfile), [`edge`](https://github.com/sysflow-telemetry/sf-collector/blob/master/Dockerfile), [`dev`](https://github.com/sysflow-telemetry/sf-collector/blob/dev/Dockerfile)
1010

1111
# Quick reference
1212

@@ -26,7 +26,7 @@
2626
[docker hub](https://hub.docker.com/u/sysflowtelemetry) | [GHCR](https://github.com/orgs/sysflow-telemetry/packages)
2727

2828
- **Binary packages**:
29-
[deb](https://github.com/sysflow-telemetry/sf-collector/releases/tag/0.6.1/sfcollector-0.6.1-x86_64.deb) | [rpm](https://github.com/sysflow-telemetry/sf-collector/releases/tag/0.6.1/sfcollector-0.6.1-x86_64.rpm) | [tgz](https://github.com/sysflow-telemetry/sf-collector/releases/tag/0.6.1/sfcollector-0.6.1-x86_64.tar.gz)
29+
[deb](https://github.com/sysflow-telemetry/sf-collector/releases/tag/0.6.2/sfcollector-0.6.2-x86_64.deb) | [rpm](https://github.com/sysflow-telemetry/sf-collector/releases/tag/0.6.2/sfcollector-0.6.2-x86_64.rpm) | [tgz](https://github.com/sysflow-telemetry/sf-collector/releases/tag/0.6.2/sfcollector-0.6.2-x86_64.tar.gz)
3030

3131
# What is SysFlow?
3232

makefile.manifest.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818

19-
SYSFLOW_VERSION?=0.6.1
19+
SYSFLOW_VERSION?=0.6.2
2020
SYSFLOW_BUILD_NUMBER?=1
2121
FALCO_VERSION=0.36.2
2222
FALCO_LIBS_VERSION=0.13.4

src/libs/controlflowprocessor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ inline void ControlFlowProcessor::removeAndWriteProcessFlow(ProcessObj *proc) {
103103

104104
int ControlFlowProcessor::handleProcEvent(sinsp_evt *ev, OpFlags flag) {
105105
sinsp_threadinfo *ti = ev->get_thread_info();
106+
if (ti == nullptr) {
107+
SF_DEBUG(m_logger, "ti is NULL in handleProcEvent for flag " << flag);
108+
return -1;
109+
}
106110

107111
switch (flag) {
108112
case OP_EXIT: {

src/libs/processcontext.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,14 @@ ProcessObj *ProcessContext::createProcess(sinsp_threadinfo *ti, sinsp_evt *ev,
6969

7070
if (parent != nullptr) {
7171
OID poid;
72-
parent = parent->is_main_thread() ? parent : parent->get_main_thread();
72+
if (!parent->is_main_thread()) {
73+
sinsp_threadinfo *main = parent->get_main_thread();
74+
if (main != nullptr) {
75+
parent = main;
76+
} else {
77+
SF_DEBUG(m_logger, "Parent main thread is NULL.");
78+
}
79+
}
7380
poid.createTS = parent->m_clone_ts;
7481
poid.hpid = parent->m_pid;
7582
p->proc.poid.set_OID(poid);
@@ -252,7 +259,12 @@ ProcessObj *ProcessContext::getProcess(sinsp_evt *ev, SFObjectState state,
252259
mt = mt->get_parent_thread();
253260

254261
while (mt != nullptr && mt->m_tid != -1) {
255-
mt = mt->is_main_thread() ? mt : mt->get_main_thread();
262+
if (mt->is_main_thread()) {
263+
sinsp_threadinfo *tmp = mt->get_main_thread();
264+
if (tmp != nullptr) {
265+
mt = tmp;
266+
}
267+
}
256268
if (mt->m_clone_ts == 0 && mt->m_pid == 0) {
257269
ct = mt;
258270
mt = mt->get_parent_thread();

src/libs/sysflowcontext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ SysFlowContext::SysFlowContext(SysFlowConfig *config)
162162
m_inspector->set_snaplen(0);
163163
}
164164
m_offline = !config->scapInputPath.empty();
165-
m_hasPrefix = (config->filePath.back() != '/');
165+
m_hasPrefix = ((!config->filePath.empty()) && config->filePath.back() != '/');
166166
m_callback = config->callback;
167167
}
168168

0 commit comments

Comments
 (0)