Commit graph

30503 commits

Author SHA1 Message Date
Lennart Poettering 459b9f9ff7 merge two lines in our get_output_flags() functions
loginctl, machinectl, systemctl all have very similar implementations of
a get_output_flags() functions. Simplify it by merging two lines that
set the same flag.
2017-11-10 21:40:47 +01:00
Lennart Poettering 0b3c84eb7d tree-wide: use _cleanup_(sd_bus_flush_close_unrefp) at various appropriate places
Let's shorten the code a bit.
2017-11-10 21:15:44 +01:00
Lennart Poettering d13b522751 pager: cache not only number of columns but also of lines before we open pager
Not that we need it, but let's do this as matter of completeness.
2017-11-10 21:10:17 +01:00
Lennart Poettering 9e29521e27 loginctl: invoke sigbus_install()
We show journal data, hence we should install the SIGBUS handler.

Similar for machinectl, where the same applies.
2017-11-10 21:09:13 +01:00
Boucman f332611abe device : reload when udev generates a "changed" event (#6850) 2017-11-10 17:00:32 +01:00
Lennart Poettering 8d644046d9
Merge pull request #7089 from oniko/luks2-support
LUKS2 support for systemd-cryptsetup and dissect-image
2017-11-10 16:16:36 +01:00
juga0 28522b0d8c networkd: set dhcp_use_routes to true when dhcp_anonymize is true (#7209)
It does not send duplicated options in the PRL.
Fix #7048.
2017-11-10 16:03:43 +01:00
Alan Jenkins 9b9881d75b core: add missing error_message cases (#6911)
We neglected to set error_message for errors which occur _after_ the
`finish` label.  These fatal errors only happen in paths where `finish`
was reached successfully, i.e. error_message has not already been set
(and this analysis is simple enough that this need not cause too much
headaches.  Also our new assignments to error_message come immediately
after execve() calls, which would have lost the error_message if it had
been set).

Also print a status message when we fail to exec init, otherwise the only
sign the user will see is `# ` :).

This addresses the lack of error messages pointed out in issue #6827.
2017-11-10 15:57:52 +01:00
Lennart Poettering 67595fce2d
Merge pull request #7096 from keszybz/logind-session-killing
Logind session killing fix
2017-11-10 15:51:39 +01:00
Zbigniew Jędrzejewski-Szmek 556c7bae0c basic/hashmap: add cleanup of memory pools (#7164)
It was dropped in 89439d4fc0. As a result, every
process that uses a hashmap allocates and then leaks the hashmap mempools.
The mempools are only allocated in the main thread, but we don't know where
the memory is used.

So let's check if we are the last thread and free the mempools then. This is
fairly heavy, because /proc/self/status has to be opened and parsed, but we do
it only when compiled for valgrind, i.e. not by default, and compared to running
under valgrind or asan, the extra cost is acceptable. The big advantage is that
we don't have to think or filter out this false positive.

As a micro-opt, cleanup is attempted only in the main thread. We could allow
any thread to check if it is the last one and perform cleanup, but that'd mean
that we'd have to _do_ the check in every thread. We don't use threads like
that, our non-main threads are always short-lived, so let's just accept the
possibility that we'll leak memory if a thread survives. The check is also
non-atomic, but it's called in a destructor of the main thread _and_ we do
cleanup only when there are no other threads, so the risk of some library
suddenly spawning another thread is very low. All in all, this is not perfect,
but should work in 999‰ of cases.

Fixes the following valgrind warning:

==22564== HEAP SUMMARY:
==22564==     in use at exit: 8,192 bytes in 2 blocks
==22564==   total heap usage: 243 allocs, 241 frees, 151,905 bytes allocated
==22564==
==22564== 4,096 bytes in 1 blocks are still reachable in loss record 1 of 2
==22564==    at 0x4C2FB6B: malloc (vg_replace_malloc.c:299)
==22564==    by 0x4F08A8C: mempool_alloc_tile (mempool.c:62)
==22564==    by 0x4F08B16: mempool_alloc0_tile (mempool.c:81)
==22564==    by 0x4EF8DE0: hashmap_base_new (hashmap.c:748)
==22564==    by 0x4EF8ED9: internal_hashmap_new (hashmap.c:782)
==22564==    by 0x11045D: test_hashmap_copy (test-hashmap-plain.c:87)
==22564==    by 0x115722: test_hashmap_funcs (test-hashmap-plain.c:914)
==22564==    by 0x10FC9D: main (test-hashmap.c:60)
==22564==
==22564== 4,096 bytes in 1 blocks are still reachable in loss record 2 of 2
==22564==    at 0x4C2FB6B: malloc (vg_replace_malloc.c:299)
==22564==    by 0x4F08A8C: mempool_alloc_tile (mempool.c:62)
==22564==    by 0x4F08B16: mempool_alloc0_tile (mempool.c:81)
==22564==    by 0x4EF8DE0: hashmap_base_new (hashmap.c:748)
==22564==    by 0x4EF8EF8: internal_ordered_hashmap_new (hashmap.c:786)
==22564==    by 0x10A2A0: test_ordered_hashmap_copy (test-hashmap-ordered.c:89)
==22564==    by 0x10F70F: test_ordered_hashmap_funcs (test-hashmap-ordered.c:916)
==22564==    by 0x10FCA2: main (test-hashmap.c:61)
==22564==
==22564== LEAK SUMMARY:
==22564==    definitely lost: 0 bytes in 0 blocks
==22564==    indirectly lost: 0 bytes in 0 blocks
==22564==      possibly lost: 0 bytes in 0 blocks
==22564==    still reachable: 8,192 bytes in 2 blocks
==22564==         suppressed: 0 bytes in 0 blocks

v2:
- check if we are the main thread

v3:
- check if there are no other threads
2017-11-10 15:44:58 +01:00
Antonio Rojas 8e6a7a8b2b Fix typo in statx macro (#7180)
This makes statx properly whitelisted in supported systems.
2017-11-10 11:07:36 +01:00
Simon Arlott 6fcae8e4de rules: run all persistent-input rules for rmi and i8042 (#7287)
Commit 83b48159 set ID_BUS for these subsystems but copied the intent
of commit c49df207 by not creating symlinks for those devices.

Remove the GOTO so that the rest of the rules are still processed and
symlinks are created for rmi and i8042 devices.
2017-11-10 10:32:51 +01:00
John Lin ff21046656 systemctl: fix memory leak (#7289)
Fixes: #7283
2017-11-10 10:32:25 +01:00
tblume ed457f1380 systemd-firstboot: add vconsole keymap support (#7035)
Enable systemd-firstboot to set the keymap.

RFE:

https://github.com/systemd/systemd/issues/6346
2017-11-10 10:31:44 +01:00
Yu Watanabe c54515b1e4 core/load-fragment: add RemoveIPC= (#7288)
PR #3865 introduced RemoveIPC= but the option is not listed in
load-fragment-gperf.gperf. So, the option could be used only via d-bus.
This adds RemoveIPC= in load-fragment-gperf.gperf. Then, now we can
set the option in unit files.

Fixes #7281.
2017-11-10 10:15:55 +01:00
John Lin caa45f5b4e man: remove restrictions in [Install] section (#7278)
Now [Install] section also supports drop-in files.

Follow-up for 142468d895.
2017-11-10 00:12:01 +09:00
Collin Eggert 79f3cd2bf5 hwdb: Add ACCEL_MOUNT_MATRIX for HP Stream 8 (#7279) 2017-11-09 15:38:34 +01:00
Lennart Poettering 4deff0b92b
Merge pull request #7280 from yuwata/fix-7270-2
test-event: do not work in assert()
2017-11-09 14:26:42 +01:00
Lukáš Nykrýn f7576eb9fd cryptsetup: ignore _netdev, since it is used in generator (#7282) 2017-11-09 14:24:57 +01:00
Yu Watanabe 3fcf65c352 test-parse-util: add more tests, mainly for empty string 2017-11-09 18:39:50 +09:00
Yu Watanabe ccd1fc2f69 libsystemd-network: coding style fix 2017-11-09 18:39:41 +09:00
Yu Watanabe 1950011227 tree-wide: do not work in assert()
Follow-up for 85e55d14de.
2017-11-09 18:38:02 +09:00
Lennart Poettering f5f0dca0ce
Merge pull request #7112 from tstellar/udev-for-kfd
udev-rules: Add rules for /dev/kfd
2017-11-09 09:22:55 +01:00
Dimitri John Ledkov 02ec6e04fd test-bpf: use /bin/ping path (#7276)
This path to ping is compatible with both debian-like and usr-merged
distros. This keeps the test simple, and should thus pass everywhere.

Fixes: #7267
2017-11-08 20:04:55 +01:00
John Lin 142468d895 systemctl: respect [Install] section in drop-ins (#7158)
Fixes: #7114
2017-11-08 18:04:31 +01:00
Tom Stellard 3754abc58f NEWS: Add note about udev changes for /dev/kvm, /dev/dri/renderD*, and /dev/kfd 2017-11-08 08:37:18 -08:00
Lennart Poettering f9007887a6
Merge pull request #7268 from yuwata/rfe-7262
timesync: make poll interval configurable
2017-11-08 17:35:56 +01:00
Lennart Poettering 376065ee26
Merge pull request #7275 from yuwata/fix-7070-7260
core: fixes related to RuntimeDirectory=, ReadWritePaths= and DynamicUser=
2017-11-08 17:34:39 +01:00
Tom Stellard f301622d84 udev-rules: Add rule for /dev/kfd 2017-11-08 08:22:05 -08:00
Tom Stellard 4e15a7343c udev-rules: Permission changes for /dev/dri/renderD*
- Remove the uaccess tag from /dev/dri/renderD*.
- Change the owning group from video to render.
- Change default mode to 0666.
- Add an option to allow users to set the access mode for these devices at
compile time.
2017-11-08 08:21:31 -08:00
Tom Stellard b8fd3d8220 udev-rules: Permission changes for /dev/kvm
- Remove uaccess tag from /dev/kvm.
- Change the default mode for /dev/kvm to 0666.
2017-11-08 08:17:49 -08:00
NeilBrown c44cac7c6c umount: always use MNT_FORCE in umount_all() (#7213)
The linux umount2() systemcall accepts a MNT_FORCE flags
which some filesystems honor, particularly FUSE and various
network filesystems such as NFS.
These filesystems can sometimes wait for an indefinite period
for a response from an external service, and the wait if
sometimes "uninterruptible" meaning that the process cannot be
killed.
Using MNT_FORCE causes any such request that are outstanding to
be aborted.  This normally allows the waiting process to
be killed.  It will then realease and reference it has to the
filesytem, this allowing the filesystem to be unmounted.

If there remain active references to the filesystem, MNT_FORCE
is *not* forcefull enough to unmount the filesystem anyway.

By the time that umount_all() is run by systemd-shutdown, all
filesystems *should* be unmounted, and sync() will have been
called.  Anything that remains cannot be unmounted in a
completely clean manner and just nees to be dealt with as firmly
as possible.  So use MNT_FORCE and try to explain why in the
comment.

Also enhance an earlier comment to explain why umount2() is
safe even though mount(MNT_REMOUNT) isn't.
2017-11-08 11:29:32 +03:00
Yu Watanabe fdfcb94631 man: update documents for RuntimeDirectory= and friends 2017-11-08 15:52:08 +09:00
Yu Watanabe 8092a48cc1 core/execute: do not create RuntimeDirectory= under private/ sub-directory
RuntimeDirectory= often used for sharing files or sockets with other
services. So, if creating them under private/ sub-directory, we cannot
set DynamicUser= to service units which want to share something through
RuntimeDirectory=.
This makes the directories given by RuntimeDirectory= are created under
/run/ even if DynamicUser= is set.

Fixes #7260.
2017-11-08 15:50:58 +09:00
Yu Watanabe 2bf13bd51e core/load-fragment: fix alignment 2017-11-08 15:49:22 +09:00
Yu Watanabe 652bb2637a core/execute: RuntimeDirectory= or friends requires mount namespace
Since #6940, RuntimeDirectory= or their friends imply BindPaths=.
So, if at least one of them are set, mount namespace is required.
2017-11-08 15:48:51 +09:00
Yu Watanabe 23fd04e92d test: add test for ReadOnlyPaths= with RuntimeDirectory= 2017-11-08 15:48:32 +09:00
Yu Watanabe d18aff0422 core: ReadWritePaths= and friends assume '+' prefix when BindPaths= or freinds are set
When at least one of BindPaths=, BindReadOnlyPaths=, RootImage=,
RuntimeDirectory= or their friends are set, systemd prepares
a namespace under /run/systemd/unit-root. Thus, ReadWritePaths=
or their friends without '+' prefix is completely meaningless.
So, let's assume '+' prefix when one of them are set.

Fixes #7070 and #7080.
2017-11-08 15:48:01 +09:00
Yu Watanabe 7bcef4efe6 core: remove compile_read_write_paths()
From 6c47cd7d3b, RuntimeDirectory= and
their friends also imply BindPaths=. Thus, implying ReadWritePaths=
is meaningless.
2017-11-08 15:07:22 +09:00
Yu Watanabe a4465d0d4c timesync: make poll interval configurable
This adds PollIntervalMinSec= and PollIntervalMaxSec= to timesyncd.conf

Closes #7262.
2017-11-08 01:47:38 +09:00
Alan Jenkins 3a58ca47ee systemctl: remove extra space character in output (#7250)
> See "systemctl  status fail-stop.service" and "journalctl  -xe" for
> details.
2017-11-07 19:18:10 +03:00
John Lin 474cca49ee mkosi: set locale to be en_US.UTF-8 (#7244)
Fixes: #7238
2017-11-07 19:17:40 +03:00
Alan Jenkins fec7615c07 core: simplify - don't add jobs to dbus queue if we immediately remove them (#7251)
job_finish_and_invalidate() calls job_free() to destroy jobs (and remove
them from the dbus queue).  So we don't need to add them to the dbus queue
first.

We only want to add jobs to the dbus queue if they're a restart job, which
we're transmogrifying into a start job and putting back into the system.
2017-11-07 19:14:15 +03:00
Alessandro Ghedini 30046d9c89 man: fix reference to gateway hostname (#7258)
Follow-up to commit 1dc92a06e2 which didn't
catch all cases.
2017-11-07 19:13:15 +03:00
Shawn Landden ed440f6be9 condition: detect TOMOYO MAC (#7249)
TOMOYO is a Mandatory Access Control security module for Linux.
Rather than ship rules, TOMOYO features a learning mode.

http://tomoyo.osdn.jp/
http://tomoyo.osdn.jp/2.5/index.html.en
2017-11-07 19:12:36 +03:00
Dimitri John Ledkov 4b742c8acd test: switch to using ext4 instead of ext3 as default fallback fs (#7265)
Using ext3 is not representative anymore, and Ubuntu has stopped shipping
fsck.ext3 in the initramfs.
2017-11-07 17:51:30 +03:00
Lennart Poettering 7a5cb197d8
Merge pull request #7256 from keszybz/add-cii-badge
Add CII badge
2017-11-07 17:47:57 +03:00
Yu Watanabe 85e55d14de tree-wide: do not work in assert() (#7271)
Fixes #7270.
2017-11-07 16:04:20 +03:00
macrothian 0b97f52a33 Fix Dell E7570 hwdb dimensions #7252 (#7263) 2017-11-07 08:28:06 +10:00
Yu Watanabe f907cc1620 timesync: add RootDistanceMaxSec= to timesyncd.conf (#7215)
Closes #7211.
2017-11-05 07:39:34 +01:00