Commit Graph

31159 Commits

Author SHA1 Message Date
Yu Watanabe 6071202165 sysusers: use NOBODY_USER_NAME 2017-12-07 17:12:13 +09:00
Yu Watanabe a3d37fe9a3 test: use NOBODY_USER_NAME instead of hard-coded string "noody" 2017-12-07 17:12:09 +09:00
Lennart Poettering ea781d0dd8
Merge pull request #7554 from keszybz/autodetect-build
Autodetect build directory ignoring mkosi artefacts
2017-12-07 09:07:40 +01: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
Zbigniew Jędrzejewski-Szmek 00562cc356
Merge pull request #7566 from yuwata/fix-bootspec-default-entry
bootspec: fix debug message about default entry
2017-12-07 08:49:11 +01:00
Lennart Poettering 5dfcaaaf11 units: delegate only "cpu" and "pids" controllers by default (#7564)
Now that we can configure which controllers to delegate precisely, let's
limit wht we delegate to the user session: only "cpu" and "pids" as a
minimal baseline.

Fixes: #1715
2017-12-07 08:48:08 +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
Christian Hesse dd014eebfb NEWS: add missing whitespace (#7561) 2017-12-06 23:49:01 +01: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
Zbigniew Jędrzejewski-Szmek b1891d2aaf
Merge pull request #7530 from poettering/uid-gid-fixes
various uid/gid fixes
2017-12-06 15:28:31 +01:00
Zbigniew Jędrzejewski-Szmek 2535f23dd8 run-integration-test: allow argument to be overriden
This is useful for "sudo test/run-integration-tests.sh clean".
2017-12-06 15:16:55 +01:00
Zbigniew Jędrzejewski-Szmek ded65775a2 tests: try to autodetect directory better
Ignore mkosi.builddir. In the future we can also add other patterns
if necessary.

run-intergration-tests.sh is updated to use the new script, and modified
to work from arbitrary directory.

Follow-up for #7494.
2017-12-06 15:16:35 +01:00
Lennart Poettering c82ce4f215 mkosi.build: add code to determine the right nobody user/group name 2017-12-06 13:53:39 +01:00
hanklank 4fb55f18ea Added some missing Swedish Strings (#7552) 2017-12-06 13:52:25 +01:00
Lennart Poettering fa75683700 update TODO 2017-12-06 13:40:50 +01:00
Lennart Poettering afde45740f meson: print warnings if the "nobody" user/group name is not compatible with the local system
At least on Fedora and Debian systems this not obvious to get right,
hence warn.
2017-12-06 13:40:50 +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
Lennart Poettering 4e72397b00 coredump,journal: do not do ACL magic for processes of dynamic UIDs
Dynamic UIDs should be treated like system users in this regard.
2017-12-06 13:40:50 +01:00
Lennart Poettering ece877d434 user-util: add new uid_is_system() helper
This adds uid_is_system() and gid_is_system(), similar in style to
uid_is_dynamic(). That a helper like this is useful is illustrated by
the fact that test-condition.c didn't get the check right so far, which
this patch fixes.
2017-12-06 13:40:50 +01:00
Lennart Poettering 399725532d doc: add a document briefly explaining UID/GID range assumptions we make 2017-12-06 13:40:50 +01:00
Lennart Poettering 87d5e4f286 build-sys: make the dynamic UID range, and the container UID range configurable
Also, export these ranges in our pkg-config files.
2017-12-06 12:55:37 +01:00
Lennart Poettering 6cae1ebe19 resolved: ignore our own LLMNR packets, the same way we ignore mDNS packets already
Let's minimize our traffic a bit. And for local names we bypass the
packet generation anyway.
2017-12-06 12:45:39 +01:00
Lennart Poettering f1b1a5c4ca resolved: downgrade log messages about incoming LLMNR/mDNS packets on unexpected scopes
This might very well happen due to races between joining multicast
groups and network configuration and such, let's not complain, but just
drop the messages at debug level.

Fixes: #7527
2017-12-06 12:44:05 +01:00
Zbigniew Jędrzejewski-Szmek 2f813b8aae test-systemd-tmpfiles: respect $HOME in test for %h expansion
%h is a special specifier because we look at $HOME (unless running suid, but
let's say that this case does not apply to tmpfiles, since the code is
completely unready to be run suid). For all other specifiers we query the user
db and use those values directly. I'm not sure if this exception is good, but
let's just "document" status quo for now. If this is changes, it should be in
a separate PR.
2017-12-06 10:30:49 +01:00
Zbigniew Jędrzejewski-Szmek df1172fe72 test-systemd-tmpfiles: ignore result of %m test
It's failing on artful s390x and i386:
Running /tmp/autopkgtest.Pexzdu/build.lfO/debian/build-deb/systemd-tmpfiles  on 'f /tmp/test-systemd-tmpfiles.c236s1uq/arg - - - - %m'
expect: '01234567890123456789012345678901'
actual: 'e84bc78d162e472a8ac9759f5f1e4e0e'
--- stderr ---
Traceback (most recent call last):
  File "/tmp/autopkgtest.Pexzdu/build.lfO/debian/src/test/test-systemd-tmpfiles.py", line 129, in <module>
    test_valid_specifiers(user=False)
  File "/tmp/autopkgtest.Pexzdu/build.lfO/debian/src/test/test-systemd-tmpfiles.py", line 89, in test_valid_specifiers
    test_content('f {} - - - - %m', '{}'.format(id128.get_machine().hex), user=user)
  File "/tmp/autopkgtest.Pexzdu/build.lfO/debian/src/test/test-systemd-tmpfiles.py", line 84, in test_content
    assert content == expected
AssertionError
-------

Let's skip the test for now until this is resolved properly on the autopkgtest
side.
2017-12-06 10:30:26 +01:00
Zbigniew Jędrzejewski-Szmek 7488492a81 test-systemd-tmpfiles: skip on python3.4
python3.4 is used by our CI.
Let's revert this when we stop supporting python < 3.5.
2017-12-06 10:30:26 +01:00
Zbigniew Jędrzejewski-Szmek 03025f46af test-systemd-tmpfiles: add tests for specifiers 2017-12-06 10:30:26 +01:00
Zbigniew Jędrzejewski-Szmek c987fefc43 Fix typo 2017-12-06 10:30:26 +01:00
Zbigniew Jędrzejewski-Szmek 0deb073a66 man: improve formatting in systemd.unit.xml 2017-12-06 10:30:26 +01:00
Zbigniew Jędrzejewski-Szmek 5a8575ef01 tmpfiles: also add %t/%S/%C/%L specifiers
sd_path_home() returns ENXIO when a variable (such as $XDG_RUNTIME_DIR) is not
defined. Previously we used ENOKEY for unresolvable specifiers. To avoid having
two codes, or translating ENXIO to ENOKEY, I replaced ENOKEY use with ENXIO.

v2:
- use sd_path_home and change to ENXIO everywhere
2017-12-06 10:30:26 +01:00
Zbigniew Jędrzejewski-Szmek cfdda37c9f Hook up systemd-tmpfiles as user units
An explicit --user switch is necessary because for the user@0.service instance
systemd-tmpfiles is running as root, and we need to distinguish that from
systemd-tmpfiles running in systemd-tmpfiles*.service.

Fixes #2208.

v2:
- restore "systemd-" prefix
- add systemd-tmpfiles-clean.{service,timer}, systemd-setup.service to
  systemd-tmpfiles(8)
2017-12-06 10:19:35 +01:00