Skip to content

Commit

Permalink
Merge pull request #65 from sysflow-telemetry/release/0.6.2
Browse files Browse the repository at this point in the history
fix(segfault): fixed segfaults related to missing main threads and th…
  • Loading branch information
araujof authored Mar 4, 2024
2 parents 07f8e1c + 40e57ee commit 9fb5ddf
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 7 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
## [Unreleased]

## [0.6.2] - 2024-03-04

### Fixed

- Fix segfaulting issues in k8s/kind

## [0.6.1] - 2024-02-23

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

- First release candidate of SysFlow Collector.

[Unreleased]: https://github.com/sysflow-telemetry/sf-collector/compare/0.6.1...HEAD
[Unreleased]: https://github.com/sysflow-telemetry/sf-collector/compare/0.6.2...HEAD
[0.6.2]: https://github.com/sysflow-telemetry/sf-collector/compare/0.6.1...0.6.2
[0.6.1]: https://github.com/sysflow-telemetry/sf-collector/compare/0.6.0...0.6.1
[0.6.0]: https://github.com/sysflow-telemetry/sf-collector/compare/0.5.1...0.6.0
[0.5.1]: https://github.com/sysflow-telemetry/sf-collector/compare/0.5.0...0.5.1
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Supported tags and respective `Dockerfile` links

- [`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)
- [`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)

# Quick reference

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

- **Binary packages**:
[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)
[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)

# What is SysFlow?

Expand Down
2 changes: 1 addition & 1 deletion makefile.manifest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

SYSFLOW_VERSION?=0.6.1
SYSFLOW_VERSION?=0.6.2
SYSFLOW_BUILD_NUMBER?=1
FALCO_VERSION=0.36.2
FALCO_LIBS_VERSION=0.13.4
Expand Down
4 changes: 4 additions & 0 deletions src/libs/controlflowprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ inline void ControlFlowProcessor::removeAndWriteProcessFlow(ProcessObj *proc) {

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

switch (flag) {
case OP_EXIT: {
Expand Down
16 changes: 14 additions & 2 deletions src/libs/processcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,14 @@ ProcessObj *ProcessContext::createProcess(sinsp_threadinfo *ti, sinsp_evt *ev,

if (parent != nullptr) {
OID poid;
parent = parent->is_main_thread() ? parent : parent->get_main_thread();
if (!parent->is_main_thread()) {
sinsp_threadinfo *main = parent->get_main_thread();
if (main != nullptr) {
parent = main;
} else {
SF_DEBUG(m_logger, "Parent main thread is NULL.");
}
}
poid.createTS = parent->m_clone_ts;
poid.hpid = parent->m_pid;
p->proc.poid.set_OID(poid);
Expand Down Expand Up @@ -252,7 +259,12 @@ ProcessObj *ProcessContext::getProcess(sinsp_evt *ev, SFObjectState state,
mt = mt->get_parent_thread();

while (mt != nullptr && mt->m_tid != -1) {
mt = mt->is_main_thread() ? mt : mt->get_main_thread();
if (mt->is_main_thread()) {
sinsp_threadinfo *tmp = mt->get_main_thread();
if (tmp != nullptr) {
mt = tmp;
}
}
if (mt->m_clone_ts == 0 && mt->m_pid == 0) {
ct = mt;
mt = mt->get_parent_thread();
Expand Down
2 changes: 1 addition & 1 deletion src/libs/sysflowcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ SysFlowContext::SysFlowContext(SysFlowConfig *config)
m_inspector->set_snaplen(0);
}
m_offline = !config->scapInputPath.empty();
m_hasPrefix = (config->filePath.back() != '/');
m_hasPrefix = ((!config->filePath.empty()) && config->filePath.back() != '/');
m_callback = config->callback;
}

Expand Down

0 comments on commit 9fb5ddf

Please sign in to comment.