Skip to content

Fix build failures with older kernel headers and non-Linux systems#58

Merged
ThomasHabets merged 1 commit intoThomasHabets:arping-2.xfrom
p-linnane:fix-build-portability
Dec 27, 2025
Merged

Fix build failures with older kernel headers and non-Linux systems#58
ThomasHabets merged 1 commit intoThomasHabets:arping-2.xfrom
p-linnane:fix-build-portability

Conversation

@p-linnane
Copy link
Contributor

Hi. I'm a maintainer for Homebrew. While building arming 2.27 for distribution we encountered some build failures. The changes in this PR help with portability and resolve those failures.

LANDLOCK_ACCESS_FS_REFER was added in kernel 5.19 and is not available in older kernel headers.

linux/prctl.h and sys/prctl.h do not exist on macOS/BSD.

- landlock.c: Guard LANDLOCK_ACCESS_FS_REFER with #ifdef, as it was
  added in kernel 5.19 (Landlock ABI v2) and is not available in older
  kernel headers. This follows the existing pattern used for
  LANDLOCK_ACCESS_FS_TRUNCATE and LANDLOCK_ACCESS_FS_IOCTL_DEV.

- no_new_privs.c: Guard linux/prctl.h and sys/prctl.h includes with
  #ifdef __linux__, as these headers are Linux-specific and do not
  exist on macOS/BSD. The functionality is already runtime-guarded
  by HAS_NO_NEW_PRIVS.
@ThomasHabets ThomasHabets merged commit 02256b9 into ThomasHabets:arping-2.x Dec 27, 2025
@p-linnane p-linnane deleted the fix-build-portability branch December 27, 2025 21:24
@ThomasHabets
Copy link
Owner

Oh, that's an embarrassing mistake. Thanks for the fix.

I adjusted it a bit to have includes of the prctl.h's not depend on __linux__, but on their actual presence.

If you could confirm that this looks good to you know, I think this is important enough to do a 2.28 fix release. :-/

@p-linnane
Copy link
Contributor Author

Confirming that building from HEAD worked just fine on macOS.

@ThomasHabets
Copy link
Owner

Thanks. I'll likely do another release tomorrow to not have the latest version fail to build.

@ThomasHabets
Copy link
Owner

I've released 2.28, and added a github action building on OpenBSD to prevent it happening again. May add others, but at least it's quite different from Linux.

@p-linnane
Copy link
Contributor Author

I've opened #59 to add a macOS testing workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants