]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agoMerge pull request #22631 from yuwata/network-redesign-request-queue
Luca Boccassi [Fri, 11 Mar 2022 10:48:45 +0000 (10:48 +0000)] 
Merge pull request #22631 from yuwata/network-redesign-request-queue

network: re-design request queue

2 years agoMerge pull request #22618 from yuwata/network-safe-string
Lennart Poettering [Fri, 11 Mar 2022 10:33:07 +0000 (11:33 +0100)] 
Merge pull request #22618 from yuwata/network-safe-string

network: dhcp-server: refuse unsafe filename

2 years agofix signature of sd_journal_print_with_location in docs
Marcel Hellwig [Fri, 11 Mar 2022 07:23:45 +0000 (08:23 +0100)] 
fix signature of sd_journal_print_with_location in docs

2 years agogitignore: ignore mkosi.installdir
Clyde Byrd III [Fri, 11 Mar 2022 01:43:26 +0000 (17:43 -0800)] 
gitignore: ignore mkosi.installdir

2 years agonetwork: re-design request queue 22631/head
Yu Watanabe [Mon, 28 Feb 2022 01:55:51 +0000 (10:55 +0900)] 
network: re-design request queue

This makes Request object takes hash, compare, free, and process functions.

With this change, the logic in networkd-queue.c can be mostly
independent of the type of the request or the object (e.g. Address) assigned
to the request, and it becomes simpler.

2 years agonetwork: increment reference counters of Link and Request before processing requests
Yu Watanabe [Mon, 28 Feb 2022 02:21:24 +0000 (11:21 +0900)] 
network: increment reference counters of Link and Request before processing requests

To prevent the request or link is freed while processing requests.

2 years agonetwork: merge RequestType and SetLinkOperation
Yu Watanabe [Mon, 28 Feb 2022 02:03:11 +0000 (11:03 +0900)] 
network: merge RequestType and SetLinkOperation

These two enum indicate how we process the request. Hence, it is not
necessary to introduce two separated indicators.

2 years agonetwork: refuse to configure link properties when in initialized state
Yu Watanabe [Mon, 28 Feb 2022 02:15:01 +0000 (11:15 +0900)] 
network: refuse to configure link properties when in initialized state

The condition should be satisfied only when users request to reconfigure
the link, and in that case, all request will be cancelled. Hence, it is
not necessary to process the request.

2 years agonetwork: drop unnecessary link_enter_failed()
Yu Watanabe [Mon, 28 Feb 2022 02:00:56 +0000 (11:00 +0900)] 
network: drop unnecessary link_enter_failed()

As returning negative errno makes the link will enter the failed state.

2 years agonetwork: introduce request_call_netlink_async()
Yu Watanabe [Mon, 28 Feb 2022 00:20:42 +0000 (09:20 +0900)] 
network: introduce request_call_netlink_async()

In most netlink handlers, we do the following,
1. decrease the message counter,
2. check the link state,
3. error handling,
4. update link state via e.g. link_check_ready().

The first two steps are mostly common, hence let's extract it.

Moreover, this is not only extracting the common logic, but provide a
strong advantage; `request_call_netlink_async()` assigns the relevant
Request object to the userdata of the netlink slot, and the request object
has full information about the message we sent. Hence, in the future,
netlink handler can print more detailed error message. E.g. when
an address is failed to configure, then currently we only show an
address is failed to configure, but with this commit, potentially we can
show which address is failed explicitly.

This does not change such error handling yet. But let's do that later.

2 years agonetwork: make Request object take Manager*
Yu Watanabe [Sun, 27 Feb 2022 06:39:16 +0000 (15:39 +0900)] 
network: make Request object take Manager*

Previously, even though all Request object are owned by Manager, they
do not have direct reference to Manager, but through Link or NetDev
object. But, as Link or NetDev can be NULL, we need to conditionalize
how to access Manager from Request with the type of the request.
This makes the way simpler, as now Request object has direct reference
to Manager.

This also rename request_drop() -> request_detach(), as in the previous
commit, the reference counter is introduced, so even if a reference of
a Request object from Manager is dropped, the object may still alive.
The naming `request_drop()` sounds the object will freed by the
function. But it may not. And `request_detach()` suggests the object
will not be managed by Manager any more, and I think it is more
appropreate.

This is just a cleanup, and should not change any behavior.

2 years agonetwork: introduce reference counter for Request object
Yu Watanabe [Sun, 27 Feb 2022 06:18:01 +0000 (15:18 +0900)] 
network: introduce reference counter for Request object

Currently, all Request object are always owned by Manager, and freed
when it is processed, especially, soon after a netlink message is sent.
So, it is not necessary to introduce the reference counter.

In a later commit, the Request object will _not_ be freed at the time
when a netlink message is sent, but assigned to the relevant netlink
slot as a userdata, and will be freed when a reply is received. So, the
owner of the Request object is changed in its lifetime. In that case, it
is convenient that the object has reference counter to avoid memleak or
double free.

2 years agonetwork: make request_process_address() and friends take Link and corresponding object
Yu Watanabe [Sat, 26 Feb 2022 06:56:39 +0000 (15:56 +0900)] 
network: make request_process_address() and friends take Link and corresponding object

This also renames e.g. request_process_address() -> address_process_request().

Also, this drops type checks such as `assert(req->type == REQUEST_TYPE_ADDRESS)`,
as in the later commits, the function of processing request, e.g.
`address_process_request()`, will be assigned to the Request object when
it is created. And the request type will be used to distinguish and to
avoid deduplicating requests which do not have any assigned objects,
like REQUEST_TYPE_DHCP4_CLIENT. Hence, the type checks in process functions
are mostly not necessary and redundant.

This is mostly cleanups and preparation for later commits, and should
not change any behavior.

2 years agonetwork: make address_configure() and friends take Request object
Yu Watanabe [Fri, 11 Mar 2022 01:40:59 +0000 (10:40 +0900)] 
network: make address_configure() and friends take Request object

This should not change any behavior.
Just a preparation for a later commit which introduces
request_call_netlink_async().

2 years agonetwork: tc: assign netlink handlers into Request object
Yu Watanabe [Fri, 11 Mar 2022 01:38:59 +0000 (10:38 +0900)] 
network: tc: assign netlink handlers into Request object

This should not change any behavior, as req->netlink_handler is always
qdisc_handler or tclass_handler.

This is just a preparation for a later commit which introduces
request_call_netlink_async().

2 years agoalloc-util: introduce mfree_func_type_t
Yu Watanabe [Fri, 18 Feb 2022 06:24:23 +0000 (15:24 +0900)] 
alloc-util: introduce mfree_func_type_t

2 years agonetwork: dhcp: rename NextServer= and Filename= settings 22618/head
Yu Watanabe [Mon, 7 Mar 2022 10:57:09 +0000 (19:57 +0900)] 
network: dhcp: rename NextServer= and Filename= settings

And make the settings configures DHCP option 66 and 67.

Follow-ups for #22615.
Fixes #22661.

2 years agoMerge pull request #22701 from poettering/raise-memlock
Luca Boccassi [Fri, 11 Mar 2022 01:09:33 +0000 (01:09 +0000)] 
Merge pull request #22701 from poettering/raise-memlock

pid1/nspawn: raise RLIMIT_MEMLOCK to 8M matching kernel 5.16's new default

2 years agocore/dbus-job: Use new way of specifying sd-bus vtable parameter names
Clyde Byrd III [Thu, 10 Mar 2022 08:47:20 +0000 (00:47 -0800)] 
core/dbus-job: Use new way of specifying sd-bus vtable parameter names

2 years agohostname-util: normalize get_pretty_hostname() call semantics
Lennart Poettering [Thu, 10 Mar 2022 17:20:11 +0000 (18:20 +0100)] 
hostname-util: normalize get_pretty_hostname() call semantics

get_pretty_hostname() so far had semantics not in line with our usual
ones: the return parameter was actually freed before the return string
written into it, because that's what parse_env_file() does. Moreover,
when the value was not set it would return NULL but succeed.

Let's normalize this, and only fill in the return value if there's
something set, and never read from it, like we usually do with return
parameter, and in particular those named "ret_xyz".

The existing callers don't really care about the differences, but it's
nicer to normalize behaviour to minimize surprises.

2 years agoMerge pull request #22705 from mrc0mmand/pretty_hostname_specifier
Luca Boccassi [Thu, 10 Mar 2022 21:45:34 +0000 (21:45 +0000)] 
Merge pull request #22705 from mrc0mmand/pretty_hostname_specifier

core: introduce %R specifier for pretty hostname

2 years agocgls: mangle user-provided unit names
Frantisek Sumsal [Thu, 10 Mar 2022 14:18:45 +0000 (15:18 +0100)] 
cgls: mangle user-provided unit names

so the CLI interface is now similar to `systemctl`, i.e. if no unit name
suffix is provided, assume `.service`.

Fixes: #20492
Before:
```
$ systemd-cgls --unit user@1000
Failed to query unit control group path: Invalid argument
Failed to list cgroup tree: Invalid argument
```

After:
```
$ build/systemd-cgls --unit user@1000
Unit user@1000.service (/user.slice/user-1000.slice/user@1000.service):
├─session.slice (#4939)
│ ├─pipewire-pulse.service (#5203)
│ │ └─7711 /usr/bin/pipewire-pulse
...
```

2 years agocore: support ExtensionDirectories in user manager
Luca Boccassi [Thu, 10 Mar 2022 01:30:08 +0000 (01:30 +0000)] 
core: support ExtensionDirectories in user manager

Unprivileged overlayfs is supported since Linux 5.11. The only
change needed to get ExtensionDirectories to work is to avoid
hard-coding the staging directory to the system manager runtime
directory, everything else just works (TM).

2 years agopo: Translated using Weblate (Georgian)
Temuri Doghonadze [Thu, 10 Mar 2022 18:17:00 +0000 (19:17 +0100)] 
po: Translated using Weblate (Georgian)

Currently translated at 100.0% (189 of 189 strings)

Co-authored-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ka/
Translation: systemd/main

2 years agocore: introduce %R specifier for pretty hostname 22705/head
Frantisek Sumsal [Thu, 10 Mar 2022 15:15:54 +0000 (16:15 +0100)] 
core: introduce %R specifier for pretty hostname

Resolves: #20054

2 years agoMerge pull request #22460 from bluca/monitor_refactor
Lennart Poettering [Thu, 10 Mar 2022 17:34:20 +0000 (18:34 +0100)] 
Merge pull request #22460 from bluca/monitor_refactor

core: split $MONITOR_METADATA and return it only if a single unit triggers OnFailure/OnSuccess

2 years agopid1,nspawn: raise default RLIMIT_MEMLOCK to 8M 22701/head
Lennart Poettering [Thu, 10 Mar 2022 12:22:57 +0000 (13:22 +0100)] 
pid1,nspawn: raise default RLIMIT_MEMLOCK to 8M

This mirrors a similar check in Linux kernel 5.16
(9dcc38e2813e0cd3b195940c98b181ce6ede8f20) that raised the
RLIMIT_MEMLOCK to 8M.

This change does two things: raise the default limit for nspawn
containers (where we try to mimic closely what the kernel does), and
bump it when running on old kernels which still have the lower setting.

Fixes: #16300
See: https://lwn.net/Articles/876288/

2 years agomain: add 'const' on two function arguments
Lennart Poettering [Thu, 10 Mar 2022 12:22:32 +0000 (13:22 +0100)] 
main: add 'const' on two function arguments

2 years agoMerge pull request #22682 from bluca/start_skip
Luca Boccassi [Thu, 10 Mar 2022 17:25:44 +0000 (17:25 +0000)] 
Merge pull request #22682 from bluca/start_skip

core: do not return 'skipped' when Condition*= fail with StartUnitWithFlags()

2 years agoMerge pull request #22695 from poettering/crash-handle-refactor
Luca Boccassi [Thu, 10 Mar 2022 16:42:50 +0000 (16:42 +0000)] 
Merge pull request #22695 from poettering/crash-handle-refactor

pid1: add comment clarifying not to use memory allocation from crash handler

2 years agocore: be a bit more defensive when resolving specifiers
Frantisek Sumsal [Thu, 10 Mar 2022 16:14:04 +0000 (17:14 +0100)] 
core: be a bit more defensive when resolving specifiers

2 years agomanager: pass monitor metadata in more cases 22460/head
Zbigniew Jędrzejewski-Szmek [Tue, 1 Mar 2022 09:49:26 +0000 (10:49 +0100)] 
manager: pass monitor metadata in more cases

The first ExecStartPre or the first ExecStart commands would get the metadata,
but not the subsequent ones. Also check that we do not pass it in
ExecStartPost.

2 years agomanager: prevent cleanup of triggering units before we start the handler
Zbigniew Jędrzejewski-Szmek [Wed, 2 Mar 2022 12:09:06 +0000 (13:09 +0100)] 
manager: prevent cleanup of triggering units before we start the handler

This fixes the following case:
OnFailure= would be spawned correctly, but OnSuccess= would be
spawned without the MONITOR_* metadata, because we'd "collect" the unit
that started successfully. So let's block cleanup while we have a job
running for the handler. The job cannot last infinitely, so at some point
we'll be able to collect both.

2 years agomanager/service: when we have multiple candidates to handle, warn
Zbigniew Jędrzejewski-Szmek [Wed, 2 Mar 2022 12:05:50 +0000 (13:05 +0100)] 
manager/service: when we have multiple candidates to handle, warn

This would be very confusing to users, so let's warn if they configured the
same handler for multiple units and we're not running it as expected.

2 years agomanager/service: when we spawn, say why
Zbigniew Jędrzejewski-Szmek [Tue, 1 Mar 2022 10:59:48 +0000 (11:59 +0100)] 
manager/service: when we spawn, say why

We already logged what we are spawning, but not so much why. Let's
add this, so it's easier to distinguish execstartpre/execstart/execstartpost
and such.

2 years agomanager: log how many OnSuccess/OnFailure jobs were started
Zbigniew Jędrzejewski-Szmek [Tue, 1 Mar 2022 10:33:07 +0000 (11:33 +0100)] 
manager: log how many OnSuccess/OnFailure jobs were started

2 years agomanager: adjust comment
Zbigniew Jędrzejewski-Szmek [Tue, 1 Mar 2022 10:33:28 +0000 (11:33 +0100)] 
manager: adjust comment

2 years agovarious: align vertically for ease of reading
Zbigniew Jędrzejewski-Szmek [Tue, 1 Mar 2022 12:03:31 +0000 (13:03 +0100)] 
various: align vertically for ease of reading

2 years agoTEST-68: enhance testing of chained commands
Zbigniew Jędrzejewski-Szmek [Thu, 10 Mar 2022 14:47:41 +0000 (14:47 +0000)] 
TEST-68: enhance testing of chained commands

The test would fail when the the same handler was used for multiple
*failing* units. We need to call 'reset-failed' to let the manager forget
about the earlier ones.

systemd-analyze log-target console is removed, because it's easier to follow
the logs if logging it to the journal.

2 years agoTEST-68-PROPAGATE-EXIT-STATUS: deobfuscate shell code and fix typo
Zbigniew Jędrzejewski-Szmek [Tue, 1 Mar 2022 09:07:23 +0000 (10:07 +0100)] 
TEST-68-PROPAGATE-EXIT-STATUS: deobfuscate shell code and fix typo

After the cleanup, it was fairly easy to see the wrong variable name ;)

2 years agoNEWS: note backward-incompatible MONITOR_METADATA change
Luca Boccassi [Wed, 9 Feb 2022 11:58:30 +0000 (11:58 +0000)] 
NEWS: note backward-incompatible MONITOR_METADATA change

2 years agotest: cover template OnFailure/OnSuccess handlers in TEST-68-PROPAGATE-EXIT-STATUS
Luca Boccassi [Wed, 9 Feb 2022 11:50:19 +0000 (11:50 +0000)] 
test: cover template OnFailure/OnSuccess handlers in TEST-68-PROPAGATE-EXIT-STATUS

2 years agocore: split $MONITOR_METADATA and return it only if a single unit triggers OnFailure...
Luca Boccassi [Wed, 9 Feb 2022 11:48:30 +0000 (11:48 +0000)] 
core: split $MONITOR_METADATA and return it only if a single unit triggers OnFailure/OnSuccess

Remove the list logic, and simply skip passing metadata if more than one
unit triggered an OnFailure/OnSuccess handler.
Instead of a single env var to loop over, provide each separate item
as its own variable.

Fixes https://github.com/systemd/systemd/issues/22370

2 years agoNEWS: note backward-incompatible change in StartUnitWithFlags() 22682/head
Luca Boccassi [Tue, 8 Mar 2022 22:16:29 +0000 (22:16 +0000)] 
NEWS: note backward-incompatible change in StartUnitWithFlags()

2 years agocore: do not return 'skipped' when Condition*= fail with StartUnitWithFlags()
Luca Boccassi [Tue, 8 Mar 2022 22:13:37 +0000 (22:13 +0000)] 
core: do not return 'skipped' when Condition*= fail with StartUnitWithFlags()

Backward incompatible change to avoid returning 'skipped' if a condition causes
a job activation to be skipped when using StartUnitWithFlags().
Job results are broadcasted, so it is theoretically possible that existing
software could get confused if they see this result.

Replaces https://github.com/systemd/systemd/pull/22369

2 years agoMerge pull request #22685 from bluca/user_root_dir
Luca Boccassi [Thu, 10 Mar 2022 13:12:19 +0000 (13:12 +0000)] 
Merge pull request #22685 from bluca/user_root_dir

core: support MountAPIVFS and RootDirectory in user manager

2 years agopid1: split out crash handler logic into its own .c/.h file 22695/head
Lennart Poettering [Thu, 10 Mar 2022 08:33:05 +0000 (09:33 +0100)] 
pid1: split out crash handler logic into its own .c/.h file

This stuff is sufficiently different from the rest of main.c, let's move
it to its own .c/.h file, to make main.c a bit shorter.

No code changes, just some refactoring.

2 years agopid1: add comment to crash handler about memory allocations
Lennart Poettering [Thu, 10 Mar 2022 08:22:32 +0000 (09:22 +0100)] 
pid1: add comment to crash handler about memory allocations

2 years agoMerge pull request #22595 from poettering/logind-action-refact
Yu Watanabe [Thu, 10 Mar 2022 11:56:15 +0000 (20:56 +0900)] 
Merge pull request #22595 from poettering/logind-action-refact

logind: some minor refactoring around logind's HandleAction logic

2 years agocore: support MountAPIVFS and RootDirectory in user manager 22685/head
Luca Boccassi [Wed, 9 Mar 2022 02:07:34 +0000 (02:07 +0000)] 
core: support MountAPIVFS and RootDirectory in user manager

The only piece missing was to somehow make /proc appear in the
new user+mount namespace. It is not possible to mount a new
/proc instance, not even with hidepid=invisible,subset=pid, in
a user namespace unless a PID namespace is created too (and also
at the same time as the other namespaces, it is not possible to
mount a new /proc in a child process that creates a PID namespace
forked from a parent that created a user+mount namespace, it has
to happen at the same time).

Use the host's /proc with a bind-mount as a fallback for this
case. User session services would already run with it, so
nothing is lost.

2 years agomain: drop get_process_cmdline from crash handler
licunlong [Thu, 10 Mar 2022 01:22:29 +0000 (09:22 +0800)] 
main: drop get_process_cmdline from crash handler
get_process_cmdline calls malloc, which should be avoid in signal handler.

Fixes: #22690
2 years agodhcp: list all known message type
Yu Watanabe [Mon, 7 Mar 2022 10:23:43 +0000 (19:23 +0900)] 
dhcp: list all known message type

2 years agosd-dhcp6-client: rename timezone options
Yu Watanabe [Mon, 7 Mar 2022 10:17:05 +0000 (19:17 +0900)] 
sd-dhcp6-client: rename timezone options

To make them follow corresponding DHCPv4 options.

2 years agodhcp: list all known DHCP options
Yu Watanabe [Mon, 7 Mar 2022 10:13:31 +0000 (19:13 +0900)] 
dhcp: list all known DHCP options

2 years agoconf-parser: introduce config_parse_dns_name() and config_parse_hostname()
Yu Watanabe [Thu, 10 Mar 2022 05:40:18 +0000 (14:40 +0900)] 
conf-parser: introduce config_parse_dns_name() and config_parse_hostname()

This makes nspawn refuse hostnames which are invalid DNS domain names.

2 years agonetwork: refuse string which contains non-safe or non-ascii characters for Filename=
Yu Watanabe [Mon, 7 Mar 2022 06:45:17 +0000 (15:45 +0900)] 
network: refuse string which contains non-safe or non-ascii characters for Filename=

The string will be used when the client load additional config file to
boot, and it must be a valid path or url. Hence, let's refuse non-safe or
non-characters.

2 years agoconf-parser: introduce CONFIG_PARSE_STRING_ASCII flag
Yu Watanabe [Mon, 7 Mar 2022 07:09:23 +0000 (16:09 +0900)] 
conf-parser: introduce CONFIG_PARSE_STRING_ASCII flag

When the flag is set, the string which contains non-ascii characters
will be refused.

2 years agoconf-parser: merge config_parse_string() and config_parse_safe_string()
Yu Watanabe [Mon, 7 Mar 2022 06:39:07 +0000 (15:39 +0900)] 
conf-parser: merge config_parse_string() and config_parse_safe_string()

This also makes unsafe strings escaped when logged. Otherwise,
journalctl may not show the log message unless '--all' is specified.

2 years agopo: Translated using Weblate (Georgian)
Temuri Doghonadze [Wed, 9 Mar 2022 13:25:27 +0000 (14:25 +0100)] 
po: Translated using Weblate (Georgian)

Currently translated at 23.2% (44 of 189 strings)

po: Added translation using Weblate (Georgian)

Co-authored-by: Temuri Doghonadze <temuri.doghonadze@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ka/
Translation: systemd/main

2 years agologind: rename scheduled_shutdown_type → scheduled_shutdown_action 22595/head
Lennart Poettering [Tue, 22 Feb 2022 12:28:24 +0000 (13:28 +0100)] 
logind: rename scheduled_shutdown_type → scheduled_shutdown_action

This matches naming of the 'delayed_action' field we already have. It's
similar in both type and concept, and hence should be named similarly.

2 years agologind: rename manager_item_for_handle() → handle_action_lookup()
Lennart Poettering [Tue, 22 Feb 2022 12:26:31 +0000 (13:26 +0100)] 
logind: rename manager_item_for_handle() → handle_action_lookup()

The function has nothing to do with any Manager object, hence drop that
from the name. And it actually looks something up by handle *action* not
by *handle*, hence the old name was a bit misnomer. Let's call it
handle_action_lookup(), as it queries handle action metainfo for a
handle action.

Also, let's make sure it behaves more like our usual functions that
lookup some fixed data from some enum value/int: let's return NULL if we
don't find it.

2 years agologind: drop unused prototype
Lennart Poettering [Tue, 22 Feb 2022 12:24:40 +0000 (13:24 +0100)] 
logind: drop unused prototype

2 years agologind: minor whitespace fix
Lennart Poettering [Tue, 22 Feb 2022 12:23:52 +0000 (13:23 +0100)] 
logind: minor whitespace fix

2 years agologind: rename ActionTableItem → HandleActionData
Lennart Poettering [Tue, 22 Feb 2022 12:19:44 +0000 (13:19 +0100)] 
logind: rename ActionTableItem → HandleActionData

It stores meta-info about various HandleActions, hence let's name it
after that. The fact that it can be seen as stored inside some form of a
table is an implementation detail of logind-action.c, and should not
leak into other modules, hence let's focus on what it is, not how it is
stored.

2 years agologind: replace handle_action_valid() macro by inline function
Lennart Poettering [Tue, 22 Feb 2022 12:05:16 +0000 (13:05 +0100)] 
logind: replace handle_action_valid() macro by inline function

The old macro will double evaluation and has no protection against
operator precedence issues. Let's fix that by using an inline func
instead, which also gives us typesafety.

2 years agoupdate TODO
Lennart Poettering [Wed, 9 Mar 2022 13:25:43 +0000 (14:25 +0100)] 
update TODO

2 years agorandom-util: unify RANDOM_ALLOW_INSECURE and !RANDOM_BLOCK and simplify
Jason A. Donenfeld [Mon, 7 Mar 2022 04:36:19 +0000 (21:36 -0700)] 
random-util: unify RANDOM_ALLOW_INSECURE and !RANDOM_BLOCK and simplify

RANDOM_BLOCK has existed for a long time, but RANDOM_ALLOW_INSECURE was
added more recently, leading to an awkward relationship between the two.
It turns out that only one, RANDOM_BLOCK, is needed.

RANDOM_BLOCK means return cryptographically secure numbers no matter
what. If it's not set, it means try to do that, but if it fails, fall
back to using unseeded randomness.

This part of falling back to unseeded randomness is the intent of
GRND_INSECURE, which is what RANDOM_ALLOW_INSECURE previously aliased.
Rather than having an additional flag for that, it makes more sense to
just use it whenever RANDOM_BLOCK is not set. This saves us the overhead
of having to open up /dev/urandom.

Additionally, when getrandom returns too little data, but not zero data,
we currently fall back to using /dev/urandom if RANDOM_BLOCK is not set.
This doesn't quite make sense, because if getrandom returned seeded data
once, then it will forever after return the same thing as whatever
/dev/urandom does. So in that case, we should just loop again.

Since there's never really a time where /dev/urandom is able to return
some easily but more with difficulty, we can also get rid of
RANDOM_EXTEND_WITH_PSEUDO. Once the RNG is initialized, bytes
should just flow normally.

This also makes RANDOM_MAY_FAIL obsolete, because the only case this ran
was where we'd fall back to /dev/urandom on old kernels and return
GRND_INSECURE bytes on new kernels. So also get rid of that flag.

Finally, since we're always able to use GRND_INSECURE on newer kernels,
and we only fall back to /dev/urandom on older kernels, also only fall
back to using RDRAND on those older kernels. There, the only reason to
have RDRAND is to avoid a kmsg entry about unseeded randomness.

The result of this commit is that we now cascade like this:

  - Use getrandom(0) if RANDOM_BLOCK.
  - Use getrandom(GRND_INSECURE) if !RANDOM_BLOCK.
  - Use /dev/urandom if !RANDOM_BLOCK and no GRND_INSECURE support.
  - Use /dev/urandom if no getrandom() support.
  - Use RDRAND if we would use /dev/urandom for any of the above reasons
    and RANDOM_ALLOW_RDRAND is set.

2 years agoPackit: build SRPMs in Copr
Laura Barcziova [Wed, 9 Mar 2022 06:50:29 +0000 (07:50 +0100)] 
Packit: build SRPMs in Copr

Add srpm_build_deps key to the Packit config to specify needed dependencies for SRPM build
and indicate to build SRPM in Copr.

2 years agotest: set log level of user manager in TEST-43 to debug
Luca Boccassi [Wed, 9 Mar 2022 02:08:15 +0000 (02:08 +0000)] 
test: set log level of user manager in TEST-43 to debug

2 years agocore: create parent directory for mount point of ExtensionDirectories
Luca Boccassi [Wed, 9 Mar 2022 02:02:17 +0000 (02:02 +0000)] 
core: create parent directory for mount point of ExtensionDirectories

This is used by ExtensionDirectories too, as they are bind-mounted in the
propagate directory to check the extension-release files

2 years agotest: skip TEST-17 on ubuntu ppc64el
Yu Watanabe [Tue, 8 Mar 2022 12:15:58 +0000 (21:15 +0900)] 
test: skip TEST-17 on ubuntu ppc64el

On Ubuntu CI on ppc64el, the test randomly fails when /run/udev is not
synced before checking its contents (see #22357). But /run/udev is a
tmpfs and fsync on tmpfs is noop (see `struct shmem_file_operations` in
mm/shmem.c of the kernel), hence, it is not necessary to call fsync on
/run/udev in general. This should be a testing emvironment issue (I
guess it is an issue on nested KVM on ppc64el), instead of an issue on
udev.

C.f. #22357.

Fixes #21603.

2 years agomain: log which process send SIGNAL to PID1
licunlong [Tue, 8 Mar 2022 11:18:36 +0000 (19:18 +0800)] 
main: log which process send SIGNAL to PID1
This can help users to figure out what makes systemd freeze.
1. Someone kills systemd accidentally, then the sender_pid won't be 1;
2. systemd triggers segfault or assert, then the sender_pid will be 1;

2 years agocore: manage SetShowStatus through polkit
Zbigniew Jędrzejewski-Szmek [Mon, 7 Mar 2022 18:22:26 +0000 (19:22 +0100)] 
core: manage SetShowStatus through polkit

When writing docs for SD_BUS_VTABLE_CAPABILITY, I noticed that we have one use
of SD_BUS_VTABLE_CAPABILITY(CAP_SYS_ADMIN) in the tree. This is the default, so
it's not very useful to specify it. But if we're touching that, I think it's
better to use mac + polkit for this like for everything else.

We don't have a very good category for this, but I don't think it makes sense
to add a new one. I just reused the same as other similar calls.

2 years agoudev: 60-persistent-storage-tape.rules: handle duplicate device ID
David Bond [Tue, 8 Mar 2022 09:41:39 +0000 (10:41 +0100)] 
udev: 60-persistent-storage-tape.rules: handle duplicate device ID

Some SCSI tape devices use the same device ID (NAA registered device
designator) for the SCSI tape changer device and the first actual tape
device. For example, this one:

https://docs.oracle.com/en/storage/tape-storage/storagetek-sl150-modular-tape-library/slofs/bridged-tape-drives.html

   You must connect the bridged drive to an HBA supporting multiple
   LUNs (also referred to as LUN scanning). The SL150 Library uses a
   single SCSI ID and two logical unit numbers (LUN). LUN 0 controls
   the tape drive and LUN 1 which is configured as a SCSI medium
   changer device controls the robotics. Data is sent to the remaining
   LUN on the bridged drive or to LUNs on the other, unbridged drives
   in the partition, all of which are configured as SCSI
   sequential-access (tape) devices.

This may lead to errors because /dev/tape/by-id symlinks may sometimes
point to the st device representing the tape, and sometimes to the sg
device representing the changer.

Fix this by assigning an increased priority to the tape device, and creating
a separate -changer link for the SCSI tape changer.

Co-developed-by: Martin Wilck <mwilck@suse.com>
2 years agoFix mic mute on Acer TravelMate B311-31 (#22677)
tawefogo [Tue, 8 Mar 2022 14:10:51 +0000 (15:10 +0100)] 
Fix mic mute on Acer TravelMate B311-31 (#22677)

2 years agoMerge pull request #22656 from keszybz/portablectl-method2
Zbigniew Jędrzejewski-Szmek [Tue, 8 Mar 2022 12:26:33 +0000 (13:26 +0100)] 
Merge pull request #22656 from keszybz/portablectl-method2

portable: add return parameter to GetImageMetadataWithExtensions

2 years agoTEST-29: do not pass -q to mk/unsquashfs, not supported on CentOS 8
Luca Boccassi [Mon, 7 Mar 2022 16:20:42 +0000 (16:20 +0000)] 
TEST-29: do not pass -q to mk/unsquashfs, not supported on CentOS 8

2 years agologind: use mfree instead of freep
Ludwig Nussel [Mon, 7 Mar 2022 12:33:59 +0000 (13:33 +0100)] 
logind: use mfree instead of freep

2 years agoci: make the concurrency group identifier unique once again
Frantisek Sumsal [Mon, 7 Mar 2022 15:18:42 +0000 (16:18 +0100)] 
ci: make the concurrency group identifier unique once again

Otherwise we end up randomly cancelling once of the two centos_epel
jobs.

Follow-up to da637c8fcad1baa530578982d41a6ecb1440f7c5.

2 years agoTEST-29: do not pass -q to mk/unsquashfs, not supported on CentOS 8 22656/head
Luca Boccassi [Mon, 7 Mar 2022 16:20:42 +0000 (16:20 +0000)] 
TEST-29: do not pass -q to mk/unsquashfs, not supported on CentOS 8

2 years agomemory-id: Work-around incorrect "Number of slots"
Bastien Nocera [Mon, 7 Mar 2022 09:11:12 +0000 (10:11 +0100)] 
memory-id: Work-around incorrect "Number of slots"

In some BIOSes, the "Number of slots or sockets available for Memory
Devices in this array" is incorrectly set to the number of memory array
that's populated.

Work-around this problem by outputting the number of sockets after
having parsed them so that consumers of this data can carry on expecting
an accurate number in this property.

This fixes the number of memory slots advertised for the HP Z600.

See https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1686

2 years agoNEWS: note GetMetadataWithExtensions backward incompatible change
Luca Boccassi [Mon, 7 Mar 2022 13:50:32 +0000 (13:50 +0000)] 
NEWS: note GetMetadataWithExtensions backward incompatible change

2 years agoportable: add return parameter to GetImageMetadataWithExtensions
Zbigniew Jędrzejewski-Szmek [Thu, 3 Mar 2022 15:26:36 +0000 (16:26 +0100)] 
portable: add return parameter to GetImageMetadataWithExtensions

The complaint was that the output array was used for two kinds of data, and the
input flag decided whether this extra data should be included. The flag is
removed, and instead the old method is changed to include the data always as
a separate parameter.

This breaks backward compatibility, but  the old method is effectively broken
and does not appear to be used yet, at least in open source code, by
searching on codesearch.debian.net and github.com.

Fixes #22404.

Co-authored-by: Luca Boccassi <bluca@debian.org>
2 years agomkosi: Add CentOS Stream 9
Daan De Meyer [Mon, 28 Feb 2022 10:12:04 +0000 (10:12 +0000)] 
mkosi: Add CentOS Stream 9

The blocker causing Stream 9 builds to fail was fixed
(https://bugzilla.redhat.com/show_bug.cgi?id=2056276) so we can add
CentOS Stream 9 builds as well now.

2 years agodocs: add more links for portabled
Zbigniew Jędrzejewski-Szmek [Thu, 3 Mar 2022 18:54:34 +0000 (19:54 +0100)] 
docs: add more links for portabled

2 years agoportable: inline one variable declaration
Zbigniew Jędrzejewski-Szmek [Thu, 3 Mar 2022 18:13:20 +0000 (19:13 +0100)] 
portable: inline one variable declaration

2 years agoportablectl: reorder if branches to match previous conditional in the same function
Zbigniew Jędrzejewski-Szmek [Thu, 3 Mar 2022 17:56:06 +0000 (18:56 +0100)] 
portablectl: reorder if branches to match previous conditional in the same function

One is a ternary op, the other an normal conditional, but they should still use
the same order of branches.

2 years agoTEST-29: trim output a bit
Zbigniew Jędrzejewski-Szmek [Thu, 3 Mar 2022 17:55:26 +0000 (18:55 +0100)] 
TEST-29: trim output a bit

IIUC, pipefail doesn't matter for a sequence of commands joined with &&, and we
don't have any pipes. And such a failing expression also does not trigger an
exit, so the set +e/set -e were noops.

2 years agoAdd support for NEC VersaPro VG-S
4piu [Mon, 7 Mar 2022 08:38:08 +0000 (16:38 +0800)] 
Add support for NEC VersaPro VG-S

The brightness control key (Fn+F7 Fn+F8) and touchpad toggle key (Fn + Space) do not work on the NEC VersaPro VG-S laptop. Add the keycode to fix the problem.

2 years agotree-wide: fix typo
Yu Watanabe [Mon, 7 Mar 2022 06:32:22 +0000 (15:32 +0900)] 
tree-wide: fix typo

2 years agotest: check systemd RPM macros
Frantisek Sumsal [Thu, 3 Mar 2022 19:30:43 +0000 (20:30 +0100)] 
test: check systemd RPM macros

Make sure our RPM macros work as intended. Based on the original PR
(#16464) by Mikhail Novosyolov.

Co-authored-by: Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
2 years agoMerge pull request #22663 from keszybz/various-man-page-bits
Zbigniew Jędrzejewski-Szmek [Fri, 4 Mar 2022 17:16:46 +0000 (18:16 +0100)] 
Merge pull request #22663 from keszybz/various-man-page-bits

Various man page bits

2 years agojournalctl: advertise --header a bit more 22663/head
Zbigniew Jędrzejewski-Szmek [Fri, 4 Mar 2022 15:39:34 +0000 (16:39 +0100)] 
journalctl: advertise --header a bit more

Fixes #2738.

2 years agoman: describe UNIT=/USER_UNIT=
Zbigniew Jędrzejewski-Szmek [Fri, 4 Mar 2022 15:26:12 +0000 (16:26 +0100)] 
man: describe UNIT=/USER_UNIT=

Fixes 17538.

2 years agoman: tweak description of auto/noauto
Zbigniew Jędrzejewski-Szmek [Fri, 4 Mar 2022 15:07:19 +0000 (16:07 +0100)] 
man: tweak description of auto/noauto

I think the current behaviour is stupid: 'x-systemd.automount,noauto' should
mean that we create the units, but don't add .mount or .automount to any targets.
Instead, we completely ignore 'noauto'. But let's at least describe the
implementation.

Text suggested by dpartrid in the bug.

Fixes #21040.

2 years agoman: describe capability checks on the bus
Zbigniew Jędrzejewski-Szmek [Fri, 4 Mar 2022 14:41:31 +0000 (15:41 +0100)] 
man: describe capability checks on the bus

A description of SD_BUS_VTABLE_CAPABILITY is added, and the discussion
on SD_BUS_VTABLE_UNPRIVILEGED in expanded. I think it would be nice
to add longer description of how access is checked (maybe in sd-bus(3)),
but I'm leaving that for later. I think the text that was added here
describes everything, even if tersely.

Fixes #21882.

2 years agoman: fix formatting of macros in sd_bus_add_object
Zbigniew Jędrzejewski-Szmek [Fri, 4 Mar 2022 14:23:17 +0000 (15:23 +0100)] 
man: fix formatting of macros in sd_bus_add_object

docbook would convert the newline to a space before the first argument:
  SD_BUS_METHOD_WITH_ARGS( member, args, result, handler)

And we need each item in a separate <para>, otherwise they'll all be in
one line.

2 years agoman: say that we ignore ignored options
Zbigniew Jędrzejewski-Szmek [Fri, 4 Mar 2022 13:13:56 +0000 (14:13 +0100)] 
man: say that we ignore ignored options

Fixes #22057.

2 years agoman: drop outdated info about polkit in pid1
Zbigniew Jędrzejewski-Szmek [Fri, 4 Mar 2022 13:03:50 +0000 (14:03 +0100)] 
man: drop outdated info about polkit in pid1

Fixes #22648.

2 years agodevnode-acl: use _cleanup_ to free acl_t
David Tardon [Thu, 3 Mar 2022 14:58:24 +0000 (15:58 +0100)] 
devnode-acl: use _cleanup_ to free acl_t