]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agorepart: Use 4096 as the fallback sector size for verity/luks/filesystems 28812/head
Daan De Meyer [Sat, 12 Aug 2023 11:30:46 +0000 (13:30 +0200)] 
repart: Use 4096 as the fallback sector size for verity/luks/filesystems

When we don't know the sector size of the actual block device, because
we're building an image in a loopback file and no sector size was specified
explicitly, let's use 4096 as the sector size for filesystems, verity and
LUKS. This should be the most compatible option, since 4096 will also work
on devices with sector size 512 or 2048.

For the actual GPT partition table size, we stick with 512 as the default
value since UEFI firmware and the kernel will only try to read the GPT
partition table from the first LBA on the device and the sector size for
most devices is still 512. It can also be trivially modified when copying
the image to another device using --copy-from + --sector-size.

2 years agomkfs-util: Pass sector size to mkfs.f2fs
Daan De Meyer [Sat, 12 Aug 2023 11:29:50 +0000 (13:29 +0200)] 
mkfs-util: Pass sector size to mkfs.f2fs

Let's pass the sector size to mkfs.f2fs as well.

2 years agomkfs-util: Set sector size environment variables when invoking mkfs.ext4
Daan De Meyer [Sat, 12 Aug 2023 11:28:10 +0000 (13:28 +0200)] 
mkfs-util: Set sector size environment variables when invoking mkfs.ext4

Let's inform mkfs.ext4 about the sector size we're using.

2 years agoman: don't claim BindPaths= file systems would remain "in memory", they are just...
Lennart Poettering [Fri, 11 Aug 2023 11:24:07 +0000 (13:24 +0200)] 
man: don't claim BindPaths= file systems would remain "in memory", they are just kept "mounted"

Follow-up for: 947d836a6e86f1936250ff8e3c67fa33b92a597f

(I guess in the original patch authors usecase the root fs actually
*does* remain in memory, but that's a special case and does not belong
in the man pages this way).

2 years agoMerge pull request #28766 from DaanDeMeyer/repart-copy-from
Daan De Meyer [Fri, 11 Aug 2023 12:51:24 +0000 (14:51 +0200)] 
Merge pull request #28766 from DaanDeMeyer/repart-copy-from

repart: Allow specifying --copy-from more than once

2 years agofile-io: Fix copying sparse files
Michael A Cassaniti [Fri, 11 Aug 2023 06:41:56 +0000 (16:41 +1000)] 
file-io: Fix copying sparse files

This change makes sure a data copy using copy_bytes() does not exceed the
max_bytes value when using COPY_HOLES and max_bytes stops before the next
data section.

2 years agorepart: Allow specifying --copy-from more than once 28766/head
Daan De Meyer [Thu, 10 Aug 2023 12:41:31 +0000 (14:41 +0200)] 
repart: Allow specifying --copy-from more than once

Definitions will be synthesized from each of the given images.

2 years agodocs: update link to RHEL/CentOS Stream tracker
Jan Macku [Thu, 10 Aug 2023 12:58:16 +0000 (14:58 +0200)] 
docs: update link to RHEL/CentOS Stream tracker

Also update link to systemd downstream GitHub repo.

2 years agorepart: Allow acquire shared lock on --copy-from files/devices
Daan De Meyer [Fri, 11 Aug 2023 08:41:04 +0000 (10:41 +0200)] 
repart: Allow acquire shared lock on --copy-from files/devices

We're not going to modify these, so no need for an exclusive lock.

2 years agotest-mountpoint-util: /root might be mounted
Franck Bui [Thu, 10 Aug 2023 12:13:45 +0000 (14:13 +0200)] 
test-mountpoint-util: /root might be mounted

On openSUSE with BTRFS, /root has to be mounted as dedicated subvolume to avoid
restoring it when a rollback of the system happens.

2 years agoMerge pull request #28779 from yuwata/iovw-append
Yu Watanabe [Thu, 10 Aug 2023 22:21:32 +0000 (07:21 +0900)] 
Merge pull request #28779 from yuwata/iovw-append

io-util, coredump: introduce iovw_append() and use it

2 years agocoredump: fix various invalid memory access 28779/head
Yu Watanabe [Thu, 10 Aug 2023 19:48:01 +0000 (04:48 +0900)] 
coredump: fix various invalid memory access

Previously, we did not check error from iovw_put(). If it fails, the
target iovw may have no iov or partial iovs from the journal importar.
So, the finalization may cause underflow and may access and free invalid
memory.

Follow-up for 946dc7c635f050129896d1515c08a81504af2421.

2 years agoio-util: introduce iovw_append() helper function
Yu Watanabe [Thu, 10 Aug 2023 19:46:00 +0000 (04:46 +0900)] 
io-util: introduce iovw_append() helper function

2 years agoMake ukify the default ifUKI_GENERATOR is unset
cvlc12 [Sat, 5 Aug 2023 12:25:23 +0000 (14:25 +0200)] 
Make ukify the default ifUKI_GENERATOR is unset

2 years agovconsole-setup: use "@kernel" rather than "kernel" as special string to leave keymap...
Lennart Poettering [Thu, 10 Aug 2023 13:12:15 +0000 (15:12 +0200)] 
vconsole-setup: use "@kernel" rather than "kernel" as special string to leave keymap untouched

This is a magic string, and we should avoid stepping into the territory
of normal keymap names with that, given that users can pick names
otherwise freely.

Hence, prefix the name with a special char to avoid any namespace
issues.

Follow-up for: #28660

2 years agoMerge pull request #28760 from poettering/coredump-tweaks
Yu Watanabe [Thu, 10 Aug 2023 19:16:31 +0000 (04:16 +0900)] 
Merge pull request #28760 from poettering/coredump-tweaks

coredump: minor tweaks/modernizations

2 years agofile-io: let's use offsetof() rather than sizeof() for determining EFI_FILE_INFO...
Lennart Poettering [Thu, 10 Aug 2023 08:46:05 +0000 (10:46 +0200)] 
file-io: let's use offsetof() rather than sizeof() for determining EFI_FILE_INFO prefix size

The gnu-efi definition of the struct uses [1], our local one [0] to size
the filename array. Let's avoid an ambiguity and use offsetof() so that
this difference doesn't matter. Also, doing it this way makes very clear
to the read what happens here: it's a structure with a variable size
suffix.

2 years agoMerge pull request #28749 from yuwata/udev-net-id-fix-and-cleanup
Yu Watanabe [Thu, 10 Aug 2023 19:10:32 +0000 (04:10 +0900)] 
Merge pull request #28749 from yuwata/udev-net-id-fix-and-cleanup

udev-builtin-net_id: fix and cleanups

2 years agoukify: Use length= instead of ignore_padding= in inspect
Daan De Meyer [Thu, 10 Aug 2023 15:05:55 +0000 (17:05 +0200)] 
ukify: Use length= instead of ignore_padding= in inspect

ignore_padding= was only added in a recent version of pefile. Let's
set length= to the virtual size instead which is what ignore_padding
does behind the scenes so we're compatible with older versions of
pefile.

2 years agoMerge pull request #28767 from poettering/epoll-eperm-journalctl
Yu Watanabe [Thu, 10 Aug 2023 18:18:36 +0000 (03:18 +0900)] 
Merge pull request #28767 from poettering/epoll-eperm-journalctl

journalctl epoll/EPERM follow-up

2 years agomkosi: Copy sources under /usr in the image
Michal Koutný [Wed, 9 Aug 2023 19:31:58 +0000 (21:31 +0200)] 
mkosi: Copy sources under /usr in the image

Originally, the source code was copied under /root/src.
This home directory is part of root FS and the new mkosi building
paradigm has only ephemeral root FS that is generated lazily.
Any files placed on the root FS in the build environment are that
excluded from the final image.

It is useful to have source codes available in the image's runtime (not
build time) environment for debugging.

ExtraTrees= as used currently are ineffective, so change the destination
to copy files under /usr to achieve the intention.

gdb sees source files as:
> 1354 ../src/src/systemctl/systemctl.c: No such file or directory.

Modify gdb configration in the built image accordingly (that file cannot
be in /root neither) to resolve to the moved sources.

(Commit fdecbf7 ("Enable unprivileged image builds") envisions bind
mounting or virtiofsd for nspawn or qemu containers respectively.)

2 years agoMerge pull request #28743 from mrc0mmand/lint-python-scripts
Luca Boccassi [Thu, 10 Aug 2023 18:13:45 +0000 (19:13 +0100)] 
Merge pull request #28743 from mrc0mmand/lint-python-scripts

tools: lint Python scripts

2 years agotmpfiles: move static vars into Context object
Lennart Poettering [Wed, 9 Aug 2023 09:37:46 +0000 (11:37 +0200)] 
tmpfiles: move static vars into Context object

Same as #28722, but for tmpfiles rather than sysusers

2 years agotest: testsuite-35.sh needs manual/test-session-properties to be installed on SUSE
Franck Bui [Tue, 8 Aug 2023 09:40:36 +0000 (11:40 +0200)] 
test: testsuite-35.sh needs manual/test-session-properties to be installed on SUSE

2 years agoAdd .pylintrc to globally suppress warnings we don't really care about 28743/head
Frantisek Sumsal [Wed, 9 Aug 2023 19:57:47 +0000 (21:57 +0200)] 
Add .pylintrc to globally suppress warnings we don't really care about

Also, drop the respective disable directives from existing files.

2 years agotools: pylint meson-render-jinja2.py
Frantisek Sumsal [Thu, 10 Aug 2023 09:10:28 +0000 (11:10 +0200)] 
tools: pylint meson-render-jinja2.py

2 years agotools: pylint analyze-dump-sort.py
Frantisek Sumsal [Wed, 9 Aug 2023 19:54:28 +0000 (21:54 +0200)] 
tools: pylint analyze-dump-sort.py

2 years agotools: pylint dump-auxv.py
Frantisek Sumsal [Wed, 9 Aug 2023 19:53:45 +0000 (21:53 +0200)] 
tools: pylint dump-auxv.py

2 years agotools: pylint gdb-sd_dump_hashmaps.py
Frantisek Sumsal [Wed, 9 Aug 2023 19:44:36 +0000 (21:44 +0200)] 
tools: pylint gdb-sd_dump_hashmaps.py

2 years agotools: pylint list-discoverable-partitions.py
Frantisek Sumsal [Wed, 9 Aug 2023 19:43:08 +0000 (21:43 +0200)] 
tools: pylint list-discoverable-partitions.py

2 years agotools: pylint xml_helper.py
Frantisek Sumsal [Mon, 17 Jul 2023 20:51:19 +0000 (22:51 +0200)] 
tools: pylint xml_helper.py

2 years agotools: pylint update-man-rules.py
Frantisek Sumsal [Mon, 17 Jul 2023 20:39:37 +0000 (22:39 +0200)] 
tools: pylint update-man-rules.py

2 years agotools: pylint update-dbus-docs.py
Frantisek Sumsal [Mon, 17 Jul 2023 19:11:04 +0000 (21:11 +0200)] 
tools: pylint update-dbus-docs.py

2 years agotools: pylint make-man-index.py
Frantisek Sumsal [Mon, 17 Jul 2023 18:02:54 +0000 (20:02 +0200)] 
tools: pylint make-man-index.py

2 years agotools: pylint make-directive-index.py
Frantisek Sumsal [Mon, 17 Jul 2023 17:58:38 +0000 (19:58 +0200)] 
tools: pylint make-directive-index.py

2 years agotools: pylint make-autosuspend-rules.py
Frantisek Sumsal [Mon, 17 Jul 2023 17:08:08 +0000 (19:08 +0200)] 
tools: pylint make-autosuspend-rules.py

2 years agotools: pylint generate-gperfs.py
Frantisek Sumsal [Mon, 17 Jul 2023 17:06:40 +0000 (19:06 +0200)] 
tools: pylint generate-gperfs.py

2 years agonetworkd: add comment about order of IPReversePathFilter enum
Lennart Poettering [Thu, 10 Aug 2023 14:17:32 +0000 (16:17 +0200)] 
networkd: add comment about order of IPReversePathFilter enum

Follow-up for: #28391

2 years agomkosi: Move python3dist(pytest-flakes) to base preset build packages
Daan De Meyer [Thu, 10 Aug 2023 13:11:32 +0000 (15:11 +0200)] 
mkosi: Move python3dist(pytest-flakes) to base preset build packages

We don't want to pull in python in the base image to keep the initrd
small.

2 years agoupdate TODO
Lennart Poettering [Thu, 10 Aug 2023 13:29:21 +0000 (15:29 +0200)] 
update TODO

2 years agosd-event: explicit document what to do with epoll-incompatible fds 28767/head
Lennart Poettering [Thu, 10 Aug 2023 13:01:16 +0000 (15:01 +0200)] 
sd-event: explicit document what to do with epoll-incompatible fds

2 years agojournalcl: simplify handling of stdout being a regular file and epoll()
Lennart Poettering [Thu, 10 Aug 2023 12:47:12 +0000 (14:47 +0200)] 
journalcl: simplify handling of stdout being a regular file and epoll()

Let's not check the fd type beforehand, let's instead gracefully handle
if we get EPERM back from epoll_ctl() because the fd doesn't do epoll.
THis should be safer and more generic.

The epoll_ctl(2) man page clearly documents EPERM is being returned in
this case, hence it's safe to check for exactly that case.

Follow-up for: #28644

2 years agoman: let's tone down the recommendation to use Type=exec a bit
Lennart Poettering [Wed, 9 Aug 2023 16:23:09 +0000 (18:23 +0200)] 
man: let's tone down the recommendation to use Type=exec a bit

This is a follow-up for #28596.

I think the suggestion to use Type=exec uses too strong wording:
Type=exec has non-trivial drawbacks over Type=simple, and they deserve
to be mentioned.

Hence drop the <emphasis> and turn this around so that Type=exec is
*recommended*, but Type=simple is not expressly discouraged, because
there are plenty reasons to use it.

Add a brief discussion where Type=simple might be preferable.

Also, fix the outright unruth that Type=exec was the "simplest and
fastest", because it certainly is a lot, but not that.

2 years agoexecute: Chown credentials files and directories to service group
Daan De Meyer [Thu, 10 Aug 2023 09:32:55 +0000 (11:32 +0200)] 
execute: Chown credentials files and directories to service group

For a userns root user to be able to access the credentials, both
the uid and gid of the credentials directory have to be mapped into
the userns. Currently, the credentials directory group is root, which
we obviously do not want to map in to a userns, so let's make sure
that the credentials directory and files are owned by the service
group instead, which can generally be safely mapped into the userns.

Since we use permissions mode 0600, this shouldn't cause any change
in who is able to access the credentials.

Fixes #28747

2 years agoMerge pull request #28756 from DaanDeMeyer/repart-fix
Daan De Meyer [Thu, 10 Aug 2023 12:36:02 +0000 (14:36 +0200)] 
Merge pull request #28756 from DaanDeMeyer/repart-fix

repart --copy-from followups

2 years agoudev-builtin-net_id: use strjoin() if possible 28749/head
Yu Watanabe [Thu, 10 Aug 2023 11:13:32 +0000 (20:13 +0900)] 
udev-builtin-net_id: use strjoin() if possible

Addresses the post-merge comment
https://github.com/systemd/systemd/pull/28623#pullrequestreview-1571307466.

2 years agoudev-builtin-net_id: add more debugging logs
Yu Watanabe [Wed, 9 Aug 2023 22:02:19 +0000 (07:02 +0900)] 
udev-builtin-net_id: add more debugging logs

2 years agoudev-builtin-net_id: introduce get_first_syspath_component() helper function
Yu Watanabe [Wed, 9 Aug 2023 21:57:43 +0000 (06:57 +0900)] 
udev-builtin-net_id: introduce get_first_syspath_component() helper function

Obtaining a component from syspath is a common pattern. Let's split out
the pattern. No functional change, just refactoring.

2 years agoudev-builtin-net_id: introduce get_matching_parent() helper function
Yu Watanabe [Wed, 9 Aug 2023 21:24:29 +0000 (06:24 +0900)] 
udev-builtin-net_id: introduce get_matching_parent() helper function

The pattern is common in many naming scheme. Let's split out the
pattern. No functional change, just refactoring.

2 years agocoredump: let's use FOREACH_ARRAY() at once very obvious place 28760/head
Lennart Poettering [Thu, 10 Aug 2023 10:13:46 +0000 (12:13 +0200)] 
coredump: let's use FOREACH_ARRAY() at once very obvious place

2 years agocoredump: fix error path
Lennart Poettering [Thu, 10 Aug 2023 10:13:07 +0000 (12:13 +0200)] 
coredump: fix error path

We must go through finish, to undo the destruction of the final elements
of the iovw properly.

2 years agocoredump: rename gather_pid_metadata() → gather_pid_metadata_from_procfs()
Lennart Poettering [Thu, 10 Aug 2023 10:11:52 +0000 (12:11 +0200)] 
coredump: rename gather_pid_metadata() → gather_pid_metadata_from_procfs()

Let's make clear what this function does, and what it distinguishes with
the more precisely named gather_pid_metadata_from_argv().

2 years agocoredump: add four assert()s
Lennart Poettering [Thu, 10 Aug 2023 10:11:33 +0000 (12:11 +0200)] 
coredump: add four assert()s

2 years agocoredump: use a cleanup handler for destroying iovw objects
Lennart Poettering [Thu, 10 Aug 2023 10:10:47 +0000 (12:10 +0200)] 
coredump: use a cleanup handler for destroying iovw objects

2 years agocoredump: explicitly document that in order to process a coredump we have to write...
Lennart Poettering [Thu, 10 Aug 2023 10:09:15 +0000 (12:09 +0200)] 
coredump: explicitly document that in order to process a coredump we have to write it to disk first

Prompted by: #28740

2 years agotools: pylint dbus_exporter.py
Frantisek Sumsal [Mon, 17 Jul 2023 16:38:54 +0000 (18:38 +0200)] 
tools: pylint dbus_exporter.py

2 years agotools: pylint check-includes.py
Frantisek Sumsal [Mon, 17 Jul 2023 16:37:17 +0000 (18:37 +0200)] 
tools: pylint check-includes.py

2 years agotools: pylint catalog-report.py
Frantisek Sumsal [Mon, 17 Jul 2023 16:34:12 +0000 (18:34 +0200)] 
tools: pylint catalog-report.py

2 years agotools: pylint analyze-dump-sort.py
Frantisek Sumsal [Mon, 17 Jul 2023 16:16:21 +0000 (18:16 +0200)] 
tools: pylint analyze-dump-sort.py

2 years agorepart: Reword --copy-from docs 28756/head
Daan De Meyer [Thu, 10 Aug 2023 08:46:14 +0000 (10:46 +0200)] 
repart: Reword --copy-from docs

2 years agorepart: Pass GptPartitionType *
Daan De Meyer [Thu, 10 Aug 2023 08:32:35 +0000 (10:32 +0200)] 
repart: Pass GptPartitionType *

2 years agomain: drop redundant ()
Lennart Poettering [Thu, 10 Aug 2023 08:14:33 +0000 (10:14 +0200)] 
main: drop redundant ()

2 years agoupdate TODO
Lennart Poettering [Thu, 10 Aug 2023 08:06:50 +0000 (10:06 +0200)] 
update TODO

2 years agoMerge pull request #28736 from poettering/polkit-tweaks
Lennart Poettering [Thu, 10 Aug 2023 07:35:52 +0000 (09:35 +0200)] 
Merge pull request #28736 from poettering/polkit-tweaks

some minor polkit handling tweaks

2 years agoMerge pull request #28732 from yuwata/udev-vs-tmpfiles-take-2
Yu Watanabe [Wed, 9 Aug 2023 23:48:51 +0000 (08:48 +0900)] 
Merge pull request #28732 from yuwata/udev-vs-tmpfiles-take-2

Udev vs tmpfiles take 2

2 years agoMerge pull request #28741 from keszybz/minor-tweaks-for-recent-patches
Yu Watanabe [Wed, 9 Aug 2023 23:45:44 +0000 (08:45 +0900)] 
Merge pull request #28741 from keszybz/minor-tweaks-for-recent-patches

Minor tweaks for recent patches

2 years agoudev: re-introduce symlinks for loopback block device
Yu Watanabe [Fri, 21 Jul 2023 01:26:13 +0000 (10:26 +0900)] 
udev: re-introduce symlinks for loopback block device

But the directories are changed from /dev/loop/by-ref/ -> /dev/disk/by-loop-ref/
and /dev/loop/by-inode/ -> /dev/disk/by-loop-inode/.
As /dev/loop/ is used by losetup command for other purpose.
See issue #28475.

This effectively reverts commits 9915cc60868c77e7e8cecb669ddb90516dffc7df,
5022fab15fc16204d163883ca818fd6092dc919c, and
c0d998248e10e1dcf18108fdbb70f259acd452eb.

2 years agoudev-builtin-net_id: fix potential invalid memory access
Yu Watanabe [Wed, 9 Aug 2023 20:08:23 +0000 (05:08 +0900)] 
udev-builtin-net_id: fix potential invalid memory access

Follow-up for 28141620d963c0c490d409d6ec6ff5f143357124.

Addresses post-merge review in #28269.

2 years agoMerge pull request #28734 from loongarch64/dev-wu-main
Luca Boccassi [Wed, 9 Aug 2023 19:20:03 +0000 (20:20 +0100)] 
Merge pull request #28734 from loongarch64/dev-wu-main

seccomp: add LoongArch 64bit support

2 years agomkosi: Update to latest
Daan De Meyer [Wed, 9 Aug 2023 15:17:50 +0000 (17:17 +0200)] 
mkosi: Update to latest

This update introduces the explicit Dependencies= setting, instead
of relying on implicit dependencies via alphanumerical ordering.

We also take the opportunity to rename the "final" preset to the
"system" preset, which seems like a better name.

2 years agotree-wide: drop _pure_ + _const_ from local, static functions
Lennart Poettering [Wed, 9 Aug 2023 08:48:47 +0000 (10:48 +0200)] 
tree-wide: drop _pure_ + _const_ from local, static functions

This is supposed to be a help for compilers to apply optimizations on
functions where they can't determine whether they are const/pure on
their own. For static, local functions the compiler can do this on its
own easily however, hence the decoration with pure/const is just noise.
Let's drop it, and let the compiler to its thing better.

(Use it for exported functions, since compilers can't 'reach-over' into
other modules to determine if they are pure, except if LTO is used)

2 years agoMerge pull request #28728 from yuwata/fstab-no
Mike Yuan [Wed, 9 Aug 2023 15:59:51 +0000 (23:59 +0800)] 
Merge pull request #28728 from yuwata/fstab-no

gpt-auto, remount-fs: parse fstab= kernel command line option

2 years agosysusers: move global variables into a Context object
Lennart Poettering [Tue, 8 Aug 2023 12:56:40 +0000 (14:56 +0200)] 
sysusers: move global variables into a Context object

Our coding style says static variables suck except for very special
cases, i.e. things like the log level or very per-process stuff, such as
parsed version of cmdline args and such. sysusers departed from that as
one of the very few exceptions in our codebases: it keeps its
operational state in global variables.

Address that. Introduce a Context object that carries the fields that so
far have been global, and pass it around as needed.

This has the nice effect that state and configuration is clearly
separated in code, and we can very clearly see which functions mangle
state and which ones do not.

No actual codeflow changes, just refactoring.

2 years agoMerge pull request #28720 from poettering/vconsole-setup-tweaks
Lennart Poettering [Wed, 9 Aug 2023 15:32:12 +0000 (17:32 +0200)] 
Merge pull request #28720 from poettering/vconsole-setup-tweaks

vconsole-setup: trivial modernizations

2 years agoLoongArch: Replace __loongarch64 with __loongarch_lp64 28734/head
Xiaotian Wu [Wed, 9 Aug 2023 12:52:27 +0000 (20:52 +0800)] 
LoongArch: Replace __loongarch64 with __loongarch_lp64

`__loongarch64` is no longer used for historical reasons and should be replaced by `__loongarch_lp64` in new code.

https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html#_cc_preprocessor_built_in_macro_definitions

2 years agobootctl: don't advertise systemd-efi-options in --help/man anymore
Lennart Poettering [Wed, 9 Aug 2023 11:08:58 +0000 (13:08 +0200)] 
bootctl: don't advertise systemd-efi-options in --help/man anymore

The command is deprecated, as per NEWS of 254. Let's go one step further
and remove it from the help text and man page, so that people are not
inspired to use it at this time anymore.

This is how we usually have done this before: remove it from visibility,
but support it for a while still.

2 years ago60-ukify.install: fix whitespace 28741/head
Zbigniew Jędrzejewski-Szmek [Wed, 9 Aug 2023 10:54:14 +0000 (12:54 +0200)] 
60-ukify.install: fix whitespace

2 years agotest: use pytest.raises wrapper
Zbigniew Jędrzejewski-Szmek [Wed, 9 Aug 2023 10:25:06 +0000 (12:25 +0200)] 
test: use pytest.raises wrapper

This way we check that the appropriate exception is raised,
not just ignore it.

Follow-up for e3c04a5c84af5a39794a0a4963bc9916787aa5b4.

2 years agopolkit: move asserts up, so that they cover all reply codepaths 28736/head
Lennart Poettering [Wed, 9 Aug 2023 08:51:40 +0000 (10:51 +0200)] 
polkit: move asserts up, so that they cover all reply codepaths

2 years agopolkit: use LIST_POP where appropriate
Lennart Poettering [Wed, 9 Aug 2023 08:51:19 +0000 (10:51 +0200)] 
polkit: use LIST_POP where appropriate

2 years agoremount-fs: refuse to remount based on fstab when fstab=no kernel command line option... 28728/head
Yu Watanabe [Tue, 8 Aug 2023 17:02:23 +0000 (02:02 +0900)] 
remount-fs: refuse to remount based on fstab when fstab=no kernel command line option specified

Otherwise, if for some reasons remount-fs is invoked even when fstab=no is
specified, mounts may get unexpected options from fstab.

For safety, let's parse the kernel command line option.

2 years agoremount-fs: split-out remount_by_fstab()
Yu Watanabe [Tue, 8 Aug 2023 16:57:16 +0000 (01:57 +0900)] 
remount-fs: split-out remount_by_fstab()

No functional change, just refactoring and preparation for later
commits.

2 years agofstab-generator: update cache in fstab_enabled_full() based on the parsed result...
Yu Watanabe [Tue, 8 Aug 2023 17:40:21 +0000 (02:40 +0900)] 
fstab-generator: update cache in fstab_enabled_full() based on the parsed result of fstab=

Currently, fstab-generator does not use fstab file parsers in
fstab-util.c. So, this is not necessary. Just for a possible
optimization in the case the parsers used in the future.

2 years agofstab-util: introduce fstab_enabled() helper function
Yu Watanabe [Tue, 8 Aug 2023 17:30:33 +0000 (02:30 +0900)] 
fstab-util: introduce fstab_enabled() helper function

And refuse to parse fstab when 'fstab=no' is specified in the kernel
command line.

When 'fstab=no' is specified in the kernel command line, fstab-generator
does not parse fstab and will not create e.g. /boot or /efi mount entry
even if fstab contains entries for the mount points. However, gpt-auto
generator may parse fstab file, and adjust or ignore mounts for EFI or
XBOOTLDR partitions based on the fstab file.

This makes gpt-auto also ignore fstab entries if 'fstab=no' is set in
the kernel command line.

2 years agoproc-cmdline: make proc_cmdline_get_bool() take flags
Yu Watanabe [Wed, 9 Aug 2023 08:41:55 +0000 (17:41 +0900)] 
proc-cmdline: make proc_cmdline_get_bool() take flags

All other command line parsers takes flags. Let's make
proc_cmdline_get_bool() also take flags. Though, currently,
no flag is set by the caller.

2 years agovconsole-setup: simplify error handling 28720/head
Lennart Poettering [Tue, 8 Aug 2023 12:20:17 +0000 (14:20 +0200)] 
vconsole-setup: simplify error handling

no need to negate an error which we don't need negated.

also, add debug log about errors we ignore.

2 years agovconsole-setup: simplify path allocation
Lennart Poettering [Tue, 8 Aug 2023 12:19:21 +0000 (14:19 +0200)] 
vconsole-setup: simplify path allocation

Let's code this straighforwadly, and just allocate the string as we need
it, instead of doing pre-allocation.

This is not performance sensitive, as this will almost certainly just
return /dev/tty1 after the first transition.

2 years agovconsole-setup: use FOREACH_ARRAY() at one more place
Lennart Poettering [Tue, 8 Aug 2023 12:18:50 +0000 (14:18 +0200)] 
vconsole-setup: use FOREACH_ARRAY() at one more place

2 years agovconsole-setup: port to main-func.h boilerplate
Lennart Poettering [Tue, 8 Aug 2023 12:18:38 +0000 (14:18 +0200)] 
vconsole-setup: port to main-func.h boilerplate

2 years agotest: also check the ordering between udevd and tmpfiles-setup 28732/head
Yu Watanabe [Tue, 8 Aug 2023 22:20:49 +0000 (07:20 +0900)] 
test: also check the ordering between udevd and tmpfiles-setup

2 years agoRevert "Revert "tmpfiles.d: adjust /dev/vfio/vfio access mode""
Yu Watanabe [Tue, 8 Aug 2023 16:25:42 +0000 (01:25 +0900)] 
Revert "Revert "tmpfiles.d: adjust /dev/vfio/vfio access mode""

This reverts commit 33b91308c26ca5d512e43b6b32d596a2c9237d04.

The commit b42482af904ae0b94a6e4501ec595448f0ba1c06 dropped
'--exclude-prefix=/dev' from systemd-tmpfiles-setup.service. So, the
possibly later invocation of the service changes the permission set by
udevd.

As commmented in the head of this file, settings should be consistent
with udev rules. Only missing entry here is vfio. Let's re-add the
entry for the device.

Addresses https://github.com/systemd/systemd/pull/28681#issuecomment-1666949888.

2 years agoveritysetup-generator: fix ordering of generated units
Yu Watanabe [Tue, 8 Aug 2023 18:40:14 +0000 (03:40 +0900)] 
veritysetup-generator: fix ordering of generated units

Fixes a bug introduced by 08b04ec7e72b7327b4803809732b1b8fce8dd069 and
953006dcb0a37a57aed0e762ff6289700e8689e8.

Fixes #28725.

2 years agoMerge pull request #28731 from yuwata/sd-dhcp-server-cleanups
Yu Watanabe [Wed, 9 Aug 2023 02:25:44 +0000 (11:25 +0900)] 
Merge pull request #28731 from yuwata/sd-dhcp-server-cleanups

sd-dhcp-server: cleanups

2 years agoseccomp: add LoongArch 64bit support
Xiaotian Wu [Fri, 5 Nov 2021 08:52:27 +0000 (16:52 +0800)] 
seccomp: add LoongArch 64bit support

2 years agoMerge pull request #28727 from yuwata/proc-cmdline-cleanups
Luca Boccassi [Wed, 9 Aug 2023 00:18:13 +0000 (01:18 +0100)] 
Merge pull request #28727 from yuwata/proc-cmdline-cleanups

tree-wide: fixlet and optimization for parsing kernel command line

2 years agounit: make udev rules really take precedence over tmpfiles
Yu Watanabe [Tue, 8 Aug 2023 22:15:26 +0000 (07:15 +0900)] 
unit: make udev rules really take precedence over tmpfiles

Follow-up for b42482af904ae0b94a6e4501ec595448f0ba1c06.

The commit makes systemd-tmpfiles-setup.service also updates the
permission or owner of device nodes. However, the service does not have
ordering for systemd-udevd.service. So, the service may set different
permission from the one udevd already set.

Fixes #28653.
Replaces #28681.

2 years agoRevert "unit: make udev rules take precesence over tmpfiles"
Yu Watanabe [Tue, 8 Aug 2023 22:13:09 +0000 (07:13 +0900)] 
Revert "unit: make udev rules take precesence over tmpfiles"

This reverts commit 31845ef554877525dc4ff4f25ad11ad805ebf81c.

systemd-tmpfiles-setup-dev.service has Before=systemd-udevd.service.
So the commit does not change anything.

2 years agomeson: use install_emptydir() and drop meson-make-symlink.sh
Yu Watanabe [Tue, 8 Aug 2023 01:38:47 +0000 (10:38 +0900)] 
meson: use install_emptydir() and drop meson-make-symlink.sh

The script is mostly equivalent to 'mkdir -p' and 'ln -sfr'.
Let's replace it with install_emptydir() builtin function and
inline meson call.

2 years agosd-dhcp-server: propagate error on parsing DHCP packet 28731/head
Yu Watanabe [Tue, 8 Aug 2023 19:58:04 +0000 (04:58 +0900)] 
sd-dhcp-server: propagate error on parsing DHCP packet

Otherwise, we silently ignore the received packet and that makes hard to
debug issue.

2 years agodhcp: rename function argument
Yu Watanabe [Tue, 8 Aug 2023 20:04:07 +0000 (05:04 +0900)] 
dhcp: rename function argument