Zbigniew Jędrzejewski-Szmek [Wed, 28 Mar 2018 08:15:44 +0000 (10:15 +0200)]
shared/specifier: be less extravagant with memory allocations
ubsan times out because we do too many allocations:
$ valgrind build/fuzz-unit-file test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6977-full
...
test/fuzz-regressions/fuzz-unit-file/oss-fuzz-6977-full... ok
==1757==
==1757== HEAP SUMMARY:
==1757== in use at exit: 0 bytes in 0 blocks
==1757== total heap usage: 199,997 allocs, 199,997 frees, 90,045,318,585 bytes allocated
...
==3256== total heap usage: 100,120 allocs, 100,120 frees, 13,097,140 bytes allocated
https://oss-fuzz.com/v2/issue/
4651449704251392/6977 should now be really fixed.
e3c3d6761b3e7d was the first attempt, but even with this change,
e3c3d6761b3e7d
still makes sense.
Zbigniew Jędrzejewski-Szmek [Tue, 27 Mar 2018 20:09:25 +0000 (22:09 +0200)]
core/main: preserve return value under valgrind
Lennart Poettering [Tue, 27 Mar 2018 07:36:49 +0000 (09:36 +0200)]
journal-file: we can't use a chain cache entry if we don't know where it starts (#8542)
It might happen that we try to bisect through a chain of offset arrays in the
journal whose last element was just allocated but no item yet written
to. In that case that array will be all NUL, but it might still end up
in our array chain cache. If it does, we cannot use it for bisection,
since for bisection we need to know the value of the first entry in that
array, but if it's uninitialized it does not have a first value. Hence,
as a simple fix, in this unlikely case, simply ignore the chain cache.
This is supposed to fix the issue pointed out in #8432, but in a more
permissive way, as this case isn't strictly a badly formatted journal
but actually a valid state (though one within a very short time window),
and we should make the best of it, and handle it gracefully.
Background: in each journal file entries are linked up in large arrays
of offsets. In each array the entries are strictly ordered by the
offsets of the entries, which permits search by bisection. These arrays
are allocated with a fixed size and then filled up as entries are added
to the journal file. If an array is fully filled up, a new array
(double in size as the old one) is appended to the journal file, and
linked up. This means, the journal file will contain a series of chained
up arrays, each time doubling in size, and strictly ordered. When
looking for an entry we maintain a "chain cache", which allows us to
bypass traversing the chain in full if we look for entries close to each
other in a short time. With the fix above we make sure we don't
erroneously use a chain cache item that doesn't carry enough information
for this bisection to work.
Original issue identified (with patch) by @Kxuan.
Replaces: #8432
Lennart Poettering [Tue, 27 Mar 2018 05:38:26 +0000 (07:38 +0200)]
label: rework label_fix() implementations (#8583)
This reworks the SELinux and SMACK label fixing calls in a number of
ways:
1. The two separate boolean arguments of these functions are converted
into a flags type LabelFixFlags.
2. The operations are now implemented based on O_PATH. This should
resolve TTOCTTOU races between determining the label for the file
system object and applying it, as it it allows to pin the object
while we are operating on it.
3. When changing a label fails we'll query the label previously set, and
if matches what we want to set anyway we'll suppress the error.
Also, all calls to label_fix() are now (void)ified, when we ignore the
return values.
Fixes: #8566
Zbigniew Jędrzejewski-Szmek [Mon, 26 Mar 2018 16:00:08 +0000 (18:00 +0200)]
Merge pull request #8554 from poettering/chase-trail-slash
fs-util: add new CHASE_TRAIL_SLASH flag for chase_symlinks()
mourikwa [Mon, 26 Mar 2018 15:50:35 +0000 (17:50 +0200)]
Fix for alphabetical ordering (#8581)
I read the addition of the purism laptop keyboard and noticed
that the 60-keyboard.hwdb file could/should have an alphabetical ordering.
I scratched that itch with this commit.
Michael Olbrich [Mon, 26 Mar 2018 15:34:53 +0000 (17:34 +0200)]
core: don't include libmount.h in a header file (#8580)
linux/fs.h sys/mount.h, libmount.h and missing.h all include MS_*
definitions.
To avoid problems, only one of linux/fs.h, sys/mount.h and libmount.h
should be included. And missing.h must be included last.
Without this, building systemd may fail with:
In file included from [...]/libmount/libmount.h:31:0,
from ../systemd-238/src/core/manager.h:23,
from ../systemd-238/src/core/emergency-action.h:37,
from ../systemd-238/src/core/unit.h:34,
from ../systemd-238/src/core/dbus-timer.h:25,
from ../systemd-238/src/core/timer.c:26:
[...]/sys/mount.h:57:2: error: expected identifier before numeric constant
Lennart Poettering [Mon, 26 Mar 2018 13:34:39 +0000 (15:34 +0200)]
Merge pull request #8562 from keszybz/docs
Man page and log message fixes
Zbigniew Jędrzejewski-Szmek [Mon, 26 Mar 2018 12:54:30 +0000 (14:54 +0200)]
Merge pull request #8578 from yuwata/resolve-tool-cleanup
resolve-tool: small cleanups
Yu Watanabe [Sun, 25 Mar 2018 09:57:19 +0000 (18:57 +0900)]
resolve: always shows global settings
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 13:43:52 +0000 (14:43 +0100)]
core/service: rework the hold-off time over message
"hold-off" is apparently confusing, because we also have HoldoffTimeoutSec=.
Let's use RestartSec= directly in the message.
Fixes #5472.
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 13:27:48 +0000 (14:27 +0100)]
man: add an additional note about journalctl -u
Fixes #5387.
I kept the _SYSTEMD_UNIT= example because it is easy to understand and
not very verbose. _SYSTEMD_CGROUP has much longer entries which do not
fit well in the narrow man page. Instead, I added an explanation of what
-u is translated into.
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 13:04:13 +0000 (14:04 +0100)]
man: mention that oldest journal files are removed
Fixes #7225.
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 12:54:20 +0000 (13:54 +0100)]
man: add a note about "archived" journal files and when files can be copied
Issue #6673 requests advice on backup strategy. But the right backup strategy
depends on many factors, too many to describe in a man page. So let's just
provide some general information which files are mutable and that it is always
safe to use/copy files.
Closes #6673.
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 12:15:19 +0000 (13:15 +0100)]
man: add a note about $XDG_SEAT and $XDG_VTNR to pam_systemd(8)
Issue #6499 requests that a mention that those varibles can be set in the
environment is added. But the man page already says that. There isn't much
detail, but a man page does not need to and in this case should not include
all the details. Instead a note is added that those vars can be derived from
$DISPLAY.
Closes #6499.
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 11:59:09 +0000 (12:59 +0100)]
man: add link and list of known attrs to systemd-gpt-auto-generator(8)
Fixes #7859.
Zbigniew Jędrzejewski-Szmek [Wed, 21 Mar 2018 15:38:51 +0000 (16:38 +0100)]
man: add missing headers to glib-event-glue.c
Zbigniew Jędrzejewski-Szmek [Wed, 21 Mar 2018 15:35:02 +0000 (16:35 +0100)]
man: fix compilation of journal-iterate-poll.c
Our examples should compile...
Zbigniew Jędrzejewski-Szmek [Wed, 21 Mar 2018 19:02:49 +0000 (20:02 +0100)]
man: drop license header in glib-event-glue.c
We're moving towards just SPDX license identifiers, and the boilerplate
is especially annoying in a man page. Also adjust to the smaller indentation
to make the code fit better on a page.
Zbigniew Jędrzejewski-Szmek [Wed, 21 Mar 2018 15:32:17 +0000 (16:32 +0100)]
man: move examples out of sd_journal_get_fd into separate files
man/.dir-locals is to keep indentation under control.
This makes it much easier to compile and run those examples, c.f. #7578.
v2:
- copy more of .dir-locals.el from the root to man/.dir-locals.el
(I though emacs would inherit from the one in the parent dir, but
it seems it just uses its own broken defaults, including
indent-tabs-mode by default.)
Yu Watanabe [Tue, 20 Mar 2018 09:11:39 +0000 (18:11 +0900)]
resolve: actually shows information about all specified interfaces
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 18:22:24 +0000 (19:22 +0100)]
Merge pull request #8565 from poettering/cocci-again
run all coccinelle again
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 18:21:25 +0000 (19:21 +0100)]
Merge pull request #8559 from poettering/integration-test-fixes
make integration tests pass again
Lennart Poettering [Fri, 23 Mar 2018 15:33:38 +0000 (16:33 +0100)]
coccinelle: run no-if-assignments.cocci again
Lennart Poettering [Fri, 23 Mar 2018 15:32:48 +0000 (16:32 +0100)]
coccinelle: run safe_fclose.cocci again
Lennart Poettering [Fri, 23 Mar 2018 15:32:26 +0000 (16:32 +0100)]
coccinelle: run while-true.cocci again
James Cowgill [Fri, 23 Mar 2018 15:04:16 +0000 (15:04 +0000)]
Partially revert "seccomp: add mmap and address family restrictions for MIPS" (#8563)
This reverts the mmap parts of
f5aeac1439d64905c7b1b57042c39589dd31e3a6,
but keeps the part which restricts address families which works
correctly.
Unfortunately the MIPS toolchains still do not implement PT_GNU_STACK.
This means that while the commit to restrict mmap on MIPS was "correct",
it had the side effect of causing pthread_create to fail because glibc tries
to allocate an executable stack for new threads in the absense of
PT_GNU_STACK. We should wait until PT_GNU_STACK is implemented in all
the relevant parts of the toolchain (at least gcc and glibc) before
enabling this again.
Lennart Poettering [Fri, 23 Mar 2018 14:44:10 +0000 (15:44 +0100)]
run-coccinelle.sh: use set -x for showing command line of "spatch"
Let's make sure run-coccinelle.sh generates similar output as
run-integration-tests.sh, hence use the same "set -x" logic.
Lennart Poettering [Fri, 23 Mar 2018 14:41:33 +0000 (15:41 +0100)]
coccinelle: run const-strlen.cocci again
Lennart Poettering [Fri, 23 Mar 2018 09:02:22 +0000 (10:02 +0100)]
run-integration-tests: show number of tests run
Lennart Poettering [Fri, 23 Mar 2018 08:51:02 +0000 (09:51 +0100)]
run-integration-tests: show make command line executed
That makes it much easier to figure out what to type to just run one
specific test for debugging.
Lennart Poettering [Fri, 23 Mar 2018 08:48:15 +0000 (09:48 +0100)]
test: bypass selinux integration test if selinux policy devel package is not installed
With this "sudo ./run-integration-tests.sh" should work fully without
exception, even on systems lacking SELinux (in which case that test will
just be skipped)
Lennart Poettering [Fri, 23 Mar 2018 08:47:04 +0000 (09:47 +0100)]
stat-util: fix fd_is_network_ns()
This was broken in
77f9fa3b8ea46c27e5a5e9270f71bf1b4000c3e0. My fault.
Fixes: #8543
Michal Sekletar [Fri, 23 Mar 2018 14:28:06 +0000 (15:28 +0100)]
core: delay adding target dependencies until all units are loaded and aliases resolved (#8381)
Currently we add target dependencies while we are loading units. This
can create ordering loops even if configuration doesn't contain any
loop. Take for example following configuration,
$ systemctl get-default
multi-user.target
$ cat /etc/systemd/system/test.service
[Unit]
After=default.target
[Service]
ExecStart=/bin/true
[Install]
WantedBy=multi-user.target
If we encounter such unit file early during manager start-up (e.g. load
queue is dispatched while enumerating devices due to SYSTEMD_WANTS in
udev rules) we would add stub unit default.target and we order it Before
test.service. At the same time we add implicit Before to
multi-user.target. Later we merge two units and we create ordering cycle
in the process.
To fix the issue we will now never add any target dependencies until we
loaded all the unit files and resolved all the aliases.
Lennart Poettering [Fri, 23 Mar 2018 14:26:54 +0000 (15:26 +0100)]
Merge pull request #8552 from keszybz/test-improvements
Test and diagnostics improvements
Lennart Poettering [Fri, 23 Mar 2018 14:21:35 +0000 (15:21 +0100)]
tree-wide: tabs suck (#8527)
Lennart Poettering [Fri, 23 Mar 2018 14:20:34 +0000 (15:20 +0100)]
backlight: minor modernizations (#8528)
Use strjoina() and STR_IN_SET()
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 14:19:32 +0000 (15:19 +0100)]
Merge pull request #8529 from poettering/logind-fixlets
three trivial logind improvements
Peter Hutterer [Fri, 23 Mar 2018 14:15:41 +0000 (00:15 +1000)]
udev: don't label high-button mice as joysticks (#8493)
If a device exposes more than 16 mouse buttons, we run into the BTN_JOYSTICK
range, also labelling it as joystick. And since 774ff9b this results in only
ID_INPUT_JOYSTICK but no ID_INPUT_MOUSE.
Fixes #8460
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 14:13:02 +0000 (15:13 +0100)]
Merge pull request #8530 from poettering/include-is-obsolete
actively say that .include is obsolete
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 14:11:46 +0000 (15:11 +0100)]
Merge pull request #8533 from poettering/bootup-shutdown-phase2
extend docs on second phase of shutdown and watchdog handling
Zbigniew Jędrzejewski-Szmek [Fri, 23 Mar 2018 11:30:12 +0000 (12:30 +0100)]
Merge pull request #8534 from poettering/safe-atoi-full
some improvements to safe_atou() to allow specification of arbitrary bases
Zbigniew Jędrzejewski-Szmek [Thu, 22 Mar 2018 12:03:41 +0000 (13:03 +0100)]
tree-wide: warn when a directory path already exists but has bad mode/owner/type
When we are attempting to create directory somewhere in the bowels of /var/lib
and get an error that it already exists, it can be quite hard to diagnose what
is wrong (especially for a user who is not aware that the directory must have
the specified owner, and permissions not looser than what was requested). Let's
print a warning in most cases. A warning is appropriate, because such state is
usually a sign of borked installation and needs to be resolved by the adminstrator.
$ build/test-fs-util
Path "/tmp/test-readlink_and_make_absolute" already exists and is not a directory, refusing.
(or)
Directory "/tmp/test-readlink_and_make_absolute" already exists, but has mode 0775 that is too permissive (0755 was requested), refusing.
(or)
Directory "/tmp/test-readlink_and_make_absolute" already exists, but is owned by 1001:1000 (1000:1000 was requested), refusing.
Assertion 'mkdir_safe(tempdir, 0755, getuid(), getgid(), MKDIR_WARN_MODE) >= 0' failed at ../src/test/test-fs-util.c:320, function test_readlink_and_make_absolute(). Aborting.
No functional change except for the new log lines.
Alan Jenkins [Thu, 22 Mar 2018 22:33:38 +0000 (22:33 +0000)]
Merge pull request #8553 from poettering/take-take
introduce TAKE_FD() and TAKE_PTR() macros
Lennart Poettering [Thu, 22 Mar 2018 20:41:54 +0000 (21:41 +0100)]
units: document why systemd-time-wait-sync.service conditions on CAP_SYS_TIME (#8555)
As requested by @evverx in https://github.com/systemd/systemd/pull/8537#issuecomment-
375122615
Lennart Poettering [Thu, 22 Mar 2018 16:12:23 +0000 (17:12 +0100)]
vconsole: minor modernizations
Lennart Poettering [Thu, 22 Mar 2018 16:07:18 +0000 (17:07 +0100)]
vconsole-setup: don't concat strv if we don't need to (i.e. not in debug log mode)
Lennart Poettering [Thu, 22 Mar 2018 16:04:29 +0000 (17:04 +0100)]
macro: introduce new TAKE_FD() macro
This is similar to TAKE_PTR() but operates on file descriptors, and thus
assigns -1 to the fd parameter after returning it.
Removes 60 lines from our codebase. Pretty good too I think.
Lennart Poettering [Thu, 22 Mar 2018 15:59:46 +0000 (16:59 +0100)]
sleep-config: replace USE() macro with TAKE_PTR() usage
let's use the new generic macor instead of the locally defined, specific
one.
Lennart Poettering [Thu, 22 Mar 2018 15:53:26 +0000 (16:53 +0100)]
macro: introduce TAKE_PTR() macro
This macro will read a pointer of any type, return it, and set the
pointer to NULL. This is useful as an explicit concept of passing
ownership of a memory area between pointers.
This takes inspiration from Rust:
https://doc.rust-lang.org/std/option/enum.Option.html#method.take
and was suggested by Alan Jenkins (@sourcejedi).
It drops ~160 lines of code from our codebase, which makes me like it.
Also, I think it clarifies passing of ownership, and thus helps
readability a bit (at least for the initiated who know the new macro)
Lennart Poettering [Thu, 22 Mar 2018 18:59:49 +0000 (19:59 +0100)]
sd-device: make use of the fact that log_debug_errno() returns the error passed in
Lennart Poettering [Thu, 22 Mar 2018 18:54:24 +0000 (19:54 +0100)]
fs-util: add new CHASE_TRAIL_SLASH flag for chase_symlinks()
This rearranges chase_symlinks() a bit: if no special flags are
specified it will now revert to behaviour before
b12d25a8d631af00b200e7aa9dbba6ba4a4a59ff. However, if the new
CHASE_TRAIL_SLASH flag is specified it will follow the behaviour
introduced by that commit.
I wasn't sure which one to make the beaviour that requires specification
of a flag to enable. I opted to make the "append trailing slash"
behaviour the one to enable by a flag, following the thinking that the
function should primarily be used to generate a normalized path, and I
am pretty sure a path without trailing slash is the more "normalized"
one, as the trailing slash is not really a part of it, but merely a
"decorator" that tells various system calls to generate ENOTDIR if the
path doesn't refer to a path.
Or to say this differently: if the slash was part of normalization then
we really should add it in all cases when the final path is a directory,
not just when the user originally specified it.
Fixes: #8544
Replaces: #8545
Jan Synacek [Thu, 22 Mar 2018 18:24:37 +0000 (19:24 +0100)]
man/udevadm: remove superfluous --version from subcommands (#8549)
There's need to show the program specific --version for each subcommand.
Zbigniew Jędrzejewski-Szmek [Wed, 21 Mar 2018 15:07:20 +0000 (16:07 +0100)]
man: add a note that nspawn gives access to network by default
Fixes #6546.
Zbigniew Jędrzejewski-Szmek [Thu, 22 Mar 2018 11:38:01 +0000 (12:38 +0100)]
basic/mkdir: convert bool flag to enum
In preparation for subsequent changes...
Zbigniew Jędrzejewski-Szmek [Thu, 22 Mar 2018 08:24:14 +0000 (09:24 +0100)]
test-execute: skip exec-specifier-interpolation if perl is missing
Zbigniew Jędrzejewski-Szmek [Thu, 22 Mar 2018 07:50:10 +0000 (08:50 +0100)]
test-execute: allow sit0@ to exist in private network namespace
It's always visible:
$ sudo modprobe sit
$ sudo unshare -n ip l
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN mode DEFAULT group default qlen 1000
...
2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
...
Zbigniew Jędrzejewski-Szmek [Thu, 22 Mar 2018 07:42:02 +0000 (08:42 +0100)]
test-execute: simplify checks if grep output is empty
grep already indicates if it matched anything by return value.
Additional advantage is then that if the test fails, the unexpected
matching lines are visible in the log output.
Zbigniew Jędrzejewski-Szmek [Thu, 22 Mar 2018 07:34:21 +0000 (08:34 +0100)]
tests: skip udev-test when perl is not installed
James Cowgill [Thu, 22 Mar 2018 14:40:44 +0000 (14:40 +0000)]
seccomp: add mmap and address family restrictions for MIPS (#8547)
Lennart Poettering [Thu, 22 Mar 2018 14:36:48 +0000 (15:36 +0100)]
Merge pull request #8531 from poettering/dhcp-server-mini-fixes
some minor tweaks to sd-dhcp-server
Lennart Poettering [Thu, 22 Mar 2018 14:36:01 +0000 (15:36 +0100)]
HACKING: small umask tweak for the rootpw (#8541)
Peter A. Bigot [Thu, 22 Mar 2018 02:27:27 +0000 (21:27 -0500)]
units: disable systemd-time-sync-wait inside containers (#8537)
Fixes #8535
Peter A. Bigot [Wed, 21 Mar 2018 22:56:33 +0000 (17:56 -0500)]
doc/HACKING: show command to set root password in image (#8540)
Fixes #8538
juergbi [Wed, 21 Mar 2018 22:41:19 +0000 (23:41 +0100)]
main: add NoNewPrivileges config option (#8475)
This makes it possible to disable new privileges for the whole system.
Lennart Poettering [Wed, 21 Mar 2018 21:31:40 +0000 (22:31 +0100)]
parse-util: similar to safe_atou16_full() add safe_atou_full()
What's good for uint16_t is also good for unsigned.
This is preparation for: #8140
Lennart Poettering [Wed, 21 Mar 2018 21:27:19 +0000 (22:27 +0100)]
parse-util: introduce safe_atou16_full()
safe_atou16_full() is like safe_atou16() but also takes a base
parameter. safe_atou16() is then implemented as inline function on top
of it, passing 0 as base. Similar safe_atoux16() is reworked as inline
function too, with 16 as base.
Lennart Poettering [Wed, 21 Mar 2018 21:00:21 +0000 (22:00 +0100)]
man: watchdog documentation improvements
Lennart Poettering [Wed, 21 Mar 2018 19:57:06 +0000 (20:57 +0100)]
man: document that there's a second phase of shutdown in bootup(7)
Lennart Poettering [Wed, 21 Mar 2018 19:30:56 +0000 (20:30 +0100)]
dhcp-server: don't propagate erros up the event loop
If we can't send a message this is no reason to completely abort the
event handler.
Issue identified by Nandor Han <nandor.han@ge.com>, Sebastian Reichel
<sebastian.reichel@collabora.co.uk>.
Replaces: #8525
Lennart Poettering [Wed, 21 Mar 2018 19:30:29 +0000 (20:30 +0100)]
dhcp-sever: check properly for invalid fds
We generally just compare for negativity, not for equlity to -1, let's
do so here too.
Lennart Poettering [Wed, 21 Mar 2018 19:29:43 +0000 (20:29 +0100)]
dhcp_server_handle_message: don't pretend there was a difference between return code 0 or 1
We ignore the difference anyway, hence let's systematically return 0.
Lennart Poettering [Wed, 21 Mar 2018 19:29:07 +0000 (20:29 +0100)]
dhcp-server: reduce level of indentation a bit
Less indentation is good, let's do that where it's easy.
Lennart Poettering [Wed, 21 Mar 2018 19:28:01 +0000 (20:28 +0100)]
dhcp-server: introduce log_dhcp_server_errno()
Sometimes we want to print the error number, hence do so properly, and
avoid to use strerror() which is not reentrant.
Lennart Poettering [Wed, 21 Mar 2018 19:25:46 +0000 (20:25 +0100)]
dhcp-server: don't assign sendmsg() return value to "int"
The type is "ssize_t", not "int", let's be accurate about that, as these
types are different on some archs.
Given that we don't actually care about the return value reall, drop
the whole assignment, just check if negative.
Lennart Poettering [Fri, 23 Feb 2018 19:50:22 +0000 (20:50 +0100)]
conf-parse: small prettification
Let's use first_word() instead of startswith(), it's more explanatory
and a bit more correct. Also, let's use the return value instead of
adding +9 when looking for the second part of the directive.
Lennart Poettering [Fri, 23 Feb 2018 19:46:38 +0000 (20:46 +0100)]
conf-parser: let's explicitly deprecate .include in unit files
.include lines are already deprecated somewhat, and for example
explicitly not mentioned in the documentation for this reason. Let's get
one step further and generatea warning when we encounter them (but still
process them).
Why are they deprecated? Because they are semantically awful — they
complicate stat() based mtime checks for configuration files and they
allow arbitrary loops we currently have zero protection against and
really shouldn't have to have.
Lennart Poettering [Wed, 21 Mar 2018 18:06:59 +0000 (19:06 +0100)]
logind: drop obsolete comment
The code matching this comment was removed in
a50df72b37ce2a7caf7775c70d18c3f9504b9e80 in 2014, let's drop the comment
too.
Lennart Poettering [Wed, 21 Mar 2018 18:06:21 +0000 (19:06 +0100)]
logind: use manager_get_user_by_pid() where appropriate
The current code reimplemented something like the
manager_get_user_by_pid() logic on its own, manually. Let's unify this.
Lennart Poettering [Wed, 21 Mar 2018 18:04:45 +0000 (19:04 +0100)]
logind: rework manager_get_{user|session}_by_pid() a bit
Let's make sure we always initialize the return value if we return
non-negative.
Just a matter of coding style: we should always initialize our return
values when we return >= 0, and leave them unclobbered if we return < 0.
Zbigniew Jędrzejewski-Szmek [Wed, 21 Mar 2018 14:26:47 +0000 (15:26 +0100)]
When mangling names, optionally emit a warning (#8400)
The warning is not emitted for absolute paths like /dev/sda or /home, which are
converted to .device and .mount unit names without any fuss.
Most of the time it's unlikely that users use invalid unit names on purpose,
so let's warn them. Warnings are silenced when --quiet is used.
$ build/systemctl show -p Id hello@foo-bar/baz
Invalid unit name "hello@foo-bar/baz" was escaped as "hello@foo-bar-baz" (maybe you should use systemd-escape?)
Id=hello@foo-bar-baz.service
$ build/systemd-run --user --slice foo-bar/baz --unit foo-bar/foo true
Invalid unit name "foo-bar/foo" was escaped as "foo-bar-foo" (maybe you should use systemd-escape?)
Invalid unit name "foo-bar/baz" was escaped as "foo-bar-baz" (maybe you should use systemd-escape?)
Running as unit: foo-bar-foo.service
Fixes #8302.
Lennart Poettering [Wed, 21 Mar 2018 14:26:25 +0000 (15:26 +0100)]
Merge pull request #8523 from keszybz/oss-fuzz-fixes
A fix for oss-fuzz msan ListenNetlink workaround
Franck Bui [Wed, 21 Mar 2018 14:26:02 +0000 (15:26 +0100)]
user-util: add new wrappers for reading/writing {passwd,shadow,gshadow} database files (#8521)
The API povided by the glibc is too error-prone as one has to deal directly
with errno in order to detect if errors occured.
Suggested by Zbigniew.
Zbigniew Jędrzejewski-Szmek [Wed, 21 Mar 2018 12:16:25 +0000 (13:16 +0100)]
fuzz-unit-file: fix check if ListenNetlink is used
A line may contain leading spaces which we should skip.
Fixes https://oss-fuzz.com/v2/issue/
5546208027213824/7049.
Zbigniew Jędrzejewski-Szmek [Wed, 21 Mar 2018 12:15:01 +0000 (13:15 +0100)]
shared/conf-parser: fix outdated comment
Lennart Poettering [Wed, 21 Mar 2018 11:52:18 +0000 (12:52 +0100)]
ac-power: add simple getopt() argument parsing to systemd-ac-power (#8516)
We should probably do that for all our tools, hence fill in this gap
here.
Zbigniew Jędrzejewski-Szmek [Wed, 21 Mar 2018 11:50:49 +0000 (12:50 +0100)]
Merge pull request #8508 from poettering/more-cocci
two new coccinelle rules files and their results
Peter A. Bigot [Wed, 21 Mar 2018 11:42:04 +0000 (06:42 -0500)]
time-sync-wait: add service (#8494)
This one-shot service waits until the kernel time has been set to
synchronized.
Lennart Poettering [Wed, 21 Mar 2018 11:37:54 +0000 (12:37 +0100)]
Merge pull request #8313 from alexgartrell/compression-threshold
Compression threshold
Lennart Poettering [Wed, 21 Mar 2018 11:36:47 +0000 (12:36 +0100)]
Merge pull request #8368 from yuwata/nss-systemd-getpwent
nss-systemd: make dynamic users enumerable by `getent`
Lennart Poettering [Wed, 21 Mar 2018 11:10:01 +0000 (12:10 +0100)]
dissect: add dissect_image_and_warn() that unifies error message generation for dissect_image() (#8517)
Lennart Poettering [Wed, 21 Mar 2018 11:03:45 +0000 (12:03 +0100)]
move MANAGER_IS_RELOADING() check into manager_recheck_{dbus|journal}() (#8510)
Let's better check this inside of the call than before it, so that we
never issue this while reloading, even should these calls be called due
to other reasons than just the unit notify.
This makes sure the reload state is unset a bit earlier in
manager_reload() so that we can safely call this function from there and
they do the right thing.
Follow-up for
e63ebf71edd7947f29389c72e851d8df5c7bedda.
Lennart Poettering [Wed, 21 Mar 2018 10:59:56 +0000 (11:59 +0100)]
fileio: port parse_env_file_internal() to use _cleanup_free_ (#8511)
Long Li [Wed, 21 Mar 2018 10:51:28 +0000 (03:51 -0700)]
v3: Properly parsing SCSI Hyperv devices (#8509)
Since 2016, Hyperv devices moved to using standard way to expose UUID to sysfs. Fix the parsing function to work with the newer format.
Change log:
v2: changed code to work with both old and new path format
v3: changed guid_str_len type to size_t, fixed length in char guid[] in handle_scsi_hyperv()
Lennart Poettering [Wed, 21 Mar 2018 10:50:57 +0000 (11:50 +0100)]
Merge pull request #8487 from keszybz/oss-fuzz-fixes
Oss fuzz fixes, another batch
Lennart Poettering [Wed, 21 Mar 2018 10:48:40 +0000 (11:48 +0100)]
selinux: let's fully (and statically) initialize log callback union (#8512)
We can make this const and static, and initialize this ahead of time and
fully, hence let's do that.
Zbigniew Jędrzejewski-Szmek [Wed, 21 Mar 2018 10:48:06 +0000 (11:48 +0100)]
Merge pull request #8513 from poettering/journal-minifixes
two minor journal fixes
Lennart Poettering [Wed, 21 Mar 2018 10:46:49 +0000 (11:46 +0100)]
sd-bus: drop fd_nonblock() calls that are implied by rearrange_stdio() (#8514)
Lennart Poettering [Wed, 21 Mar 2018 10:46:08 +0000 (11:46 +0100)]
coredumpctl: drop unnecessary NULL initialization, and use const where possible (#8515)
Yu Watanabe [Thu, 8 Mar 2018 03:53:43 +0000 (12:53 +0900)]
doc: update TODO