Commit Graph

21861 Commits

Author SHA1 Message Date
Yu Watanabe 8aae9a66fa sd-device,libudev: make an argument for *_set_sysattr_value() const 2018-09-11 12:45:21 +09:00
Yu Watanabe 7f9e03952a libudev-monitor: use assert_return() in many places 2018-09-11 12:45:21 +09:00
Yu Watanabe e38242b03a libudev-monitor: add missing error checks in udev_monitor_enable_receiving() 2018-09-11 12:45:21 +09:00
Yu Watanabe a9808d8445 libudev-monitor: introduce udev_monitor_send_sd_device()
And use it in udev_monitor_send_device().
2018-09-11 12:45:21 +09:00
Yu Watanabe 23c457a7fb libudev-monitor: re-implement udev_monitor_receive_sd_device() 2018-09-11 12:45:21 +09:00
Yu Watanabe 759d9f3f8d libudev-monitor: use Hashmap or Set to store filters 2018-09-11 12:45:21 +09:00
Yu Watanabe 5e1e4c247b libudev-monitor: use structured initializer 2018-09-11 12:45:21 +09:00
Yu Watanabe a062a72f1b libudev-monitor: rename monitor_set_nl_address() and make it return negative errno 2018-09-11 12:45:21 +09:00
Yu Watanabe be1791ad6a libudev-monitor: rename udev_has_devtmpfs() and move it to mount-util.c
As the function itself is quite generic.
2018-09-11 12:45:21 +09:00
Yu Watanabe 3d01fa902c libudev-monitor: use structured initializer in bpf_*()
This also drop inline attribute from the functions.
2018-09-11 12:45:21 +09:00
Yu Watanabe 7f79720711 libudev-monitor: use 'unsigned' instead of 'unsigned int' 2018-09-11 12:45:21 +09:00
Yu Watanabe 02e7ae2fdc libudev-device: create sd_device at first in udev_device_new_from_*() 2018-09-11 12:45:21 +09:00
Yu Watanabe a7e9db150b libudev-device: drop prototypes of unexistent functions 2018-09-11 12:45:21 +09:00
Yu Watanabe 536cbd7fa6 libudev: drop a prototype of unexistent function 2018-09-11 12:45:21 +09:00
Yu Watanabe 76387b9abb libudev-device: coding style fixes 2018-09-11 12:45:21 +09:00
Yu Watanabe 33a03e6eff libudev-device: fix return value of udev_device_has_tag() 2018-09-11 12:45:21 +09:00
Yu Watanabe 1b6374d285 libudev-device: use original negative errno 2018-09-11 12:45:21 +09:00
Yu Watanabe 71074e3a10 libudev-device: use structured initializer 2018-09-11 12:45:21 +09:00
Yu Watanabe 60fdee32bd libudev-enumerate: use structured initializer 2018-09-11 12:45:21 +09:00
Yu Watanabe 2b19953a0d libudev-hwdb: use assert_return_errno() 2018-09-11 12:45:21 +09:00
Yu Watanabe 68b80b8557 libudev-hwdb: use structured initializer 2018-09-11 12:45:21 +09:00
Yu Watanabe b485aa5852 libudev-hwdb: drop unused 'struct udev *udev' in udev_hwdb struct 2018-09-11 12:45:21 +09:00
Yu Watanabe f8cdabc0ec libudev-queue: coding style fixes 2018-09-11 12:45:21 +09:00
Yu Watanabe 09f638ebd9 libudev-queue: drop prototypes of nonexistent functions 2018-09-11 12:45:21 +09:00
Yu Watanabe 2dac88a9d1 libudev-queue: use _cleanup_ attribute and TAKE_FD() 2018-09-11 12:45:21 +09:00
Yu Watanabe d35c0e8d53 libudev-queue: use assert_return() 2018-09-11 12:45:21 +09:00
Yu Watanabe ccda7f87f5 libudev-queue: use structured initializer 2018-09-11 12:45:21 +09:00
Yu Watanabe bc54df90e4 libudev: modernize code a bit 2018-09-11 12:45:21 +09:00
Yu Watanabe 5ccb44a53f libudev: use structured initializer 2018-09-11 12:45:21 +09:00
Yu Watanabe 2454727d5a libudev: drop unused element in udev struct 2018-09-11 12:45:21 +09:00
Yu Watanabe ff6f97f0cf libudev: drop outdated comments 2018-09-11 12:45:21 +09:00
Yu Watanabe 3c6ac21929 libudev: use DEFINE_PUBLIC_TRIVIAL_REF_UNREF_FUNC() macro where applicable 2018-09-11 12:45:21 +09:00
Yu Watanabe 50d2158901 libudev-monitor: use safe_close() in udev_monitor_disconnect() 2018-09-11 12:45:21 +09:00
Thomas Haller a507737e5c dhcp: fix assertion starting DHCP client without MAC address (#10054)
An assertion in dhcp_network_bind_raw_socket() is triggered when
starting an sd_dhcp_client without setting a MAC address first.

  - sd_dhcp_client_start()
    - client_start()
      - client_start_delayed()
        - dhcp_network_bind_raw_socket()

In that case, the arp-type and MAC address is still unset. Note that
dhcp_network_bind_raw_socket() already checks for a valid arp-type
and MAC address below, so we should just gracefully return -EINVAL.

Maybe sd_dhcp_client_start() should fail earlier when starting without
MAC address. But the failure here will be correctly propagated and
the start aborted.

Fixes: 76253e73f9
2018-09-11 09:45:47 +09:00
Franck Bui 03d0f4b58e nspawn: always use mode 555 for /sys
When a network namespace is needed, /sys is mounted as tmpfs (see commit
d8fc6a000f for details).

But in this case mode 755 was used as initial permissions for /sys whereas the
default mode for sysfs is 555.

In practice using 755 doesn't have any impact because /sys is mounted read-only
too but for consistency, let's use the correct mode.

Fixes: #10050
2018-09-11 00:34:00 +02:00
Jürg Billeter da0da5eccf pam_systemd: support use in PID namespaces
Pass 0 as leader PID to CreateSession to let logind use the PID from the
D-Bus credentials. This allows use of pam_systemd in PID namespaces.
2018-09-10 19:04:21 +02:00
Zbigniew Jędrzejewski-Szmek 9d0798a2ed
Merge pull request #9832 from yuwata/fix-9831
network: fixes related to setting MTU
2018-09-08 17:17:07 +02:00
Zbigniew Jędrzejewski-Szmek a5404992cc
Merge pull request #9942 from lucaswerkmeister/9939
seccomp: fix #9939 and allow specifying multiple errnos for syscall
2018-09-08 12:08:54 +02:00
Evgeny Vereshchagin 231dca5579 tests: put fuzz_journald_processing_function in a .c file 2018-09-08 12:05:14 +02:00
Lucas Werkmeister 9d7fe7c65a seccomp: permit specifying multiple errnos for a syscall
If more than one errno is specified for a syscall in SystemCallFilter=,
use the last one instead of reporting an error. This is especially
useful when used with system call sets:

    SystemCallFilter=@privileged:EPERM @reboot

This will block any system call requiring super-user capabilities with
EPERM, except for attempts to reboot the system, which will immediately
terminate the process. (@reboot is included in @privileged.)

This also effectively fixes #9939, since specifying different errnos for
“the same syscall” (same pseudo syscall number) is no longer an error.
2018-09-07 21:44:13 +02:00
Yu Watanabe e8596ca5c4 backlight: do not unref parent device
Fixes double-free introduced by 9aadd28149.
2018-09-07 20:00:01 +02:00
Yu Watanabe 3457a7a939
Merge pull request #10009 from evverx/rework-journald-fuzzers
Add a fuzzer for server_process_native_message
2018-09-05 11:46:17 +09:00
Yu Watanabe 53253d9c54 sd-dhcp6: set requested time for DUID-LLT
Follow-up for 7e90a499ab.
2018-09-04 13:07:37 -07:00
Yu Watanabe 339697f081 sd-dhcp: drop meaningless checking
mac_addr is not dynamically allocated.

Fixes CID 1395162 and 1395164.
2018-09-04 13:07:37 -07:00
Michal Sekletar 70f5f48eb8 cryptsetup-generator: introduce basic keydev support
Dracut has a support for unlocking encrypted drives with keyfile stored
on the external drive. This support is included in the generated initrd
only if systemd module is not included.

When systemd is used in initrd then attachment of encrypted drives is
handled by systemd-cryptsetup tools. Our generator has support for
keyfile, however, it didn't support keyfile on the external block
device (keydev).

This commit introduces basic keydev support. Keydev can be specified per
luks.uuid on the kernel command line. Keydev is automatically mounted
during boot and we look for keyfile in the keydev
mountpoint (i.e. keyfile path is prefixed with the keydev mount point
path). After crypt device is attached we automatically unmount
where keyfile resides.

Example:
        rd.luks.key=70bc876b-f627-4038-9049-3080d79d2165=/key:LABEL=KEYDEV
2018-09-04 16:54:53 +02:00
Zbigniew Jędrzejewski-Szmek 807690fb7f systemctl: fix compilation w/o logind
Fixes #10006.
2018-09-04 09:34:16 +02:00
Dongsu Park 21224070e8 importd, basic/string-util: use case-insensitive comparison for HTTP headers
According to RFC2616[1], HTTP header names are case-insensitive. So
it's totally valid to have a header starting with either `Date:` or
`date:`.

However, when systemd-importd pulls an image from an HTTP server, it
parses HTTP headers by comparing header names as-is, without any
conversion. That causes failures when some HTTP servers return headers
with different combinations of upper-/lower-cases.

An example:
https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_developer_container.bin.bz2 returns `Etag: "pe89so9oir60"`,
while https://alpha.release.core-os.net/amd64-usr/current/coreos_developer_container.bin.bz2
returns `ETag: "f03372edea9a1e7232e282c346099857"`.
Since systemd-importd expects to see `ETag`, the etag for the Container Linux image
is correctly interpreted as a part of the hidden file name.
However, it cannot parse etag for Flatcar Linux, so the etag the Flatcar Linux image
is not appended to the hidden file name.

```
$ sudo ls -al /var/lib/machines/
-r--r--r--  1 root root 3303014400 Aug 21 20:07 '.raw-https:\x2f\x2falpha\x2erelease\x2ecore-os\x2enet\x2famd64-usr\x2fcurrent\x2fcoreos_developer_container\x2ebin\x2ebz2.\x22f03372edea9a1e7232e282c346099857\x22.raw'
-r--r--r--  1 root root 3303014400 Aug 17 06:15 '.raw-https:\x2f\x2falpha\x2erelease\x2eflatcar-linux\x2enet\x2famd64-usr\x2fcurrent\x2fflatcar_developer_container\x2ebin\x2ebz2.raw'
```

As a result, when the Flatcar image is removed and downloaded again,
systemd-importd is not able to determine if the file has been already
downloaded, so it always download it again. Then it fails to rename it
to an expected name, because there's already a hidden file.

To fix this issue, let's introduce a new helper function
`memory_startswith_no_case()`, which compares memory regions in a
case-insensitive way. Use this function in `curl_header_strdup()`.

See also https://github.com/kinvolk/kube-spawn/issues/304

[1]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
2018-09-03 22:59:27 +02:00
Harald Hoyer 15720d0340 boot/efi/stub.c: fix Dell LoadOptions
On Dell machines LoadOptions is filled with:
01 00 00 00 <name of BIOS Boot Loader Entry> ... <unknown bytes>

So, in case of meaningfull LoadOptions, better check if the first char
is a printable character.
2018-09-03 14:10:38 +02:00
Alan Jenkins 81375d8026 user-runtime-dir: fix selinux regression
Fix #9993.  When this code was split out to user-runtime-dir, it forgot to
include the call to mac_selinux_init().  So mkdir_label() stopped working.

Fixes: a9f0f5e501 ("logind: split %t directory creation to a helper
unit")
2018-09-03 14:09:21 +02:00
Yu Watanabe 7dd05e9472 network: drop an unused variable
Follow-up for 53cb501a13.
2018-09-03 14:08:30 +02:00