1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-31 16:21:26 +03:00
Commit Graph

49443 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
450918d111 coredump: add typedef for struct 2021-02-16 14:27:59 +01:00
Zbigniew Jędrzejewski-Szmek
a779cf30d2 basic/capability-util: add missing initialization
There was no error, because the pointer is unconditionally set below.
2021-02-16 14:27:59 +01:00
Zbigniew Jędrzejewski-Szmek
6aa601c56c analyze: use typedefs for structs and inline iterator variable decls 2021-02-16 14:27:59 +01:00
Zbigniew Jędrzejewski-Szmek
a16d732a51 fuzz-systemctl-parse-argv: avoid "leak" of bus object
Memory sanitizer would report leaked memory from --boot-load-entry=help.

Maybe we should disable all bus connections from the fuzzer? It seems not
appropriate to communicate with logind. OTOH, in a real fuzzing environment
this call should just fail, so maybe that's OK.
2021-02-16 08:57:12 +01:00
Zbigniew Jędrzejewski-Szmek
e557c82dd5
Merge pull request #18571 from bluca/portable_dbus_doc
portable: use helpers for DBUS registration and document DBUS interface
2021-02-16 08:30:27 +01:00
Zbigniew Jędrzejewski-Szmek
8f50eb04ac
Merge pull request #18481 from keszybz/rpm-restart-post-trans
Restart units after the rpm transaction
2021-02-16 08:25:49 +01:00
Lennart Poettering
71311efe23 journalctl: rotation is not a reason to warn, but certainly noteworthy
Downgrade the phrasing, since it is a bit misleading.

Fixes: #18465
2021-02-15 14:41:57 -08:00
Lennart Poettering
83ce3b1944
Merge pull request #18579 from keszybz/fix-fragment-id-crash
Fix fragment id crash
2021-02-15 23:35:25 +01:00
Lennart Poettering
0886999416
Merge pull request #18605 from poettering/suppress-repeated-stub
resolved: filter repeated stub queries
2021-02-15 23:06:37 +01:00
Luca Boccassi
23e5c8d296 portabled: add DBUS documentation 2021-02-15 21:34:00 +00:00
Luca Boccassi
598f938e3b portabled: use SD_BUS_METHOD_WITH_ARGS 2021-02-15 21:30:01 +00:00
Luca Boccassi
3b91bae3ce portabled: use service_parse_argv/bus_add_implementation
Remove some boilerplate and allow introspection
2021-02-15 21:20:14 +00:00
Lennart Poettering
5e8bc852d5 resolved: don't redundantly switch DNS servers because of transaction failures
When a transaction fails and we decide to switch DNS servers, don#t do
so unconditionally. Check if the current DNS server is still the same as
when the transaction was initiated. And if not, do not do anything.

That should reduce the number of redundant DNS server switches if many
parallel transactions fail simultaneously (which is pretty likely if
DNSSEC is on).

Fixes: #17040
2021-02-15 21:59:05 +01:00
Lennart Poettering
c78735eb79 resolved: reuse check for link-local IP address lookups
Let's reuse accept_link_local_reverse_lookups() at one more place, where
we check for the list of link local reverase address domains. Since we
don't actually accept the domains here (but rather the opposite, not
accept), let's rename the function a bit more generically with accept_ →
match_.

While we are at it invert the if branches, to make things more easily
understandable: filter out the unwatnted stuff and have the "all good"
state as main codepath.
2021-02-15 21:54:53 +01:00
Zbigniew Jędrzejewski-Szmek
bb3443d4f6
Merge pull request #18604 from poettering/resolved-minor-tweaks
two minor resolved tweaks
2021-02-15 21:18:34 +01:00
Zbigniew Jędrzejewski-Szmek
fa97d2fcf6 rpm: restart services in %posttrans
This fixes a long-standing issue in packaging scriptlets: daemon-reload
was moved to the end of the transaction, but restarting services was still
straightaway after package installation.

https://bugzilla.redhat.com/show_bug.cgi?id=1614751

Note that daemon-reload is called twice. This wouldn't be hardly noticable,
except that now a bunch of units (at least in Fedora) generate very verbose
warnings about deprecated features. So we get those warnings twice…

reload-or-restart --needing-restart is also called twice, but the second call
is usually a noop, because the first clears the flag for restarted units. The
second call is necessary for the case where we only uninstall packages, and the
%transfiletriggerpostun trigger fires, but not the %transfiletriggerin
scriptlet.

Also note that this assumes that units are marked only for restart if paths
under @systemunitdir@ or /etc/systemd/system have been touched. I would prefer
make the trigger that does 'restart --needing-restart' fire always, but it
seems rpm doesn't have such functionality. (Except as a %transfiletrigger that
would trigger on "/*" to catch all transactions, but that seems ineffiecient
and ugly.)
2021-02-15 20:49:14 +01:00
Zbigniew Jędrzejewski-Szmek
cd621954ed rpm: order sysctl/sysusers/tmpfiles execution before package scriptlets
P>1000000 is *before* "normal" scriptlets, P<1000000 is *after*. I think it
makes sense to do stuff like execution of sysctl/sysusers/tmpfiles configuration
before package scriptlets. I think that was the intent, but a single digit got
dropped ;(

Also, let's reorder the scriptlets in the file to match execution order, to
make it easier to see what is going on.

Most of those may happen in any order, but there are some exceptions:
tmpfiles should be after sysusers,
udevadm --reload should be after hwdb.
2021-02-15 20:49:14 +01:00
Zbigniew Jędrzejewski-Szmek
b492db99d6 rpm: simplify daemon-reload trigger
The trigger was initially written to use %transfiletriggerun instead
of %transfiletriggerpostun because the latter would not fire. It turned
out to a buffer overread in rpm that since has been long fixed:
https://bugzilla.redhat.com/show_bug.cgi?id=1284645
f6521c50f6
2021-02-15 20:49:14 +01:00
Zbigniew Jędrzejewski-Szmek
addf2c0ecd rpm: sync the shell version of triggers.systemd with the lua version
Note that this goes both ways: in particular the lua version had udev
scriptlets in the wrong package, fixed in
3c9433d7cf.

Add missing "|| :" so the scriptlets never fail.
2021-02-15 20:49:14 +01:00
Zbigniew Jędrzejewski-Szmek
8e5658010d rpm: pull in the alternative trigger implementation in sh
From https://src.fedoraproject.org/rpms/systemd/blob/master/f/triggers.systemd.

In 12dde791d5 scriptlets were converted to lua.
This is not only faster and cleaner, but also avoids a nasty dependency loop:
rpm implements the lua scripting internally, so we don't need a working shell
for the scriplets. This is nice and all, but unfortunately ostree wants to
capture scriptlets and execute them at a later time and does not support lua.
So in Fedora we ended up with a revert back to a shell-based implementation
[1]. At the time I hoped this would only be a temporary workaround, but three
years later I think it's fair to assume that this will not happen any time
soon. But carrying the upstream lua version and the downstream sh version is
error prone. So let's import the other version into our tree too so that they
can be kept in sync.

[1] 8e6b39457b
2021-02-15 20:49:14 +01:00
Zbigniew Jędrzejewski-Szmek
2a9b4bbe3e Move rpm stuff into a separate src/rpm/ directory
It is only of interest to rpm-based distros, we can move it out of src/core/
which is pretty busy.
2021-02-15 20:49:14 +01:00
Zbigniew Jędrzejewski-Szmek
c9615f7352 systemctl: add "reload-or-restart --marked"
This is almost equivalent to 'busctl call-method org.freedesktop.systemd1
/org/freedesktop/systemd1 org.freedesktop.systemd1.Manager EnqueueMarkedJobs',
but waits for the jobs to finish.
2021-02-15 20:49:14 +01:00
Zbigniew Jędrzejewski-Szmek
deaf4b863b systemctl: reduce scope of iterator variables 2021-02-15 20:49:14 +01:00
Zbigniew Jędrzejewski-Szmek
cb31470f40 core: wrap long lines 2021-02-15 20:49:14 +01:00
Zbigniew Jędrzejewski-Szmek
70666e28a1 core: add EnqueueMarkedJobs method to reload/restart marked units
We support two return types for methods that start jobs. EnqueueJob support the
full-monty mode with affected jobs. I didn't do this here, since it seems
unlikely to be used. In the common case there'd be a huge list of jobs and
affected jobs. EnqueueMarkedJobs() just returns a list of jobs that we can wait
upon.

The name of the method is generic in case we decide to add something other than
just reload/restart later on.

When errors occur, resource errors are treated as fatal, but for other error
types we queue up other jobs, and only return an error at the end. The
assumption is that the caller will ignore the result error anyway, so it's
better to try to reload/restart as much as possible.
2021-02-15 20:49:14 +01:00
Zbigniew Jędrzejewski-Szmek
0dd3c0907f core: allow Markers to be set using set-property 2021-02-15 20:49:14 +01:00
Zbigniew Jędrzejewski-Szmek
95d1e21e90 core/dbus-unit: reduce scope of iterator variables 2021-02-15 20:49:14 +01:00
Zbigniew Jędrzejewski-Szmek
ff68472a20 core: add Unit.Markers property
The property is never set by systemd, only reset after a stop or restart or
reload. It may externally be set to mark the unit for a later restart/reload.

I wasn't sure whether to configure the property only for the types where this
makes sense (Service, Swap, etc). But Restart() method is defined on the unit,
and also having this always under the same property name is more convenient.
2021-02-15 20:49:14 +01:00
Luca Boccassi
79dbbb261d
Merge pull request #18593 from keszybz/fuzz-more-systemctl-paths
Fuzz more systemctl paths
2021-02-15 19:13:58 +00:00
Frantisek Sumsal
986eeaeb55 Revert "ci: build on Fedora ELN as well"
This reverts commit 58bc1735fe.

The ELN composes are quite unstable and take a while to refresh. Let's
drop them again and revisit this once they get more mature to reduce
the CI noise.
2021-02-15 19:02:59 +00:00
RussianNeuroMancer
5185d4ddff Fix micmute hotkey on HP EliteBook Folio G1
Desktop environments expect f20 hotkey instead of micmute
2021-02-15 18:32:04 +00:00
Lennart Poettering
bf843b0bd4 update TODO 2021-02-15 19:23:05 +01:00
Lennart Poettering
bde69bbd89 resolved: filter repeated stub queries
Let's suppress repeated stub queries coming in, to minimize resource
usage. Many DNS clients are pretty aggressive regarding repeating DNS
requests, hence let's find them and suppress the follow-ups should we
need more time to fulfill the queries.
2021-02-15 16:27:40 +01:00
Lennart Poettering
ed8a48c9b6 resolved: allow DNS_PACKET_DATA() argument to be const 2021-02-15 16:27:40 +01:00
Lennart Poettering
7130db9155 resolved: allow DNS_PACKET_DATA() argument to be const 2021-02-15 16:23:30 +01:00
Lennart Poettering
6d76b5d7f0 resolved: move mdns event sources close to the fds 2021-02-15 16:22:14 +01:00
Pierre Dubouilh
1edebb0b89 rlimit-util: log when falling back setting limit 2021-02-15 15:30:35 +01:00
Lennart Poettering
458ab40f35
Merge pull request #18580 from keszybz/signal-list
Add systemctl --signal=list
2021-02-15 14:37:03 +01:00
Luca Boccassi
7eba0c50f5 test: install binaries from local d/control file
The source package in the apt cache might be older than the
packaging from salsa.debian.org/systemd-team/systemd so it might not
list all the current binary packages.
This is currently the case for systemd-timesyncd, so TEST-30 fails.

Simply grep the control file rather than using apt-cache when iterating
over the packages contents.
2021-02-15 10:17:39 +01:00
Florian Hülsmann
92ef9e568b hwdb: add resolution for Waltop/MEDION batteryless graphics tablet (v:172f p:0505) 2021-02-15 10:16:57 +01:00
Yu Watanabe
0f1f933b6e tree-wide: fix typo 2021-02-15 10:15:04 +01:00
Zbigniew Jędrzejewski-Szmek
860f154fa3 fuzz-systemctl-parse-argv: add argv[0] values to corpus 2021-02-15 10:01:38 +01:00
Zbigniew Jędrzejewski-Szmek
d41a9e4fc1 systemctl: use argv[0] not program_invocation_short_name for arg dispatch
The immediate motivation is to allow fuzz-systemctl-parse-argv to cover also
the other code paths. p_i_s_n is not getting set (and it probably shouldn't),
so the fuzzer would only cover the paths for ./systemctl, and not ./reboot,
etc. Looking at argv[0] instead, which is passed as part of the fuzzer data,
fixes that.

But I think in general it's more correct to look at argv[0] here: after all we
have all the information available through local variables and shouldn't go out
of our way to look at a global.
2021-02-15 10:00:08 +01:00
Zbigniew Jędrzejewski-Szmek
1751efdf6f test-parse-argument: add a test for the three parse_*_argument() functions
This mostly tests the return values and that the xsprintf
buffers are big enough.
2021-02-15 08:50:45 +01:00
Zbigniew Jędrzejewski-Szmek
b1e8f46c31 Move and rename parse_json_argument() function
json.[ch] is a very generic implementation, and cmdline argument parsing
doesn't fit there.
2021-02-15 08:50:45 +01:00
Zbigniew Jędrzejewski-Szmek
614b022c76 Move and rename parse_path_argument() function
This fits better in shared/, and the new parse-argument.c file is a good home
for it.
2021-02-15 08:50:45 +01:00
Zbigniew Jędrzejewski-Szmek
923e2122d0 basic/signal-util: drop unneeded extra byte from buffer
DECIMAL_STR_MAX() already returns +1 for NULL, so no need to do it
a second time.
2021-02-15 08:50:45 +01:00
Zbigniew Jędrzejewski-Szmek
97ab9dfc0d systemctl,loginctl,machinectl: add --signal=list
This lists numerical signal values:
$ systemctl --signal list
SIGNAL NAME
1      SIGHUP
2      SIGINT
3      SIGQUIT
...
62     SIGRTMIN+28
63     SIGRTMIN+29
64     SIGRTMIN+30

This is useful when trying to kill e.g. systemd with a specific signal number
using kill. kill doesn't accept our fancy signal names like RTMIN+4, so one
would have to calculate that value somehow. Doing
  systemctl --signal list | grep -F RTMIN+4
is a nice way of doing that.
2021-02-15 08:50:40 +01:00
Evgeny Vereshchagin
c39e36203f ci: switch back to meson-0.56.2
It seems there is another meson (0.57.0) regression preventing clang from
building systemd with --optimization=3 -Db_lto=true

By analogy with https://github.com/google/oss-fuzz/pull/5199 let's just switch
to 0.56.2 for the time being
2021-02-15 15:38:27 +09:00
Yu Watanabe
f24cbe56d7
Merge pull request #18588 from poettering/refuse-loops
resolved: try hard to never enter packet loops between resolved's stub and resolved's client
2021-02-15 11:10:32 +09:00