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

Ohai: Change C language plugin for glibc version detection #1636

Merged

Conversation

bhaveshdavda
Copy link

@bhaveshdavda bhaveshdavda commented Mar 24, 2021

It's not safe to directly execute "libc.so.6" to determine glibc version.
This can lead to segfaults when other shared libraries are preloaded using
LD_PRELOAD or /etc/ld.so.preload due to circular relocation dependencies.

Replace this version detection with "ldd --version" as "ldd" is a core part
of glibc and reports the same version.

Description

Related Issue

Types of changes

  • [ x] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • [ x] I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • [ x] All commits have been signed-off for the Developer Certificate of Origin.

@bhaveshdavda bhaveshdavda requested review from a team as code owners March 24, 2021 23:55
@damacus
Copy link

damacus commented Mar 25, 2021

Hi @bhaveshdavda

looks like you're missing the DCO sign-off and the the gcc version from running gcc -v tests are currently failing

It's not safe to directly execute "libc.so.6" to determine glibc version.
This can lead to segfaults when other shared libraries are preloaded using
LD_PRELOAD or /etc/ld.so.preload due to circular relocation dependencies.

Replace this version detection with "ldd --version" as "ldd" is a core part
of glibc and reports the same version.

Signed-off-by: Bhavesh Davda <bhavesh.davda@oracle.com>
@bhaveshdavda bhaveshdavda force-pushed the ohai-glibc-bhavesh.davda@oracle.com branch from a1a73a9 to 479ec99 Compare March 25, 2021 15:55
@bhaveshdavda
Copy link
Author

Hi community, can someone please help me with the unit test validation failures? I'm completely unfamiliar with this project and can't quite tell how to modify spec/unit/plugins/c_spec.rb to make the unit tests happy with my change.

Bhavesh Davda added 2 commits March 25, 2021 16:21
Replace invocation of libc.so.6 with "ldd --version" instead

Signed-off-by: Bhavesh Davda <bhavesh.davda@oracle.com>
…glibc

Signed-off-by: Bhavesh Davda <bhavesh.davda@oracle.com>
@bhaveshdavda bhaveshdavda force-pushed the ohai-glibc-bhavesh.davda@oracle.com branch from 1927888 to 426f585 Compare March 25, 2021 23:22
@bhaveshdavda
Copy link
Author

Wild! I hacked my way through passing the unit tests :-) Waiting for some reviews now.

@lamont-granquist
Copy link
Contributor

cool, this LGTM.

@lamont-granquist lamont-granquist merged commit 53c33f6 into chef:master Apr 5, 2021
@bhaveshdavda
Copy link
Author

Thank you for your review, as well as merging the change, @lamont-granquist !

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