Skip to content
New issue

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

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

Already on GitHub? # to your account

Potential problems with strict-aliasing violations (libsinsp/fdinfo.cpp) #1964

Open
hhoffstaette opened this issue Jul 18, 2024 · 12 comments
Open
Labels
kind/bug Something isn't working
Milestone

Comments

@hhoffstaette
Copy link
Contributor

hhoffstaette commented Jul 18, 2024

Describe the bug

Gentoo QA complains about the following potential problems with strict-aliasing violations when doing naughty pointer things:

/tmp/portage/dev-debug/sysdig-0.38.1/work/libs-0.17.2/userspace/libsinsp/fdinfo.cpp: In member function 'virtual libsinsp::state::static_struct::field_infos sinsp_fdinfo::static_fields() const':
/tmp/portage/dev-debug/sysdig-0.38.1/work/libs-0.17.2/userspace/libsinsp/fdinfo.cpp:149:41: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  149 |         define_static_field(ret, this, ((uint64_t*) &m_sockinfo.m_ipv6info.m_fields.m_sip)[0], "socket_ipv6_src_ip_low");
      |                                        ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/portage/dev-debug/sysdig-0.38.1/work/libs-0.17.2/userspace/libsinsp/fdinfo.cpp:151:41: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  151 |         define_static_field(ret, this, ((uint64_t*) &m_sockinfo.m_ipv6info.m_fields.m_dip)[0], "socket_ipv6_dest_ip_low");
      |                                        ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/portage/dev-debug/sysdig-0.38.1/work/libs-0.17.2/userspace/libsinsp/fdinfo.cpp:159:41: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
  159 |         define_static_field(ret, this, ((uint64_t*) &m_sockinfo.m_ipv6serverinfo.m_ip)[0], "socket_ipv6_server_ip_low");
      |                                        ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

How to reproduce it

Building sysdig-0.38.x+libs-0.17.2 with gcc-13.3 and -Werror=strict-aliasing should show this.

Expected behaviour

No QA violations (if possible)

Environment

Gentoo Linux, ~amd64 (testing)

  • Kernel:

6.10.0 :)

  • Installation method:

From source - I am the package maintainer

Additional context

I understand that accessing the union needs to accommodate the IPv6 address and have no immediate solution either. Sorry 😞

@hhoffstaette hhoffstaette added the kind/bug Something isn't working label Jul 18, 2024
@FedeDP
Copy link
Contributor

FedeDP commented Jul 25, 2024

/cc @LucaGuerra our pointer hero!

@poiana
Copy link
Contributor

poiana commented Oct 23, 2024

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

@poiana
Copy link
Contributor

poiana commented Nov 22, 2024

Stale issues rot after 30d of inactivity.

Mark the issue as fresh with /remove-lifecycle rotten.

Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle rotten

@poiana
Copy link
Contributor

poiana commented Dec 22, 2024

Rotten issues close after 30d of inactivity.

Reopen the issue with /reopen.

Mark the issue as fresh with /remove-lifecycle rotten.

Provide feedback via https://github.com/falcosecurity/community.
/close

@poiana poiana closed this as completed Dec 22, 2024
@poiana
Copy link
Contributor

poiana commented Dec 22, 2024

@poiana: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue with /reopen.

Mark the issue as fresh with /remove-lifecycle rotten.

Provide feedback via https://github.com/falcosecurity/community.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@FedeDP
Copy link
Contributor

FedeDP commented Jan 2, 2025

/reopen

@poiana poiana reopened this Jan 2, 2025
@poiana
Copy link
Contributor

poiana commented Jan 2, 2025

@FedeDP: Reopened this issue.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@poiana
Copy link
Contributor

poiana commented Feb 1, 2025

Rotten issues close after 30d of inactivity.

Reopen the issue with /reopen.

Mark the issue as fresh with /remove-lifecycle rotten.

Provide feedback via https://github.com/falcosecurity/community.
/close

@poiana poiana closed this as completed Feb 1, 2025
@poiana
Copy link
Contributor

poiana commented Feb 1, 2025

@poiana: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue with /reopen.

Mark the issue as fresh with /remove-lifecycle rotten.

Provide feedback via https://github.com/falcosecurity/community.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@FedeDP
Copy link
Contributor

FedeDP commented Feb 3, 2025

/reopen
/remove-lifecycle rotten

@poiana poiana reopened this Feb 3, 2025
@poiana
Copy link
Contributor

poiana commented Feb 3, 2025

@FedeDP: Reopened this issue.

In response to this:

/reopen
/remove-lifecycle rotten

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@FedeDP
Copy link
Contributor

FedeDP commented Feb 3, 2025

/milestone TBD

@poiana poiana added this to the TBD milestone Feb 3, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants