Skip to content
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

enabled CGO for Macos otelcol contrib #626

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

pureklkl
Copy link

@pureklkl pureklkl commented Aug 2, 2024

Add a CGO enabled otelcol-contrib for macos
open-telemetry/opentelemetry-collector-contrib#33393

There are some test failures need be fixed by this PR
open-telemetry/opentelemetry-collector-contrib#33921

@pureklkl pureklkl requested review from a team and TylerHelmuth August 2, 2024 20:21
@atoulme
Copy link
Contributor

atoulme commented Aug 2, 2024

Nice work :)

Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

Can you please go over our security audit? it lists a few recommendations in case we ever change to CGO, which this PR is doing.

https://7asecurity.com/reports/pentest-report-opentelemetry.pdf

@jpkrohling
Copy link
Member

Related: #618

@pureklkl
Copy link
Author

The checksec.sh is not working for macos ref
I used snake&apple instead, see section3. But this is also not accurate because it is for Xcode compiled binary instead of golang. Here is the result

PIE: True
ARC: False
STRIPPED: False
CANARY: True
NX STACK: True
NX HEAP: False
XN: True
NOTARIZED: False
ENCRYPTED: False
RESTRICTED: False
HARDENED: False
APP SANDBOX: False
FORTIFIED: True
RPATH: False

I am not a security expert, so need advice other tools that can check macos binary security.

.github/workflows/release-contrib-cgo.yaml Outdated Show resolved Hide resolved
@@ -0,0 +1,11 @@
# OpenTelemetry Collector Contrib CGO Distro
Copy link
Member

Choose a reason for hiding this comment

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

As a user, I would find it confusing. Why should I care? What does it bring that others don't?

I'm not sure I like the idea of a distribution with just a different platform or compilation mechanism. I would prefer a solution where we built with the right options based on what we need to ship.

Does hostmetrics require cgo when compiled for Darwin? Then we should use cgo to compile the distributions that include that component for Darwin.

I find a separate cgo distribution confusing, and opens the door for a cgo distribution for other platforms, which is not something we want.

Copy link
Author

Choose a reason for hiding this comment

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

My concern is that when CGO is enabled, the binary is coupled to certain OS versions and will support less OS versions.

Copy link
Author

Choose a reason for hiding this comment

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

@jpkrohling
Hi, I have updated the PR to just enable CGO for Macos otelcol contrib, could you review it again?

Copy link
Member

Choose a reason for hiding this comment

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

I would like to have it discussed as part of the SIG and have buy-in from other maintainers.

Copy link
Author

Choose a reason for hiding this comment

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

Hi, I have tested with golang 10.15 and it works, which is also the oldest macos version that golang >= 1.21 supported ref
I think we could just turn on the CGO option without a separated distribution.

@pureklkl pureklkl changed the title Macos CGO enabled distribution enabled CGO for Macos otelcol contrib Aug 23, 2024
@@ -51,8 +51,12 @@ jobs:
with:
platforms: arm64,ppc64le,linux/arm/v7,s390x

- uses: docker/setup-buildx-action@aa33708b10e362ff993539393ff100fa93ed6a27 # v3.5.0
<<<<<<< HEAD
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't look right :-)

- uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.5.0
if: ${{ runner.os != 'macOS' }} # docker is not available on macos
=======
- uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
Copy link
Member

Choose a reason for hiding this comment

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

I think it should be the other way around... the newer version should be kept

@pureklkl
Copy link
Author

configure.go need to be modified to fix the build, and it will be affected by whether we want a new distribution. I will fix the build once the community have a decision.

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

Successfully merging this pull request may close these issues.

3 participants