Commit Graph

23495 Commits

Author SHA1 Message Date
Lennart Poettering fd8bdbc79b sysctl: use STATIC_DESTRUCTOR_REGISTER() to free arg_prefixes 2018-11-20 16:48:21 +01:00
Lennart Poettering 07a91a45c7 sysctl: use _cleanup_ in one more occasion 2018-11-20 16:48:21 +01:00
Lennart Poettering 8eb42d9050 sysctl: port to use DEFINE_MAIN_FUNCTION() 2018-11-20 16:48:20 +01:00
Zbigniew Jędrzejewski-Szmek 6bc7a6ac2c inhibit: fix return value in error path 2018-11-20 16:48:20 +01:00
Lennart Poettering bd0ce2447d tmpfiles: also order glob child/parent relationships
This is necessary so that "r" can be nested and are always executed in
the same order.

Fixes: #10191
2018-11-20 16:36:29 +01:00
Lennart Poettering 09f467ac24 tmpfiles: fix typo 2018-11-20 16:32:19 +01:00
Lennart Poettering 44ac4f8854 tmpfiles: label phases explicitly 2018-11-20 16:15:09 +01:00
Lennart Poettering 48d9690430 tmpfiles: behind → below in log msgs
As suggested here:

https://github.com/systemd/systemd/pull/10538#pullrequestreview-176710207
2018-11-20 15:56:55 +01:00
Zbigniew Jędrzejewski-Szmek 7fa0269bca
Merge pull request #10850 from poettering/log-setup
reduce some logging boilerplate
2018-11-20 13:36:45 +01:00
Zbigniew Jędrzejewski-Szmek ad0cdb6b67 veritysetup-generator: treat '-' and '_' as equivalent 2018-11-20 13:19:08 +01:00
Zbigniew Jędrzejewski-Szmek 606b0b64a7
Merge pull request #10538 from poettering/tmpfiles-reorder
tmpfiles: remove children before their parents plus other fixlets
2018-11-20 13:00:28 +01:00
Lennart Poettering e27686053c
Merge pull request #10831 from keszybz/less-libbasic
Move various files that don't need to be in basic/ to shared/
2018-11-20 12:44:30 +01:00
Lennart Poettering 6bf3c61c57 log: introduce new helper call log_setup_service()
Let's reduce the common boilerplate and have a single setup function
used by all service code to setup logging.
2018-11-20 11:18:22 +01:00
Lennart Poettering afe44c8ffd generators: introduce a common implementation for the log setup boilerplate 2018-11-20 10:57:50 +01:00
Zbigniew Jędrzejewski-Szmek a03d43593c journal: fix sort order of header includes 2018-11-20 07:27:37 +01:00
Zbigniew Jędrzejewski-Szmek 4de8d971f0 meson: drop libblkid from libbasic
This doesn't seem to change anything, because libmount links to libblkid anyway.
But we don't need to include this dep directly in libbasic.
2018-11-20 07:27:37 +01:00
Zbigniew Jędrzejewski-Szmek d284b82b3e Move various files that don't need to be in basic/ to shared/
This doesn't have much effect on the final build, because we link libbasic.a
into libsystemd-shared.so, so in the end, all the object built from basic/
end up in libsystemd-shared. And when the static library is linked into binaries,
any objects that are included in it but are not used are trimmed. Hence, the
size of output artifacts doesn't change:

$ du -sb /var/tmp/inst*
54181861	/var/tmp/inst1    (old)
54207441	/var/tmp/inst1s   (old split-usr)
54182477	/var/tmp/inst2    (new)
54208041	/var/tmp/inst2s   (new split-usr)

(The negligible change in size is because libsystemd-shared.so is bigger
by a few hundred bytes. I guess it's because symbols are named differently
or something like that.)

The effect is on the build process, in particular partial builds. This change
effectively moves the requirements on some build steps toward the leaves of the
dependency tree. Two effects:
- when building items that do not depend on libsystemd-shared, we
  build less stuff for libbasic.a (which wouldn't be used anyway,
  so it's a net win).
- when building items that do depend on libshared, we reduce libbasic.a as a
  synchronization point, possibly allowing better parallelism.

Method:
1. copy list of .h files from src/basic/meson.build to /tmp/basic
2. $ for i in $(grep '.h$' /tmp/basic); do echo $i; git --no-pager grep "include \"$i\"" src/basic/ 'src/lib*' 'src/nss-*' 'src/journal/sd-journal.c' |grep -v "${i%.h}.c";echo ;done | less
2018-11-20 07:27:37 +01:00
Yu Watanabe f921b457a7 libudev: coding style fixes 2018-11-20 14:38:35 +09:00
Yu Watanabe 5ea78a39e5 libudev-list: move libudev-list related definitions to libudev-list-internal.h
This also rename libudev-private.h to libudev-util.h, and cleanups
several unnecessary headers from udev.h and libudev-util.h
2018-11-20 14:38:35 +09:00
Yu Watanabe 170e4380b6 libudev: drop prototypes for nonexistent functions 2018-11-20 14:38:35 +09:00
Yu Watanabe c84954e8ed libudev-monitor: drop unused private functions 2018-11-20 14:38:35 +09:00
Yu Watanabe 53369277ec libudev-device: drop unused private functions 2018-11-20 14:38:35 +09:00
Yu Watanabe 02edd80d87 udev: move definition of READ_END and WRITE_END from libudev-private.h to udev.h 2018-11-20 14:38:35 +09:00
Yu Watanabe 278939be7a
Merge pull request #10847 from evverx/journald-stream-fuzzer
tests: add a fuzzer for journald streams
2018-11-20 13:37:27 +09:00
Yu Watanabe f23ff5ba51
Merge pull request #10835 from poettering/transient-env-fix
fix flushing out of transient env vars from PID1's Manager object
2018-11-20 12:53:51 +09:00
Lennart Poettering cc7a0bfa15 bootspec: introduce SYSTEMD_ESP_PATH for overriding where to look for the ESP (#10834) 2018-11-20 12:37:01 +09:00
David Leeds 53640e6fb9 process-util: check for correct kill return value (#10841)
Code was not doing a wait() after kill() due to checking for a return value > 0, and was leaving zombie processes. This affected things like  sd-bus unixexec connections.
2018-11-20 12:35:36 +09:00
Lennart Poettering 012c2f761b tree-wide: use __ prefixed gcc attributes (#10843)
As suggest here:

https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax

    "You may optionally specify attribute names with ‘__’ preceding and
    following the name. This allows you to use them in header files without
    being concerned about a possible macro of the same name. For example,
    you may use the attribute name __noreturn__ instead of noreturn. "
2018-11-20 12:34:08 +09:00
Yu Watanabe 52048013b7
Merge pull request #10845 from poettering/static-destruct
RFC: introduce automatic destructors for static variables
2018-11-20 12:31:52 +09:00
Lennart Poettering bd7989a3d9 tests: always use the right vtable wrapper calls
Prompted by https://github.com/systemd/systemd/pull/10836#discussion_r234598868
2018-11-20 05:34:29 +03:00
Evgeny Vereshchagin 9541f5ff5c tests: add a fuzzer for journald streams 2018-11-20 03:03:32 +01:00
Lennart Poettering 1acacd737b test-execute: fix killing of unit processes
Let's use the correct wrapper for calling unit vtable functions. Let's
make sure we always use the right wrappers, and never bypass them
needlessly.

Moreover use SIGKILL rather than "9" as signal name. Let's not be
needlessly cryptic.

Follow-up for: f7f8e8cbb9
2018-11-19 21:53:23 +01:00
Lennart Poettering a64841779a meson: order source files alphabetically 2018-11-19 21:50:54 +01:00
Lennart Poettering 4197fde5c7 debug-generator: port over to using static destructors 2018-11-19 21:14:34 +01:00
Lennart Poettering f60947d970 debug-generator: port over to DEFINE_MAIN_FUNCTION() 2018-11-19 21:14:34 +01:00
Lennart Poettering 8a4fdaf292 main-func: automatically call static destructors from main-func.h macros 2018-11-19 21:14:34 +01:00
Lennart Poettering 67e16c31e9 util: add set of macros for declaring _cleanup_-style destructors for static variables 2018-11-19 21:14:34 +01:00
Lennart Poettering 5e332028f2 util-lib: move main() definition macros to its own header file
This way, we can extend the macro a bit with stuff pulled in from other
headers without this affecting everything which pulls in macro.h, which
is one of our most basic headers.

This is just refactoring, no change in behaviour, in prepartion for
later changes.
2018-11-19 21:14:34 +01:00
Lennart Poettering 2a44bf5099
Merge pull request #10811 from keszybz/define-main-through-macro
Define main through macro
2018-11-19 15:28:17 +01:00
Lennart Poettering 2675747f3c pam_systemd: suppress LOG_DEBUG log messages if debugging is off
In the PAM module we need to suppress LOG_DEBUG messages manually, if
debug logging is not on, as PAM won't do this for us. We did this
correctly for most log messages already, but two were missing. Let's fix
those too.

Fixes: #10822
2018-11-19 14:03:34 +01:00
Lennart Poettering 79a224c460 main: when reloading PID 1 let's reset the default environment
Otherwise we keep collecting stuff from env generators, and we really
shouldn't.

This was working properly on reexec but not on reload, as for reexec we
would always start fresh, but for reload would reuse the Manager object
and hence its default environment set.

Fixes: #10671
2018-11-19 13:01:19 +01:00
Lennart Poettering 2fbbbf9a5f manager: log on two OOM occasions 2018-11-19 12:22:56 +01:00
Lennart Poettering e16f425654
Merge pull request #10698 from yuwata/udevd-replace-udev-device
udevd: replace udev_device by sd_device
2018-11-19 11:28:45 +01:00
Lennart Poettering b08020893a
Merge pull request #10809 from keszybz/unit-log-result
Add helper function for logging unit results
2018-11-19 11:07:07 +01:00
Lennart Poettering 431957c959
Merge pull request #10814 from poettering/logind-suspend-fallback
if we need to hibernate/suspend-then-hibernate/hybrid-sleep due to keypress/lid switch but can't, fallback to regular suspend
2018-11-19 11:05:48 +01:00
Lennart Poettering a44088f10f
Merge pull request #10825 from keszybz/advertize-followup
udev link advertizing followup
2018-11-19 11:05:18 +01:00
Lennart Poettering 2b38a8ea80
Merge pull request #10507 from cdown/cpu_acct
cgroup v2: Don't require CPU controller for CPU accounting in 4.15+
2018-11-19 10:57:48 +01:00
Evgeny Vereshchagin f7f8e8cbb9 test: kill all processes launched by test-execute before exiting
As was shown in https://github.com/systemd/systemd/issues/10696#issuecomment-439613204,
currently `meson` waits for 1080 seconds (which is three times the global timeout) for the
test to fail completely even though it takes just two minutes for it to really fail. This
happens because the test itself leaves the services it has launched behind, which, in turn, makes
meson think that the test is still in progress. KILL_ALL with SIGKILL should make the issue
go away.
2018-11-19 09:24:22 +01:00
Zbigniew Jędrzejewski-Szmek 64d9f7568b basic/missing: drop _ETHTOOL_LINK_MODE_MAX
It was only used in one place, where we don't actually need it, and
it is too easy to forget to update it when adding new items to the table.
Let's just drop it.
2018-11-18 16:14:21 +01:00
Zbigniew Jędrzejewski-Szmek 5dd101186b udev: use an "inline" array instead of allocating for advertise mode
The code is a bit shorter and we don't allocate the uint32_t[127] array.
2018-11-18 16:14:19 +01:00
Zbigniew Jędrzejewski-Szmek 7f6bfc561f basic/util: import memeqzero from casync 2018-11-18 16:12:53 +01:00
Chris Down a88c5b8ac4 cgroup v2: DefaultCPUAccounting=yes if CPU controller isn't required
We now don't enable the CPU controller just for CPU accounting if we are
on 4.15+ and using pure unified hierarchy, as this is provided
externally to the CPU controller. This makes CPUAccounting=yes
essentially free, so enabling it by default when it's cheap seems like a
good idea.
2018-11-18 12:21:41 +00:00
Chris Down 94ddb08d74 cgtop: Still try to get CPU statistics if controller-free
If CPU accounting is cheap, no controller necessarily needs to be
enabled here for us to be able to read statistics.
2018-11-18 12:21:41 +00:00
Chris Down f98c25850f cgroup v2: Don't require CPU controller for CPU accounting in 4.15+
systemd only uses functions that are as of Linux 4.15+ provided
externally to the CPU controller (currently usage_usec), so if we have a
new enough kernel, we don't need to set CGROUP_MASK_CPU for
CPUAccounting=true as the CPU controller does not need to necessarily be
enabled in this case.

Part of this patch is modelled on an earlier patch by Ryutaroh Matsumoto
(see PR #9665).
2018-11-18 12:21:41 +00:00
Zbigniew Jędrzejewski-Szmek 09c984c6f7 test-util: modernize 2018-11-18 10:47:16 +01:00
Yu Watanabe 2d18ac4491 ethtool: drop NetDevAdvertise
Fixes #10807.
2018-11-18 14:33:50 +09:00
Yu Watanabe 8a716f26ef missing: add ETHTOOL_LINK_MODE_* and struct ethtool_link_settings 2018-11-18 14:33:50 +09:00
Zbigniew Jędrzejewski-Szmek f921797d61
Merge pull request #10817 from evverx/audit-fuzzer
Add a fuzzer for process_audit_string
2018-11-17 18:26:54 +01:00
Yu Watanabe af18705f8e test: also tests enumerating subsystems 2018-11-17 18:18:22 +01:00
Yu Watanabe eb546b3532 udevd: replace udev_device in struct event by sd_device 2018-11-17 21:45:03 +09:00
Yu Watanabe 044497e2a3 udevd: update several log messages 2018-11-17 21:45:03 +09:00
Yu Watanabe ba47b71c2d udevd: decrease indentation 2018-11-17 21:45:03 +09:00
Yu Watanabe d8f462b435 udevd: rename event sources in struct event 2018-11-17 21:45:03 +09:00
Yu Watanabe dc7faf2a6f udevd: capitalize log messages in on_sigchld() 2018-11-17 21:45:03 +09:00
Yu Watanabe e2130348ef udevd: also use sd_device_monitor_start() in worker_main() 2018-11-17 21:45:03 +09:00
Yu Watanabe f00d2b6dd2 udevd: use sd_device_monitor_start() in manager_new() 2018-11-17 21:45:03 +09:00
Yu Watanabe 7f2e3a1409 udevd: replace udev_monitor by sd_device_monitor 2018-11-17 21:45:03 +09:00
Yu Watanabe 7443654e5f udevd: use safe_fork() to spawn worker process 2018-11-17 21:45:03 +09:00
Yu Watanabe abde5ea854 udevd: make worker_process_device() take sd_device instead of udev_device 2018-11-17 21:45:03 +09:00
Yu Watanabe b97897e3e8 udevd: make worker_lock_block_device() take sd_device instead of udev_device
Also adds many debug logs.
2018-11-17 21:45:02 +09:00
Yu Watanabe 0bed242cbe udevd: split worker_spawn() and manager_free() in small pieces 2018-11-17 21:45:02 +09:00
Evgeny Vereshchagin ed62712dc6 tests: introduce dummy_server_init and use it in all journald fuzzers 2018-11-17 13:02:26 +01:00
Evgeny Vereshchagin 1dab14aba7 journald: check whether sscanf has changed the value corresponding to %n
It's possible for sscanf to receive strings containing all three fields
and not matching the template at the same time. When this happens the
value of k doesn't change, which basically means that process_audit_string
tries to access memory randomly. Sometimes it works and sometimes it doesn't :-)

See also https://bugzilla.redhat.com/show_bug.cgi?id=1059314.
2018-11-17 11:25:19 +01:00
Zbigniew Jędrzejewski-Szmek 51e2378642 volatile-root: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 0420d20dd2 tty-ask-password-agent: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 47031c9276 sysv-generator: configure logging before use and define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 1b425cb28f stdio-bridge: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 7caefb8140 sleep: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 6e61c701f2 remount-fs: configure logging before use and define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 72d0d7a628 random-seed: configure logging before use and define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 2ab2a55bd6 quotacheck: configure logging before use and define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 44c5d0442e portabled: add missing STOPPING=1 notification 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 166a9dc66f portabled: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 24d5223fc9 path: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek fb1fa5a882 makefs: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek aac0b2e8f3 notify: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 9b58b5ad34 machined: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek cc639ee79d user-runtime-dir: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek c11cfa2865 logind: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek b453c447e0 inhibit: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 634a0ad3e5 cat: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 5272ae42ce import: define mains through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 3c79f0b3ce id128: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 06213aae94 hwdb: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 43ead4114b hostnamectl: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 9013653e3c fsck: configure logging before use and define main through macro
There's a slight change in logic: before, when rebooting the machine, we could
also request quotacheck (by touching /run/systemd/quotacheck) if the fsck
helper set FSCK_ERROR_CORRECTED.  This is just a race, and doesn't matter much
in practice.
2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek c88f45e744 escape: use free_and_replace 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 5f200747f6 escape: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek bdab09849e detect-virt: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 4515a95ee0 coredump: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 02434ea263 boot-check-no-failures: define main through macro 2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek 9a5cedc319 ac-power: define main through macro
I decided to use a separate definition for this because it's too easy to return
positive from functions which don't need this distinction and only return
negative on error and success otherwise.
2018-11-17 09:13:35 +01:00
Zbigniew Jędrzejewski-Szmek a974a6569e Introduce main definer and use it in cgtop
This actually fixes one bogus return code in error path.
2018-11-17 09:03:54 +01:00
Lennart Poettering 4472fa6d2c conf-parse: use strjoina() where appropriate 2018-11-17 08:47:27 +01:00
Lennart Poettering 46f2d09f31 conf-parse: drop unused prototype 2018-11-17 08:47:27 +01:00
Lennart Poettering 222c8d4e22 macro: remove double evaluation in FLAGS_SET() 2018-11-17 08:45:24 +01:00
Lennart Poettering bca89fe84d rc-local-generator: add comment explaining the background of the generator
This is not obvious, hence it deserves some form of documentation.
However, it's also ultimately an implementation detail, hence let's not
add this to the man page, but as a code comment, that is visible right
at the top of source file.

Fixes: #10675
2018-11-17 08:43:57 +01:00
Evgeny Vereshchagin 090a20cfaf tests: add a fuzzer for process_audit_string 2018-11-16 23:14:31 +01:00
asavah 6917857ed4 fix build with -Defi=false 2018-11-16 21:51:47 +01:00
Lennart Poettering 07be866903 logind: voidify more things 2018-11-16 21:50:37 +01:00
Lennart Poettering c282daed68 logind: when we need to execute a sleep operation we don't support, fall back to suspend
If suspend-then-hibernate, hybrid-sleep or plain hibernation is
supposed to be execute due to a key press/lid switch but is not
supported, automatically fall back to plain suspend (and log about it).

Fixes: #10558
2018-11-16 21:50:24 +01:00
Zbigniew Jędrzejewski-Szmek aac99f303a core: introduce a helper function to wrap unit_log_{success,failure}
It's inline so that the compiler can easily optimize away the call to get
status string.
2018-11-16 19:47:07 +01:00
Lennart Poettering 464e48f495
Merge pull request #10751 from yuwata/sd-event-util
Reuse sd_event_source object for timer event
2018-11-16 17:54:43 +01:00
Lennart Poettering ae3cc6ec0d
Merge pull request #10770 from poettering/unit-done-log
improvements to structure log events from PID1
2018-11-16 17:54:19 +01:00
Lennart Poettering ca0e33734e
Merge pull request #10777 from poettering/seccomp-filter-others
list syscalls supported by the local kernel but not in any syscall groups explicitly in "systemd-analyze syscall-filter"
2018-11-16 17:53:50 +01:00
Lennart Poettering 6415fecd4c
Merge pull request #10785 from poettering/cgroup-join-removal
remove JoinControllers= setting
2018-11-16 17:53:26 +01:00
Lennart Poettering 3382cf28b6
Merge pull request #10802 from poettering/hide-only-on
man: let's deprecate PermissionsStartOnly=
2018-11-16 17:53:01 +01:00
Lennart Poettering 1b259a5bf3
Merge pull request #10804 from poettering/sd-boot-updates
various sd-boot/EFI fixes (split out from #10495)
2018-11-16 17:52:37 +01:00
Lennart Poettering db0ba2a4a4
Merge pull request #10806 from poettering/logind-many-fixes
various smaller fixes and improvements to logind (split out of #10495)
2018-11-16 17:52:11 +01:00
Lennart Poettering a9bfb3eff2 analyze: add some minimal ANSI highlighting of syscall-filter output 2018-11-16 16:10:57 +01:00
Lennart Poettering a05cfe230f seccomp: add some missing syscalls to filter sets 2018-11-16 16:10:57 +01:00
Lennart Poettering cdf6258c2e analyze: show list of syscalls the kernel supports but not included in any group in the output
This is quite useful for making sure our list is complete.
2018-11-16 16:10:57 +01:00
Lennart Poettering f20db19954 cocci: simplify some if checks 2018-11-16 16:05:29 +01:00
Henry Tung 0c093a62ef logind: fix determination of CanHibernate() and other calls
As suggest here:

https://github.com/systemd/systemd/issues/10250#issuecomment-426788301

Fixes: #10250

(This suggested patch has been converted into a proper commit by me,
Lennart, with attribution to the original author, @henryptung)
2018-11-16 15:52:22 +01:00
Lennart Poettering c78e6f9e7b logind: imply right to reboot when user has right to set reboot-to-firmware flag
Let's reduce the number of actions the user has to acquire.
2018-11-16 15:52:22 +01:00
Lennart Poettering 68d7c268f8 efivars: let's add some validation of boot menu entry name syntax 2018-11-16 15:52:22 +01:00
Lennart Poettering cea72d53f8 efivars: add new helper efi_set_variable_string()
Let's make it easier to parse an UTF-16 string properly.
2018-11-16 15:52:22 +01:00
Lennart Poettering c57ed5735f logind: log correct error msg 2018-11-16 15:52:22 +01:00
Lennart Poettering 75100aeb9f logind: sort includes 2018-11-16 15:52:22 +01:00
Lennart Poettering 80641a81b6 bootctl: display loader features in a pretty way. 2018-11-16 15:52:22 +01:00
Lennart Poettering c027b67f53 util: force time multiplications to happen in longs 2018-11-16 15:52:22 +01:00
Lennart Poettering 52ecf1958d locale-util: add special glyph support for check marks/cross marks 2018-11-16 15:52:22 +01:00
Lennart Poettering 3b42f34910 efi: NUL terminate strings read with efivar_get()
let's be more careful and NUL terminate everything we read from EFI
variables, in case it isn't already.
2018-11-16 15:47:18 +01:00
Lennart Poettering 996daf2fa9 sd-boot: make sure special menu items also work if menu is skipped
While it doesn't really make much sense to set "auto-reboot-to-firmware"
as oneshot boot item, let's still support it properly, by also
dispatching such a menu item if selected.
2018-11-16 15:47:18 +01:00
Lennart Poettering aec1443aec sd-boot: use structured initialization 2018-11-16 15:47:18 +01:00
Lennart Poettering b58c7351c0 sd-boot: change name of automatic entry for rebooting into firmware
Let's stick to one nomenclature. In userspace we usually call this
"reboot to firmware setup", hence use the same name in sd-boot too.

This name was previously only relevant internally, but since the
addition of the LoaderEntries EFI var is exposed to userspace, hence
let's get this right with the first release adding this.
2018-11-16 15:47:18 +01:00
Lennart Poettering 5dd5f7cfa8 sd-boot: add new EFI variable exposing feature set of boot loader
We keep adding new features, let's advertise to the host OS what these
are in a new variable LoaderFeatures.

It works a bit like OsIndicationsSupported, but is about Loader
features.
2018-11-16 15:47:18 +01:00
Lennart Poettering 95a18e91db efi: make sure parse_boolean() does something useful on a NULL parameter 2018-11-16 15:47:18 +01:00
Lennart Poettering 427ee7ec82 efi: add 'const' to various util.h API parameters 2018-11-16 15:47:18 +01:00
Lennart Poettering fe2579dd9c sd-boot: introduce a one-time override for the boot menu timeout
This is useful to allow userspace to request a "boot into boot menu"
feature.
2018-11-16 15:47:18 +01:00
Lennart Poettering 2366d92345 sd-boot: when converting menu timeout for UINTN to INTN saturate
Let's be a bit more careful and handle overly long timeouts in a
slightly more sensible way.
2018-11-16 15:47:18 +01:00
Lennart Poettering b49dd00f8c efi: add simple macros for MAX values of EFI's UINTN/INTN types 2018-11-16 15:47:18 +01:00
Lennart Poettering 8ac694710f sd-boot: timeout_sec is unsigned hence show it with %u 2018-11-16 15:47:18 +01:00
Lennart Poettering 4e96eb682c logind: also expose bool prop on bus that declares whether we are on external power
The three core variables that affect idleness handling are whether we
are docked, whether we are on AC power and whether the lid is closed,
hence let's also expose the third variable on the bus, to make things
nicely debuggable.
2018-11-16 15:39:31 +01:00
Lennart Poettering e455380b18 logind: make sure that if we can't figure out whether we are on AC we presume we are
It's safer to assume that we are on AC than to assume we are on battery,
if we can't figure it out.
2018-11-16 15:39:31 +01:00
Lennart Poettering c30e0d7b6a logind: don't claim that RebootToFirmwareSetup was constant
It's not, after all, that's what SetRebootToFirmware() is about.

(I was wondering for a moment whether to make this EMITS_CHANGES, but
decided against it, given that the flag actually can be changed
externally to logind too, and we couldn't send out notifications for
that.)
2018-11-16 15:39:31 +01:00
Lennart Poettering 9b9c23daf4 logind: expose a boolean on the bus explaining whether logind thinks the lid is closed
This copies how we already expose a "Docked" boolean the reflects
whether we are in a docking station or not.
2018-11-16 15:39:31 +01:00
Lennart Poettering ff30a86bd4 job: simplify status message extraction
As @keszybz points out these fields are always here, there's no point in
checking if they are NULL or not.
2018-11-16 15:30:36 +01:00
Lennart Poettering 9a80f2f453 job: when a job was skipped due to a failed condition, log about it
Previously we'd neither show console status output nor log output. Let's
fix that, and still log something.
2018-11-16 15:30:36 +01:00
Lennart Poettering 6e64994d69 core: make unit_start() return a distinguishable error code in case conditions didn't hold
Ideally we'd even propagate this all the way to the client, by having a
separate JobType enum value for this. But it's hard to add this without
breaking compat, hence for now let's at least internally propagate this
case differently from the case "already on it".

This is then used to call job_finish_and_invalidate() slightly
differently, with the already= parameter false, as in the failed
condition case no message was likely produced so far.
2018-11-16 15:22:48 +01:00
Lennart Poettering 0e2b4a822e job: add two explanatory comments 2018-11-16 15:22:48 +01:00
Lennart Poettering a69b3872ac job: let's remove one comparison and reduce indentation level by one 2018-11-16 15:22:48 +01:00
Lennart Poettering 523ee2d414 core: log a recognizable message when a unit succeeds, too
We already are doing it on failure, let's do it on success, too.

Fixes: #10265
2018-11-16 15:22:48 +01:00
Lennart Poettering 91bbd9b796 core: make log messages about unit processes exiting recognizable 2018-11-16 15:22:48 +01:00
Lennart Poettering 7c047d7443 core: make log messages about units entering a 'failed' state recognizable
Let's make this recognizable, and carry result information in a
structure fashion.
2018-11-16 15:22:48 +01:00
Lennart Poettering 295f31b0b7 sd-messages: add comment and reorder a bit
The message SD_MESSAGE_UNIT_FAILED is closely related to
SD_MESSAGE_UNIT_STARTED as it is generated when a start job failed
instead of completed successfully, Hence they should be placed together.

Otherwise one might get the impression that the message was about
failing units, which it really is not.
2018-11-16 15:22:48 +01:00
Lennart Poettering b344b363ce job: also include job ID in log messages when we begin with a job 2018-11-16 15:22:48 +01:00
Lennart Poettering 33a3fdd978 core: move unit_status_emit_starting_stopping_reloading() and related calls to job.c
This call is only used by job.c and very specific to job handling.
Moreover the very similar logic of job_emit_status_message() is already
in job.c.

Hence, let's clean this up, and move both sets of functions to job.c,
and rename them a bit so that they express precisely what they do:

1. unit_status_emit_starting_stopping_reloading() →
   job_emit_begin_status_message()
2. job_emit_status_message() → job_emit_done_status_message()

The first call is after all what we call when we begin with the
execution of a job, and the second call what we call when we are done
wiht it.

Just some moving and renaming, not other changes, and hence no change in
behaviour.
2018-11-16 15:22:48 +01:00
Lennart Poettering f8c34706f5 job: add log message when we can't enable the job run event source 2018-11-16 15:22:48 +01:00
Lennart Poettering 8ebd9175db job: add comment for EAGAIN job run case 2018-11-16 15:22:48 +01:00
Lennart Poettering ea2c0e4526 job: minor coding style tweaks 2018-11-16 15:22:48 +01:00
Lennart Poettering 1cd81629e1 job: include JOB_ID field in log message about jobs 2018-11-16 15:22:48 +01:00
Evgeny Vereshchagin a7891d203c tests: run fuzzers four times in a row (#10794)
This should help to catch issues that are easily detectable by
bad_build_check like the one being fixed in https://github.com/systemd/systemd/pull/10793,
which would totally break the build tomorrow if I hadn't run
`helper.py check_build` manually.
2018-11-16 23:09:24 +09:00
Yu Watanabe ff4b032106 sd-ndisc: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe 144faa8ea5 sd-ndisc: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Yu Watanabe 807a8edeb1 sd-radv: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe 78f9d24f7b sd-radv: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Yu Watanabe 6ec11d46dc lldp: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe 8158b90d59 lldp: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Yu Watanabe 32ab66c5ee ipv4acd: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe 4ca5acb35f ipv4acd: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Yu Watanabe c9393e8c41 dhcp6-client: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe 8b8ecac85b dhcp6-client: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Benjamin Berg a5f07d2a16 sd-dhcp6: fix crash by unrefing event sources before re-adding them
In certain cases the timeouts may not have been unref'ed before they
need to be re-added. Add the appropriate unref calls to ensure we don't
register the timeout multiple times.

This fixes possible cases where timeouts are triggered multiple times
and even on destroyed DHCPv6 clients.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/73

Fixes #10749.
2018-11-16 22:57:42 +09:00
Yu Watanabe a3fa4287f5 dhcp-client: do not unref() event sources when update or disable them 2018-11-16 22:57:42 +09:00
Yu Watanabe be6bf4a786 dhcp-client: use structured initializer at one more place 2018-11-16 22:57:42 +09:00
Yu Watanabe 0725c4b9d1 udevd: use event_source_disable() 2018-11-16 22:57:42 +09:00
Yu Watanabe 6d63048a77 udevd: use event_reset_time() to update kill_workers_event 2018-11-16 22:57:42 +09:00
Yu Watanabe d44325cb96 sd-event: also introduce event_source_is_enabled() 2018-11-16 22:57:42 +09:00
Yu Watanabe 2701983ce8 sd-event: introduce event_source_disable() 2018-11-16 22:57:42 +09:00
Yu Watanabe 764c08e6b7 sd-event: introduce event_reset_time() 2018-11-16 22:57:42 +09:00
Yu Watanabe a137a1c3ff sd-event: split definition of event_source to event-source.h 2018-11-16 22:57:37 +09:00
Lennart Poettering e353faa0d6 cgroup-util: when attaching/creating cgroups in multiple hierarchies, take jointly mounted controlelrs into account
If we create a cgroup in one controller it might already have been
created in another too, if we have jointly mounted controllers. Take
that into consideration.
2018-11-16 14:54:13 +01:00
Lennart Poettering fae9bc298a cgroup: when determining which controllers we need, always extend the mask according to cpu/cpuacct joint mounting
Note that for cgroup_context_get_mask() this doesn't actually change
much, but it does prepare the ground for #10507 later on.
2018-11-16 14:54:13 +01:00
Lennart Poettering c01ef321af cgroup: add new helper that knows which controllers are mounted together 2018-11-16 14:54:13 +01:00
Lennart Poettering 143fadf369 core: remove JoinControllers= configuration setting
This removes the ability to configure which cgroup controllers to mount
together. Instead, we'll now hardcode that "cpu" and "cpuacct" are
mounted together as well as "net_cls" and "net_prio".

The concept of mounting controllers together has no future as it does
not exist to cgroupsv2. Moreover, the current logic is systematically
broken, as revealed by the discussions in #10507. Also, we surveyed Red
Hat customers and couldn't find a single user of the concept (which
isn't particularly surprising, as it is broken...)

This reduced the (already way too complex) cgroup handling for us, since
we now know whenever we make a change to a cgroup for one controller to
which other controllers it applies.
2018-11-16 14:54:13 +01:00
Lennart Poettering 8d33dca2ff core: fix capitalization of CPUShares= settings 2018-11-16 14:46:49 +01:00
Lennart Poettering 63a0cbbac3 cgtop: use FOREACH_STRING() for fun and profit 2018-11-16 14:46:49 +01:00
Lennart Poettering fdaa23af94 cgtop: use automatic clean-up 2018-11-16 14:46:49 +01:00
Lennart Poettering ac0a94f743 sd-bus: make strict asan shut up
asan doesn't like it if we use strndup() (i.e. a string function) on a
non-NULL terminated buffer (i.e. something that isn't really a string).

Let's hence use memdup_suffix0() instead of strndup(), which is more
appropriate for binary data that is to become a string.

Fixes: #10385
2018-11-16 14:32:41 +01:00
Lennart Poettering 899feb7225 man: let's deprecate PermissionsStartOnly=
The concept is redundant and predates the special chars that do the same
in ExecStar=. Let's settle on advertising just the latter, and hide
PermissionsStartOnly= from the docs (even if we continue supporting it).
2018-11-16 14:31:37 +01:00
Zbigniew Jędrzejewski-Szmek 62adb5d085
Merge pull request #10795 from poettering/generator-fixes
trivial fixes to some generators
2018-11-16 14:30:53 +01:00
Lennart Poettering 567e5d5549
Merge pull request #10791 from keszybz/sd-event-get-enabled
Some minor tweaks for sd_event_source_get_enabled
2018-11-16 12:46:30 +01:00
Evgeny Vereshchagin cc55ac0171 test: initialize syslog_fd in fuzz-journald-kmsg too
This is a follow-up to 8857fb9beb that prevents the fuzzer from crashing with
```
==220==ERROR: AddressSanitizer: ABRT on unknown address 0x0000000000dc (pc 0x7ff4953c8428 bp 0x7ffcf66ec290 sp 0x7ffcf66ec128 T0)
SCARINESS: 10 (signal)
    #0 0x7ff4953c8427 in gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35427)
    #1 0x7ff4953ca029 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x37029)
    #2 0x7ff49666503a in log_assert_failed_realm /work/build/../../src/systemd/src/basic/log.c:805:9
    #3 0x7ff496614ecf in safe_close /work/build/../../src/systemd/src/basic/fd-util.c:66:17
    #4 0x548806 in server_done /work/build/../../src/systemd/src/journal/journald-server.c:2064:9
    #5 0x5349fa in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/fuzz/fuzz-journald-kmsg.c:26:9
    #6 0x592755 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/libfuzzer/FuzzerLoop.cpp:571:15
    #7 0x590627 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/libfuzzer/FuzzerLoop.cpp:480:3
    #8 0x594432 in fuzzer::Fuzzer::MutateAndTestOne() /src/libfuzzer/FuzzerLoop.cpp:708:19
    #9 0x5973c6 in fuzzer::Fuzzer::Loop(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, fuzzer::fuzzer_allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&) /src/libfuzzer/FuzzerLoop.cpp:839:5
    #10 0x574541 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:764:6
    #11 0x5675fc in main /src/libfuzzer/FuzzerMain.cpp:20:10
    #12 0x7ff4953b382f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #13 0x420f58 in _start (/out/fuzz-journald-kmsg+0x420f58)
```
2018-11-16 12:44:47 +01:00
Lennart Poettering b39cfe21b4 core: show error code even when debug logging 2018-11-16 12:22:11 +01:00
Lennart Poettering 7dcb6ef06f hibernate-resume-generator: fix minor memory leak on error path 2018-11-16 12:22:11 +01:00
Lennart Poettering a0e1f0c164 debug-generator: fix minor memory leak 2018-11-16 12:22:11 +01:00
Yu Watanabe 9b2934cb81 udev-util: read resolve_names from udev.conf
Fixes CID#1396866.
2018-11-16 09:21:58 +01:00
Zbigniew Jędrzejewski-Szmek 708dab44cd
Merge pull request #10788 from evverx/fuzz-kmsg
tests: add a fuzzer for dev_kmsg_record
2018-11-16 09:08:38 +01:00
Zbigniew Jędrzejewski-Szmek b6cdfbe5c4 journal: simplify use of sd_event_source_get_enabled() 2018-11-16 09:03:41 +01:00
Zbigniew Jędrzejewski-Szmek ca5d90d4d9 journal-file: get rid of a helper variable
It doesn't really save much in code length. Having the event source named
explicitly makes it easier to understand the code at a glance.
2018-11-16 09:03:41 +01:00
Zbigniew Jędrzejewski-Szmek 08c1eb0e30 sd-event: make sd_event_source_get_enabled return more info 2018-11-16 09:03:41 +01:00
Zbigniew Jędrzejewski-Szmek 7d92a1a490 sd-event: do not use assert_return for something that is not an error
It's totally OK for description to be unset, so let's not log about this
even at debug level.
2018-11-16 09:00:33 +01:00
Evgeny Vereshchagin 080d112caa journal: fix an off-by-one error in dev_kmsg_record 2018-11-16 08:45:16 +01:00
Evgeny Vereshchagin 8dc4de966c basic: remove an assertion from cunescape_one
The function takes a pointer to a random block of memory and
the length of that block. It shouldn't crash every time it sees
a zero byte at the beginning there.

This should help the dev-kmsg fuzzer to keep going.
2018-11-16 08:45:16 +01:00
Evgeny Vereshchagin 8857fb9beb tests: add a fuzzer for dev_kmsg_record 2018-11-16 08:44:35 +01:00
Yu Watanabe a6da77b71b udev-rules: fix possible assertion
On 'remove' action, event->dev_db_clone is NULL. So, `IMPORT{db}` rule
on 'remove' action triggers assertion. This fixes the issue.
2018-11-15 15:50:27 +01:00
Zbigniew Jędrzejewski-Szmek df7f9e0b2c basic/json: silence gcc warning about limited range of data type
With gcc-7.1.1-3.fc26.aarch64:
../src/basic/json.c: In function ‘json_format’:
../src/basic/json.c:1409:40: warning: comparison is always true due to limited range of data type [-Wtype-limits]
                                 if (*q >= 0 && *q < ' ')
                                        ^~
../src/basic/json.c: In function ‘inc_lines_columns’:
../src/basic/json.c:1762:31: warning: comparison is always true due to limited range of data type [-Wtype-limits]
                 } else if (*s >= 0 && *s < 127) /* Process ASCII chars quickly */
                               ^~

Cast to (signed char) silences the warning, but a cast to (int) for some reason
doesn't.
2018-11-15 15:39:06 +01:00
Zbigniew Jędrzejewski-Szmek cd5a29ce98
Merge pull request #10742 from poettering/c-utf8
default to C.UTF-8 locale, and many improvements to env var file parsing/kernel cmdline parsing
2018-11-15 12:47:17 +01:00
Lennart Poettering 042cad5737
Merge pull request #10753 from keszybz/pager-no-interrupt
Add mode in journalctl where ^C is handled by the pager
2018-11-14 20:09:39 +01:00
Lennart Poettering 3dafa6bc76 core: drop dbus queue recursion check
We don't dispatch the queue recursively anymore, hence let's simplify
things a bit.

As pointed out by @fbuihuu:

https://github.com/systemd/systemd/pull/10763#discussion_r233209550
2018-11-14 20:09:11 +01:00
Lennart Poettering 483d713e0a tests: add some tests for cmdline args containing spaces 2018-11-14 17:22:18 +01:00
Lennart Poettering e6755a3350 locale-util: introduce common helper locale_variables_free() for freeing locale variable arrays 2018-11-14 17:01:55 +01:00
Lennart Poettering 13df9c398d fileio: automatically add NULL sentinel to parse_env_file()
Let's modernize things a bit.
2018-11-14 17:01:55 +01:00
Lennart Poettering 608eea8ea0 localed: be more careful with the used types 2018-11-14 17:01:55 +01:00
Lennart Poettering aa8fbc74e3 fileio: drop "newline" parameter for env file parsers
Now that we don't (mis-)use the env file parser to parse kernel command
lines there's no need anymore to override the used newline character
set. Let's hence drop the argument and just "\n\r" always. This nicely
simplifies our code.
2018-11-14 17:01:54 +01:00
Lennart Poettering 01771226c2 tree-wide: replace all remaining uses of parse_env_file() for parsing /proc/cmdline
Let's always go through the proc-cmdline.c APIs.
2018-11-14 17:01:54 +01:00
Lennart Poettering 26a9337690 localed: no need to log twice about reload requests 2018-11-14 17:01:54 +01:00
Lennart Poettering 936d113663 localed: show proper bus error if we can in log message 2018-11-14 17:01:54 +01:00
Lennart Poettering 46e8b9470a localed: don't silently eat up errors, log something 2018-11-14 17:01:54 +01:00
Lennart Poettering 0db9bd200f locale-setup: default to C.UTF-8
Most distributions already were shipping a C.UTF-8 locale and even Fedora
now supports the C.UTF-8 locale, and there's clear indication that this
is going upstream too. Hence, let's default to it now too, if nothing
else is set.

Note that this is only a fallback if noting else is set, and since
distros generally configure a default for this behaviour shouldn't
really change in installed systems.

On new systems this makes vconsole.conf redundant.
2018-11-14 17:01:54 +01:00
Lennart Poettering cd45734f87 locale-setup: rework to use new proc_cmdline_get_key_many() API
This way we use the same code to access /proc/cmdline as everywhere
else, and thus support it in containers and the SYSTEMD_PROC_CMDLINE env
var.
2018-11-14 17:01:54 +01:00
Lennart Poettering 6176be15ac locale-setup: use precise type for locale variable iterator 2018-11-14 17:01:54 +01:00
Lennart Poettering 05e062cb89 locale-setup: use _cleanup_strv_free_ 2018-11-14 17:01:54 +01:00
Lennart Poettering 78b30ee056 proc-cmdline: introduce new proc_cmdline_get_key_many() helper
This is like parse_env_file(), but from the kernel command line
2018-11-14 17:01:54 +01:00
Lennart Poettering 1e7a599671 proc-cmdline: split out rd. prefix handling in proc_cmdline_parse_given() and proc_cmdline_get_key()
This introduces a wrapper around extrac_first_word() called
proc_cmdline_extract_first(), which suppresses "rd." parameters
depending on the specified calls.

This allows us to share more code between proc_cmdline_parse_given() and
proc_cmdline_get_key(), and makes it easier to reuse this logic for
other purposes.
2018-11-14 17:01:54 +01:00
Zbigniew Jędrzejewski-Szmek 6432da6a69 basic/pager: ignore ^C when piping to less and K is not set
Normally, we want to immediately quit on ^C. But when we are running under
less, people may set SYSTEMD_LESS without K, in which case they can use ^C to
communicate with less, and e.g. start and stop following input.

Fixes #6405.
2018-11-14 16:53:50 +01:00
Zbigniew Jędrzejewski-Szmek ce02b69ea8 basic/cgroup-util: remove two unnecessary includes 2018-11-14 16:26:12 +01:00
Zbigniew Jędrzejewski-Szmek fde32028a4 Move LONG_LINE_MAX definition to fileio.h
All users of the macro (except for one, in serialize.c), use the macro in
connection with read_line(), so they must include fileio.h.  Let's not play
libc games and require multiple header file to be included for the most common
use of a function.

The removal of def.h includes is not exact. I mostly went over the commits that
switch over to use read_line() and add def.h at the same time and reverted the
addition of def.h in those files.
2018-11-14 16:25:32 +01:00
Zbigniew Jędrzejewski-Szmek 0221d68a13 basic/pager: convert the pager options to a flags argument
Pretty much everything uses just the first argument, and this doesn't make this
common pattern more complicated, but makes it simpler to pass multiple options.
2018-11-14 16:25:11 +01:00
Lennart Poettering f6dd5e7c18 proc-cmdline: turn flags parameter into a proper typedef'ed enum
Let's add some extra typesafety.
2018-11-14 16:22:28 +01:00
Lennart Poettering 8755568681
Merge pull request #10759 from keszybz/udevd-more-configuration
Udevd more configuration options
2018-11-14 16:21:14 +01:00
Zbigniew Jędrzejewski-Szmek b5be61d1ed
Merge pull request #10747 from poettering/machinectl-list-fix
properly acquire os-release file from containers
2018-11-14 12:47:56 +01:00
Zbigniew Jędrzejewski-Szmek eff162bf96
Merge pull request #10763 from poettering/pending-reload-fix
when reloading, don't throttle unit/job dbus change signal generation
2018-11-14 10:44:50 +01:00
Yu Watanabe d4a389eb5f json: decrease DEPTH_MAX to 4k
This makes DEPTH_MAX lower value, as test-json fails with stack
overflow.

Note that the test can pass with 8k, but for safety, here set to 4k.

Fixes #10738.
2018-11-14 10:44:18 +01:00
Lennart Poettering 8204470252 unit: don't claim there was no IP traffic generated by a unit when we don't know
Only if we have some IP traffic accounting at all we should claim that.
2018-11-14 09:53:50 +01:00
Lennart Poettering 6eb65e7ca4 core: split out audit message generation from unit_notify()
Just some refactoring, no change in behaviour.
2018-11-14 09:51:47 +01:00
Lennart Poettering 862d9d9503
Merge pull request #10757 from Antique/cgroupv2
Fix cgroupv2 bpf-devices issues
2018-11-13 22:03:10 +01:00
Zbigniew Jędrzejewski-Szmek 7fe0d0d5c0 udev: downgrade message when we fail to set inotify watch up
My logs are full of:

systemd-udevd[6586]: seq 13515 queued, 'add' 'block'
systemd-udevd[6586]: seq 13516 queued, 'change' 'block'
systemd-udevd[6586]: seq 13517 queued, 'change' 'block'
systemd-udevd[6586]: seq 13518 queued, 'remove' 'bdi'
systemd-udevd[6586]: seq 13519 queued, 'remove' 'block'
systemd-udevd[9865]: seq 13514 processed
systemd-udevd[9865]: seq 13515 running
systemd-udevd[9865]: GROUP 6 /usr/lib/udev/rules.d/50-udev-default.rules:59
systemd-udevd[9865]: IMPORT builtin 'blkid' /usr/lib/udev/rules.d/60-persistent-storage.rules:95
systemd-udevd[9865]: IMPORT builtin 'blkid' fails: No such file or directory
systemd-udevd[9865]: loop4: Failed to add device '/dev/loop4' to watch: No such file or directory
(the last line is at error level).
If we are too slow to set up a watch and the device is already gone by the time
we try, this is not an error.
2018-11-13 22:02:55 +01:00
Zbigniew Jędrzejewski-Szmek a14e7af162 udev: also allow resolve_names= to be specified in udev.conf 2018-11-13 14:35:36 +01:00
Zbigniew Jędrzejewski-Szmek bc768f0475 udev: move ResolveNameTiming definition and parsers to udev-util.h
Follow-up for c4d44cba4d. No functional change,
but the parser is moved to libsystemd-shared.so.
2018-11-13 14:04:29 +01:00
Zbigniew Jędrzejewski-Szmek 4b3ca79ea9 udevd: allow more parameters to be set through udev.conf
Rebooting to set change the kernel command line to set some udev parameters is
inconvenient. Let's allow setting more stuff in the config file.

Also drop quotes from around "info" in udev.conf. We need to accept them for
compatibility, but there is no reason to use them.
2018-11-13 14:03:47 +01:00
Pavel Hrdina 2af3eed1aa bpf-devices: fix order of removing and adding BPF programs
The current code has multiple issues and it should never be done like
that.  If someone updates list of allowed devices we should attach new
program before we remove the old one for two reasons:

1. It takes some time to attach new program so there is a period of time
when all devices are allowed.

2. BPF programs have limit for number of instructions (4096) and if user
adds a lot of devices we might hit the instruction limit and the new
program will not be accepted which will result in allow all devices
because the old program was already removed.

In order to attach the new program before we remove the old one we need
to use BPF_F_ALLOW_MULTI flag every time.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-11-13 14:03:01 +01:00
Zbigniew Jędrzejewski-Szmek 66f737b415 udev: do not pass timeout_warn_usec around, calculate it on demand
It was always set to one third of timeout_usec, so let's simplify things by
calculating it using a helper function right before it is used.

Before 9d9264ba39, udevd.c would avoid setting
timeout_warn_usec to 0, using 1 instead. This wasn't necessary, because when
timeout_warn_usec is finally used in spawn_wait(), it is ignored if
timeout_usec is 0 or timeout_warn_usec is 0. So there was no need to handle
this case specially.
2018-11-13 14:00:32 +01:00
Pavel Hrdina 0b82cd2502 bpf-devices: fix cgroup v2 devices detection
If cgroup v2 bpf devices is supported we need to return 1, not -1.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-11-13 12:58:05 +01:00
Lennart Poettering b8d381c477 core: make sure we don't throttle change signal generator when a reload is pending
Fixes: #10627
2018-11-13 12:51:48 +01:00
Lennart Poettering 4b66bccab0 core: when we can't send the pending reload message, say we ignore it in the warning we log
No change in behaviour, just better wording.
2018-11-13 12:01:22 +01:00
Lennart Poettering 209de5256b core: rename queued_message → pending_reload_message
This field is only used for pending Reload() replies, hence let's rename
it to be more descriptive and precise.

No change in behaviour.
2018-11-13 11:59:06 +01:00
Zbigniew Jędrzejewski-Szmek 705727fd76 shared/dissect-image: drop parens 2018-11-13 11:58:44 +01:00
Zbigniew Jędrzejewski-Szmek bd897e729a nspawn: add a hint to the message we emit when a child dies
From #10526:

$ sudo systemd-nspawn -i image
Spawning container image on /home/zbyszek/src/mkosi/image.
Press ^] three times within 1s to kill container.
Short read while reading cgroup mode.
2018-11-13 11:58:44 +01:00