Commit graph

19112 commits

Author SHA1 Message Date
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
Lennart Poettering 6c78f016d7 core: move write_container_id() invocation into initialize_runtime()
This moves the invocation a bit later, but that shoudln't matter. By
moving it we gain two things: first of all, its closer to other code
where it belongs, secondly its naturally conditioned properly, as we no
longer will rewrite the container ID file on every reexecution again,
and not in test mode either.
2017-12-06 21:57:35 +01:00
Lennart Poettering 5afbaa36f4 core: split out various system/process initialization steps into its own function
Again, no changes in behaviour, just some refactoring to make main() a
bit more digestable.
2017-12-06 21:57:35 +01:00
Lennart Poettering 970777b59a core: split out code that frees arg_xyz variables
No change in behaviour, just some refactoring to shorten main() a bit.
2017-12-06 21:57:35 +01:00
Lennart Poettering 6acca5fcd1 core: split out code that queues default job from main()
No functional changes really, just some refactoring to shorten main() a
bit
2017-12-06 21:57:35 +01:00
Lennart Poettering 7eb3504969 core: split out the core loop out of main()
No real functional changes, just some rearranging to shorten the overly
long main() function a bit.

This gets rid of the arm_reboot_watchdog variable, as it can be directly
derived from shutdown_verb, and we need it only one time. By dropping it
we can reduce the number of arguments we need to pass around.
2017-12-06 21:57:35 +01:00
Lennart Poettering 3c7878f94b core: split out reexecution code of main() into its own function
No functional changes, just an attempt to shorten main() a bit.
2017-12-06 21:57:35 +01:00
Lennart Poettering 0161d32b7b virt: remove triple spurious newline 2017-12-06 21:57:35 +01:00
Evgeny Vereshchagin e62d316561 shared: fix a memory leak
```
$ ./src/test/test-systemd-tmpfiles.py valgrind --leak-check=full --error-exitcode=1 ./build/systemd-tmpfiles
...
Running valgrind --leak-check=full --error-exitcode=1 ./build/systemd-tmpfiles on 'w /unresolved/argument - - - - "%Y"'
...
[<stdin>:1] Failed to substitute specifiers in argument: Invalid slot
...
==22602== 5 bytes in 1 blocks are definitely lost in loss record 1 of 2
==22602==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22602==    by 0x4ECA7D4: malloc_multiply (alloc-util.h:74)
==22602==    by 0x4ECA909: specifier_printf (specifier.c:59)
==22602==    by 0x113490: specifier_expansion_from_arg (tmpfiles.c:1923)
==22602==    by 0x1144E7: parse_line (tmpfiles.c:2159)
==22602==    by 0x11551C: read_config_file (tmpfiles.c:2425)
==22602==    by 0x115AB0: main (tmpfiles.c:2529)
```
2017-12-06 19:31:28 +00:00
Evgeny Vereshchagin 59ca366cdd tests: allow passing more than one argument to test-systemd-tmpfiles.py
This makes it easier to run `systemd-tmpfiles` under valgrind.
2017-12-06 19:30:08 +00:00
Olaf Hering 87dc723ae0 virt: use /proc/xen as indicator for a Xen domain (#6442, #6662) (#7555)
The file /proc/xen/capabilities is only available if xenfs is mounted.

With a classic xenlinux based kernel that file is available
unconditionally. But with a modern pvops based kernel, xenfs must be
mounted before the "capabilities" may appear. xenfs is mounted very late
via .services files provided by the Xen toolstack. Other units may be
scheduled before xenfs is mounted, which will confuse the detection of
VIRTUALIZATION_XEN.

In all Xen enabled kernels, and if that kernel is actually running on
the Xen hypervisor, the "/proc/xen" directory is the reliable indicator
that this instance runs in a "Xen guest".

Adjust the code to check for /proc/xen instead of
/proc/xen/capabilities.

Fixes commit 3f61278b5 ("basic: Bugfix Detect XEN Dom0 as no virtualization")
2017-12-06 19:59:30 +01:00
Lennart Poettering c7a54cd67b
Merge pull request #7419 from keszybz/tmpfiles-fixes
Tmpfiles --user mode and various fixes
2017-12-06 19:50:26 +01:00
Max Resch b4f9f2a62f Set secure_boot flag in Kernel Zero-Page (#7482)
Setting the secure_boot flag, avoids getting the printout
"EFI stub: UEFI Secure Boot is enabled." when booting
a Linux kernel with linuxx64.efi.stub and EFI SecureBoot enabled.

This is mainly a cosmetic fixup, as the "quiet" kernel parameter does
not silence pr_efi printouts in the linux kernel (this only works using
the efi stub from the linux source tree)
2017-12-06 15:29:52 +01:00
Lennart Poettering 66d73cc728 test-execute: use the "nogroup" group if it exists for testing
We currently look for "nobody" and "nfsnobody" when testing groups, both
of which do not exist on Ubuntu, our main testing environment. Let's
extend the tests slightly to also use "nogroup" if it exists.
2017-12-06 13:40:50 +01:00
Lennart Poettering 05fd2156b7 journal,coredump: do not do ACL magic for "nobody" user either
The "nobody" user might possibly be seen by the journal or coredumping
code if unmapped userns-using processes are somehow visible to them.
Let's make sure we don't do the ACL magic for this user either, since
this is a special system user that might be backed by different real
users in different contexts.
2017-12-06 13:40:50 +01:00
Lennart Poettering 7e61fd02b0 user-util: synthesize user records for "nobody" the same way as for "root"
We already synthesize records for both "root" and "nobody" in
nss-systemd. Let's do the same in our own NSS wrappers that are supposed
to bypass NSS if possible. Previously this was done for "root" only, but
let's clean this up, and do the same for "nobody" too, so that we
synthesize records the same way everywhere, regardless whether in NSS or
internally.
2017-12-06 13:40:50 +01:00
Lennart Poettering 3a664727fa user-util: add UID_NOBODY defines that resolve to (uid_t) 65534
We use it all over the place, let's add a #define for it. Makes things
easier greppable, and more explanatory I think.
2017-12-06 13:40:50 +01:00
Lennart Poettering 8343827793 nss-systemd: tweak checks when we consult PID 1 for dynamic UID/GID lookups
Instead of contacting PID 1 for dynamic UID/GID lookups for all
UIDs/GIDs that do not qualify as "system" do the more precise check
instead: check if they actually qualify for the "dynamic" range.
2017-12-06 13:40:50 +01:00