1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-04 13:51:24 +03:00
Commit Graph

36302 Commits

Author SHA1 Message Date
Yu Watanabe
eb1f9e30ec udev-event: replace udev_device in udev_event_execute_rules() by sd_device
Also, this adds many logs.
2018-10-27 07:25:27 +09:00
Yu Watanabe
e52eaf5649 udev-event: move devnode handling logic to a new function
Also, replace udev_device by sd_device.
2018-10-27 07:25:27 +09:00
Yu Watanabe
2740750d40 udev-event: move conditions to rename network interface into rename_netif()
Also, replace udev_device by sd_device.
2018-10-27 07:24:03 +09:00
Yu Watanabe
c1118ceba4 udev-event: rename udev_event_unref() to udev_event_free()
As struct udev_event does not have a reference counter.
2018-10-27 07:03:39 +09:00
Yu Watanabe
d737197154 udev-event: fix memleak in udev_event
The leak was introduced by 29448498c7.
2018-10-27 07:03:39 +09:00
Yu Watanabe
89665d0920 udev-event: use structured initializer at one more place 2018-10-27 07:03:39 +09:00
Yu Watanabe
a368732bc4 udev-event: add more assert() 2018-10-27 07:03:39 +09:00
Yu Watanabe
dc8aec36a6 udev-event: check command is not empty before executing 2018-10-27 07:03:39 +09:00
Yu Watanabe
e9343893f7 udev-event: include device name in error message one more place 2018-10-27 07:03:39 +09:00
Yu Watanabe
7606377e2c network,udev: drop unnecessary check whether ifindex is positive
As sd_device_get_ifindex() now returns positive ifindex when it
succeeds.
2018-10-27 07:03:39 +09:00
Yu Watanabe
5d062b4ef0 test: check sd_device_get_ifindex() returns positive ifindex when it succeeds 2018-10-27 07:03:39 +09:00
Yu Watanabe
1dfa960786 sd-device: return positive ifindex when sd_device_get_ifindex() succeeds
As valid ifindex is positive value, not non-negative value.

Follow-up for dcfbde3a43.
2018-10-27 07:03:38 +09:00
Lennart Poettering
9bf7dba739
Merge pull request #10506 from poettering/cgroup-mini-fixes
various cgroups mini fixes
2018-10-26 20:16:50 +02:00
Lennart Poettering
6897dfe85a core: add free_and_replace() at one more place 2018-10-26 19:49:15 +02:00
Lennart Poettering
7593c3ecbf tree-wide: add a few missing _sentinel_ decorators 2018-10-26 19:49:15 +02:00
Lennart Poettering
46f84f955f cgroup-util: make definition of CGROUP_CONTROLLER_TO_MASK() unsigned
Otherwise doing comparing a CGroupMask (which is unsigned in effect)
with the result of CGROUP_CONTROLLER_TO_MASK() will result in warnings
about signedness differences.
2018-10-26 18:43:34 +02:00
Lennart Poettering
f99850a0d4 cgroup-util: FLAGS_SET()ify all things 2018-10-26 18:43:34 +02:00
Lennart Poettering
03afd78029 cgroup: when discovering which controllers the kernel supports mask with what we support
Let's use our new CGROUP_MASK_V1 and CGROUP_MASK_V2 definitions for
this.
2018-10-26 18:43:34 +02:00
Lennart Poettering
ab275f2386 cgroup-util: before operating on a mounted cgroup controller check if it actually can be mounted
We now have the "BPF" pseudo-controllers. These should never be assumed
to be accessible as /sys/fs/cgroup/<controller> and not through
"cgroup.subtree_control" either, hence always check explicitly before we
go to the file system. We do this through our new CGROUP_MASK_V1 and
CGROUP_MASK_V2 definitions.
2018-10-26 18:43:34 +02:00
Lennart Poettering
4edd65e4cf cgroup-util: add mask definitions for sets of controllers supported by cgroupsv1 vs. cgroupsv2 2018-10-26 18:43:34 +02:00
Lennart Poettering
604028de60 cgroup-util: disable buffering for cg_enable_everywhere() when writing to cgroup attributes
Let's better be safe than sorry.
2018-10-26 18:43:34 +02:00
Lennart Poettering
38a90d45ad cgroup-util: don't expect cg_mask_from_string()'s return value to be initialized
Also, when we fail, don't clobber the return value.

This brings the call more in-line with our usual coding style, and
removes surprises.

None of the callers seemed to care about this behaviour.
2018-10-26 18:43:34 +02:00
Lennart Poettering
0887fa711c cgroup-util: debug log if /proc/self/ns/cgroup is not available for unexpected reasons 2018-10-26 18:43:34 +02:00
Lennart Poettering
0d76d772d1
Merge pull request #10536 from keszybz/serialize-fixes
Tests for the new serialization functions
2018-10-26 17:56:43 +02:00
Lennart Poettering
dc81f52c4d
Merge pull request #10517 from poettering/chown-rec-fixes
recursive chowning fixes
2018-10-26 16:26:20 +02:00
Lennart Poettering
cb9e44db36 test: add test case for recursive chown()ing 2018-10-26 15:13:26 +02:00
Lennart Poettering
cd6b7d50c3 chown-recursive: TAKE_FD() is your friend 2018-10-26 15:13:26 +02:00
Lennart Poettering
f89bc84f32 chown-recursive: also drop ACLs when recursively chown()ing
Let's better be safe than sorry and also drop ACLs.
2018-10-26 15:13:26 +02:00
Lennart Poettering
5de6cce58b chown-recursive: let's rework the recursive logic to use O_PATH
That way we can pin a specific inode and analyze it and manipulate it
without it being swapped out beneath our hands.

Fixes a vulnerability originally found by Jann Horn from Google.

CVE-2018-15687
LP: #1796692
https://bugzilla.redhat.com/show_bug.cgi?id=1639076
2018-10-26 15:13:26 +02:00
Evgeny Vereshchagin
845702c638 lgtm: drop redundant newlines 2018-10-26 14:52:17 +02:00
Lennart Poettering
56abe1d107
Merge pull request #10508 from poettering/watchdog-original-fix
various service watchdog fixes
2018-10-26 14:50:17 +02:00
Lennart Poettering
0ea63f7a7d
Merge pull request #10534 from poettering/cmdline-fixlets
proc-cmdline.c fixlets
2018-10-26 14:49:53 +02:00
Zbigniew Jędrzejewski-Szmek
1c1d719aec Move tests for *serialize_environment into test-serialize.c
The implementation is in serialize.c.
2018-10-26 13:17:49 +02:00
Zbigniew Jędrzejewski-Szmek
fa2951def7 test-serialize: allocate long_string dynamically 2018-10-26 13:17:44 +02:00
Lennart Poettering
aa8c4bbf6a service: when starting a service make a copy of the watchdog timeout and use that
When we start a service process we pass the selected watchdog timeout to
it with the $WATCHDOG_USEC environment variable. If the unit file is
reconfigured later, we need to make sure to continue to honour the
original timeout, i.e. watch $WATCHDOG_USEC was set to, otherwise we'll
expect the ping at a different time as the service process is sending it
to us.

Hence, whenever we start a unit, save the watchdog timeout, and stick to
that for everything we do.

Fixes: #9467
2018-10-26 13:00:04 +02:00
Lennart Poettering
34b3f625f2 service: continue to use the overriden timeout when forking off again
Let's make sure we always use the right watchdog timeout: when a service
has overwritten it, then stick to it, also for follow-up processes of
the same service.
2018-10-26 13:00:04 +02:00
Lennart Poettering
95d0d8ed0a service: rename service_reset_watchdog_timeout() → service_override_watchdog_timeout()
This is what the function really does, hence name it that way.
2018-10-26 13:00:04 +02:00
Lennart Poettering
ec35a7f6b0 service: rework service_extend_timeout()
Let's unify common code: let's extend the watchdog timeout and the
regular timeout with the same helper function.
2018-10-26 13:00:04 +02:00
Zbigniew Jędrzejewski-Szmek
40a4c4b38d test-serialize: a smoke test for the serialization functions 2018-10-26 12:56:53 +02:00
Zbigniew Jędrzejewski-Szmek
75e7d50e26 test: _cleanup_(unlink_tempfilep) in two more places 2018-10-26 12:56:53 +02:00
Zbigniew Jędrzejewski-Szmek
d8351049a8 Introduce fmkostemp_safe and use it in tests
No functional change.
2018-10-26 12:56:51 +02:00
Lennart Poettering
9fb1cdb480 service: explicit stop the watchdog when we shall not use it
This is useful so that WATCHDOG_USEC=0 sent from a process does the
right thing if turning off the watchdog logic.
2018-10-26 12:53:17 +02:00
Lennart Poettering
2a1e0f2228 journalctl: in --follow mode watch stdout for POLLHUP/POLLERR and exit
Fixes: #9374
2018-10-26 12:28:38 +02:00
Evgeny Vereshchagin
f86c1da283 lgtm: add a custom query for catching the use of fgets
As everybody knows, nodoby really reads CODING_STYLE (especially
the last paragraph :-)) so let's utilize LGTM to help us catch the
use of fgets.
2018-10-26 12:27:43 +02:00
Zbigniew Jędrzejewski-Szmek
9f1c81d80a
Merge pull request #10519 from poettering/serialize-fixes
pid1 serialization/deserialization fixes
2018-10-26 12:17:13 +02:00
Lennart Poettering
7d95229ba7 proc-cmdline: teach proc_cmdline_get_key() the same flags magic as proc_cmdline_parse() 2018-10-26 12:03:32 +02:00
Lennart Poettering
cb447ff5cc proc-cmdline: use FLAGS_SET() where appropriate
This was mostly prompted by seeing the expression "in_initrd() && flags
& PROC_CMDLINE_RD_STRICT", which uses & and && without any brackets.
Let's make that a bit more readable and hide all doubts about operator
precedence.
2018-10-26 12:00:37 +02:00
Lennart Poettering
9de12b2ef4 proc-cmdline: use our usual syntax for denoting bit mask enums 2018-10-26 12:00:01 +02:00
Lennart Poettering
b507423026 CODING_STYLE: briefly mention that fgets() should not be used anymore 2018-10-26 10:52:41 +02:00
Lennart Poettering
923db66a16 fileio: drop FOREACH_LINE(), it's not used anymore 2018-10-26 10:52:41 +02:00