Commit graph

25770 commits

Author SHA1 Message Date
Lennart Poettering 2570578d90 machine-image: openat() doesn't operate on the cwd if the first argument is specified
A fix-up for bcb846f30f.
2019-05-24 14:39:19 +02:00
Lennart Poettering c3ab2c389e test-execute: let's ignore the difference between CLD_KILLED and CLD_DUMPED
Depending on system configuration and whether SCMP_ACT_KILL_PROCESS or
SCMP_ACT_KILL_THREAD is available/used processes might coredump on
specific coredumps or are just plain killed. For our test case the
difference doesn't really matter, hence let's hide it away.
2019-05-24 10:48:28 +02:00
Lennart Poettering 18f8c5d466 test-execute: check exit code before exit status
The meaning of the status changes depending on the code, hence let's
always compare the code first, status second.
2019-05-24 10:48:28 +02:00
Lennart Poettering f9a3d8e2f3 nspawn: expose the new seccomp actions in the OCI logic 2019-05-24 10:48:28 +02:00
Lennart Poettering 7bbc229cf7 test: use the new action in our tests
This way, we know that it works as intended.
2019-05-24 10:48:28 +02:00
Lennart Poettering ccc16c7842 core: prefer SCMP_ACT_KILL_PROCESS for SystemCallFilter= behaviour
If we have it, use it. It makes a ton more sense.

Fixes: #11967
2019-05-24 10:48:28 +02:00
Lennart Poettering 915fb32438 seccomp: add scmp_act_kill_process() helper that returns SCMP_ACT_KILL_PROCESS if supported 2019-05-24 10:48:28 +02:00
Lennart Poettering d631a760e0
Merge pull request #12601 from keszybz/two-log-color-adjustments
Two log color adjustments
2019-05-24 10:43:07 +02:00
Lennart Poettering 05332e243c
Merge pull request #12590 from keszybz/unicode-cmdlines
Use unicode for cmdline printing
2019-05-24 10:41:30 +02:00
Michael Biebl 4450894653 Drop support for /usr/sbin/halt.local
/usr/sbin/halt.local is a Fedora/Red Hat anachronism from pre-systemd
times.
2019-05-23 10:19:01 +02:00
Zbigniew Jędrzejewski-Szmek ed55dc6084
Merge pull request #12645 from poettering/journal-mmap-einval
journald: output a proper error message when the journal is used on f…
2019-05-23 09:37:54 +02:00
Mike Gilbert bcb846f30f shared/machine-image: avoid passing NULL to log_debug_errno
Fixes: https://github.com/systemd/systemd/issues/12534
2019-05-23 09:36:50 +02:00
Yu Watanabe a43b1f8267
Merge pull request #12618 from yuwata/test-network-improvements
network: several cleanups
2019-05-23 11:17:33 +09:00
root 12e982425c login: fixup button_open() fd 2019-05-23 11:16:11 +09:00
Chris Down 3062dddabd test: Remove superfluous error check
This is already checked above before we set any manager attributes,
immediately after manager_new().
2019-05-22 15:27:26 -04:00
Lennart Poettering 93d70b6cf2
Merge pull request #12631 from keszybz/doc-and-error-message-tweaks
Doc and error message tweaks
2019-05-22 19:00:10 +02:00
Lennart Poettering 5087825ea7 journald: output a proper error message when the journal is used on fs that doesn't do mmap() properly
Prompted by:

https://lists.freedesktop.org/archives/systemd-devel/2019-May/042708.html
2019-05-22 18:56:24 +02:00
Zbigniew Jędrzejewski-Szmek 9e099c9fd8
Merge pull request #12431 from poettering/tmpfiles-chmod-chown-order
tmpfiles: run chown() before chmod()
2019-05-22 17:23:28 +02:00
Zbigniew Jędrzejewski-Szmek 7cc5ef5f18 pid1: improve message when setting up namespace fails
I covered the most obvious paths: those where there's a clear problem
with a path specified by the user.

Prints something like this (at error level):
May 21 20:00:01.040418 systemd[125871]: bad-workdir.service: Failed to set up mount namespacing: /run/systemd/unit-root/etc/tomcat9/Catalina: No such file or directory
May 21 20:00:01.040456 systemd[125871]: bad-workdir.service: Failed at step NAMESPACE spawning /bin/true: No such file or directory

Fixes #10972.
2019-05-22 16:28:02 +02:00
Zbigniew Jędrzejewski-Szmek 9d48671c62 core: unset HOME=/ that the kernel gives us
Partially fixes #12389.

%h would return "/" in a machine, but "/root" in a container. Let's fix
this by resetting $HOME to the expected value.
2019-05-22 16:28:02 +02:00
Zbigniew Jędrzejewski-Szmek 8da24acad5 sd-bus: improve error message for invalid org.freedesktop.DBus.Properties.Set signature
Fixes #12551.
2019-05-22 16:28:02 +02:00
Zbigniew Jędrzejewski-Szmek 92c605796d login: use _cleanup_ to simplify error handling
When logging about a device, try to include the path to it everywhere in
messages. Also fixes an invalid assert(fd).

Inspired by b2774a3ae6.
2019-05-22 15:17:24 +02:00
Lennart Poettering 0f6519d43c loop-util: invoke LOOP_CTL_GET_FREE in a loop
if we don't call it in a loop the device it tells us to open might
already be gone, taken by somebody else racing against us. Hence try a
few times.
2019-05-22 13:04:26 +02:00
Yu Watanabe 910feb787f network: unify link_ipv4ll_enabled() and link_ipv4ll_fallback_enabled() 2019-05-22 17:59:39 +09:00
Yu Watanabe a0ae96149a network: drop unused variable 2019-05-22 17:59:39 +09:00
Yu Watanabe bb262ef02b network: update master's ifindex in link_update()
And use it in link_is_enslaved().
2019-05-22 17:59:39 +09:00
Yu Watanabe 2292a4c6db network: drop duplicated logs
link_set_state() already logs about state change.
2019-05-22 17:58:46 +09:00
Yu Watanabe af9ba57aa2 network: make CAN devices go through LINK_STATE_CONFIGURING 2019-05-22 17:58:46 +09:00
Yu Watanabe 3543304057 network: deprecate OneQueue= for tun or tap devices
IFF_ONE_QUEUE has no effect since kernel-3.8. See kernel's commit
5d097109257c03a71845729f8db6b5770c4bbedc.
2019-05-22 17:58:46 +09:00
Yu Watanabe 1df569bf72 network: extend warning messages 2019-05-22 17:58:46 +09:00
Yu Watanabe 75eed300a9 network: Allow IFF_VNET_HDR to also be set for tun devices
f5f07dbf06 adds VnetHeader= for tap
devices, but the flag is also used for tun devices.
This adds VnetHeader= setting in [Tun] section.
2019-05-22 17:58:46 +09:00
Yu Watanabe f410d46358 network: disable IPv4LL for ipvlan with L3 or L3S mode
As L3 or L3S mode do not support ARP.
2019-05-22 17:58:46 +09:00
Susant Sahani 0307afc681 networkctl: add support to display Transmit/Recieve queue length (#12633)
```
(networkctl) % build/networkctl status veth-test
● 13: veth-test
            Link File: /usr/lib/systemd/network/99-default.link
         Network File: /usr/lib/systemd/network/veth0.network
                 Type: ether
                State: routable (configured)
               Driver: veth
           HW Address: 8a:a6:1c:3f:a6:1a
                  MTU: 1500
          Minimum MTU: 68
          Maximum MTU: 65535
Transmit Queue Length: 1
 Receive Queue Length: 1
              Address: 192.168.5.31
                       fe80::88a6:1cff:fe3f:a61a
              Gateway: 192.168.5.1
                  DNS: 192.168.5.1
                  NTP: 192.168.5.1
            Time Zone: Asia/Kolkata
         Connected To: Zeus on port peer-test
```
2019-05-22 17:53:12 +09:00
ven b2774a3ae6 bus_open leak sd_event_source when udevadm trigger。
On my host, when executing the udevadm trigger, I only receive the change event, which causes memleak
2019-05-22 10:44:34 +02:00
Zbigniew Jędrzejewski-Szmek 4c6d51390c basic/utf8: reduce memory usage 2019-05-22 10:22:20 +02:00
Zbigniew Jędrzejewski-Szmek e3b4efd28f Add 8bit-version of get_process_cmdline() and use in cgroup-show.c
This restores show_pid_array() output in legacy locales on the console.
Only one call to get_process_cmdline() is changed, all others retain
utf8-only mode. This affects systemd-cgls, systemctl status, etc, when
working locally.

Calls to get_process_cmdline() that cross a process boundary always use
utf8. It's the callers responsibility to convert this to some encoding that
they use. This means that we always pass utf8 over the bus.
2019-05-22 10:16:00 +02:00
Zbigniew Jędrzejewski-Szmek 09c1dceef1 basic/process-util: convert bool arg to flags
In preparation for the next commit…
2019-05-22 10:15:49 +02:00
Zbigniew Jędrzejewski-Szmek 70d558199c basic/escape: add truncation to xescape too
This does for ASCII and non-unicode encodings what utf8_escape_non_printable_full()
does for utf8-based encodings.
2019-05-22 10:11:00 +02:00
Zbigniew Jędrzejewski-Szmek 0e85cbcfc3 util-lib: do not truncate kernel comm names
It turns out that the kernel allows comm names higher than our expected limit
of 16.
$ wc -c /proc/*/comm|sort -g|tail -n3
35 /proc/1292317/comm
35 /proc/1293610/comm
36 /proc/1287112/comm
$ cat /proc/1287112/comm
kworker/u9:3-kcryptd/253:0
2019-05-22 10:09:35 +02:00
Zbigniew Jędrzejewski-Szmek bc28751ed2 Rework cmdline printing to use unicode
The functions to retrieve and print process cmdlines were based on the
assumption that they contain printable ASCII, and everything else
should be filtered out. That assumption doesn't hold in today's world,
where people are free to use unicode everywhere.

This replaces the custom cmdline reading code with a more generic approach
using utf8_escape_non_printable_full().
For kernel threads, truncation is done on the parenthesized name, so we'll
get "[worker]", "[worker…]", …, "[w…]", "[…", "…" as we reduce the number of
available columns.

This implementation is most likely slower for very long cmdlines, but I don't
think this is very important. The common case is to have short commandlines,
and should print those properly. Absurdly long cmdlines are the exception,
which needs to be handled correctly and safely, but speed is not too important.

Fixes #12532.

v2:
- use size_t for the number of columns. This change propagates into various
  other functions that call get_process_cmdline(), increasing the size of the
  patch, but the changes are rather trivial.
2019-05-22 10:08:17 +02:00
Zbigniew Jędrzejewski-Szmek da88f542d9 util-lib: add truncation based on printable width to utf8_escape_non_printable() 2019-05-22 09:50:19 +02:00
Zhang Xianwei 1f7b6872db udev/scsi_id: fix incorrect page length when get device identification VPD page
The length of device identification VPD page is filled with two bytes,
but scsi_id only gets the low byte. Fix it.

Signed-off-by: Zhang Xianwei <zhang.xianwei8@zte.com.cn>
2019-05-22 13:25:20 +09:00
Yu Watanabe b94fb24b2e
Merge pull request #12629 from ssahani/networkctl
networkctl: MTU enhancements
2019-05-22 02:35:06 +09:00
Lennart Poettering 3aa317943c
Merge pull request #12626 from keszybz/oompolicy-check
Make the check if oom-killer fired more robust
2019-05-21 18:29:01 +02:00
Susant Sahani 2c73f59b81 networkctl: Add support to display min and max MTU
(networkctl) % ./networkctl status enp0s31f6                                                                                                                          ~/tt/networkctl/build
● 4: enp0s31f6
       Link File: /usr/lib/systemd/network/99-default.link
    Network File: n/a
            Type: ether
           State: n/a (unmanaged)
            Path: pci-0000:00:1f.6
          Driver: e1000e
          Vendor: Intel Corporation
           Model: Ethernet Connection (2) I219-LM
      HW Address: 8c:16:45:6c:83:b9 (LCFC(HeFei) Electronics Technology co., ltd)
             MTU: 1500
     Minimum MTU: 68
     Maximum MTU: 9000
2019-05-21 17:44:36 +05:30
Susant Sahani 61de0c42f3 sd-netlink: Add netlink property IFLA_MIN_MTU and IFLA_MAX_MTU, 2019-05-21 17:43:56 +05:30
Susant Sahani 4015d106d4 networkctl: Display MTU
Now the MTU is not displayed. with this patch it's fixed.

(networkctl) % ./networkctl status enp0s31f6                                                                                                                          ~/tt/networkctl/build
WARNING: systemd-networkd is not running, output will be incomplete.

● 4: enp0s31f6
       Link File: /usr/lib/systemd/network/99-default.link
    Network File: n/a
            Type: ether
           State: n/a (unmanaged)
            Path: pci-0000:00:1f.6
          Driver: e1000e
          Vendor: Intel Corporation
           Model: Ethernet Connection (2) I219-LM
      HW Address: 8c:16:45:6c:83:b9 (LCFC(HeFei) Electronics Technology co., ltd)
             MTU: 1500
2019-05-21 17:29:18 +05:30
Zbigniew Jędrzejewski-Szmek 31c294dc41 shared/cgroup-show: fix off-by-one in column counting
We'd get one column too many, and the trailing ellipsis would end up in
the next row.
2019-05-21 10:57:23 +02:00
Zbigniew Jędrzejewski-Szmek 9743846e23 test-utf8: add function headers and rename tests after functions they test 2019-05-21 10:57:23 +02:00
Zbigniew Jędrzejewski-Szmek 21c491e106 Introduce sc_arg_max() helper
Just a cast and an assert.
2019-05-21 10:57:23 +02:00