Commit graph

22708 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 05f339267e
Merge pull request #10378 from poettering/json-fuzz-fix
json: a comprehensive fix for oss-fuzz#10908
2018-10-25 16:25:39 +02:00
Lennart Poettering 5ec1fca41e
Merge pull request #10518 from poettering/dhcp6-size-fixes
dhcp6 packet size calculation fixes
2018-10-25 13:29:42 +02:00
Zbigniew Jędrzejewski-Szmek 5b8b8056eb
Merge pull request #10504 from poettering/hibernate-fallback
s2h: when hibernate fails after coming back from suspend, go back to suspend
2018-10-25 12:54:47 +02:00
Martin Wilck e1e74614aa core: don't create Requires for workdir if "missing ok"
Don't add an implicit RequiresMountsFor depenency for the
WorkingDirectory of a unit if the "-" character was used to
indicate that "a missing working directory is not considered fatal"
(see systemd.exec(5)). Otherwise systemd might fail the unit
because of missing dependencies.
2018-10-25 11:35:59 +02:00
Lennart Poettering 20b55f8538 dhcp6: prefer offsetof() over sizeof() for structs with undefined sizes
This doesn't change anything in the generated source, but I think makes
semantically more sense, as these structures have undefined size, and we
only want to know the size up to the data field in these cases.
2018-10-25 11:23:19 +02:00
Lennart Poettering 4dac5eaba4 dhcp6: make sure we have enough space for the DHCP6 option header
Fixes a vulnerability originally discovered by Felix Wilhelm from
Google.

CVE-2018-15688
LP: #1795921
https://bugzilla.redhat.com/show_bug.cgi?id=1639067
2018-10-25 11:23:19 +02:00
Lennart Poettering 990668aa4c dhcp6: reduce whitespace a bit 2018-10-25 11:23:19 +02:00
Lennart Poettering 3c290c0316 dhcp6: split assert_return() to be more debuggable when hit 2018-10-25 11:23:19 +02:00
Lennart Poettering e0a18b74a3 dhcp6: constify things where we can 2018-10-25 11:23:19 +02:00
Yu Watanabe 4e412d2684
string-util: fix prototype of explicit_bzero_safe() (#10513)
Follow-up for 87f5446311.
2018-10-25 11:41:55 +09:00
Lennart Poettering def34f63fe time-util: change parse_sec_fix_0() to accept "0s" for infinity too (#10501)
This function is about compatibility, nothing else, hence we should make
it properly compatible.

Fixes: #9556
2018-10-25 05:21:28 +09:00
Lennart Poettering d776fd08a3
Merge pull request #10510 from poettering/uacess-brackets
coverity fixes
2018-10-24 22:18:33 +02:00
Lennart Poettering 87f5446311 string-util: introduce explicit_zero_safe()
The only real difference is that this wrapper can deal with NULL
pointer arguments, but only if the length is also zero.

CID 1396277
2018-10-24 21:00:15 +02:00
Lennart Poettering 7388cea30d udev: use right error variable to make level decision 2018-10-24 20:47:52 +02:00
Lennart Poettering dc4fedd8cb udev: fix bad if {}
CID 1396318
CID 1396319
2018-10-24 20:46:41 +02:00
Lennart Poettering 5f00dc4df6 test: skip various tests if namespacing is not available
Apparently on Debian LXC/AppArmor doesn't allow namespacing to container
payloads. Deal with it.

Fixes: #9700
2018-10-24 19:40:24 +02:00
Lennart Poettering a4bc3c1d25 tests: add helper call have_namespaces() to test whether Linux namespaces are available
A slighly sloppy test call for conditionalizing several tests.
2018-10-24 19:40:24 +02:00
Lennart Poettering 795919efdf tests: as per CODING_STYLE undefine basename() right after including libgen.h 2018-10-24 17:08:12 +02:00
Lennart Poettering eca27ebbc8 tests: alloc-util.h and fs-util.h are our own headers
Hence include them with "" rather than <>. Also including them twices is
a pretty bad idea too.
2018-10-24 17:08:12 +02:00
Lennart Poettering 2194547e3b execute: if we fail to do namespacing, explain why we refuse to continue in a debug message 2018-10-24 17:08:12 +02:00
Lennart Poettering f05e1ae666 sleep: when we can't hibernate on suspend-then-hibernate, fall back to suspend again
Let's make this a bit safer, and try hard to return to sleep, if we can
at all.

Fixes: #10212
2018-10-24 14:44:14 +02:00
Lennart Poettering 14250f0942 sleep: rework what we do if a suspend fails.
First of all, let's fix logging: let's simply log the same message as we
do on success, so that there's always the same pair of these messages
around, regardless if the suspend was successful or not. To distuingish
a successful suspend from a failed one, check the ERRNO= field of the
structured message.

In most ways a failed suspend cycle is not distuingishable from a
successful one that took no time, hence let's treat it this way, and
always pair the success message with a failure message.

This also changes a more important concept: the post-suspend callouts
are now called also called on failure, following the same logic: let's
always run them in pairs: for every pre callout a post callout has to
follow.
2018-10-24 13:07:53 +02:00
Lennart Poettering c695101f47 sleep: no need to check for resume_offset twice
The W_OK check already checks for existance hence let's remove the F_OK
check.
2018-10-24 12:57:37 +02:00
Lennart Poettering eabcf200f7 sleep: let's turn off the RTC alarm time ASAP
Let's be a tiny bit more careful here.

Also, let's rearrange things to simplify them a bit, and to not use "r"
outside of its immediate scope of validity.
2018-10-24 12:52:11 +02:00
Lennart Poettering d029a3a8ca sleep: round up when calculating RTC sleep time
Paranoia: this way we know that when we wake up all timers are
definitely equal or ahead of what we expect them to be.
2018-10-24 12:48:56 +02:00
Lennart Poettering 033cea5c9d sleep: move log message generation for rtc_read_time() into the function itself
The log messages were petty borked anyway, and generated at two separate
locations. Let's fix that.
2018-10-24 12:47:46 +02:00
Lennart Poettering f780e438fa sleep: rework write_wakealarm() to take a numeric parameter
Also, let's rename it to rtc_write_wake_alarm(). Both changes together
make sure rtc_write_wake_alarm() and rtc_read_time() are more alike in
their naming and semantics.
2018-10-24 12:46:12 +02:00
Lennart Poettering c16669a309 sleep: rename read_wakealarm() → rtc_read_time()
It doesn't read wakealarm, but the current time of the RTC. Hence, let's
rename this to make it less misleading.
2018-10-24 12:44:20 +02:00
Lennart Poettering 6ce63245f6 sleep: log about the correct errors 2018-10-24 12:38:13 +02:00
Lennart Poettering 58220e6b91 sleep: don't make up errors, propagate the right ones 2018-10-24 12:38:04 +02:00
Lennart Poettering f00aff0a02 sleep: let's use write_string_file() instead of write_string_stream() if we can
Let's shorten things.
2018-10-24 12:35:49 +02:00
Lennart Poettering d1db1c438f
Merge pull request #10484 from yuwata/udev-spawn-simplify
udev-event: cleanups about udev_event_spawn()
2018-10-24 10:57:45 +02:00
Lennart Poettering e7b48c45ae
Merge pull request #10498 from yuwata/udev-builtin-log
udev-builtin: use log_device_*() macros
2018-10-24 10:53:35 +02:00
Lennart Poettering 77d28bd10f
Merge pull request #10483 from yuwata/udev-cleanup-10
tree-wide: use log_device_*()
2018-10-24 10:51:53 +02:00
Lennart Poettering 086712f99f
Merge pull request #10461 from yuwata/small-cleanups
Fixes recent defects reported by coverity
2018-10-24 10:36:20 +02:00
Jiuyang liu a2f577fca0 add ephemeral to nspawn-settings. 2018-10-24 10:22:20 +02:00
Yu Watanabe 1cb7d29d68 udevadm-info: fix memleak
Fixes CID#1396276.
2018-10-24 05:04:01 +09:00
Yu Watanabe a0570c1a82 udevadm-monitor: initialize variable
Fixes CID#1396278.
2018-10-24 05:04:01 +09:00
Yu Watanabe db8794c3a0 modules-load: return first error in the loop
Follow-up for a889e206a7.
Fixes CID#1396280.
2018-10-24 05:04:01 +09:00
Yu Watanabe fd5ad16cfb reply-password: initialize 'length' variable
Follow-up for 1fd2786161.

This fixes the following warning when built by clang:
```
../src/reply-password/reply-password.c:76:21 warning: variable 'length' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
```

Fixes CID#1396281 and CID#1396277.
2018-10-24 05:03:00 +09:00
Yu Watanabe ec9d636b37 core: use ascii_toupper() instead of everytime judging whether it is the first message 2018-10-24 04:58:08 +09:00
Yu Watanabe e81c3a4c5f udev-event: use sd_event_add_io() for reading stdout or stderr of spawned process 2018-10-24 04:46:48 +09:00
Yu Watanabe 4e57ad3578 udev-event: unify two log_*() by log_full() 2018-10-24 04:46:48 +09:00
Yu Watanabe 5ca3dbc91a udev-event: Capitalize log messages 2018-10-24 04:46:48 +09:00
Yu Watanabe 2e48548fed udev-event: fix condition to create pipe fds
The bug was introduced by feaa6db7ac.
2018-10-24 04:46:48 +09:00
Yu Watanabe f71e8ec10e udev-event: set O_CLOEXEC to pipe fds 2018-10-24 04:46:48 +09:00
Yu Watanabe 947ce772d9 udev-event: make failure in getting device properties fatal 2018-10-24 04:46:48 +09:00
Yu Watanabe 84b1ccb98b udev-event: use rearrange_stdio() and close_all_fds() 2018-10-24 04:46:48 +09:00
Yu Watanabe 6ce075a23a udev-event: set FORK_DEATHSIG flag 2018-10-24 04:46:48 +09:00
Yu Watanabe 63ec4dfaa1 udev-event: drop redundant code
We have set FORK_RESET_SIGNALS in safe_fork(). So, calling
reset_signal_mask() after safe_fork() is redundant.
2018-10-24 04:46:48 +09:00