evilsocket / evilsocket/opensnitch

several race conditions in eBPF program

Open
#426 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14.1k
Forks
665
PR merge metrics
No merged PRs in 30d

Description

I believe that increments like [this one](https://github.com/evilsocket/opensnitch/blob/1db03b5570ea429227ea39b4c6947a0746b1de59/ebpf_prog/opensnitch.c#L422) should be done via:

> __sync_fetch_and_add(value, 1)

according to [this](https://docs.cilium.io/en/latest/bpf/#llvm):

> Since the defined array map is global, the accounting needs to use an atomic operation, which is defined as lock_xadd(). LLVM maps __sync_fetch_and_add() as a built-in function to the BPF atomic add instruction, that is, BPF_STX | BPF_XADD | BPF_W for word sizes.

i'm not an eBPF expert so before moving forward with the fixes i'd like to hear from @gustavo-iniguez-goya and @themighty1

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.