Thomas Weißschuh [Fri, 19 Jan 2024 02:12:21 +0000 (03:12 +0100)]
login: ignore return of audit_log_acct_message
The function is marked with `warn_unused_result` so handle the return
value. Failures of `audit_open()` are also silently ignored so do the
same for `audit_log_acct_message()` itself.
Karel Zak [Wed, 17 Jan 2024 11:37:08 +0000 (12:37 +0100)]
wall: fix calloc cal [-Werror=calloc-transposed-args]
term-utils/wall.c:143:37: error: xcalloc sizes specified with sizeof in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
143 | buf->groups = xcalloc(sizeof(*buf->groups), buf->ngroups);
| ^
term-utils/wall.c:143:37: note: earlier argument should specify number of elements, later size of each element
sulogin: relabel terminal according to SELinux policy
The common SELinux practice is to have a distinct label for terminals in
use by logged in users. This allows to differentiate access on the
associated terminal (e.g. user_tty_device_t) vs foreign ones (e.g.
tty_device_t or sysadm_tty_device_t). Therefore the application
performing the user login and setting up the associated terminal should
label that terminal according to the loaded SELinux policy. Commonly
this is done by pam_selinux(7). Since sulogin(8) does not use pam(7)
perform the necessary steps manually.
Fixes: https://github.com/util-linux/util-linux/issues/1578 Reviewed-by: James Carter <jwcart2@gmail.com> Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 16 Jan 2024 10:17:55 +0000 (11:17 +0100)]
Merge branch 'time64' of https://github.com/t-8ch/util-linux
* 'time64' of https://github.com/t-8ch/util-linux:
build-sys: (tests) validate that time_t is 64bit
meson: try to always use 64bit time support on glibc
build-sys: try to always use 64bit time support on glibc
build-sys: backport autoconf year2038 macros
tests: add sysinfo to show sizeof(time_t)
tests: constify a sysinfo helpers struct
Karel Zak [Mon, 15 Jan 2024 09:38:45 +0000 (10:38 +0100)]
Merge branch 'PR/uuidd-cont-clock-persistence' of github.com:karelzak/util-linux-work
* 'PR/uuidd-cont-clock-persistence' of github.com:karelzak/util-linux-work:
libuuid: fix uint64_t printf and scanf format
uuidd: add cont_clock persistence
Karel Zak [Fri, 12 Jan 2024 09:31:38 +0000 (10:31 +0100)]
Merge branch 'libblkid/const' of https://github.com/t-8ch/util-linux
* 'libblkid/const' of https://github.com/t-8ch/util-linux:
libblkid: constify return values of blkid_probe_get_sb
include/c.h: handle members of const struct
Michael Trapp [Wed, 10 Jan 2024 16:29:38 +0000 (17:29 +0100)]
uuidd: add cont_clock persistence
cont_clock requires a correct time setup and therefore it
must be possible to detect a step back between uuidd starts.
Reserving the next 10 seconds is sufficient and should not
have a noticeable performance impact. It will also provide
the possibility to start with the clock_reg from the previous
session when the system was rebooted.
Whith that, the early cont_clock initialization in uuidd
should be removed because writing the cont_clock persitence
when -C was not set is useless and might be confusing.
Thomas Weißschuh [Fri, 12 Jan 2024 07:47:50 +0000 (08:47 +0100)]
libblkid: avoid aligning out of probing area
When reading from the end of the device the IO size alignment could
enlarge the read buffer outside of the probing area.
This would then trigger a read failure.
Thomas Weißschuh [Fri, 12 Jan 2024 06:51:39 +0000 (07:51 +0100)]
include/c.h: handle members of const struct
Trying to copy into a local const struct will lead to a compiler error.
By adding a "+ 0" to the argument of __typeof__() the type of the
resulting express will loose its constness.
Karel Zak [Thu, 11 Jan 2024 14:43:50 +0000 (15:43 +0100)]
Merge branch 'login' of https://github.com/stoeckmann/util-linux
* 'login' of https://github.com/stoeckmann/util-linux:
login: document blank treatment in shell field
login: unify pw_shell script test
login: simplify name creation
Karel Zak [Thu, 11 Jan 2024 14:25:43 +0000 (15:25 +0100)]
Merge branch 'include/parttypes' of https://github.com/t-8ch/util-linux
* 'include/parttypes' of https://github.com/t-8ch/util-linux:
include: add U-Boot environment partition type
include: add some more ChromeOS partition types
Karel Zak [Mon, 8 Jan 2024 09:37:09 +0000 (10:37 +0100)]
Merge branch 'tests--lsfd--mkfds-inotify-on-btrfs' of https://github.com/masatake/util-linux
* 'tests--lsfd--mkfds-inotify-on-btrfs' of https://github.com/masatake/util-linux:
tests: (lsfd) add a case testing INOTIFY.INODES.RAW column on btrfs
tests: (test_mkfds::inotify) add "dir" and "file" parameters
tests: (lsfd::mkfds-inotify) use findmnt(1) instead of stat(1) to get bdev numbers
Masatake YAMATO [Fri, 5 Jan 2024 08:54:36 +0000 (17:54 +0900)]
tests: (lsfd::mkfds-inotify) use findmnt(1) instead of stat(1) to get bdev numbers
Close #2349
stat(2) on some filesystems including btrfs reports a block device
number (bdev number) with a offset. On the other hand, "inotify wd"
field of /proc/$pid/fdinfo/$fd for an inotify file reports bdev
numbers without offsets.
The offset caused the failure of lsfd::mkfds-inotify test case on
btrfs. Unlike stat(2), findmnt can report bdev numbers without
offsets.
Karel Zak [Thu, 4 Jan 2024 10:51:40 +0000 (11:51 +0100)]
Merge branch 'wipefs/improvements' of https://github.com/t-8ch/util-linux
* 'wipefs/improvements' of https://github.com/t-8ch/util-linux:
wipefs: allow storage of backups in specific location
wipefs: (tests) remove necessity of root permissions
Karel Zak [Thu, 4 Jan 2024 10:50:19 +0000 (11:50 +0100)]
Merge branch 'PR/dmesg-timestamps' of github.com:karelzak/util-linux-work
* 'PR/dmesg-timestamps' of github.com:karelzak/util-linux-work:
Dividing tests into subtest based on recommendation from review
util-linux/sys-utils test dmesg support for additional human-readable timestamp
dmesg: man and coding style changes
dmesg: support for additional human readable timestamp
Eric Badger [Wed, 3 Jan 2024 21:11:43 +0000 (13:11 -0800)]
hwclock: Improve set error in the face of jitter
set_hardware_clock_exact() spins in a loop, trying to exit when we are
`delay` seconds from an integer time on the system clock. However, there
might be jitter which causes an exit a little bit later than ideal.
The prior code could cause a relatively small error in loop exit time to
produce a relatively large error in the RTC.
For example, suppose upon exit from the loop, we have:
And in slightly less than `delay` seconds, the system clock will be 1704239207 while the RTC will be approximately 1704239208, about 1
second of error.
We are better off rounding in this case. The RTC will be behind the
system clock, but only very slightly:
Karel Zak [Wed, 3 Jan 2024 13:13:28 +0000 (14:13 +0100)]
libmount: introduce /run/mount/utab.event
The mnt_monitor_...() API uses /run/mount/utab.lock to monitor utab
changes. The same file is used to control access to the utab file.
The utab can be updated more than once during one mount(8) call, for
example, one update is done in /sbin/mount.nfs and next in mount(8).
This situation triggers two (e.g. inotify) events when monitoring is
based on the lock file.
It seems better to introduce separate file to trigger the event and do
not trigger this event in /sbin/mount.<type> helpers.
Karel Zak [Tue, 2 Jan 2024 10:15:57 +0000 (11:15 +0100)]
Merge branch 'fixes' of https://github.com/t-8ch/util-linux
* 'fixes' of https://github.com/t-8ch/util-linux:
libmount: (context) avoid dead store
libmount: (utils) avoid dead store
pipesz: avoid dead store
fileeq: optimize size of ul_fileeq_method
sha1: properly wipe variables
libfdisk: (sgi): use strncpy over strcpy
libfdisk: (sun) properly initialize partition data
libmount: (tests) fix --filesystems crash on invalid argument
libmount: (tests) fix --filesystems test argument parsing
libmount: (veritydev) use asprintf to build string
libsmartcols: (samples/fromfile) properly handle return value from getline()
libuuid: (test_uuid) make reading UUIDs from file more robust
libblkid: (dev) use strdup to duplicate string
pg: use snprintf to build string
hexdump: use xasprintf to build string
readprofile: use xasprintf to build string
cal: avoid out of bound write
logger: use strncpy instead of strcpy
exec_shell: use xasprintf
strv: make strv_new_api static