Lennart Poettering [Thu, 5 Jul 2018 07:56:54 +0000 (09:56 +0200)]
core: swap order of "n_storage_fds" and "n_socket_fds" parameters
When process fd lists to pass to activated programs we always place the
socket activation fds first, and the storage fds last. Irritatingly in
almost all calls the "n_storage_fds" parameter (i.e. the number of
storage fds to pass) came first so far, and the "n_socket_fds" parameter
second. Let's clean this up, and specify the number of fds in the order
the fds themselves are passed.
(Also, let's fix one more case where "unsigned" was used to size an
array, while we should use "size_t" instead.)
(cherry picked from commit
25b583d7ffd699384435eba8e49f6ce927a83af0)
Resolves: #
1683334
Filipe Brandenburger [Wed, 25 Jul 2018 01:46:01 +0000 (18:46 -0700)]
socket-util: Introduce send_one_fd_iov() and receive_one_fd_iov()
These take a struct iovec to send data together with the passed FD.
The receive function returns the FD through an output argument. In case data is
received, but no FD is passed, the receive function will set the output
argument to -1 explicitly.
Update code in dynamic-user to use the new helpers.
(cherry picked from commit
d34673ecb825aa9ecf6958b0caab792f5061c56a)
Resolves: #
1683319
Filipe Brandenburger [Wed, 25 Jul 2018 03:15:55 +0000 (20:15 -0700)]
test-socket-util: Add tests for receive_fd_iov() and friends.
Test it when sending an FD without any contents, or an FD and some contents,
or only contents and no FD (using a bare send().)
Also fix the previous test which forked but was missing an _exit() at the
end of the child execution code.
(cherry picked from commit
8a3386ab4fea9c4efa9c72e7c149cf510a46f03e)
Resolves: #
1683319
Frantisek Sumsal [Sat, 23 Feb 2019 21:28:05 +0000 (22:28 +0100)]
travis: switch from trusty to xenial
This should fix the timeout in test-event
Taken from:
b635e4ef6b2f35f07111bb66a68fe850a2ccab72
Resolves: #
1683319
Lennart Poettering [Sat, 8 Dec 2018 19:21:43 +0000 (20:21 +0100)]
mount-point: honour AT_SYMLINK_FOLLOW correctly
Fixes: #11092
(cherry picked from commit
be24321f3dae91a166166b239954032727439942)
Resolves: #
1683319
Lennart Poettering [Wed, 10 Oct 2018 09:12:54 +0000 (11:12 +0200)]
sd-bus: call cap_last_cap() only once in has_cap()
Also, use the same type everywhere for dealing with it.
(cherry picked from commit
92a40e20bf970c3ded8a50fbeeae882a7b970c9a)
Resolves: #
1683319
Lennart Poettering [Wed, 10 Oct 2018 09:12:22 +0000 (11:12 +0200)]
sd-bus: use size_t when dealing with memory offsets
(cherry picked from commit
3cae6c21e732fd46ff024d6625243d88ef6377ed)
Resolves: #
1683319
Lennart Poettering [Wed, 10 Oct 2018 09:07:54 +0000 (11:07 +0200)]
capability: introduce CAP_TO_MASK_CORRECTED() macro replacing CAP_TO_MASK()
linux/capability.h's CAP_TO_MASK potentially shifts a signed int "1"
(i.e. 32bit wide) left by 31 which means it becomes negative. That's
just weird, and ubsan complains about it. Let's introduce our own macro
CAP_TO_MASK_CORRECTED which doesn't fall into this trap, and make use of
it.
Fixes: #10347
(cherry picked from commit
5f00c5684f96c93a22840f7241ee444b9a632b1e)
Resolves: #
1683319
Evgeny Vereshchagin [Fri, 12 Oct 2018 12:17:04 +0000 (12:17 +0000)]
sd-journal: escape binary data in match_make_string()
Fixes: #10383
(cherry picked from commit
9e8b1ec08e8eb0b4611b7caf6adb8828feb32312)
Resolves: #
1683319
Zbigniew Jędrzejewski-Szmek [Tue, 21 Aug 2018 17:44:48 +0000 (19:44 +0200)]
test-socket-util: avoid "memleak" reported by valgrind
valgrind reports the allocation done in the short-lived child as a leak.
Let's restructure the code to avoid this.
(cherry picked from commit
181c4ba750770b54a54b5abbe8ae8ff4f6db59b5)
Resolves: #
1683319
Yu Watanabe [Wed, 8 Aug 2018 07:22:55 +0000 (16:22 +0900)]
util: introduce memcmp_safe()
(cherry picked from commit
f30faf854b9bf01da294547a1bc3660506d750db)
Resolves: #
1683319
Lennart Poettering [Wed, 10 Oct 2018 09:34:30 +0000 (11:34 +0200)]
tree-wide: various ubsan zero size memory fixes
Fixes: #10346
(cherry picked from commit
65f95765d05ddcd9e5849b68c379afa7e87d1248)
Resolves: #
1683319
Frantisek Sumsal [Fri, 9 Nov 2018 11:47:30 +0000 (12:47 +0100)]
tests: keep SYS_PTRACE when running under ASan
(cherry picked from commit
7a3025658836c536f81fdd742fa338545294f5bf)
Resolves: #
1683319
Frantisek Sumsal [Sat, 23 Feb 2019 16:10:55 +0000 (17:10 +0100)]
travis: enable ASan and UBSan on RHEL8
Resolves: #
1683319
rhel-only
Yu Watanabe [Wed, 22 Aug 2018 03:33:27 +0000 (12:33 +0900)]
util: do not use stack frame for parsing arbitrary inputs
This replaces strndupa() by strndup() in socket_address_parse(),
as input string may be too long.
Fixes issue 10007 by ClusterFuzz-External:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10007
(cherry picked from commit
8d30fcb9b51b1d102a589171b6e28f5f370236f6)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Thu, 23 Aug 2018 12:48:40 +0000 (14:48 +0200)]
bus-message: avoid wrap-around when using length read from message
We would read (-1), and then add 1 to it, call message_peek_body(..., 0, ...),
and when trying to make use of the data.
The fuzzer test case is just for one site, but they all look similar.
v2: fix two UINT8_MAX/UINT32_MAX mismatches founds by LGTM
(cherry picked from commit
902000c19830f5e5a96e8948d691b42e91ecb1e7)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Sat, 11 Aug 2018 09:43:09 +0000 (11:43 +0200)]
bus-message: return -EBADMSG not -EINVAL on invalid !gvariant messages
(cherry picked from commit
d831fb6f2bde829f9309aea242f502587662d1cc)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Sat, 11 Aug 2018 09:31:45 +0000 (11:31 +0200)]
fuzz-bus-message: add two test cases that pass now
It seems that they got fixed by one of the patches. Let's add them
just in case.
(cherry picked from commit
edde66ffc2404de58e8b19810951f376efb344da)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Sat, 11 Aug 2018 07:02:48 +0000 (09:02 +0200)]
bus-message: also properly copy struct signature when skipping
The change is similar to that in the previous commit, but I don't have
a reproducer / test case case for this one, so I'm keeping it seperate.
(cherry picked from commit
3d338a302f56c0ef0445660d9856794abe1af8b5)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Sat, 11 Aug 2018 06:32:20 +0000 (08:32 +0200)]
bus-message: fix skipping of array fields in !gvariant messages
We copied part of the string into a buffer that was off by two.
If the element signature had length one, we'd copy 0 bytes and crash when
looking at the "first" byte. Otherwise, we would crash because strncpy would
not terminate the string.
(cherry picked from commit
73777ddba5100fe6c0791cd37a91f24a515f3202)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Fri, 3 Aug 2018 16:05:27 +0000 (18:05 +0200)]
bus-message: output debug information about offset troubles
(cherry picked from commit
0b4775b52747bebf7ecb62062798475629767044)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Fri, 3 Aug 2018 14:36:51 +0000 (16:36 +0200)]
bus-message: drop asserts in functions which are wrappers for varargs version
The function does no processing on it's own, and just forwards arguments
to the other function. Let's just use the asserts there.
(cherry picked from commit
8792bdf8a3311f9e629daa0ec592c97c1cfb2a7c)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Fri, 3 Aug 2018 12:46:57 +0000 (14:46 +0200)]
bus-message: fix calculation of offsets table for arrays
This is similar to the grandparent commit 'fix calculation of offsets table',
except that now the change is for array elements. Same story as before: we need
to make sure that the offsets increase enough taking alignment into account.
While at it, rename 'p' to 'previous' to match similar code in other places.
(cherry picked from commit
f88214cf9d66c93f4d22c4c8980de9ee3ff45bab)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Thu, 2 Aug 2018 12:25:31 +0000 (14:25 +0200)]
bus-message: remove duplicate assignment
(cherry picked from commit
4d82a8d5052fce8c1ea51f8bdec3476fb8cc4747)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Thu, 2 Aug 2018 12:25:11 +0000 (14:25 +0200)]
bus-message: fix calculation of offsets table
The offsets specify the ends of variable length data. We would trust the
incoming data, putting the offsets specified in our message
into the offsets tables after doing some superficial verification.
But when actually reading the data we apply alignment, so we would take
the previous offset, align it, making it bigger then current offset, and
then we'd try to read data of negative length.
In the attached example, the message specifies the following offsets:
[1, 4]
but the alignment of those items is
[1, 8]
so we'd calculate the second item as starting at 8 and ending at 4.
(cherry picked from commit
12603b84d2fb07603e2ea94b240c6b78ad17510e)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Wed, 1 Aug 2018 22:46:20 +0000 (00:46 +0200)]
bus: do not print (null) if the message has unknown type
(cherry picked from commit
e8fd7e4b5b5269377efc641a7da43850822c1250)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Tue, 24 Jul 2018 19:24:53 +0000 (21:24 +0200)]
bus-message: use define
(cherry picked from commit
f22c308aff556bf5c6599ffcb61e637e366ab232)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Tue, 24 Jul 2018 18:14:39 +0000 (20:14 +0200)]
bus-message: rename function for clarity
There's already message_free_last_container(), so rename to match.
(cherry picked from commit
9c65778d614588d21645163dea97a5fe2c1c4ca5)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Mon, 9 Jul 2018 09:12:33 +0000 (11:12 +0200)]
bus-message: let's always use -EBADMSG when the message is bad
-EINVAL means the arguments were somehow wrong, so translate the code we get
internally into -EBADMSG when returning.
(cherry picked from commit
69bd42ca072dfb2f7603b1f82053063293ab54b5)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Mon, 9 Jul 2018 08:52:51 +0000 (10:52 +0200)]
bus-message: avoid an infinite loop on empty structures
The alternative would be to treat gvariant and !gvariant messages differently.
But this is a problem because we check signatures is variuos places before we
have an actual message, for example in sd_bus_add_object_vtable(). It seems
better to treat things consistent (i.e. follow the lowest common denominator)
and disallow empty structures everywhere.
(cherry picked from commit
ec6bda56cbca9509b1abde1122645630caca877c)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Mon, 9 Jul 2018 05:38:10 +0000 (07:38 +0200)]
bus-message: use structured initialization to avoid use of unitialized memory
As far as I can see, we would either reuse some values from a previously exited
container or just random bytes from the heap.
Should fix #10127.
(cherry picked from commit
cf81c68e96aa29d0c28b5d3a26d1de9aa1b53b85)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Sat, 7 Jul 2018 17:30:25 +0000 (19:30 +0200)]
fuzz-bus-message: add fuzzer for message parsing
As with other fuzzers, SYSTEMD_FUZZ_OUTPUT=1 and SYSTEMD_LOG_LEVEL=debug can be
used for debugging.
(cherry picked from commit
56b560c26339c4b282c06038316a91509eae75fd)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Fri, 10 Aug 2018 15:15:05 +0000 (17:15 +0200)]
meson: treat all fuzz cases as unit tests
318/365 fuzz-bus-message:crash-
26bba7182dedc8848939931d9fcefcb7922f2e56:address OK 0.03 s
319/365 fuzz-bus-message:crash-
29ed3c202e0ffade3cad42c8bbeb6cc68a21eb8e:address OK 0.03 s
320/365 fuzz-bus-message:crash-
b88ad9ecf4aacf4a0caca5b5543953265367f084:address OK 0.03 s
321/365 fuzz-bus-message:crash-
c1b37b4729b42c0c05b23cba4eed5d8102498a1e:address OK 0.03 s
322/365 fuzz-bus-message:crash-
d8f3941c74219b4c03532c9b244d5ea539c61af5:address OK 0.03 s
323/365 fuzz-bus-message:crash-
e1b811da5ca494e494b77c6bd8e1c2f2989425c5:address OK 0.03 s
324/365 fuzz-bus-message:leak-
c09c0e2256d43bc5e2d02748c8d8760e7bc25d20:address OK 0.04 s
325/365 fuzz-bus-message:message1:address OK 0.03 s
326/365 fuzz-bus-message:timeout-
08ee8f6446a4064db064e8e0b3d220147f7d0b5b:address OK 0.03 s
327/365 fuzz-dhcp-server:discover-existing:address OK 0.04 s
328/365 fuzz-dhcp-server:discover-new:address OK 0.03 s
329/365 fuzz-dhcp-server:release:address OK 0.04 s
330/365 fuzz-dhcp-server:request-existing:address OK 0.03 s
331/365 fuzz-dhcp-server:request-new:address OK 0.03 s
332/365 fuzz-dhcp-server:request-reboot:address OK 0.03 s
333/365 fuzz-dhcp-server:request-renew:address OK 0.03 s
334/365 fuzz-dns-packet:issue-7888:address OK 0.03 s
335/365 fuzz-dns-packet:oss-fuzz-5465:address OK 0.03 s
336/365 fuzz-journal-remote:crash-
5a8f03d4c3a46fcded39527084f437e8e4b54b76:address OK 0.06 s
337/365 fuzz-journal-remote:crash-
96dee870ea66d03e89ac321eee28ea63a9b9aa45:address OK 0.04 s
338/365 fuzz-journal-remote:invalid-ts.txt:address OK 0.04 s
339/365 fuzz-journal-remote:oss-fuzz-8659:address OK 0.06 s
340/365 fuzz-journal-remote:oss-fuzz-8686:address OK 0.04 s
341/365 fuzz-journal-remote:sample.txt:address OK 0.07 s
342/365 fuzz-unit-file:directives.service:address OK 0.03 s
343/365 fuzz-unit-file:empty.scope:address OK 0.04 s
344/365 fuzz-unit-file:machine.slice:address OK 0.03 s
345/365 fuzz-unit-file:oss-fuzz-6884:address OK 0.05 s
346/365 fuzz-unit-file:oss-fuzz-6885:address OK 0.03 s
347/365 fuzz-unit-file:oss-fuzz-6886:address OK 0.04 s
348/365 fuzz-unit-file:oss-fuzz-6892:address OK 0.03 s
349/365 fuzz-unit-file:oss-fuzz-6897:address OK 0.05 s
350/365 fuzz-unit-file:oss-fuzz-6897-evverx:address OK 0.04 s
351/365 fuzz-unit-file:oss-fuzz-6908:address OK 0.05 s
352/365 fuzz-unit-file:oss-fuzz-6917:address OK 0.06 s
353/365 fuzz-unit-file:oss-fuzz-6977:address OK 0.08 s
354/365 fuzz-unit-file:oss-fuzz-6977-unminimized:address OK 0.10 s
355/365 fuzz-unit-file:oss-fuzz-7004:address OK 0.03 s
356/365 fuzz-unit-file:oss-fuzz-8064:address OK 0.03 s
357/365 fuzz-unit-file:oss-fuzz-8827:address OK 0.50 s
358/365 fuzz-unit-file:proc-sys-fs-binfmt_misc.automount:address OK 0.03 s
359/365 fuzz-unit-file:syslog.socket:address OK 0.03 s
360/365 fuzz-unit-file:systemd-ask-password-console.path:address OK 0.03 s
361/365 fuzz-unit-file:systemd-machined.service:address OK 0.03 s
362/365 fuzz-unit-file:systemd-resolved.service:address OK 0.03 s
363/365 fuzz-unit-file:systemd-tmpfiles-clean.timer:address OK 0.03 s
364/365 fuzz-unit-file:timers.target:address OK 0.03 s
365/365 fuzz-unit-file:var-lib-machines.mount:address OK 0.04 s
This gives us slightly nicer coverage in the normal test run.
When in a git repo, git ls-files is used to get a list of files known to git.
This mirrors what update-man-rules does for man files. Only looking at files
known to git makes it easier to not forget to commit the test file to git,
and also makes bisecting easier if some files are left in repo.
When outside of a git repo, we expect to be unpacked from a tarball, so just
using all files reported by ls is OK.
(cherry picked from commit
e6bad6746151c79a5f408e95714ffa5cea290ab0)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Fri, 10 Aug 2018 14:50:07 +0000 (16:50 +0200)]
meson: use .source_root() in more places
In the main meson.build file, .source_root() and .current_source_dir() are
equivalent, but it seems more appropriate to use .source_root() when we are appending
a path which is by design relative to repo root.
(cherry picked from commit
243e5cecc3a211519544ccba01c44edc827ac517)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Tue, 7 Aug 2018 16:10:53 +0000 (18:10 +0200)]
meson: drop duplicated condition
The generic check suffices for those four.
(cherry picked from commit
6bd2bc8e16a6d515f8a21c47fd6b833d7fcfdd1c)
Resolves: #
1696224
Yu Watanabe [Wed, 18 Jul 2018 00:25:57 +0000 (09:25 +0900)]
meson: allow building resolved and machined without nss modules
This adds -Dnss-resolve= and -Dnss-mymachines= meson options.
By using this option, e.g., resolved can be built without nss-resolve.
When no nss modules are built, then test-nss is neither built.
Also, This changes the option name -Dmyhostname= to -Dnss-myhostname=
for consistency to other nss related options.
Closes #9596.
(cherry picked from commit
08540a9591efe105439be81fc43d6dc65b715978)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Tue, 7 Aug 2018 15:34:47 +0000 (17:34 +0200)]
meson: add -Dlog-trace to set LOG_TRACE
The justification is the same as for -Dvalgrind: setting config in
meson in this way is easier, because when the value is changed stuff
that should be rebuilt is rebuilt.
(cherry picked from commit
fd5dec9adf76591d713f163d43d04e3beb76893e)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Sat, 7 Jul 2018 17:08:52 +0000 (19:08 +0200)]
test-bus-marshal: use cescaping instead of hexmem
It is easier to see the contents this way by eye.
(cherry picked from commit
3ddf3d439463ab2c76391a4d22b54166be2dbe94)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Sat, 7 Jul 2018 16:09:21 +0000 (18:09 +0200)]
fuzz: unify the "fuzz-regressions" directory with the main corpus
There isn't really much need to keep them separate. Anything which is a good
corpus entry can be used as a smoke test, and anything which which is a
regression test can just as well be inserted into the corpus.
The only functional difference from this patch (apart from different paths in
output) is that the regression tests are now zipped together with the rest of
the corpus.
$ meson configure build -Dslow-tests=true && ninja -C build test
...
307/325 fuzz-dns-packet:issue-7888:address OK 0.06 s
308/325 fuzz-dns-packet:oss-fuzz-5465:address OK 0.04 s
309/325 fuzz-journal-remote:crash-
5a8f03d4c3a46fcded39527084f437e8e4b54b76:address OK 0.07 s
310/325 fuzz-journal-remote:crash-
96dee870ea66d03e89ac321eee28ea63a9b9aa45:address OK 0.05 s
311/325 fuzz-journal-remote:oss-fuzz-8659:address OK 0.05 s
312/325 fuzz-journal-remote:oss-fuzz-8686:address OK 0.07 s
313/325 fuzz-unit-file:oss-fuzz-6884:address OK 0.06 s
314/325 fuzz-unit-file:oss-fuzz-6885:address OK 0.05 s
315/325 fuzz-unit-file:oss-fuzz-6886:address OK 0.05 s
316/325 fuzz-unit-file:oss-fuzz-6892:address OK 0.05 s
317/325 fuzz-unit-file:oss-fuzz-6897:address OK 0.05 s
318/325 fuzz-unit-file:oss-fuzz-6897-evverx:address OK 0.06 s
319/325 fuzz-unit-file:oss-fuzz-6908:address OK 0.07 s
320/325 fuzz-unit-file:oss-fuzz-6917:address OK 0.07 s
321/325 fuzz-unit-file:oss-fuzz-6977:address OK 0.13 s
322/325 fuzz-unit-file:oss-fuzz-6977-unminimized:address OK 0.12 s
323/325 fuzz-unit-file:oss-fuzz-7004:address OK 0.05 s
324/325 fuzz-unit-file:oss-fuzz-8064:address OK 0.05 s
325/325 fuzz-unit-file:oss-fuzz-8827:address OK 0.52 s
(cherry picked from commit
c74a3f973e3e0bac13d66a28728a47f10046b71f)
Resolves: #
1696224
Yu Watanabe [Wed, 22 Aug 2018 03:39:40 +0000 (12:39 +0900)]
test: add testcase for issue 10007 by oss-fuzz
(cherry picked from commit
a1a605f144e5635fdae57125a92032b3e5ebeca9)
Resolves: #
1696224
Zbigniew Jędrzejewski-Szmek [Sat, 7 Jul 2018 15:43:40 +0000 (17:43 +0200)]
fuzz: rename "fuzz-corpus" directory to just "fuzz"
Also, all corpus subdirectories are named exactly the same as the fuzzer they
are for. This makes the paths a bit longer, but easier.
(cherry picked from commit
93b575b26605c347a717b2aa24ddf9cad08b8080)
Resolves: #
1696224
Evgeny Vereshchagin [Wed, 26 Sep 2018 18:09:09 +0000 (18:09 +0000)]
tests: add a reproducer for another infinite loop in ndisc_handle_datagram
(cherry picked from commit
bbb393877b2cfcbe2f205c902ca7d9f7ce91f1a1)
Resolves: #
1696224
Evgeny Vereshchagin [Wed, 26 Sep 2018 15:10:21 +0000 (15:10 +0000)]
tests: add a reproducer for an infinite loop in ndisc_handle_datagram
=0 ndisc_router_parse (rt=0x60d000000110) at ../src/libsystemd-network/ndisc-router.c:126
=1 0x000055555558dc67 in ndisc_handle_datagram (nd=0x608000000020, rt=0x60d000000110) at ../src/libsystemd-network/sd-ndisc.c:170
=2 0x000055555558e65d in ndisc_recv (s=0x611000000040, fd=4, revents=1, userdata=0x608000000020) at ../src/libsystemd-network/sd-ndisc.c:233
=3 0x00007ffff63913a8 in source_dispatch (s=0x611000000040) at ../src/libsystemd/sd-event/sd-event.c:3042
=4 0x00007ffff6395eab in sd_event_dispatch (e=0x617000000080) at ../src/libsystemd/sd-event/sd-event.c:3455
=5 0x00007ffff6396b12 in sd_event_run (e=0x617000000080, timeout=
18446744073709551615) at ../src/libsystemd/sd-event/sd-event.c:3512
=6 0x0000555555583f5c in LLVMFuzzerTestOneInput (data=0x6060000000e0 "\206", size=53) at ../src/fuzz/fuzz-ndisc-rs.c:422
=7 0x0000555555586356 in main (argc=2, argv=0x7fffffffe3d8) at ../src/fuzz/fuzz-main.c:33
(cherry picked from commit
df30e78e02f653c9e6ee6677b7ccaea21d3dcd7d)
Resolves: #
1696224
Evgeny Vereshchagin [Sun, 2 Sep 2018 18:13:31 +0000 (18:13 +0000)]
tests: add reproducers for several issues uncovered with fuzz-journald-syslog
This is a follow-up to
a70f343cacf03ac51cdefb0d2e.
(cherry picked from commit
3311c74d0560e4aa6a223f5e288a5fbf2404d3fa)
Resolves: #
1696224
Yu Watanabe [Fri, 28 Sep 2018 10:28:05 +0000 (19:28 +0900)]
ndisc: fix two infinite loops
(cherry picked from commit
f3241c61f12dbd8f0ed37419ae272e291d09461d)
Resolves: #
1696224
Evgeny Vereshchagin [Wed, 26 Sep 2018 15:04:26 +0000 (15:04 +0000)]
tests: add a fuzzer for sd-ndisc
(cherry picked from commit
0f0a1dad7d69802a7e6c7fc9aba350f0e87c1952)
Resolves: #
1696224
Evgeny Vereshchagin [Mon, 3 Sep 2018 07:05:48 +0000 (07:05 +0000)]
tests: add a fuzzer for server_process_native_message
(cherry picked from commit
9cdea02db57a36442ad9e9afcd67760ca319173a)
Resolves: #
1696224
Evgeny Vereshchagin [Mon, 3 Sep 2018 07:03:10 +0000 (07:03 +0000)]
journald: make server_process_native_message compatible with fuzz_journald_processing_function
(cherry picked from commit
21acb27b71f6284a57e4e9f3ac5f0d38721ef4eb)
Resolves: #
1696224
Evgeny Vereshchagin [Mon, 3 Sep 2018 06:46:24 +0000 (06:46 +0000)]
tests: rework the code fuzzing journald
This should make it easier to add a new fuzzer without a lot of
duplication.
(cherry picked from commit
b1bd453f36b9428b6bf9feba31fa0a2b36143e9c)
Resolves: #
1696224
Evgeny Vereshchagin [Fri, 10 Aug 2018 12:52:07 +0000 (12:52 +0000)]
journald: free the allocated memory before returning from dev_kmsg_record
This fixes a minor memory leak.
(cherry picked from commit
30eddcd51b8a472e05d3b8d1f0b89fbd3e094d71)
Resolves: #
1696224
Evgeny Vereshchagin [Fri, 10 Aug 2018 12:45:42 +0000 (12:45 +0000)]
journald: make it clear that dev_kmsg_record modifies the string passed to it
The function replaces a couple commas, a semicolon and the final newline with
zero bytes in the string passed to it. The 'const' seems to have been added
by accident during a bulk edit (more specifically
3b3154df7e2773332bb814).
(cherry picked from commit
1e0c5fc2a76e4f3d508331f410899c50493e1fc9)
Resolves: #
1696224
Evgeny Vereshchagin [Mon, 3 Sep 2018 03:18:26 +0000 (06:18 +0300)]
tests: add a rudimentary fuzzer for server_process_syslog_message (#9979)
(cherry picked from commit
a70f343cacf03ac51cdefb0d2e7651b04fd2e23a)
Resolves: #
1696224
Lennart Poettering [Thu, 8 Nov 2018 08:32:17 +0000 (09:32 +0100)]
analyze: add new security verb
(cherry picked from commit
ec16f3b6dd8b03e3ce6eff1fa9f21432208ef42b)
Conflicts:
src/analyze/analyze.c
Resolves: #
1689832
Lennart Poettering [Tue, 6 Nov 2018 16:59:58 +0000 (17:59 +0100)]
locale-util: add logic to output smiley emojis at various happiness levels
(cherry picked from commit
5f1b0cc6d064f7847982e7b680cab3d080aef52e)
Conflicts:
doc/ENVIRONMENT.md
src/basic/locale-util.c
src/basic/locale-util.h
src/test/test-locale-util.c
Related: #
1689832
Lennart Poettering [Mon, 3 Dec 2018 20:39:39 +0000 (21:39 +0100)]
format-table: never try to reuse cells that have color/url/uppercase set
The table cell reusing code is supposed to be an internal memory
optimization, and not more. This means behaviour should be the same as
if we wouldn't reuse cells.
(cherry picked from commit
94a80afed42a8b36d69a229bf44ba690f8f59a78)
Related: #
1689832
Lennart Poettering [Mon, 3 Dec 2018 20:36:26 +0000 (21:36 +0100)]
format-table: add option to uppercase cells on display
This adds a per-cell option for uppercasing displayed strings.
Implicitly turn this on for the header row. The fact that we format the
table header in uppercase is a formatting thing after all, hence should
be applied by the formatter, i.e. the table display code.
Moreover, this provides us with the benefit that we can more nicely
reuse the specified table headers as JSON field names, like we already
do: json field names are usually not uppercase.
(cherry picked from commit
359abf6dd05aa6bca3438e9c969ed904bd3d447d)
Related: #
1689832
Lennart Poettering [Mon, 3 Dec 2018 19:28:15 +0000 (20:28 +0100)]
format-table: use right field for display
Since .timespan and .timestamp are unionized on top of each other this
doesn't actually matter, but it is still more correct to address it
under it's correct name.
(cherry picked from commit
c93d372d7ceda0b080487fa35d3638ef3d8507cb)
Related: #
1689832
Lennart Poettering [Wed, 14 Nov 2018 17:39:37 +0000 (18:39 +0100)]
format-table: make sure we never call memcmp() with NULL parameters
(cherry picked from commit
88db94fa57c9a5b1a0b926c49d3624fc84c88090)
Related: #
1689832
Lennart Poettering [Fri, 9 Nov 2018 10:38:12 +0000 (11:38 +0100)]
format-table: add calls to query the data in a specific cell
(cherry picked from commit
62d99b39709f903f8a66a9aae757deb5546a53eb)
Related: #
1689832
Lennart Poettering [Thu, 8 Nov 2018 20:39:28 +0000 (21:39 +0100)]
format-table: always underline header line
(cherry picked from commit
30d98de00c68440ff4d77d851b4b3323c34027da)
Related: #
1689832
Lennart Poettering [Thu, 8 Nov 2018 20:21:09 +0000 (21:21 +0100)]
format-table: add an API for getting the cell at a specific row/column
(cherry picked from commit
9314ead7853a1479fc60eb2ae7e3d0a77b7eba7c)
Related: #
1689832
Lennart Poettering [Thu, 8 Nov 2018 20:17:47 +0000 (21:17 +0100)]
format-table: add table_update() to update existing entries
(cherry picked from commit
27e730e6d0a7709c17ccef170f10846e92dca2a0)
Related: #
1689832
Lennart Poettering [Wed, 7 Nov 2018 16:41:32 +0000 (17:41 +0100)]
format-table: optionally allow reversing the sort order for a column
(cherry picked from commit
a2c73e2d3823e878de7a7ee193631108c5fc5be0)
Related: #
1689832
Lennart Poettering [Wed, 7 Nov 2018 14:25:51 +0000 (15:25 +0100)]
format-table: add option to store/format percent and uint64_t values in cells
(cherry picked from commit
a4661181fa702a8bff4644210ba7ea14bea51a4a)
Related: #
1689832
Lennart Poettering [Tue, 6 Nov 2018 17:37:21 +0000 (18:37 +0100)]
format-table: before outputting a color, check if colors are available
This is in many cases redundant, as a similar check is done by various
callers already, but in other cases (where we read the color from a
static table for example), it's nice to let the color check be done by
the table code itself, and since it doesn't hurt in the other cases just
do it again.
(cherry picked from commit
a22318e55492af721879d8692ed039144696bb08)
Related: #
1689832
Lennart Poettering [Tue, 6 Nov 2018 11:06:14 +0000 (12:06 +0100)]
format-table: optionally make specific cells clickable links
(cherry picked from commit
165ca5663e9859083c70d793a6b4aa4f3b2af24c)
Related: #
1689832
Lennart Poettering [Thu, 8 Nov 2018 20:16:23 +0000 (21:16 +0100)]
format-table: when duplicating a cell, also copy the color
(cherry picked from commit
13b0d4d7bdb674d0e51a6d595abd1e7bf2691bf9)
Related: #
1689832
Zbigniew Jędrzejewski-Szmek [Mon, 24 Sep 2018 14:59:12 +0000 (16:59 +0200)]
seccomp: reduce logging about failure to add syscall to seccomp
Our logs are full of:
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call oldstat() / -10037, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call get_thread_area() / -10076, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call set_thread_area() / -10079, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call oldfstat() / -10034, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call oldolduname() / -10036, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call oldlstat() / -10035, ignoring: Numerical argument out of domain
Sep 19 09:22:10 autopkgtest systemd[690]: Failed to add rule for system call waitpid() / -10073, ignoring: Numerical argument out of domain
...
This is pointless and makes debug logs hard to read. Let's keep the logs
in test code, but disable it in nspawn and pid1. This is done through a function
parameter because those functions operate recursively and it's not possible to
make the caller to log meaningfully.
There should be no functional change, except the skipped debug logs.
(cherry-picked from commit
b54f36c604472ffe08830ec4306fa2885b4a5424)
Resolves: #
1658691
Lennart Poettering [Fri, 18 Jan 2019 19:13:55 +0000 (20:13 +0100)]
nss: unportect errno before writing to NSS' *errnop
Fixes: #11321
(cherry picked from commit
cdccd29f39cd20cb2a8b71e50445eb839f076331)
Resolves: #
1691691
Lennart Poettering [Fri, 18 Jan 2019 19:04:13 +0000 (20:04 +0100)]
util.h: add new UNPROTECT_ERRNO macro
THis is inspired by #11395, but much simpler.
(cherry picked from commit
840f606d88fef2f5d240b2d759ce7b951354d5bb)
Resolves: #
1691691
Yu Watanabe [Sun, 15 Jul 2018 14:00:00 +0000 (23:00 +0900)]
nss: do not modify errno when NSS_STATUS_NOTFOUND or NSS_STATUS_SUCCESS
This also adds PROTECT_ERRNO for all nss module functions.
C.f. glibc NSS documents https://www.gnu.org/software/libc/manual/html_node/NSS-Modules-Interface.html
and discussion in https://sourceware.org/bugzilla/show_bug.cgi?id=23410.
Fixes #9585.
(cherry picked from commit
06202b9e659e5cc72aeecc5200155b7c012fccbc)
Resolves: #
1691691
Jan Synacek [Tue, 22 Jan 2019 09:28:42 +0000 (10:28 +0100)]
units: add [Install] section to tmp.mount
rhel-only
Resolves: #
1667065
Lennart Poettering [Wed, 5 Dec 2018 17:42:32 +0000 (18:42 +0100)]
logs-show: use grey color for de-emphasizing journal log output
(cherry picked from commit
67df9b7a06d749fdd84f19f7d75ccf0d743f6d72)
Resolves: #
1695601
Jan Synacek [Thu, 2 May 2019 12:11:54 +0000 (14:11 +0200)]
journal: don't enable systemd-journald-audit.socket by default
Resolves: #
1699287
Jan Synacek [Thu, 2 May 2019 12:08:39 +0000 (14:08 +0200)]
Revert "journal: remove journal audit socket"
This reverts commit
8618ef2fb30b4139c9bec4e45fb499cd8192a87f.
Resolves: #
1699287
Lennart Poettering [Fri, 5 Oct 2018 21:04:51 +0000 (23:04 +0200)]
unit: enqueue cgroup empty check event if the last ref on a unit is dropped
(cherry picked from commit
e5c36295d81971ef75d9c6f98f0890b92a4a353f)
Resolves: #
1697893
Lennart Poettering [Fri, 5 Oct 2018 20:56:40 +0000 (22:56 +0200)]
nspawn: rework how we allocate/kill scopes
Fixes: #6347
(cherry picked from commit
1d78fea2d6230e0aafa2603abc8f1f51966ef134)
Resolves: #
1697893
Lennart Poettering [Fri, 5 Oct 2018 20:56:20 +0000 (22:56 +0200)]
nspawn: merge two variable declaration lines
(cherry picked from commit
df61bc5e4aa19f9b211dbe8414343b44361e442c)
Resolves: #
1697893
Lennart Poettering [Fri, 5 Oct 2018 20:54:57 +0000 (22:54 +0200)]
nspawn: simplify machine terminate bus call
We have the machine name anyway, let's use TerminateMachine() on
machined's Manager object directly with it. That way it's a single
method call only, instead of two, to terminate the machine.
(cherry picked from commit
11d81e506ed68c6c5cebe319dc57a9a2fc4319c5)
Resolves: #
1697893
Yu Watanabe [Tue, 7 Aug 2018 01:14:30 +0000 (10:14 +0900)]
tree-wide: shorten error logging a bit
Continuation of
4027f96aa08c73f109aa46b89842ca0e25c9c0e9.
(cherry picked from commit
4ae25393f37b96b2b753562a349d68947ab1ad3d)
Resolves: #
1697893
Lukas Nykryn [Thu, 25 Jun 2015 07:20:59 +0000 (09:20 +0200)]
Revert "core: one step back again, for nspawn we actually can't wait for cgroups running empty since systemd will get exactly zero notifications about it"
This reverts commit
743970d2ea6d08aa7c7bff8220f6b7702f2b1db7.
RHEL-only
https://bugzilla.redhat.com/show_bug.cgi?id=
1141137
https://github.com/systemd/systemd/pull/350
Resolves: #
1703485
Jussi Pakkanen [Sat, 6 Apr 2019 19:59:06 +0000 (21:59 +0200)]
meson: drop misplaced -Wl,--undefined argument
Ld's man page says the following:
-u symbol
--undefined=symbol
Force symbol to be entered in the output file as an undefined symbol. Doing
this may, for example, trigger linking of additional modules from standard
libraries. -u may be repeated with different option arguments to enter
additional undefined symbols. This option is equivalent to the "EXTERN"
linker script command.
If this option is being used to force additional modules to be pulled into
the link, and if it is an error for the symbol to remain undefined, then the
option --require-defined should be used instead.
This would imply that it always requires an argument, which this does not
pass. Thus it will grab the next argument on the command line as its
argument. Before it took one of the many -lrt args (presumably) and now it
grabs something other random linker argument and things break.
[zj: this line was added in the first version of the meson configuration back
in
5c23128daba7236a6080383b2a5649033cfef85c. AFAICT, this was a mistake. No
such flag appeared in Makefile.am at the time.]
https://github.com/mesonbuild/meson/issues/5113
(cherry picked from commit
700805f6c546f2adb79059614f3747f7b5474325)
Lennart Poettering [Wed, 13 Feb 2019 15:51:22 +0000 (16:51 +0100)]
sd-bus: if we receive an invalid dbus message, ignore and proceeed
dbus-daemon might have a slightly different idea of what a valid msg is
than us (for example regarding valid msg and field sizes). Let's hence
try to proceed if we can and thus drop messages rather than fail the
connection if we fail to validate a message.
Hopefully the differences in what is considered valid are not visible
for real-life usecases, but are specific to exploit attempts only.
(cherry-picked from commit
6d586a13717ae057aa1b4127400c3de61cd5b9e7)
Related: #
1678641
Riccardo Schirone [Mon, 4 Feb 2019 13:29:28 +0000 (14:29 +0100)]
Allocate temporary strings to hold dbus paths on the heap
Paths are limited to BUS_PATH_SIZE_MAX but the maximum size is anyway too big
to be allocated on the stack, so let's switch to the heap where there is a
clear way to understand if the allocation fails.
(cherry-picked from commit
f519a19bcd5afe674a9b8fc462cd77d8bad403c1)
Related: #
1678641
Riccardo Schirone [Mon, 4 Feb 2019 13:29:09 +0000 (14:29 +0100)]
Refuse dbus message paths longer than BUS_PATH_SIZE_MAX limit.
Even though the dbus specification does not enforce any length limit on the
path of a dbus message, having to analyze too long strings in PID1 may be
time-consuming and it may have security impacts.
In any case, the limit is set so high that real-life applications should not
have a problem with it.
(cherry-picked from commit
61397a60d98e368a5720b37e83f3169e3eb511c4)
Related: #
1678641
Filipe Brandenburger [Tue, 17 Jul 2018 18:32:40 +0000 (11:32 -0700)]
bus-socket: Fix line_begins() to accept word matching full string
The switch to memory_startswith() changed the logic to only look for a space or
NUL byte after the matched word, but matching the full size should also be
acceptable.
This changed the behavior of parsing of "AUTH\r\n", where m will be set to 4,
since even though the word will match, the check for it being followed by ' '
or NUL will make line_begins() return false.
Tested:
- Using netcat to connect to the private socket directly:
$ echo -ne '\0AUTH\r\n' | sudo nc -U /run/systemd/private
REJECTED EXTERNAL ANONYMOUS
- Running the Ignition blackbox test:
$ sudo sh -c 'PATH=$PWD/bin/amd64:$PATH ./tests.test'
PASS
Fixes:
d27b725abf64a19a6b2f99332b663f17ad046771
(cherry picked from commit
3f10c66270b74530339b3f466c43874bb40c210f)
Resolves: #
1692991
Frantisek Sumsal [Tue, 12 Mar 2019 21:44:25 +0000 (22:44 +0100)]
test: don't overwrite TESTDIR if already set
(cherry picked from commit
3f50fff536d715aee5e5195ec60e2af047b73c7f)
Evgeny Vereshchagin [Thu, 30 Aug 2018 04:01:18 +0000 (07:01 +0300)]
tests: also run TEST-01-BASIC in an unprivileged container (#9957)
This should make it much easier to catch regressions like
https://github.com/systemd/systemd/issues/9914 and
https://github.com/systemd/systemd/issues/8535.
(cherry picked from commit
746fbd9c34af5ed8b6d9aa7a9cbd7cac63a3afce)
Evgeny Vereshchagin [Thu, 5 Jul 2018 16:30:52 +0000 (16:30 +0000)]
tests: allow passing additional arguments to nspawn via NSPAWN_ARGUMENTS
(cherry picked from commit
57916ea352b85153ecbed803d52861ca8b933dd3)
Evgeny Vereshchagin [Thu, 5 Jul 2018 15:14:07 +0000 (15:14 +0000)]
tests: use the asan wrapper to boot a VM/container if systemd is built with ASAN
(cherry picked from commit
016fa3b9e8c3550d49f659c49b5ff4d93337aefe)
Evgeny Vereshchagin [Tue, 3 Jul 2018 19:29:42 +0000 (19:29 +0000)]
tests: redirect ASAN reports on journald to a file
Otherwise, they will end up in /dev/null.
(cherry picked from commit
88ed0f261ba8164a689395ddee8b92d00e073515)
Evgeny Vereshchagin [Tue, 3 Jul 2018 03:25:53 +0000 (03:25 +0000)]
tests: add a wrapper for when systemd is built with ASAN
(cherry picked from commit
1786fae3668fa94359ee58a8c11031dc46459255)
Evgeny Vereshchagin [Thu, 5 Jul 2018 04:09:30 +0000 (04:09 +0000)]
tests: create the asan wrapper automatically if systemd has been built with ASAN
(cherry picked from commit
ec9181d2ce4c0ad8b1c70b16a2b02a2667b1cc05)
Yu Watanabe [Wed, 19 Sep 2018 05:30:29 +0000 (14:30 +0900)]
test: add TEST-24-UNIT-TESTS running all basic tests under containers
(cherry picked from commit
3f6f58e03a7d22154aabe036439e7f2fb4849570)
Lukas Nykryn [Tue, 26 Feb 2019 14:22:38 +0000 (15:22 +0100)]
rules: add the rule that adds elevator= kernel command line parameter
rhel-only
Resolves: #
1670126
Evgeny Vereshchagin [Fri, 26 Oct 2018 10:25:36 +0000 (10:25 +0000)]
lgtm: drop redundant newlines
(cherry picked from commit
845702c63863add5606a7a7f00a959ffdcf89635)
Evgeny Vereshchagin [Fri, 26 Oct 2018 09:19:09 +0000 (09:19 +0000)]
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.
(cherry picked from commit
f86c1da28340f2a2afd34d72c9f416a2a94219a8)
Lucas Werkmeister [Sat, 25 Aug 2018 16:41:42 +0000 (18:41 +0200)]
tools: use print function in Python 3 code
This GDB script was converted to use Python 3 along with all other
Python scripts in commit
b95f5528cc, but still used the Python 2 print
statement syntax instead of the Python 3 print function. Fix that.
We also add the Python 2 compatibility statement, just in case some GDB
still uses Python 2 instead of Python 3.
Yu Watanabe [Sat, 8 Dec 2018 11:51:56 +0000 (20:51 +0900)]
lgtm: use python3
(cherry picked from commit
fc1c09e1dfd2073fb49c4e7bb87102c88a551876)
Yu Watanabe [Mon, 23 Jul 2018 16:37:29 +0000 (01:37 +0900)]
LGTM: make LGTM.com use meson from pip
(cherry picked from commit
55d651d8f69919b98cdc062e312e4454c34428ef)