Commit graph

19129 commits

Author SHA1 Message Date
Yu Watanabe 4a0e9289bf resolved: fix wrong error code (#7601) 2017-12-10 16:27:19 +01:00
Alan Jenkins 0fd402b012 core: fix undefined behaviour due to uninitialized string buffer (#7597)
Failure of systemd to respond on the bus interface was bisected to af6b0ecc
"core: make "taint" string logic a bit more generic and output it at boot".

Failure was presumably caused by trying to append strings to an
unintialized buffer, leading to writing outside the unterminated buffer
and hence undefined behaviour.
2017-12-10 19:58:01 +09:00
Lennart Poettering f7757a4993
Merge pull request #7352 from eddiejames/master
Add path configuration for hardware watchdog device
2017-12-08 22:22:02 +01:00
Olaf Hering 575e6588df virt: use XENFEAT_dom0 to detect the hardware domain (#6442, #6662) (#7581)
The detection of ConditionVirtualisation= relies on the presence of
/proc/xen/capabilities. If the file exists and contains the string
"control_d", the running system is a dom0 and VIRTUALIZATION_NONE should
be set. In case /proc/xen exists, or some sysfs files indicate "xen",
VIRTUALIZATION_XEN should be set to indicate the system is a domU.

With an (old) xenlinux based kernel, /proc/xen/capabilities is always
available and the detection described above works always. But with a
pvops based kernel, xenfs must be mounted on /proc/xen to get
"capabilities". This is done by a proc-xen.mount unit, which is part of
xen.git. Since the mounting happens "late", other units may be scheduled
before "proc-xen.mount". If these other units make use of
"ConditionVirtualisation=", the virtualization detection returns
incorect results. detect_vm() will set VIRTUALIZATION_XEN because "xen"
is found in sysfs. This value will be cached. Once xenfs is mounted, the
next process that runs detect_vm() will get VIRTUALIZATION_NONE.

This misdetection can be fixed by using
/sys/hypervisor/properties/features, which exports the value returned by
the "XENVER_get_features" hypercall. If the bit XENFEAT_dom0 is set, the
domain is the "hardware domain". It is supposed to have permissions to
access all hardware. The used sysfs file is available since v2.6.31.

The commonly used term "dom0" refers to the control domain which runs
the toolstack and has access to all hardware. But the virtualization
host may be configured such that one dedicated domain becomes the
"hardware domain", and another one the "toolstack domain".
2017-12-08 22:21:42 +01:00
Lennart Poettering 1b2aeb08e2
Merge pull request #6993 from rojkov/dnssd
Add support for server-side DNS-SD in mDNS zones.
2017-12-08 22:21:01 +01:00
Edward A. James 8a2c1fbfc3 core: Add WatchdogDevice config option and implement it
This option allows a device path to be specified for the systemd
watchdog (both runtime and shutdown).

If a system requires a watchdog other than /dev/watchdog (pointing to
/dev/watchdog0) to be used to reboot the system, this setting should be
changed to the relevant watchdog device path (e.g. /dev/watchdog1).
2017-12-08 11:26:44 -06:00
Edward A. James e4c98db335 watchdog: allow a device path to be specified
Currently systemd hardcodes the use of /dev/watchdog. This is a legacy
chardev that points to watchdog0 in the system.

Modify the watchdog API to allow a different device path to be passed
and stored. Opening the watchdog defaults to /dev/watchdog, maintaining
existing behavior.
2017-12-08 11:26:30 -06:00
Zbigniew Jędrzejewski-Szmek 8208c8f25d shared: use _cleanup_ in specifier_printf (#7586)
Follow-up for e62d316561.
2017-12-08 19:28:02 +03:00
Yu Watanabe 848f01784e acl: fix typo in comment (#7580) 2017-12-08 13:34:25 +01:00
Patrik Flykt 349a981d32 networkd: Ignore DNS information when uplink is not managed (#7571)
When another networking daemon or configuration is handling the
uplink connection, systemd-networkd won't have a network configuration
associated with the link, and therefore link->network will be NULL.
An assert will be triggered later on in the code when link->network is
NULL.
2017-12-08 13:33:40 +01:00
Dmitry Rozhkov 400f54fb36 resolved: support multiple TXT RRs per DNS-SD service
Section 6.8 of RFC 6763 allows having service instances with
multiple TXT resource records.
2017-12-08 14:29:27 +02:00
Dmitry Rozhkov 84b0f133e4 resolved: consult Polkit for privileges when manipulating DNS-SD 2017-12-08 14:29:27 +02:00
Dmitry Rozhkov e7c1b0e456 resolved: resolve possible conflicts for DNS-SD RRs
It might happen that a DNS-SD service doesn't include local host's
name in its RR keys and still conflicts with a remote service.

In this case try to resolve the conflict by changing name for
this particular service.
2017-12-08 14:29:27 +02:00
Dmitry Rozhkov d686f15c9e resolved: don't check conflicts for DNS-SD enumeration RRs 2017-12-08 14:29:27 +02:00
Dmitry Rozhkov c3036641f0 resolved: implement D-Bus API for DNS-SD 2017-12-08 14:29:27 +02:00
Dmitry Rozhkov 8d67e72cbe resolved: detect and handle mDNS race condition upon probing
As discussed in RFC 6762, Section 8.2 a race condition may
happen when two hosts are probing for the same name simultaniously.

Detect and handle such race conditions.
2017-12-08 14:29:27 +02:00
Dmitry Rozhkov 0d5ee47dfd resolved: add authority section to mDNS probing queries
According to RFC 6762 Section 8.2 "Simultaneous Probe Tiebreaking"
probing queries' Authority Section is populated with proposed
resource records in order to resolve possible race conditions.
2017-12-08 14:29:27 +02:00
Dmitry Rozhkov 748a548e1b resolved: set cache-flush bit on mDNS responses
From RFC 6762, Section 10.2
"They (the rules about when to set the cache-flush bit) apply to
startup announcements as described in Section 8.3, "Announcing",
and to responses generated as a result of receiving query messages."

So, set the cache-flush bit for mDNS answers except for DNS-SD
service enumerattion PTRs described in RFC 6763, Section 4.1.
2017-12-08 14:29:27 +02:00
Dmitry Rozhkov 008d4ab7a2 resolved: make rfc4795-specific code run for LLMNR only
RFC6762 specifies different procedure for conflict resolution and
the code is not applicable for the mDNS case.
2017-12-08 14:29:27 +02:00
Dmitry Rozhkov a2bf8a19cc resolved: announce DNS-SD records in mDNS scopes 2017-12-08 14:29:27 +02:00
Dmitry Rozhkov 6db6a4642e resolved: put DNS-SD records to mDNS-enabled zones. 2017-12-08 14:29:27 +02:00
Dmitry Rozhkov 6501dd31a7 resolved: add enablers for DNS-SD
Introduce network services loaded from .dnssd files that
can be used for server-side DNS-SD implementation in systemd-resolved.
2017-12-08 14:29:27 +02:00
Dmitry Rozhkov ebb779dc23 resolved: inroduce dns_txt_item_new_empty() function 2017-12-08 14:29:27 +02:00
Dmitry Rozhkov 154ae08781 shared: introduce dnssd_srv_type_is_valid() function 2017-12-08 14:29:27 +02:00
Dmitry Rozhkov 9c5e7b73f7 resolved: answer all mDNS questions found in packet
According to p5.3 of RFC6762 (Multicast DNS) one mDNS query message
can contain more than one question sections.

Generate answers for all found questions and put them to a reply
message.
2017-12-08 14:29:26 +02:00
Lennart Poettering 9e32914aa5
Merge pull request #7570 from keszybz/sulogin-shell-reload-manager
Reload manager before exit from sulogin shell
2017-12-08 13:09:45 +01:00
Olaf Hering 1a8e414860 virt: propagate errors in detect_vm_xen_dom0 (#7553)
Update detect_vm_xen_dom0 to propagate errors in case reading
/proc/xen/capabilites fails. This does not fix any bugs, it just makes
it consistent with other functions called by detect_vm.
2017-12-07 21:09:32 +01:00
Harald Hoyer bfdf8c3bb8 boot/efi: fixup TPM V2 measuring and logging (#7568)
Honor the log format and use packed event structures.

Fixes https://github.com/systemd/systemd/issues/7118
2017-12-07 21:07:53 +01:00
Zbigniew Jędrzejewski-Szmek ba60adc623
Merge pull request #7572 from poettering/taint-manager
"taint" logic improvements and other minor fixes
2017-12-07 21:06:28 +01:00
Zbigniew Jędrzejewski-Szmek fa9ee6f357
Merge pull request #7573 from poettering/empty-to-null
use empty_to_null() where we can
2017-12-07 21:04:53 +01:00
Lennart Poettering 2ac6aeace1
Merge pull request #7562 from poettering/fix-manager-test-mkdir
fix --test mode
2017-12-07 17:31:34 +01:00
Zbigniew Jędrzejewski-Szmek 9db82fe3c2 sulogin-shell: replace "^D" by "exit"
^D is a bit cryptic, and advanced users will know that they can use ^D instead
of typing exit anyway.
2017-12-07 12:42:06 +01:00
Lennart Poettering 8fd010bb1b nspawn: turn on watchdog logic for nspawn too
It's a long-running daemon, and it's easy to enable, hence do it.
2017-12-07 12:34:46 +01:00
Lennart Poettering 90d7464d83 manager: taint the manager if the overflowuid/overflowgid aren't set to 65534 2017-12-07 12:34:46 +01:00
Zbigniew Jędrzejewski-Szmek 375c3f6aae sulogin-shell: do daemon-reload before starting default target
If the user modifies configuration, e.g. /etc/fstab, they might forget to tell
systemd about the changes. Let's do a reload for them.

Note that doing a reload should be safe, because emergency and rescue modes are
"single threaded" and nothing should be doing changes at the point where we are
exiting from the sushell. Also, daemon-reload can be implicitly called at
various moments, so we can ignore the case where the user did some incompatible
changes on disk and is counting on systemd never reloading and picking them up.

C.f. #7565.
2017-12-07 12:34:31 +01:00
Zbigniew Jędrzejewski-Szmek cccb78f093 sulogin-shell: simplify returns from a function
This is actually slightly safer because it allows gcc to make sure that all code
paths either call return or are noreturn. But the real motivation is just to
follow the usual style and make it a bit shorter.
2017-12-07 12:34:12 +01:00
Zbigniew Jędrzejewski-Szmek e821f6a916 meson: place systemd-sulogin-shell in build/
We do that will all executables so that it's easy to call them.
2017-12-07 12:34:12 +01:00
Lennart Poettering a8ea93a5e2 core: use empty_to_null() where we can 2017-12-07 12:13:00 +01:00
Lennart Poettering cefb3eda60 core: add console error message if manager_startup() fails 2017-12-07 11:28:00 +01:00
Lennart Poettering af6b0ecc4c core: make "taint" string logic a bit more generic and output it at boot
The tainting logic existed for a long time, but was hidden inside the
bus interfaces. Let's give it a small bit more coverage, by logging its
value early at boot during initialization.
2017-12-07 11:27:07 +01:00
Lennart Poettering e27fe688f2 manager: don't check /usr state of initrd to determine "taint-usr" taint 2017-12-07 11:09:09 +01:00
Lennart Poettering 5eb397cfad manager: don't bother with creating /run/systemd/units/ in test mode
This makes sure running "systemd --test" works again on systems running
older systemd versions where the dir doesn't exist yet.
2017-12-07 11:07:55 +01:00
Lennart Poettering 279d81dd46 manager: split out code that sets up run_queue event source into function of its own
Let's shorten manager_new() a bit.
2017-12-07 11:02:47 +01:00
Yu Watanabe a3d37fe9a3 test: use NOBODY_USER_NAME instead of hard-coded string "noody" 2017-12-07 17:12:09 +09:00
Zbigniew Jędrzejewski-Szmek 43a29e2b65
Merge pull request #7560 from poettering/refactor-main
reduce main() size a bit
2017-12-07 08:51:04 +01:00
Yu Watanabe ad1afd60d4 bootspec: make boot_entries_select_default() static
The function is used only in bootspec.c.
So, let's make the function static.
2017-12-07 14:52:39 +09:00
Yu Watanabe 5838493a3a bootspec: fix debug message about default entry
When no entries matches with entry_oneshot, entry_default and
default_pattern, then log message shows a wrong entry.
Moreover, if none of entry_oneshot, entry_default and default_pattern
are set, then the index `i` is uninitialized.
This fixes such problem.
2017-12-07 14:50:49 +09:00
Zbigniew Jędrzejewski-Szmek a6300ead67
Merge pull request #7551 from poettering/resolved-unknown-scope
downgrade resolved log messages about incoming packets from unknown scopes
2017-12-06 23:30:51 +01:00
Zbigniew Jędrzejewski-Szmek 4dbb344fce
Merge pull request #7559 from evverx/incorrect-spec-memleak
shared: fix a memory leak
2017-12-06 22:56:02 +01:00
Lennart Poettering 31aef7ff2b core: split out execution context logging from main()
Again, no functional changes, let's just shorten main() a bit, by
splitting out more code into a separate functions.
2017-12-06 21:57:35 +01:00