]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
5 hours agoMerge branch 'PR/pty-terminal-setup-race' of https://github.com/karelzak/util-linux... master
Karel Zak [Wed, 29 Jul 2026 12:32:43 +0000 (14:32 +0200)] 
Merge branch 'PR/pty-terminal-setup-race' of https://github.com/karelzak/util-linux-work

* 'PR/pty-terminal-setup-race' of https://github.com/karelzak/util-linux-work:
  pty-session: defer raw mode until after signals are blocked

7 hours agolsfd: update man page for bpf-map NAME format
Karel Zak [Wed, 29 Jul 2026 11:07:47 +0000 (13:07 +0200)] 
lsfd: update man page for bpf-map NAME format

Note that the bpf-map NAME format is used only for opened file
objects, not for mapped ones.

Addresses: https://github.com/util-linux/util-linux/pull/4501
Signed-off-by: Karel Zak <kzak@redhat.com>
7 hours agoMerge branch 'lsfd/fix-bpf-map' of https://github.com/echoechoin/util-linux
Karel Zak [Wed, 29 Jul 2026 11:06:05 +0000 (13:06 +0200)] 
Merge branch 'lsfd/fix-bpf-map' of https://github.com/echoechoin/util-linux

* 'lsfd/fix-bpf-map' of https://github.com/echoechoin/util-linux:
  tests: (lsfd) add mapped-bpf-map test case
  test: (mkfds::mapped-bpf-map) new factory
  lsfd: improve bpf-map display when fdinfo is not available

28 hours agoMerge branch 'lsfd/typo' of https://github.com/echoechoin/util-linux
Karel Zak [Tue, 28 Jul 2026 13:24:44 +0000 (15:24 +0200)] 
Merge branch 'lsfd/typo' of https://github.com/echoechoin/util-linux

* 'lsfd/typo' of https://github.com/echoechoin/util-linux:
  lsfd: fix typo.

29 hours agoMerge branch 'fdisk-fix-t-type-autocreate' of https://github.com/Persioqq/util-linux
Karel Zak [Tue, 28 Jul 2026 13:02:37 +0000 (15:02 +0200)] 
Merge branch 'fdisk-fix-t-type-autocreate' of https://github.com/Persioqq/util-linux

* 'fdisk-fix-t-type-autocreate' of https://github.com/Persioqq/util-linux:
  fdisk: fix -t/--type when auto-creating a label on empty devices

29 hours agoagetty: move man page to agetty-cmd/
Karel Zak [Tue, 28 Jul 2026 12:57:52 +0000 (14:57 +0200)] 
agetty: move man page to agetty-cmd/

The agetty source was moved to agetty-cmd/ but the man page
agetty.8.adoc was left behind in term-utils/. Move it to agetty-cmd/
and update references in meson.build, Makemodule.am, and po-man/po4a.cfg.

Signed-off-by: Karel Zak <kzak@redhat.com>
29 hours agoagetty: show default issue file when built without issue.d support
lzwind [Tue, 28 Jul 2026 12:33:00 +0000 (14:33 +0200)] 
agetty: show default issue file when built without issue.d support

Commit d1cf7ef refactored the issue file handling to read the default
issue file (/etc/issue) together with the issue.d drop-in directory
through ul_configs_file_list(). That call was placed inside an
"#ifdef ISSUEDIR_SUPPORT" block, so on builds without issue.d support
(e.g. systems where scandirat()/openat() are unavailable, such as musl
libc) the default issue file was no longer read at all.

As a result `agetty --show-issue` and the login prompt printed nothing
on such builds unless --issue-file was given, regressing the long-standing
behaviour of displaying /etc/issue.

ul_configs_file_list() returns the main issue file even when drop-in
directory support is unavailable (it skips the drop-in scan but still
locates the main configuration file), so move the call out from under
ISSUEDIR_SUPPORT and include configs.h unconditionally. The drop-in
directory scanning itself still requires ISSUEDIR_SUPPORT, which is
unchanged.

[kzak: removed github issue URL from in-code comment]

Fixes: https://github.com/util-linux/util-linux/issues/4505
Suggested-by: Naomi Rennie-Waldock <naomi.renniewaldock@gmail.com>
Signed-off-by: lzwind <liuzheng@uniontech.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
29 hours agopty-session: defer raw mode until after signals are blocked
Karel Zak [Tue, 28 Jul 2026 12:16:31 +0000 (14:16 +0200)] 
pty-session: defer raw mode until after signals are blocked

ul_pty_setup() switches the user's terminal to raw mode before
ul_pty_signals_setup() blocks signals. A terminating signal delivered
in this window kills the process without reaching ul_pty_cleanup(),
leaving the terminal in raw mode.

Move the raw-mode tcsetattr() out of ul_pty_setup() into a new
ul_pty_terminal_setup() function, to be called after
ul_pty_signals_setup(). This ensures signals are already directed
to signalfd when raw mode is activated, closing the race window.

The setup sequence is now:
  ul_pty_setup()          -- open pty, save terminal attrs
  <app-specific work>     -- e.g. utempter (needs SIGCHLD unblocked)
  ul_pty_signals_setup()  -- block signals, create signalfd
  ul_pty_terminal_setup() -- set raw mode (signals already blocked)
  fork()

Addresses: https://github.com/util-linux/util-linux/issues/4499
Signed-off-by: Karel Zak <kzak@redhat.com>
45 hours agofdisk: fix -t/--type when auto-creating a label on empty devices
Henrique Surian Stobbe [Fri, 17 Jul 2026 00:58:17 +0000 (21:58 -0300)] 
fdisk: fix -t/--type when auto-creating a label on empty devices

fdisk_create_disklabel(cxt, NULL) always resolves to "dos" or "sun",
regardless of any restriction set via -t/--type. If -t disabled "dos"
(like in -t gpt) auto-creation on an empty device fails with -EINVAL.
As the return code was never checked, the failure was silent,
thus no label got created and no error was shown.

The requested label via -t is now passed to the auto-create call,
which warns if creation still fails.

There is no behavior change when -t is not used in the program.

Signed-off-by: Henrique Surian Stobbe <henriquesstobbe@gmail.com>
2 days agotests: (lsfd) add mapped-bpf-map test case
WanBingjiang [Thu, 23 Jul 2026 07:35:18 +0000 (15:35 +0800)] 
tests: (lsfd) add mapped-bpf-map test case

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
5 days agopty-session: handle SIGALRM instead of aborting
lzwind [Fri, 24 Jul 2026 13:00:15 +0000 (21:00 +0800)] 
pty-session: handle SIGALRM instead of aborting

ul_pty_signals_setup() subscribes to SIGALRM through the signalfd set,
but handle_signal() has no case for it, so a SIGALRM delivered to the
proxy (e.g. an alarm(2) timer armed before execve(), or an external
"kill -ALRM") falls through to "default: abort()".

The abort() terminates script/su --pty/runuser --pty with SIGABRT before
ul_pty_cleanup() runs, leaving the user's terminal in raw mode (no echo,
no canonical mode, no signal generation) until "stty sane" is run.

Treat SIGALRM like the other terminating signals (SIGHUP/SIGTERM/SIGINT/
SIGQUIT): record it in delivered_signal and forward SIGTERM to the child
so the proxy leaves its poll() loop through the normal path and
ul_pty_cleanup() restores the saved terminal settings. The default
disposition of SIGALRM is termination, so this preserves the previous
outcome while adding the cleanup.

None of script, su --pty or runuser --pty arms SIGALRM internally on this
code path.

This addresses the deterministic SIGALRM path reported in #4499. The
separate, much narrower window where a terminating signal arrives
between ul_pty_setup() (raw mode on) and ul_pty_signals_setup() (signals
blocked) is not addressed here; closing it requires reworking the signal
mask contract between those two calls.

Partially fixes: https://github.com/util-linux/util-linux/issues/4499
Signed-off-by: lzwind <liuzheng@uniontech.com>
5 days agolsfd: fix typo.
WanBingjiang [Fri, 24 Jul 2026 07:20:45 +0000 (15:20 +0800)] 
lsfd: fix typo.

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
6 days agotest: (mkfds::mapped-bpf-map) new factory
WanBingjiang [Thu, 23 Jul 2026 07:10:19 +0000 (15:10 +0800)] 
test: (mkfds::mapped-bpf-map) new factory

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
6 days agolsfd: improve bpf-map display when fdinfo is not available
WanBingjiang [Thu, 23 Jul 2026 07:08:41 +0000 (15:08 +0800)] 
lsfd: improve bpf-map display when fdinfo is not available

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
6 days agoMerge branch 'fix/fdisk-gpt-first-usable-lba' of https://github.com/lzwind/util-linux
Karel Zak [Thu, 23 Jul 2026 09:46:39 +0000 (11:46 +0200)] 
Merge branch 'fix/fdisk-gpt-first-usable-lba' of https://github.com/lzwind/util-linux

* 'fix/fdisk-gpt-first-usable-lba' of https://github.com/lzwind/util-linux:
  fdisk: derive first usable LBA from the real primary entries location

6 days agoMerge branch 'fix/scriptreplay-divisor-fractional-seconds' of https://github.com...
Karel Zak [Thu, 23 Jul 2026 09:34:16 +0000 (11:34 +0200)] 
Merge branch 'fix/scriptreplay-divisor-fractional-seconds' of https://github.com/dengzhongyuan365-dev/util-linux

* 'fix/scriptreplay-divisor-fractional-seconds' of https://github.com/dengzhongyuan365-dev/util-linux:
  scriptreplay: fix --divisor discarding fractional seconds

6 days agoMerge branch 'fix/pg-endline-tab-oob' of https://github.com/logical-misha/util-linux
Karel Zak [Thu, 23 Jul 2026 09:23:05 +0000 (11:23 +0200)] 
Merge branch 'fix/pg-endline-tab-oob' of https://github.com/logical-misha/util-linux

* 'fix/pg-endline-tab-oob' of https://github.com/logical-misha/util-linux:
  pg: fix out-of-bounds access past wbuf on a trailing tab

6 days agoMerge branch 'fix/more-get_line-mbc-oob' of https://github.com/logical-misha/util...
Karel Zak [Thu, 23 Jul 2026 09:19:19 +0000 (11:19 +0200)] 
Merge branch 'fix/more-get_line-mbc-oob' of https://github.com/logical-misha/util-linux

* 'fix/more-get_line-mbc-oob' of https://github.com/logical-misha/util-linux:
  more: fix out-of-bounds write in get_line() on invalid multibyte input

6 days agofdisk: derive first usable LBA from the real primary entries location
lzwind [Thu, 23 Jul 2026 06:55:54 +0000 (14:55 +0800)] 
fdisk: derive first usable LBA from the real primary entries location

fdisk_gpt_set_npartitions() (the expert "change table length" command)
computed the first usable LBA with gpt_calculate_first_lba(), which
assumes the primary partition entries array is at the default LBA 2. The
primary entries array is not relocated when the table length changes, so
on a GPT whose primary entries are not at the default location the usable
area ended up overlapping the entries array and a partition could be
created on top of it.

Derive the first usable LBA from the actual on-disk location of the
primary entries array (pheader->partition_entry_lba) instead. The backup
entries array is recalculated to the default end-of-device location by
gpt_mknew_header_common(), so gpt_calculate_last_lba() is still based on
the default layout and is left unchanged.

Add a regression test that relocates the primary entries array to a
non-default LBA and checks the first usable LBA after a "change table
length" operation.

Fixes: https://github.com/util-linux/util-linux/issues/3923
Signed-off-by: lzwind <liuzheng@uniontech.com>
6 days agoMerge branch 'lsfd/bpf-link' of https://github.com/echoechoin/util-linux
Karel Zak [Thu, 23 Jul 2026 08:05:31 +0000 (10:05 +0200)] 
Merge branch 'lsfd/bpf-link' of https://github.com/echoechoin/util-linux

* 'lsfd/bpf-link' of https://github.com/echoechoin/util-linux:
  test: (lsfd) add a case for testing bpf-link related columns
  test: (mkfds::bpf-link) new factory
  lsfd: add configure check for BPF_LINK_CREATE
  lsfd: introduce bpf-link anon-inode support

6 days agoscriptreplay: fix --divisor discarding fractional seconds
dengzhongyuan365-dev [Thu, 23 Jul 2026 01:42:15 +0000 (09:42 +0800)] 
scriptreplay: fix --divisor discarding fractional seconds

replay_get_next_step() divided the tv_sec and tv_usec fields of the
recorded delay by the divisor independently.  Both fields are integers, so
the fractional part of the whole-seconds field was discarded instead of
being carried into microseconds.  Replaying a 1.000000 s delay with
--divisor 2 therefore produced a 0.000000 s delay (the next step was
emitted immediately) instead of the expected 0.500000 s, and the error
could approach one second per step and accumulate across recordings with
multiple pauses.

Scale the complete duration once in microseconds, then split the result
back into seconds and microseconds so the fractional whole-seconds part is
preserved.  This affects both scriptreplay and scriptlive, which share the
helper.

Add a "divisor-fractional" subtest to tests/ts/script/replay that verifies
a 1.000000 s delay scaled by --divisor 2 takes about half a second rather
than collapsing to zero.

Addresses: https://github.com/util-linux/util-linux/issues/4500
Signed-off-by: dengzhongyuan365-dev <dengzhongyuan@uniontech.com>
8 days agopg: fix out-of-bounds access past wbuf on a trailing tab
logical-misha [Tue, 21 Jul 2026 04:55:43 +0000 (04:55 +0000)] 
pg: fix out-of-bounds access past wbuf on a trailing tab

endline_for_mb() and its single-byte twin endline() advance the scan
pointer twice when the last character of a buffer-filling line is a tab
(once in the tab branch, once via the shared *++p) with no terminator
re-check in between. A full line (wl == READBUF-1) ending in a tab makes
*++p read wbuf[READBUF] and the following *end = L'\0' write it -- one
element past the wbuf[READBUF] array.

Re-check for the terminator before the second advance.

Closes #4495

Signed-off-by: logical-misha <220645577+logical-misha@users.noreply.github.com>
8 days agomore: fix out-of-bounds write in get_line() on invalid multibyte input
logical-misha [Tue, 21 Jul 2026 04:55:43 +0000 (04:55 +0000)] 
more: fix out-of-bounds write in get_line() on invalid multibyte input

In get_line(), the invalid-multibyte switch arm (case (size_t)-1) writes
*p++ = mbc[0] without the bounds check that its sibling write paths use,
and the "goto process_mbc" back-edge lets it re-run within one loop
iteration, bypassing the loop-head guard. A line that first fills line_buf
with zero-width combining characters (which advance p but not column) and
then supplies an invalid multibyte sequence can step p past the
num_columns*4 + 2 byte allocation -- a heap out-of-bounds write.

Guard the write the same way the sibling path does.

Closes #4494

Signed-off-by: logical-misha <220645577+logical-misha@users.noreply.github.com>
8 days agotest: (lsfd) add a case for testing bpf-link related columns
WanBingjiang [Thu, 16 Jul 2026 03:32:14 +0000 (11:32 +0800)] 
test: (lsfd) add a case for testing bpf-link related columns

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
9 days agoMerge branch 'fix-rename-lsipc-three-bugs' of https://github.com/lionheartyu/util...
Karel Zak [Mon, 20 Jul 2026 10:52:12 +0000 (12:52 +0200)] 
Merge branch 'fix-rename-lsipc-three-bugs' of https://github.com/lionheartyu/util-linux_

* 'fix-rename-lsipc-three-bugs' of https://github.com/lionheartyu/util-linux_:
  lsipc: report shared memory creator GID correctly
  lsipc: print numeric permissions for message queues
  rename: honor no-overwrite for dangling symlinks

9 days agotest: (mkfds::bpf-link) new factory
WanBingjiang [Thu, 16 Jul 2026 03:31:12 +0000 (11:31 +0800)] 
test: (mkfds::bpf-link) new factory

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
9 days agolsfd: add configure check for BPF_LINK_CREATE
WanBingjiang [Wed, 15 Jul 2026 09:06:28 +0000 (17:06 +0800)] 
lsfd: add configure check for BPF_LINK_CREATE

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
9 days agolsfd: introduce bpf-link anon-inode support
WanBingjiang [Wed, 15 Jul 2026 08:33:26 +0000 (16:33 +0800)] 
lsfd: introduce bpf-link anon-inode support

Add BPF link file descriptor decoding to lsfd, following the same
pattern as bpf-prog and bpf-map.

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
9 days agoMerge branch 'PR/libmount-vfs' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 20 Jul 2026 08:40:00 +0000 (10:40 +0200)] 
Merge branch 'PR/libmount-vfs' of https://github.com/karelzak/util-linux-work

* 'PR/libmount-vfs' of https://github.com/karelzak/util-linux-work:
  docs: add VFS symbols to libmount-sections.txt
  tests: add libmount VFS test
  libmount: add VFS test to test_mount_context
  libmount: add pluggable VFS I/O support

12 days agolsipc: report shared memory creator GID correctly
dongshengyuan [Fri, 17 Jul 2026 10:20:18 +0000 (18:20 +0800)] 
lsipc: report shared memory creator GID correctly

Change:
  Use shm_perm.cgid for the shared memory CGID column.
  Keep CGID consistent with CGROUP and other IPC types.

Before:
  lsipc --shmems --creator printed CUID as CGID.
  The error was visible when creator UID and GID differed.

Follow:
  d8461c4e4d8046fb8bd1da8c57383854159d48d1

12 days agolsipc: print numeric permissions for message queues
dongshengyuan [Fri, 17 Jul 2026 10:20:18 +0000 (18:20 +0800)] 
lsipc: print numeric permissions for message queues

Change:
  Move scols_line_refer_data() outside the else branch.
  Apply this to System V and POSIX message queues.

Before:
  --numeric-perms left PERMS empty for message queues.
  OWNER shifted into the PERMS field in normal output.

Follow:
  9d20ffda794208d26e6b3ed09fbc38d94d0b8fc6
  c457ec945b4457418af6d5d80f4e6357b15cba9b

12 days agorename: honor no-overwrite for dangling symlinks
dongshengyuan [Fri, 17 Jul 2026 10:20:18 +0000 (18:20 +0800)] 
rename: honor no-overwrite for dangling symlinks

Change:
  Use lstat() for destination existence checks.
  Treat dangling symlinks as existing entries.

Before:
  rename --no-overwrite replaced the dangling symlink.
  rename --copy --no-overwrite followed it and created target.

Follow:
  eb4aea8a4756be04655f31b286bc33b593f2689f
  d021e24bc185cca05cf81a257648ec5d2d94f0e4

13 days agodocs: add VFS symbols to libmount-sections.txt
Karel Zak [Wed, 15 Jul 2026 11:09:46 +0000 (13:09 +0200)] 
docs: add VFS symbols to libmount-sections.txt

Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 70806a09ec55defc201728d8946d3a19676ff827)

13 days agotests: add libmount VFS test
Karel Zak [Wed, 15 Jul 2026 11:06:24 +0000 (13:06 +0200)] 
tests: add libmount VFS test

Add test script that exercises the pluggable VFS I/O operations:

  table-fstab      -- verify vfs_fopen callback for fstab parsing
  table-mountinfo  -- verify vfs_fopen callback for mountinfo parsing
  blkid            -- verify vfs_open/read/lseek/close for device probing

Signed-off-by: Karel Zak <kzak@redhat.com>
13 days agolibmount: add VFS test to test_mount_context
Karel Zak [Wed, 15 Jul 2026 10:46:06 +0000 (12:46 +0200)] 
libmount: add VFS test to test_mount_context

Add --vfs test that exercises the pluggable VFS I/O operations with
three sub-options:

  --table <file>   parse a mount table through VFS fopen
  --cache <dev>    probe device via cache (udev, then blkid)
  --blkid <dev>    probe device directly via libblkid VFS

The test sets up VFS callbacks that wrap standard syscalls and report
call counts, verifying that I/O is routed through the pluggable layer.

Signed-off-by: Karel Zak <kzak@redhat.com>
13 days agolibmount: add pluggable VFS I/O support
Karel Zak [Wed, 15 Jul 2026 10:21:29 +0000 (12:21 +0200)] 
libmount: add pluggable VFS I/O support

Add three new public APIs for pluggable VFS I/O operations:

- mnt_context_set_vfs(cxt, ops) -- set VFS on mount context (owned copy)
- mnt_cache_refer_vfs(cache, vfs) -- set VFS reference on cache (borrowed)
- mnt_table_refer_vfs(tb, vfs) -- set VFS reference on table (borrowed)

The VFS operations are automatically propagated from the context to its
cache and tables when they are created or set.

Convert blkid probe calls in cache.c (read_from_blkid, fstype_from_blkid)
from blkid_new_probe_from_filename() to the VFS-aware 3-step pattern:
blkid_new_probe() + blkid_probe_set_vfs() + blkid_probe_open_device().

Convert mnt_table_parse_file() to use ul_vfs_fopen() for VFS-aware
file opening.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoMerge branch 'PR/docs-gtk-doc-fixes' of https://github.com/karelzak/util-linux-work
Karel Zak [Wed, 15 Jul 2026 11:19:56 +0000 (13:19 +0200)] 
Merge branch 'PR/docs-gtk-doc-fixes' of https://github.com/karelzak/util-linux-work

* 'PR/docs-gtk-doc-fixes' of https://github.com/karelzak/util-linux-work:
  docs: update libfdisk gtk-doc configuration
  docs: update libsmartcols gtk-doc configuration
  docs: update libblkid gtk-doc configuration
  docs: update libmount gtk-doc configuration
  libmount: fix gtk-doc comments and declarations

2 weeks agoMerge branch 'PR/dl-utils' of https://github.com/karelzak/util-linux-work
Karel Zak [Wed, 15 Jul 2026 11:19:37 +0000 (13:19 +0200)] 
Merge branch 'PR/dl-utils' of https://github.com/karelzak/util-linux-work

* 'PR/dl-utils' of https://github.com/karelzak/util-linux-work:
  tools: switch SELinux to runtime optional via dlopen
  libmount: use shared dl-utils for SELinux dlopen
  libmount: fix -Wunterminated-string-initialization warning
  libmount: use shared dl-utils for cryptsetup dlopen
  lib/dl-utils: add shared dlopen/dlsym infrastructure

2 weeks agodocs: findmnt: clarify that --target returns one filesystem
Karel Zak [Tue, 14 Jul 2026 12:48:39 +0000 (14:48 +0200)] 
docs: findmnt: clarify that --target returns one filesystem

The --target option identifies the filesystem for a given path, and a
file always resides on exactly one filesystem. Document that --target
returns at most one entry and skips over-mounted entries.

Addresses: https://github.com/util-linux/util-linux/issues/4424
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoMerge branch 'fix-target' of https://github.com/dengbo11/util-linux
Karel Zak [Tue, 14 Jul 2026 12:46:01 +0000 (14:46 +0200)] 
Merge branch 'fix-target' of https://github.com/dengbo11/util-linux

* 'fix-target' of https://github.com/dengbo11/util-linux:
  findmnt: skip shadowed entries when matching by --target

2 weeks agotools: switch SELinux to runtime optional via dlopen
Karel Zak [Mon, 13 Jul 2026 14:28:43 +0000 (16:28 +0200)] 
tools: switch SELinux to runtime optional via dlopen

Replace direct libselinux linking with runtime dlopen() using the
shared dl-utils infrastructure. All tools that use SELinux functions
now call them through selinux_call() macro and gracefully handle the
case when libselinux is not installed at runtime.

Affected tools: mkswap, chfn, chsh, lslogins, sulogin, vipw, namei,
mount, nsenter, login.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolibmount: use shared dl-utils for SELinux dlopen
Karel Zak [Mon, 13 Jul 2026 14:18:29 +0000 (16:18 +0200)] 
libmount: use shared dl-utils for SELinux dlopen

Add lib/dl-selinux.c and include/dl-selinux.h as a SELinux dlopen
wrapper using the shared dl-utils infrastructure. This replaces the
direct libselinux linking with runtime dlopen(), allowing libmount to
gracefully handle the case when libselinux is not installed.

The hook_selinux.c and lib/selinux-utils.c now use selinux_call()
macro to call SELinux functions through the dlopen'd function pointer
table.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolibmount: fix -Wunterminated-string-initialization warning
Karel Zak [Mon, 13 Jul 2026 13:45:26 +0000 (15:45 +0200)] 
libmount: fix -Wunterminated-string-initialization warning

The "xx\0" string literal is 4 bytes but buf is only 3, truncating
the NUL terminator.  Since the buffer is immediately overwritten by
memcpy, just zero-initialize it instead.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolibmount: use shared dl-utils for cryptsetup dlopen
Karel Zak [Mon, 13 Jul 2026 13:42:14 +0000 (15:42 +0200)] 
libmount: use shared dl-utils for cryptsetup dlopen

Move the cryptsetup dlopen wrapper out of hook_veritydev.c into
lib/dl-cryptsetup.c with a global cached load function
ul_dlopen_libcryptsetup().  The function pointers are resolved once
and shared across all callers.

This removes the CRYPTSETUP_VIA_DLOPEN conditional -- dlopen is now the
only supported way to use libcryptsetup.  The library is never linked
directly.

An ELF .note.dlopen metadata note is emitted so that packaging tools
can automatically derive the optional runtime dependency.

Also fix the CFLAGS order in libmount Makemodule.am to ensure local
include paths (-I for blkid, libmount) come before external pkg-config
flags that may pull in system headers.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agodocs: update libfdisk gtk-doc configuration
Karel Zak [Tue, 14 Jul 2026 12:31:28 +0000 (14:31 +0200)] 
docs: update libfdisk gtk-doc configuration

- add api-index entries for versions 2.41, 2.42 and 2.43
- add missing @start and @size parameter docs for
  fdisk_is_collision_area()
- fix "Since: v2.42" -> "Since: 2.42"

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agodocs: update libsmartcols gtk-doc configuration
Karel Zak [Tue, 14 Jul 2026 12:28:27 +0000 (14:28 +0200)] 
docs: update libsmartcols gtk-doc configuration

- add api-index entries for versions 2.41, 2.42 and 2.43
- fix wrap_nextchunk() -> @wrap_nextchunk in doc comment to avoid
  broken cross-reference link

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agodocs: update libblkid gtk-doc configuration
Karel Zak [Tue, 14 Jul 2026 12:21:52 +0000 (14:21 +0200)] 
docs: update libblkid gtk-doc configuration

- fix role="2.35" -> role="2.36" mismatch in api-index entry
- add api-index entries for versions 2.39 and 2.43
- add missing symbols to libblkid-sections.txt (BLKID_EVALUATE_NOPROBE,
  ul_vfs_ops, UL_VFS_OPS_DEFINED, LIBBLKID_VERSION, LIBBLKID_DATE,
  LIBBLKID_MAJOR_VERSION, LIBBLKID_MINOR_VERSION, LIBBLKID_PATCH_VERSION)

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agodocs: update libmount gtk-doc configuration
Karel Zak [Tue, 14 Jul 2026 11:56:56 +0000 (13:56 +0200)] 
docs: update libmount gtk-doc configuration

- set SCAN_OPTIONS with --deprecated-guards="LIBMOUNT_DISABLE_DEPRECATED"
- add monitor.h to IGNORE_HFILES (private header)
- add statmount.xml section include to libmount-docs.xml
- add api-index entries for versions 2.42 and 2.43
- remove api-index entries for non-existent versions 2.37 and 2.39
- add missing symbols to libmount-sections.txt (MNT_ERR_ONLYONCE,
  MNT_ERR_CHOWN, MNT_ERR_CHMOD, MNT_ERR_IDMAP, MNT_ERR_EXEC,
  MNT_EX_EXEC, MNT_MS_VERITY_ON_CORRUPTION, MS_NOSYMFOLLOW,
  MNT_NOFSTAB, MNT_SUPERBLOCK)

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolibmount: fix gtk-doc comments and declarations
Karel Zak [Tue, 14 Jul 2026 11:56:27 +0000 (13:56 +0200)] 
libmount: fix gtk-doc comments and declarations

- add LIBMOUNT_DISABLE_DEPRECATED guards around deprecated function
  declarations (mnt_optstr_apply_flags, mnt_has_regular_mtab,
  mnt_get_mtab_path)
- move mnt_table_enable_noautofs() and mnt_table_is_noautofs()
  declarations from private mountP.h to public libmount.h.in,
  convert doc comments to gtk-doc format
- fix missing colons in struct doc comments (libmnt_update,
  libmnt_context, libmnt_monitor, libmnt_statmnt)
- fix @id -> @ns parameter name in mnt_table_listmount_set_ns() doc
- fix typo mnt_table_fetch_listmont -> mnt_table_fetch_listmount
- fix wrong cross-references mnt_fs_set_ns_id() -> mnt_fs_set_ns(),
  mnt_table_fetch_statmount() -> mnt_fs_fetch_statmount()
- fix "Since: v2.42" -> "Since: 2.42" in mnt_monitor_enable_mountinfo

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolib/dl-utils: add shared dlopen/dlsym infrastructure
Karel Zak [Mon, 13 Jul 2026 11:32:55 +0000 (13:32 +0200)] 
lib/dl-utils: add shared dlopen/dlsym infrastructure

Add generic helpers for optional runtime dependencies loaded via dlopen().
Each optional library gets its own struct of function pointers and a symbol
table mapping names to offsets in that struct.  The shared ul_dlopen_symbols()
resolves all entries in one call.

This also includes a copy of the ELF .note.dlopen metadata macro (from
systemd's sd-dlopen.h, MIT-0 licensed) so that packaging tools can
automatically derive optional dlopen() dependencies.

Library-specific wrappers will live in lib/dl-<name>.c.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoMerge branch 'PR/lslocks-test-fix' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 14 Jul 2026 10:39:27 +0000 (12:39 +0200)] 
Merge branch 'PR/lslocks-test-fix' of https://github.com/karelzak/util-linux-work

* 'PR/lslocks-test-fix' of https://github.com/karelzak/util-linux-work:
  tests: lslocks filter, workaround duplicate lines in output

2 weeks agoMerge branch 'update_zh_CN_po' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Tue, 14 Jul 2026 09:16:29 +0000 (11:16 +0200)] 
Merge branch 'update_zh_CN_po' of https://github.com/cgoesche/util-linux-fork

* 'update_zh_CN_po' of https://github.com/cgoesche/util-linux-fork:
  po: update zn_CN.po (from translationproject.org)

2 weeks agoloopdev: initialize nr to avoid uninitialized use in debug [coverity: CID 490831]
Karel Zak [Mon, 13 Jul 2026 10:41:43 +0000 (12:41 +0200)] 
loopdev: initialize nr to avoid uninitialized use in debug [coverity: CID 490831]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolibblkid: dos: fix 32-bit overflow in partition start/size [coverity: CID 503517...
Karel Zak [Mon, 13 Jul 2026 10:38:57 +0000 (12:38 +0200)] 
libblkid: dos: fix 32-bit overflow in partition start/size [coverity: CID 503517, 503518]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agochmem: check ul_path_readf_s32() return value [coverity: CID 504055]
Karel Zak [Mon, 13 Jul 2026 10:35:39 +0000 (12:35 +0200)] 
chmem: check ul_path_readf_s32() return value [coverity: CID 504055]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agochcpu: check ul_path_readf_s32() return value [coverity: CID 504056]
Karel Zak [Mon, 13 Jul 2026 10:32:59 +0000 (12:32 +0200)] 
chcpu: check ul_path_readf_s32() return value [coverity: CID 504056]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolscpu: check ul_path_readf_s32() return value [coverity: CID 504058]
Karel Zak [Mon, 13 Jul 2026 10:29:57 +0000 (12:29 +0200)] 
lscpu: check ul_path_readf_s32() return value [coverity: CID 504058]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolscpu: add NULL guards for RISC-V ISA functions [coverity: CID 503785]
Karel Zak [Mon, 13 Jul 2026 10:15:16 +0000 (12:15 +0200)] 
lscpu: add NULL guards for RISC-V ISA functions [coverity: CID 503785]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoagetty: check ioctl() return value [coverity: CID 503786]
Karel Zak [Mon, 13 Jul 2026 10:09:34 +0000 (12:09 +0200)] 
agetty: check ioctl() return value [coverity: CID 503786]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoagetty: check fcntl() return value [coverity: CID 503788]
Karel Zak [Mon, 13 Jul 2026 10:07:25 +0000 (12:07 +0200)] 
agetty: check fcntl() return value [coverity: CID 503788]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agofindmnt: skip shadowed entries when matching by --target
dengbo [Thu, 25 Jun 2026 13:52:16 +0000 (21:52 +0800)] 
findmnt: skip shadowed entries when matching by --target

The previous approach filtered shadowed entries in match_func() using
mnt_table_over_fs() with is_defined_match(COL_TARGET) as the trigger.
This was fragile because COL_TARGET matching is also enabled by other
code paths (source/target swap fallback in get_next_fs(), poll_match()
swap logic, and positional arguments).

Replace with the standard mountinfo iteration pattern: read
/proc/self/mountinfo backward (MNT_ITER_BACKWARD), stop at the first
match (FL_FIRSTONLY), and disable source/target swapping
(FL_NOSWAPMATCH). Since later mounts appear later in mountinfo,
backward iteration naturally finds the visible (topmost) filesystem
for the given target path.

Fixes https://github.com/util-linux/util-linux/issues/4424

2 weeks agopo: update zn_CN.po (from translationproject.org)
Christian Goeschel Ndjomouo [Fri, 10 Jul 2026 00:53:55 +0000 (20:53 -0400)] 
po: update zn_CN.po (from translationproject.org)

Closes: #4474
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agobuild-sys: add --disable-lsclocks to configure
Karel Zak [Thu, 9 Jul 2026 14:50:55 +0000 (16:50 +0200)] 
build-sys: add --disable-lsclocks to configure

Addresses: https://github.com/util-linux/util-linux/issues/4472
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoMerge branch 'PR/libblkid-vfs' of https://github.com/karelzak/util-linux-work
Karel Zak [Thu, 9 Jul 2026 14:44:20 +0000 (16:44 +0200)] 
Merge branch 'PR/libblkid-vfs' of https://github.com/karelzak/util-linux-work

* 'PR/libblkid-vfs' of https://github.com/karelzak/util-linux-work:
  lib/sysfs: add VFS parameter to sysfs_devno_is_dm_*()
  lib/procfs: use VFS dispatch for read and close
  lib/path: add VFS support
  vfs: add FILE* stream support to the VFS abstraction layer
  vfs: move mode2flags() to include/vfs.h as ul_mode_to_flags()
  wipefs: use blkid_probe_open_device()
  libblkid: use blkid_probe_open_device() in evaluate and verify
  libblkid: add blkid_probe_open_device()
  libblkid: use VFS I/O operations in probe
  libblkid: add blkid_probe_set_vfs() for pluggable I/O
  include: add VFS I/O abstraction layer
  all-io: rename read_all/write_all to ul_read_all/ul_write_all

2 weeks agoMerge branch 'PR/chrt-skip-policy' of https://github.com/karelzak/util-linux-work
Karel Zak [Thu, 9 Jul 2026 10:27:55 +0000 (12:27 +0200)] 
Merge branch 'PR/chrt-skip-policy' of https://github.com/karelzak/util-linux-work

* 'PR/chrt-skip-policy' of https://github.com/karelzak/util-linux-work:
  tests: (chrt) improve skip_policy with runtime probe

2 weeks agolib/sysfs: add VFS parameter to sysfs_devno_is_dm_*()
Karel Zak [Tue, 30 Jun 2026 15:30:33 +0000 (17:30 +0200)] 
lib/sysfs: add VFS parameter to sysfs_devno_is_dm_*()

Add const struct ul_vfs_ops *vfs parameter to sysfs_devno_is_dm_hidden()
and sysfs_devno_is_dm_private() so the internal sysfs reads go through
VFS dispatch.

Wire pr->vfs in libblkid probe.c and topology/sysfs.c callers.
Non-library callers pass NULL.

Addresses: https://github.com/util-linux/util-linux/issues/4308
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolib/procfs: use VFS dispatch for read and close
Karel Zak [Tue, 30 Jun 2026 15:17:31 +0000 (17:17 +0200)] 
lib/procfs: use VFS dispatch for read and close

Pass VFS ops from path_cxt to read_procfs_file() and use
ul_vfs_close() in procfs_process_get_data_for().

Addresses: https://github.com/util-linux/util-linux/issues/4308
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolib/path: add VFS support
Karel Zak [Tue, 30 Jun 2026 15:08:53 +0000 (17:08 +0200)] 
lib/path: add VFS support

Add ul_path_refer_vfs() to set a borrowed VFS ops pointer on
path_cxt. Replace direct I/O in the read/write/fopen paths with
VFS dispatch:

 - ul_path_read(): ul_vfs_read_all + ul_vfs_close
 - ul_path_write_string(): ul_vfs_write_all + ul_vfs_close
 - ul_path_write_s64/u64(): ul_vfs_write_all + ul_vfs_close
 - ul_path_fopen(): ul_vfs_fdopen (fopencookie when VFS set)

Addresses: https://github.com/util-linux/util-linux/issues/4308
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agovfs: add FILE* stream support to the VFS abstraction layer
Karel Zak [Tue, 30 Jun 2026 15:02:16 +0000 (17:02 +0200)] 
vfs: add FILE* stream support to the VFS abstraction layer

Add vfs_fopen callback in struct ul_vfs_ops for callers who want
full control over stream creation.

Add ul_vfs_fdopen() that wraps an existing fd into a FILE* using
fopencookie() with VFS callbacks, or falls back to fdopen().

Add ul_vfs_fopen() that tries vfs_fopen first, then opens via
vfs_open and wraps with fopencookie, then falls back to fopen().

The fopencookie path is gated on __GLIBC__. On non-glibc systems,
ul_vfs_fdopen() falls back to plain fdopen().

Addresses: https://github.com/util-linux/util-linux/issues/4308
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agovfs: move mode2flags() to include/vfs.h as ul_mode_to_flags()
Karel Zak [Tue, 30 Jun 2026 14:53:56 +0000 (16:53 +0200)] 
vfs: move mode2flags() to include/vfs.h as ul_mode_to_flags()

Move the fopen-style mode string to open(2) flags parser from
lib/path.c to include/vfs.h for reuse across the project,
especially in the upcoming ul_vfs_fopen() helper.

Addresses: https://github.com/util-linux/util-linux/issues/4308
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agowipefs: use blkid_probe_open_device()
Karel Zak [Tue, 30 Jun 2026 13:52:08 +0000 (15:52 +0200)] 
wipefs: use blkid_probe_open_device()

Convert wipefs new_probe() to use blkid_probe_open_device() instead
of open() + blkid_probe_set_device(). The flags argument allows
passing the open mode directly.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolibblkid: use blkid_probe_open_device() in evaluate and verify
Karel Zak [Tue, 30 Jun 2026 13:40:46 +0000 (15:40 +0200)] 
libblkid: use blkid_probe_open_device() in evaluate and verify

Convert evaluate.c and verify.c to use blkid_probe_open_device()
instead of open() + blkid_probe_set_device(). This makes these
internal callers VFS-aware and simplifies fd ownership.

Clean up verify.c error paths with dev_err/dev_free labels.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolibblkid: add blkid_probe_open_device()
Karel Zak [Tue, 30 Jun 2026 13:18:25 +0000 (15:18 +0200)] 
libblkid: add blkid_probe_open_device()

Add a convenience function that opens a device and assigns it to
the probe, using VFS operations if previously set. This enables
the composable pattern:

  blkid_new_probe()
  → blkid_probe_set_vfs()
  → blkid_probe_open_device()

Refactor blkid_new_probe_from_filename() to use it internally.

Addresses: https://github.com/util-linux/util-linux/issues/4308
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolibblkid: use VFS I/O operations in probe
Karel Zak [Tue, 30 Jun 2026 12:47:19 +0000 (14:47 +0200)] 
libblkid: use VFS I/O operations in probe

Replace all direct I/O syscalls in the probe path with ul_vfs_*
dispatch functions that route through the pluggable VFS layer when
set, falling back to real syscalls otherwise.

Add ul_vfs_copy() to include/vfs.h for cloning VFS ops structs.

Changed call sites:
 - read_buffer(): lseek + read
 - is_sector_readable(): lseek + read, changed signature to take
   blkid_probe instead of bare fd
 - blkid_probe_set_device(): close
 - blkid_do_wipe(): lseek + write_all + fsync
 - blkid_free_probe(): close + free(pr->vfs)
 - blkid_clone_probe(): allocate private VFS copy via ul_vfs_copy()

Addresses: https://github.com/util-linux/util-linux/issues/4308
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolibblkid: add blkid_probe_set_vfs() for pluggable I/O
Karel Zak [Tue, 30 Jun 2026 12:38:56 +0000 (14:38 +0200)] 
libblkid: add blkid_probe_set_vfs() for pluggable I/O

Add public API to set custom VFS I/O operations on a blkid probe.
This allows callers (e.g., systemd fibers) to replace standard
read/write/lseek/open/close/fsync with custom implementations.

The ops struct is copied into a private allocation owned by the
probe. NULL function pointers fall back to standard syscalls.
Passing NULL resets to defaults.

New public symbol: blkid_probe_set_vfs()
New struct in public header: struct ul_vfs_ops (with include guard
shared with include/vfs.h)

Addresses: https://github.com/util-linux/util-linux/issues/4308
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoinclude: add VFS I/O abstraction layer
Karel Zak [Tue, 30 Jun 2026 12:20:50 +0000 (14:20 +0200)] 
include: add VFS I/O abstraction layer

Add include/vfs.h with struct ul_vfs_ops — a pluggable I/O operations
table with function pointers matching POSIX signatures (read, write,
open, close, lseek, fsync). NULL function pointers fall back to real
syscalls. The size field enables forward/backward compatible struct
evolution.

Refactor include/all-io.h to use VFS dispatch internally:
  - ul_write_all() and ul_read_all() become macros calling
    __write_all(NULL, ...) and __read_all(NULL, ...)
  - New ul_vfs_write_all() and ul_vfs_read_all() macros pass
    through a VFS ops struct for custom I/O

Addresses: https://github.com/util-linux/util-linux/issues/4308
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoall-io: rename read_all/write_all to ul_read_all/ul_write_all
Karel Zak [Tue, 30 Jun 2026 11:27:59 +0000 (13:27 +0200)] 
all-io: rename read_all/write_all to ul_read_all/ul_write_all

Add ul_ namespace prefix to all helper functions in all-io.h:

  write_all()      → ul_write_all()
  read_all()       → ul_read_all()
  read_all_alloc() → ul_read_all_alloc()
  fwrite_all()     → ul_fwrite_all()
  sendfile_all()   → ul_sendfile_all()

This is a mechanical rename with no logic changes, preparing
for the VFS I/O abstraction layer.

Addresses: https://github.com/util-linux/util-linux/issues/4308
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agotests: lslocks filter, workaround duplicate lines in output
Karel Zak [Thu, 9 Jul 2026 10:09:14 +0000 (12:09 +0200)] 
tests: lslocks filter, workaround duplicate lines in output

Duplicate lines have been observed in lslocks output on ppc64le
(kernel 7.0). The root cause is unknown. No duplication path has
been found in the lslocks code itself.

Wrap lslocks calls in do_lslocks() helper that deduplicates
consecutive identical lines via uniq. If duplicates are detected,
warn and mark the test as KNOWN FAILED.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agomount: fix grammar and typo in X-mount.idmap documentation
Karel Zak [Wed, 8 Jul 2026 12:03:43 +0000 (14:03 +0200)] 
mount: fix grammar and typo in X-mount.idmap documentation

Apply grammar improvements from PR #4400 (field order change
intentionally omitted as the current order matches the code).
Also fix a GUID -> GID typo in the example.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agotests: (chrt) improve skip_policy with runtime probe
Karel Zak [Wed, 8 Jul 2026 11:57:12 +0000 (13:57 +0200)] 
tests: (chrt) improve skip_policy with runtime probe

The skip_policy function relied solely on "chrt --max" output to
detect kernel support for scheduling policies.  This is unreliable
for SCHED_EXT where sched_get_priority_max() returns 0 even on
kernels without CONFIG_SCHED_CLASS_EXT, causing the test to fail
with EINVAL instead of skipping gracefully.

Rework skip_policy to accept optional chrt probe arguments and
verify actual kernel support by attempting to set the policy on
the chrt process itself (--pid 0).  Cache "chrt --max" output once
at startup to avoid repeated execution.

Additionally, filter the platform-dependent runtime parameter from
do_chrt output unless --sched-runtime was explicitly used.  This
removes the need for kernel version gating on the basic batch and
other subtests, allowing them to run on all kernel versions.

Fixes: https://github.com/util-linux/util-linux/issues/4429
Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolibmount: add Since tag to mnt_table_parse_utab()
Karel Zak [Wed, 8 Jul 2026 10:29:30 +0000 (12:29 +0200)] 
libmount: add Since tag to mnt_table_parse_utab()

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agoMerge branch 'PR/libmount-utab-api' of https://github.com/karelzak/util-linux-work
Karel Zak [Wed, 8 Jul 2026 10:28:12 +0000 (12:28 +0200)] 
Merge branch 'PR/libmount-utab-api' of https://github.com/karelzak/util-linux-work

* 'PR/libmount-utab-api' of https://github.com/karelzak/util-linux-work:
  libmount: add mnt_table_parse_utab()

3 weeks agoMerge branch 'branch-02' of https://github.com/Leefancy/util-linux
Karel Zak [Wed, 8 Jul 2026 10:21:38 +0000 (12:21 +0200)] 
Merge branch 'branch-02' of https://github.com/Leefancy/util-linux

* 'branch-02' of https://github.com/Leefancy/util-linux:
  sfdisk: validate partition number is positive

3 weeks agosetpriv: improve securebits list formatting in man page
Karel Zak [Wed, 8 Jul 2026 10:13:36 +0000 (12:13 +0200)] 
setpriv: improve securebits list formatting in man page

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agoMerge branch 'new-securebits' of https://github.com/Skyb0rg007/util-linux
Karel Zak [Wed, 8 Jul 2026 10:05:10 +0000 (12:05 +0200)] 
Merge branch 'new-securebits' of https://github.com/Skyb0rg007/util-linux

* 'new-securebits' of https://github.com/Skyb0rg007/util-linux:
  setpriv: add new securebits

3 weeks agoMerge branch 'use_libmnt_eject' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Wed, 8 Jul 2026 09:58:33 +0000 (11:58 +0200)] 
Merge branch 'use_libmnt_eject' of https://github.com/cgoesche/util-linux-fork

* 'use_libmnt_eject' of https://github.com/cgoesche/util-linux-fork:
  eject: use libmount context API for umount

3 weeks agoMerge branch 'col-cur-col-underflow' of https://github.com/aizu-m/util-linux
Karel Zak [Wed, 8 Jul 2026 09:28:22 +0000 (11:28 +0200)] 
Merge branch 'col-cur-col-underflow' of https://github.com/aizu-m/util-linux

* 'col-cur-col-underflow' of https://github.com/aizu-m/util-linux:
  col: guard c_width sign before size_t cast in BS branch
  col: fix cur_col underflow on backspace over a wide char

3 weeks agosfdisk: validate partition number is positive
lijian [Tue, 7 Jul 2026 08:56:51 +0000 (16:56 +0800)] 
sfdisk: validate partition number is positive

Signed-off-by: lijian <lijian01@kylinos.cn>
3 weeks agosetpriv: add new securebits
Skye Soss [Wed, 1 Jul 2026 02:35:16 +0000 (21:35 -0500)] 
setpriv: add new securebits

Modifies setpriv to support the securebits `no_cap_ambient_raise`,
`exec_restrict_file`, `exec_deny_interactive`, and each of their
`_locked` variants.

The NO_CAP_AMBIENT_RAISE securebit was added in Linux 4.3, and the
EXEC_RESTRICT_FILE and EXEC_DENY_INTERACTIVE securebits were added in
Linux 6.14.

Signed-off-by: Skye Soss <skye@soss.website>
3 weeks agocol: guard c_width sign before size_t cast in BS branch
Aizal Khan [Tue, 7 Jul 2026 10:14:38 +0000 (15:44 +0530)] 
col: guard c_width sign before size_t cast in BS branch

Signed-off-by: Aizal Khan <aizumusheer2@gmail.com>
3 weeks agoMerge branch 'feat/4117-agetty-no-login-message' of https://github.com/mvanhorn/util...
Karel Zak [Tue, 7 Jul 2026 09:19:07 +0000 (11:19 +0200)] 
Merge branch 'feat/4117-agetty-no-login-message' of https://github.com/mvanhorn/util-linux

* 'feat/4117-agetty-no-login-message' of https://github.com/mvanhorn/util-linux:
  agetty: clarify nologin message and skip login wait under --chroot
  agetty: handle systems without a shell or /bin/login

3 weeks agoMerge branch 'fix/4468' of https://github.com/echoechoin/util-linux
Karel Zak [Tue, 7 Jul 2026 09:10:23 +0000 (11:10 +0200)] 
Merge branch 'fix/4468' of https://github.com/echoechoin/util-linux

* 'fix/4468' of https://github.com/echoechoin/util-linux:
  dmesg: treat EAGAIN from /dev/kmsg as EOF, not an error

3 weeks agoMerge branch 'iso9660-root-dir-oob' of https://github.com/aizu-m/util-linux
Karel Zak [Tue, 7 Jul 2026 08:36:33 +0000 (10:36 +0200)] 
Merge branch 'iso9660-root-dir-oob' of https://github.com/aizu-m/util-linux

* 'iso9660-root-dir-oob' of https://github.com/aizu-m/util-linux:
  libblkid: (iso9660) fix out-of-bounds read of root dir record

3 weeks agosfdisk: fix memory leak in sfdisk_print_partition()
lijian [Tue, 7 Jul 2026 08:20:24 +0000 (10:20 +0200)] 
sfdisk: fix memory leak in sfdisk_print_partition()

The function fdisk_partition_to_string() dynamically allocates memory
for the returned string, but sfdisk_print_partition() never frees it.

[karelzak@redhat.com: fix code style]

Addresses: https://github.com/util-linux/util-linux/pull/4459
Signed-off-by: lijian <lijian01@kylinos.cn>
Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agodmesg: treat EAGAIN from /dev/kmsg as EOF, not an error
WanBingjiang [Tue, 7 Jul 2026 02:45:29 +0000 (10:45 +0800)] 
dmesg: treat EAGAIN from /dev/kmsg as EOF, not an error

Fixes: https://github.com/util-linux/util-linux/issues/4468
3 weeks agolibblkid: (iso9660) fix out-of-bounds read of root dir record
Aizal Khan [Sun, 5 Jul 2026 08:22:43 +0000 (13:52 +0530)] 
libblkid: (iso9660) fix out-of-bounds read of root dir record

root_len comes from the on-disk root directory record (rdr+10) and was only rejected when zero. The extent is then mapped for min(root_len, 2048) bytes and the first record is validated by reading rootdata[0], rootdata[32], rootdata[33] and isonum_731(rootdata+2). blkid_probe_get_buffer() only rounds a request up to io_size when the rounded region still fits the probing area, so a root extent sitting in the final partial io_size block of a crafted image returns a buffer of exactly root_len bytes. With root_len between 1 and 33 and rootdata[0] >= 34, the validation reads offsets 32/33 past that buffer. Reject an extent too small to hold the 34-byte record, which the surrounding comment already assumes.

Signed-off-by: Aizal Khan <aizumusheer2@gmail.com>
3 weeks agoagetty: clarify nologin message and skip login wait under --chroot
Matt Van Horn [Sat, 4 Jul 2026 03:48:16 +0000 (20:48 -0700)] 
agetty: clarify nologin message and skip login wait under --chroot

Address review notes from Karel: reword DEFAULT_NOLOGIN_MESSAGE so it
tells the user a keypress re-checks for the login program, and skip
wait_for_login_program() when --chroot is used since the path check
would test the wrong root. Update the man page accordingly.

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
3 weeks agoeject: use libmount context API for umount
Christian Goeschel Ndjomouo [Thu, 25 Jun 2026 16:23:04 +0000 (12:23 -0400)] 
eject: use libmount context API for umount

libmount provides a context API that can be used to replace
the fork+exec code pattern needed to leverage umount(8).
This does not only simplify the code base but also removes
the concern for signal handling due to a wait(2) call, avoids
forking and allocating additional system resources, reduces
security management and makes the code more consistent as other
functions were already using some libmount functionalities.

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
4 weeks agocol: fix cur_col underflow on backspace over a wide char
Aizal Khan [Wed, 1 Jul 2026 13:21:41 +0000 (18:51 +0530)] 
col: fix cur_col underflow on backspace over a wide char

The BS handler in handle_not_graphic() subtracts the last stored
character's width from lns->cur_col (a size_t) and only guards against
cur_col == 0. When the last graphic character is double-width and the
column was reset by CR then advanced by a single space, cur_col is 1 and
cur_col -= 2 wraps to SIZE_MAX. That feeds l_max_col and the stored
c_column, so flush_line() sizes count[] as l_max_col + 1 (== 0) and then
memsets sizeof(size_t) * l_max_col bytes and indexes count[SIZE_MAX] --
an out-of-bounds write reachable from stdin under a UTF-8 locale. Clamp
the subtraction so the column cannot go below zero.

Signed-off-by: Aizal Khan <aizumusheer2@gmail.com>
4 weeks agolibmount: add mnt_table_parse_utab()
Karel Zak [Wed, 1 Jul 2026 10:49:25 +0000 (12:49 +0200)] 
libmount: add mnt_table_parse_utab()

Add new public API to parse the utab file into a table. The utab path
and format are private library details; this function hides them from
callers. NULL as filename is recommended to let the library determine
the correct path.

This is needed by systemd for incremental fanotify-based mount
monitoring, where utab needs to be parsed independently of the full
mountinfo/listmount rescan path.

Signed-off-by: Karel Zak <kzak@redhat.com>