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

tracing-journald fix for #1698 fails to build on glibc < 2.27 #1879

Closed
pkhuong opened this issue Jan 31, 2022 · 5 comments · Fixed by #1912
Closed

tracing-journald fix for #1698 fails to build on glibc < 2.27 #1879

pkhuong opened this issue Jan 31, 2022 · 5 comments · Fixed by #1912

Comments

@pkhuong
Copy link

pkhuong commented Jan 31, 2022

Bug Report

Building tracing-journald 0.2.2 on Ubuntu Xenial (supported until 2024), Debian Stretch (supported until June 2022) or RHEL 7 (supported until 2024) fails with in function `tracing_journald::memfd::create': ... github.com-1ecc6299db9ec823/tracing-journald-0.2.2/src/memfd.rs:11: undefined reference to `memfd_create'.

This syscall was introduced in Linux 3.17 (in 2014, safely out of LTS), but only exposed by glibc in 2.27 (released in Feb 2018). Unfortunately, libc (used by #1744) just calls out to glibc for this Linux extension, instead of directly invoking a syscall(2) stub, which would always link and return ENOSYS on very old kernels.

Version

$ cargo tree | grep tracing
│   │   │   │   └── tracing v0.1.29
│   │   │   │       ├── tracing-attributes v0.1.18 (proc-macro)
│   │   │   │       └── tracing-core v0.1.21
│   │   │   │   ├── tracing v0.1.29 (*)
│   ├── tracing v0.1.29 (*)
│   ├── tracing-subscriber v0.3.7
│   │   ├── tracing v0.1.29 (*)
│   │   ├── tracing-core v0.1.21 (*)
│   │   └── tracing-log v0.1.2
│   │       └── tracing-core v0.1.21 (*)
│   └── tracing v0.1.29 (*)
├── tracing v0.1.29 (*)
├── tracing-journald v0.2.2
│   ├── tracing-core v0.1.21 (*)
│   └── tracing-subscriber v0.3.7 (*)
├── tracing-subscriber v0.3.7 (*)
    ├── tracing v0.1.29 (*)

Platform

Ubuntu Xenial, Debian Stretch, RHEL 7, on x86-64.

Crates

tracing-journald >= 0.2.1

Description

I try to build a crate that depends on tracing-journald. Linking fails because no one defines memfd_create. Pinning to 0.2.0 restores the build.

@hawkw
Copy link
Member

hawkw commented Jan 31, 2022

cc @lunaryorn, @Ralith

i'm not sure what the best way to handle compatibility with earlier glibc versions is in Rust. possibly a build script to detect the glibc version and set a cfg flag to enable/disable the memfd code?

@hawkw
Copy link
Member

hawkw commented Jan 31, 2022

alternatively, i suppose we could just make the system call ourselves rather than depending on it from libc...

@swsnr
Copy link
Contributor

swsnr commented Jan 31, 2022

I'm sorry that my changes broke things, but I would not like contribute to fixing this, to be honest.

The OP mentions RHEL 7, Ubuntu Xenial, and Debian Stretch. Stretch is end of live, Ubuntu Xenial is in ESM (i.e. you've got to pay for support), and RHEL is flat out enterprise. Whoever uses those distributions works in some kind of commercial enterprise environment, and should definitely have funding and resources to fix things on their own or contract it out for good money, instead of trying to get the community to fix it for free.

The OP can just pin to 0.2.0 which is as good as trying to cfg-away the memfd_create call 🙂

Edit: I'm willing to review any merge requests to tracing-journald of course 🙂

@Ralith
Copy link
Collaborator

Ralith commented Jan 31, 2022

I agree that pinning is a reasonable solution to this, though I'd be willing to review a PR to invoke syscall ourselves.

@9999years
Copy link
Contributor

9999years commented Feb 7, 2022

I'm from one of those enterprise environments interested in patching this to invoke syscall but the docs are not exactly elucidating -- where should I start?

(Pinning 0.2.0 doesn't work because I need to set the syslog identifier, introduced in 0.2.1.)

EDIT: Wait, I think I found the syscall table, nvm.

9999years pushed a commit to 9999years/tracing that referenced this issue Feb 7, 2022
9999years pushed a commit to 9999years/tracing that referenced this issue Feb 7, 2022
hawkw pushed a commit that referenced this issue Feb 7, 2022
Fixes #1879

## Motivation

`journald-tracing>=0.2.1` doesn't build with old glibc.

## Solution

Make the `memfd_create` syscall ourselves.

cc @lunaryorn @Ralith
hawkw pushed a commit that referenced this issue Feb 7, 2022
Fixes #1879

## Motivation

`journald-tracing>=0.2.1` doesn't build with old glibc.

## Solution

Make the `memfd_create` syscall ourselves.

cc @lunaryorn @Ralith
hawkw pushed a commit that referenced this issue Feb 7, 2022
Fixes #1879

## Motivation

`journald-tracing>=0.2.1` doesn't build with old glibc.

## Solution

Make the `memfd_create` syscall ourselves.

cc @lunaryorn @Ralith
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 a pull request may close this issue.

5 participants