Commit graph

32048 commits

Author SHA1 Message Date
tblume 75aaade16b meson.build: make docdir configurable (#8068)
SUSE is using a different docdir, so the path should be configurable
2018-02-02 06:46:15 +09:00
Lennart Poettering 52dca0de99
Merge pull request #7042 from vcaputo/iteratedcache
RFC: Optionally cache hashmap iterated results
2018-02-01 18:08:50 +01:00
Lennart Poettering 05cdbb304d
Merge pull request #8045 from yuwata/dump-more
analyze: dump more settings
2018-02-01 10:16:50 +01:00
Lennart Poettering f6c7c39897
Merge pull request #8061 from poettering/selinux-mask-fix
never use /dev/null label when making selinux access decisions
2018-02-01 10:11:30 +01:00
Yu Watanabe e7b2ea7c97 strv: drop strv_join_quoted() (#8057)
The function `strv_join_quoted()` is now not used, and has a bug
in the buffer size calculation when the strings needs to escaped,
as reported in #8056.
So, let's remove the function.

Closes #8056.
2018-02-01 10:11:02 +01:00
Michael Vogt b9ee05c266 sysusers: allow force reusing existing user/group IDs (#8037)
On Debian/Ubuntu systems the default passwd/group files use a
slightly strange mapping. E.g. in passwd:
```
man6:12::/var/cache/man:/sbin/nologin
```
and in group:
```
disk6:
man12:
```

This is not supported in systemd-sysusers right now because
sysusers will not re-use an existing uid/gid in its normal
mode of operation. Unfortunately this reuse is needed to
replicate the default Debian/Ubuntu users/groups.

This commit enforces reuse when the "uid:gid" syntax is used
to fix this.

I also added a test that replicates the Debian base-passwd
passwd/group file to ensure things are ok.
2018-02-01 13:47:50 +09:00
Lennart Poettering 81e9871e87 selinux: make sure we never use /dev/null for making unit selinux access decisions 2018-01-31 19:54:25 +01:00
Lennart Poettering 0d5456556f update TODO 2018-01-31 19:54:25 +01:00
Evgeny Vereshchagin ce691f31aa test-lldp: use memcmp to compare bytes (#8054)
Technically, `data` is a sequence of bytes without a trailing zero,
so the use of `memcmp` seems to be logical here. Besides, this helps get
around a bug that makes `asan` report the false positive mentioned in
 #8052.

Closes #8052.
2018-01-31 09:54:37 +01:00
Yu Watanabe c9d4169919 core/service: dump more settings 2018-01-30 17:10:47 +09:00
Yu Watanabe 9bd0e1b814 core/swap: dump TimeoutSec= 2018-01-30 17:10:09 +09:00
Yu Watanabe 9189979213 core/mount: dump TimeoutSec= 2018-01-30 17:09:59 +09:00
Vito Caputo 302af1c250
Merge pull request #8031 from mrq1/MRQ1_20180128_typo_fix
journalctl: typo fix
2018-01-28 13:03:39 -08:00
Hermann Gausterer fabf4dae16 journalctl: typo fix 2018-01-28 20:49:55 +01:00
Lennart Poettering 46659f7deb
Merge pull request #8030 from keszybz/another-news-update
NEWS: reword one sentence
2018-01-28 16:58:17 +01:00
Zbigniew Jędrzejewski-Szmek 31751f7e2a NEWS: add missing equal sign
Important!
2018-01-28 16:54:18 +01:00
Zbigniew Jędrzejewski-Szmek 1a0cd2c74e NEWS: reword one sentence 2018-01-28 16:52:47 +01:00
Lennart Poettering 82c8e3e650 NEWS: let's get this thing done 2018-01-28 16:36:03 +01:00
Zbigniew Jędrzejewski-Szmek e6501af8b8 NEWS: mention --grep (#8029) 2018-01-28 23:52:06 +09:00
Lennart Poettering 7755083256
Merge pull request #7881 from keszybz/pcre
Add new --grep option to journalctl
2018-01-28 15:29:10 +01:00
Zbigniew Jędrzejewski-Szmek b4766d5f15 journalctl: add highlighting for matched substring
Red is used for highligting, the same as grep does. Except when the line is
highlighted red already, because it has high priority, in which case plain ansi
highlight is used for the matched substring.

Coloring is implemented for short and cat outputs, and not for other types.
I guess we could also add it for verbose output in the future.
2018-01-28 14:50:01 +01:00
Zbigniew Jędrzejewski-Szmek 61c5f8a1f0 journalctl: make matching optionally case sensitive
Case sensitive or case insensitive matching can be requested using
--case-sensitive[=yes|no].

Unless specified, matching is case sensitive if the pattern contains any
uppercase letters, and case insensitive otherwise. This matches what
forward-search does in emacs, and recently also --ignore-case in less.  This
works surprisingly well, because usually when one is wants to do case-sensitive
matching, the pattern is usually camel-cased. In the less frequent case when
case-sensitive matching is required with an all-lowercase pattern,
--case-sensitive can be used to override the automatic logic.
2018-01-28 14:50:01 +01:00
dana 992f51ea42 Slightly improve performance of startable/restartable unit completion (#7839) 2018-01-28 13:29:58 +01:00
Lennart Poettering 508058c9c5 NEWS: update NEWS again, we didn't release yesterday (#8027)
Fix tons of whitespace issues, also add a sysusers.d/ change and update
to contributors list again
2018-01-28 21:28:58 +09:00
Lennart Poettering dcfb4b6103
Merge pull request #8025 from sourcejedi/pid1_journal_or2
pid1: when we can't log to journal, remember our fallback log target
2018-01-28 11:02:24 +01:00
Martin Pitt 055a52575c hwdb: Fix bouncing brightness keys on MSI-PR200
Thanks to djfd for the patch!

Fixes #6972
2018-01-28 10:46:40 +01:00
Michael Biebl b4d7c66808
Merge pull request #8026 from phomes/NEWS-fix
NEWS: typo fix
2018-01-28 00:08:16 +01:00
Thomas Hindoe Paaboel Andersen caf2a2d8e6 NEWS: typo fix 2018-01-28 00:05:27 +01:00
Vito Caputo 647c7b7440 test-hashmap: test IteratedCache
Add some rudimentary testing of the new IteratedCache
2018-01-27 13:11:58 -08:00
Vito Caputo 5d4ba7f2b3 journal: use IteratedCache in sd-journal
This changes real_journal_next() to leverage the IteratedCache for
accelerating iteration across the open journal files.

journalctl timing comparisons with 100 journal files of 8MiB size
party to this boot:

Pre (~v235):
  # time ./journalctl -b --no-pager > /dev/null
  real    0m9.613s
  user    0m9.560s
  sys     0m0.053s

  # time ./journalctl -b --no-pager > /dev/null
  real    0m9.548s
  user    0m9.525s
  sys     0m0.023s

  # time ./journalctl -b --no-pager > /dev/null
  real    0m9.612s
  user    0m9.582s
  sys     0m0.030s

Post-IteratedCache:

  # time ./journalctl -b --no-pager > /dev/null
  real    0m8.449s
  user    0m8.425s
  sys     0m0.024s

  # time ./journalctl -b --no-pager > /dev/null
  real    0m8.409s
  user    0m8.382s
  sys     0m0.027s

  # time ./journalctl -b --no-pager > /dev/null
  real    0m8.410s
  user    0m8.350s
  sys     0m0.061s

~12.5% improvement, the benefit increases the more log files there are.
2018-01-27 13:11:58 -08:00
Vito Caputo 45ea84d8ed basic: implement the IteratedCache
Adds the basics of the IteratedCache and constructor support for the
Hashmap and OrderedHashmap types.

iterated_cache_get() is responsible for synchronizing the cache with
the associated Hashmap and making it available to the caller at the
supplied result pointers.  Since iterated_cache_get() may need to
allocate memory, it may fail, so callers must check the return value.

On success, pointer arrays containing pointers to the associated
Hashmap's keys and values, in as-iterated order, are returned in
res_keys and res_values, respectively.  Either may be supplied as NULL
to inhibit caching of the keys or values, respectively.

Note that if the cached Hashmap hasn't changed since the previous call
to iterated_cache_get(), and it's not a call activating caching of the
values or keys, the cost is effectively zero as the resulting pointers
will simply refer to the previously returned arrays as-is.

A cleanup function has also been added, iterated_cache_free().

This only frees the IteratedCache container and related arrays.  The
associated Hashmap, its keys, and values are not affected.  Also note
that the associated Hashmap does not automatically free its associated
IteratedCache when freed.

One could, in theory, safely access the arrays returned by a
successful iterated_cache_get() call after its associated Hashmap has
been freed, including the referenced values and keys.  Provided the
iterated_cache_get() was performed prior to the hashmap free, and that
the type of hashmap free performed didn't free keys and/or values as
well.
2018-01-27 13:11:50 -08:00
Alan Jenkins 8d5c7661a7 systemd-shutdown: use log_set_prohibit_ipc(true)
Now we have log_set_prohibit_ipc(), let's use it to clarify that
systemd-shutdown is not expected to try and log via journald (which it is
about to kill).  We avoided ever asking systemd-shutdown to do this, but
it's more convenient for the reader if they don't have to think about that.
In that sense, it's similar to using assert() to validate a function's
arguments.
2018-01-27 19:51:30 +00:00
Alan Jenkins cc2b9e6b20 rationalize interface for opening/closing logging
log_open_console() did not switch from stderr to /dev/console, when
"always_reopen_console" was set.  It was necessary to call
log_close_console() first.

By contrast, log_open() did switch between e.g. journald and kmsg according
to the value of "prohibit_ipc".

Let's fix log_open() to respect the values of all the log options, and we
can make log_close_*() private.

Also log_close_console() is changed.  There was some precaution, avoiding
closing the console fd if we are not PID 1.  I think commit 48a601fe made
a little mistake in leaving this in, and it only served to confuse
readers :).

Also I changed systemd-shutdown. Now we have log_set_prohibit_ipc(), let's
use it to clarify that systemd-shutdown is not expected to try and log via
journald (which it is about to kill).  We avoided ever asking it to, but
it's more convenient for the reader if they don't have to think about that.
In that sense, it's similar to using assert() to validate a function's
arguments.
2018-01-27 18:01:51 +00:00
bleep_blop 56a2911255 Update NEWS to reflect changes made in #8020 (#8024) 2018-01-28 01:33:52 +09:00
Batuhan Osman Taşkaya 7c4a807277 [gdb-sd_dump_hashmaps.py] String Formatting Update (#7819)
Changes: % changed as .format()
2018-01-27 14:03:08 +01:00
Lennart Poettering f3ad25df08 NEWS: get ready for release today (#8019) 2018-01-27 13:52:09 +01:00
Yu Watanabe 90657286fc analyze: merge {get,set}-log-{level,target} to log-{level,target} (#8020)
Also, service-watchdogs now shows current watchdog state when
no optional argument is provided.
2018-01-27 13:51:32 +01:00
Zbigniew Jędrzejewski-Szmek 6becf48ca3 journalctl: regexp matching 2018-01-27 13:40:57 +01:00
Evgeny Vereshchagin 4c0d481095
Merge pull request #7933 from keszybz/fuzz-regression
test: add fuzzer regression testing
2018-01-27 12:56:42 +03:00
Andrew Jeddeloh 633b8afdf8 login/meson.build: require ACL for uaccess rules
Don't install udev rules that requires the uaccess builtin if systemd is
being built without the uaccess builtin.
2018-01-27 10:55:32 +01:00
Lennart Poettering 6eda13d3ba journal: losen restrictions on journal file suffix (#8013)
Previously, we'd refuse open journal files with suffixes that aren't
either .journal or .journal~. With this change we only care when we are
creating the journal file.

I looked over the sources to see whether we ever pass files discovered
by directory enumeration to journal_file_open() without first checking
the suffix (in which case the old check made sense), but I couldn't find
any. hence I am pretty sure removing this check is safe.

Fixes: #7972
2018-01-27 17:32:36 +09:00
Yu Watanabe f359fb92da
Merge pull request #8006 from zx2c4-forks/jd/no-wg-ll
networkd: assume no link local addresses for where it isn't used
2018-01-27 17:31:02 +09:00
Yu Watanabe 786b8fa0fb
Merge pull request #7973 from mvo5/sysusers-uid-gid
sysusers: allow uid:gid in sysusers.conf files
2018-01-27 17:24:39 +09:00
Zbigniew Jędrzejewski-Szmek 25a8210234 meson: use env object instead of string in tags targets
I used 'tags' before because this way we avoided a unnecessary
line about 'env' detection. But we cannot use 'env' in test(), so
previous commit added 'env' detection. We might just as well use
it in custom_target().
2018-01-27 09:03:46 +01:00
Zbigniew Jędrzejewski-Szmek b68dfb9e83 Hook up oss-fuzz test cases as tests
This is a bit painful because a separate build of systemd is necessary. The
tests are guarded by tests!=false and slow-tests==true. Running them is not
slow, but compilation certainly is. If this proves unwieldy, we can add a
separate option controlling those builds later.

The build for each sanitizer has its own directory, and we build all fuzzer
tests there, and then pull them out one-by-one by linking into the target
position as necessary. It would be nicer to just build the desired fuzzer, but
we need to build the whole nested build as one unit.

[I also tried making systemd and nested meson subproject. This would work
nicely, but meson does not allow that because the nested target names are the
same as the outer project names. If that is ever fixed, that would be the way
to go.]

v2:
- make sure things still work if memory sanitizer is not available
v3:
- switch to syntax which works with meson 0.42.1 found in Ubuntu
2018-01-27 09:03:46 +01:00
Vito Caputo 84dcca75b4 basic: track dirty state in HashmapBase
This only adds marking the HashmapBase as dirty, no clearing of
the dirty state happens yet.

No functional changes.
2018-01-26 16:04:35 -08:00
Alan Jenkins ba30753899 pid1: when we can't log to journal, remember our fallback log target
If we have to force the logging to close the journal fd, then we can open
any fallback log target.  E.g. kmsg, if the target was the default
JOURNAL_OR_KMSG.

This is the behaviour I would expect from the documentation.  I couldn't
find any justification in the code, for why we would want to start dropping
log messages instead of sending them to the fallback target.

This means we will match the behaviour of processes which we fork and which
set `open_when_needed`, and with generators - which use
log_set_prohibit_ipc(true) - which we fork+exec during a reload.

IMO this illustrates that the log_open/log_close interface is too clunky.
So with the behaviour settled, I will refactor the interface in the next
commit :).
2018-01-26 22:47:16 +00:00
Jason A. Donenfeld 4592e20659 NEWS: add self to news file for this late commit
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-26 15:41:17 +01:00
Jason A. Donenfeld a8f5bba6a0 networkd: assume no link local addresses for where it isn't used
It turns out that link local doesn't make much sense in its context.
Since link local is disabled by the kernel driver, it's important that
networkd assumes it's off too, so that the link can reach the
"configured" stage, without waiting indefinitely for link local
addresses which will never come.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-26 15:41:17 +01:00
Zbigniew Jędrzejewski-Szmek dba081db31 zsh: add service-watchdogs
A zsh counterpart to 21a6abdf0e.
2018-01-26 15:24:09 +01:00