Skip to content

fix: do not shift in map_by_fd #344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

fix: do not shift in map_by_fd #344

wants to merge 4 commits into from

Conversation

yunwei37
Copy link
Member

@yunwei37 yunwei37 commented Sep 2, 2024

Description

The old version shift 32 bit in map_by_fd, we don't need to do that.

@yunwei37 yunwei37 force-pushed the master branch 3 times, most recently from 1354316 to a6a132b Compare September 11, 2024 18:08
@yunwei37 yunwei37 requested a review from Copilot April 10, 2025 17:48
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

runtime/src/bpftime_shm.cpp:576

  • The change removes the shift and mask logic used to represent a pointer. Please verify that all consumers of map_ptr_by_fd and map_val expect the file descriptor directly and that this change does not introduce unintended behavior.
return fd;

runtime/src/bpf_map/userspace/map_in_maps.hpp:29

  • The direct cast of map_id to a pointer replaces the previous shifting logic. Confirm that this change is consistent with how map pointer values are interpreted throughout the codebase.
return (void *)((u_int64_t)map_id);

Copy link

codecov bot commented Apr 10, 2025

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 55.42%. Comparing base (9e35e28) to head (872ff64).

Files with missing lines Patch % Lines
runtime/src/bpftime_shm.cpp 0.00% 2 Missing ⚠️
runtime/src/bpf_map/userspace/map_in_maps.hpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #344      +/-   ##
==========================================
- Coverage   58.01%   55.42%   -2.59%     
==========================================
  Files         105       90      -15     
  Lines        7777     6538    -1239     
  Branches      839      544     -295     
==========================================
- Hits         4512     3624     -888     
+ Misses       3265     2914     -351     
Flag Coverage Δ
attach tests (uprobe & syscall trace) 97.52% <ø> (ø)
coverage-example-fedora-false-bashreadline-false ?
coverage-example-fedora-false-bashreadline-true ?
coverage-example-fedora-false-funclatency-false ?
coverage-example-fedora-false-funclatency-true ?
coverage-example-fedora-false-get_stack_id_example-false ?
coverage-example-fedora-false-get_stack_id_example-true ?
coverage-example-fedora-false-malloc-true ?
coverage-example-fedora-false-minimal-false ?
coverage-example-fedora-false-minimal-true ?
coverage-example-fedora-false-mountsnoop-true ?
coverage-example-fedora-false-opensnoop-libbpf-tools-true ?
coverage-example-fedora-false-opensnoop-true ?
coverage-example-fedora-false-sigsnoop-true ?
coverage-example-fedora-false-sslsniff-false ?
coverage-example-fedora-false-sslsniff-true ?
coverage-example-fedora-false-statsnoop-true ?
coverage-example-fedora-false-syscount-false ?
coverage-example-fedora-false-syscount-true ?
coverage-example-fedora-false-tailcall_minimal-true ?
coverage-example-fedora-false-usdt_minimal-false ?
coverage-example-fedora-false-usdt_minimal-true ?
coverage-example-fedora-true-bashreadline-false ?
coverage-example-fedora-true-bashreadline-true ?
coverage-example-fedora-true-funclatency-false ?
coverage-example-fedora-true-funclatency-true ?
coverage-example-fedora-true-get_stack_id_example-false ?
coverage-example-fedora-true-get_stack_id_example-true ?
coverage-example-fedora-true-malloc-true ?
coverage-example-fedora-true-minimal-false ?
coverage-example-fedora-true-minimal-true ?
coverage-example-fedora-true-mountsnoop-true ?
coverage-example-fedora-true-opensnoop-libbpf-tools-true ?
coverage-example-fedora-true-opensnoop-true ?
coverage-example-fedora-true-sigsnoop-true ?
coverage-example-fedora-true-sslsniff-false ?
coverage-example-fedora-true-sslsniff-true ?
coverage-example-fedora-true-statsnoop-true ?
coverage-example-fedora-true-syscount-false ?
coverage-example-fedora-true-syscount-true ?
coverage-example-fedora-true-tailcall_minimal-true ?
coverage-example-fedora-true-usdt_minimal-false ?
coverage-example-fedora-true-usdt_minimal-true ?
coverage-example-ubuntu-false-bashreadline-false ?
coverage-example-ubuntu-false-bashreadline-true ?
coverage-example-ubuntu-false-funclatency-false ?
coverage-example-ubuntu-false-funclatency-true ?
coverage-example-ubuntu-false-get_stack_id_example-false ?
coverage-example-ubuntu-false-get_stack_id_example-true ?
coverage-example-ubuntu-false-malloc-true ?
coverage-example-ubuntu-false-minimal-false ?
coverage-example-ubuntu-false-minimal-true ?
coverage-example-ubuntu-false-mountsnoop-true ?
coverage-example-ubuntu-false-opensnoop-libbpf-tools-true ?
coverage-example-ubuntu-false-opensnoop-true ?
coverage-example-ubuntu-false-sigsnoop-true ?
coverage-example-ubuntu-false-sslsniff-false ?
coverage-example-ubuntu-false-sslsniff-true ?
coverage-example-ubuntu-false-statsnoop-true ?
coverage-example-ubuntu-false-syscount-false ?
coverage-example-ubuntu-false-syscount-true ?
coverage-example-ubuntu-false-tailcall_minimal-true ?
coverage-example-ubuntu-false-usdt_minimal-false ?
coverage-example-ubuntu-false-usdt_minimal-true ?
coverage-example-ubuntu-true-bashreadline-false ?
coverage-example-ubuntu-true-bashreadline-true ?
coverage-example-ubuntu-true-funclatency-false ?
coverage-example-ubuntu-true-funclatency-true ?
coverage-example-ubuntu-true-get_stack_id_example-false ?
coverage-example-ubuntu-true-get_stack_id_example-true ?
coverage-example-ubuntu-true-malloc-true ?
coverage-example-ubuntu-true-minimal-false ?
coverage-example-ubuntu-true-minimal-true 20.54% <0.00%> (ø)
coverage-example-ubuntu-true-mountsnoop-true ?
coverage-example-ubuntu-true-opensnoop-libbpf-tools-true ?
coverage-example-ubuntu-true-opensnoop-true ?
coverage-example-ubuntu-true-sigsnoop-true ?
coverage-example-ubuntu-true-sslsniff-false ?
coverage-example-ubuntu-true-sslsniff-true ?
coverage-example-ubuntu-true-statsnoop-true ?
coverage-example-ubuntu-true-syscount-false ?
coverage-example-ubuntu-true-syscount-true ?
coverage-example-ubuntu-true-tailcall_minimal-true ?
coverage-example-ubuntu-true-usdt_minimal-false ?
coverage-example-ubuntu-true-usdt_minimal-true ?
runtime tests 53.11% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

gitguardian bot commented May 25, 2025

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
8730391 Triggered Generic Private Key 872ff64 benchmark/deepflow/go-server/key.pem View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant