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

libselinux: fix build on 32-bit LFS platforms #391728

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from

Conversation

mildsunrise
Copy link

@mildsunrise mildsunrise commented Mar 21, 2025

Compilation of libselinux on modern 32-bit platforms has been broken since v3.8. For example:

nix-build --arg crossSystem '{ config="riscv32-unknown-linux-gnu"; }' -A libselinux

A debian maintainer and me prepared a fix in SELinuxProject/selinux#464 (see discussion and first commit), and I'd like to get this patch here while it's reviewed and released upstream (hopefully in some months). The patch is small and I've tested it doesn't break the build on x64 (a 64-bit platform) and x86 (a 32-bit non-LFS platform).

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
  • N/A Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • N/A (Package updates) Added a release notes entry if the change is major or breaking
    • N/A (Module updates) Added a release notes entry if the change is significant
    • N/A (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@mildsunrise
Copy link
Author

I've also checked we still get the two symbols in x86

# nm -D /nix/store/4agsd6q8snyzihf1zkn3n7izdmxafycb-libselinux-i686-unknown-linux-gnu-3.8/lib/libselinux.so | grep add
         U ___tls_get_addr@GLIBC_2.3
000091cd T avc_add_callback@@LIBSELINUX_1.0
0001b358 T matchpathcon_filespec_add@@LIBSELINUX_1.0
0001b0fb T matchpathcon_filespec_add64@@LIBSELINUX_3.8
         U readdir64@GLIBC_2.2
0001eadd T selinux_failsafe_context_path@@LIBSELINUX_1.0

as expected this causes a mass rebuild so I'll target staging

@mildsunrise mildsunrise force-pushed the libselinux/fix-build-32lfs branch from adbde4f to 3f447cd Compare March 21, 2025 04:18
@github-actions github-actions bot added 6.topic: python 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: kernel The Linux kernel 8.has: changelog 8.has: module (update) This PR changes an existing module in `nixos/` 6.topic: emacs Text editor 6.topic: rust 6.topic: ruby 6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) 6.topic: stdenv Standard environment 6.topic: nodejs 6.topic: lua 6.topic: systemd 6.topic: java Including JDK, tooling, other languages, other VMs 6.topic: mate The MATE Desktop Environment 6.topic: games labels Mar 21, 2025
@mildsunrise mildsunrise changed the base branch from master to staging March 21, 2025 04:19
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 21, 2025
@github-actions github-actions bot removed 6.topic: python 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: kernel The Linux kernel 8.has: changelog 8.has: module (update) This PR changes an existing module in `nixos/` labels Mar 21, 2025
@github-actions github-actions bot removed 6.topic: emacs Text editor 6.topic: rust 6.topic: ruby 6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) 6.topic: stdenv Standard environment 6.topic: nodejs 6.topic: lua 6.topic: systemd 6.topic: java Including JDK, tooling, other languages, other VMs 6.topic: mate The MATE Desktop Environment 6.topic: games labels Mar 21, 2025
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 21, 2025
@mildsunrise mildsunrise force-pushed the libselinux/fix-build-32lfs branch 2 times, most recently from dc49ec2 to a006460 Compare March 21, 2025 04:33
see the linked pull request for more details, basically
upstream tried to improve compatibility for platforms
where ino_t defaults to 32-bit, and in the process
broke 32-bit platforms where ino_t defaults to 64-bit.

patch is in upstream review.
@mildsunrise mildsunrise force-pushed the libselinux/fix-build-32lfs branch from a006460 to c7acf11 Compare March 21, 2025 04:45
Copy link
Member

@RossComputerGuy RossComputerGuy left a comment

Choose a reason for hiding this comment

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

Looks good now, I'll hold off on merging until the upstream PR is closer to being merged in case anything changes.

@wegank wegank added 12.approvals: 1 This PR was reviewed and approved by one reputable person 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package labels Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 1-10 10.rebuild-linux: 501+ 10.rebuild-linux: 5001+ 12.approvals: 1 This PR was reviewed and approved by one reputable person 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package 12. first-time contribution This PR is the author's first one; please be gentle!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants