Skip to content

util-linux 2.42.3 builds against glibc 2.40, and asks the kernel to block symlinks and not magic links - #40

Open
DevomB wants to merge 1 commit into
mainfrom
util-linux-resolve-flag
Open

DevomB wants to merge 1 commit into
mainfrom
util-linux-resolve-flag

Conversation

@DevomB

@DevomB DevomB commented Sep 20, 2026

Copy link
Copy Markdown
Owner

Fixes the stage 04 failure on main (run 35496552035): libmount/src/hook_idmap.c:335: 'RESOLVE_NO_SYMLINKS' undeclared.

Two upstream defects, both visible only on a glibc older than 2.43, whose <fcntl.h> does not bring <linux/openat2.h> in:

  • hook_idmap.c uses the constant and includes nothing that defines it. This is what stopped the build.
  • include/fileutils.h defines a fallback of 0x02. In the kernel's ABI that is RESOLVE_NO_MAGICLINKS; RESOLVE_NO_SYMLINKS is 0x04. context.c compiled with it, so the restricted-mount hardening asked the kernel to block the wrong thing. Kryptik's mount is not setuid, so that mode is not reachable here.

Fix. A one-patch set in build/patches/util-linux-2.42.3 (with SHA256SUMS and a README), applied by a new s_util_linux with the same configure flags as before.

Checked on a glibc 2.39 host: the released tarball fails at the identical line; the patch applies with no fuzz through apply_repo_patches, which refuses a tampered copy; the package builds; context.c preprocesses to 0x04 where it had 0x02.

Held until a local smoke build of the other 18 bumped packages finishes, so that one build round covers everything it finds.

…lock symlinks and not magic links

The from-nothing build (run 35496552035, 9329c91) stopped in stage 04 at
util-linux: libmount/src/hook_idmap.c:335, 'RESOLVE_NO_SYMLINKS' undeclared.
Everything before it had passed on the new toolchain, the compiler check
included.

It is upstream's, and visible only where the C library's <fcntl.h> does not
bring <linux/openat2.h> in, which is glibc before 2.43. hook_idmap.c uses the
constant and includes nothing that defines it. Looking for where the other
files get it found the worse half: include/fileutils.h defines a fallback of
0x02, and in the kernel's ABI 0x02 is RESOLVE_NO_MAGICLINKS;
RESOLVE_NO_SYMLINKS is 0x04. context.c preprocesses to
`mnt_context_is_restricted(cxt) ? 0x02 : 0` on such a libc, so the
restricted-mount hardening 2.42 added blocks the wrong thing. Kryptik's mount
is not setuid, so that mode is not reachable here; it is fixed anyway, because
a carried patch should not leave a known-wrong constant beside the line it
touches.

build/patches/util-linux-2.42.3 holds one patch: fileutils.h includes the
kernel header where configure found it and its fallback is 0x04, and
hook_idmap.c includes fileutils.h as context.c and hook_mount.c do. The row
becomes s_util_linux, which applies the set through apply_repo_patches with
the same configure flags as before.

Reproduced and checked on a glibc 2.39 host: the released tarball fails at the
identical line; the patch applies to it with no fuzz through the project's
own function, which refuses a tampered copy; the whole package then builds;
and context.c preprocesses to 0x04 where it had 0x02.
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.

1 participant