Commit Graph

48145 Commits

Author SHA1 Message Date
Yu Watanabe 11b9105dfd seccomp: also move munmap into @default syscall filter set
Follow-up for 5abede3247.
2020-11-24 16:18:34 +01:00
INSUN PYO cfb6197bc3 sd-device-enumerator: do not return error when a device is removed
If /sys/class/OOO node is created and destroyed during booting (kernle driver initialization fails),
systemd-udev-trigger.service fails due to race condition.

***** race condition ***********************************************************************************
 1. kernel driver create /sys/class/OOO
 2. systemd-udev-trigger.service execues "/usr/bin/udevadm trigger --type=devices --action=add"

 3. device_enumerator_scan_devices() => enumerator_scan_devices_all() => enumerator_scan_dir("class") =>
    opendir("/sys/class") and iterate all subdirs ==> enumerator_scan_dir_and_add_devices("/sys/class/OOO")

 4. kernel driver fails and destroy /sys/class/OOO
 5. enumerator_scan_dir_and_add_devices("/sys/class/OOO") fails in opendir("/sys/class/OOO")

 6. "systemd-udev-trigger.service" fails
 7. udev coldplug fails and some device units not ready
 8. mount units asociated with device units fail
 9. local-fs.target fails
 10. enters emergency mode
********************************************************************************************************

***** status of systemd-udev-trigger.service unit ******************************************************
$ systemctl status systemd-udev-trigger.service
 systemd-udev-trigger.service - udev Coldplug all Devices
   Loaded: loaded (/usr/lib/systemd/system/systemd-udev-trigger.service; static; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2020-01-02 13:16:54 KST; 22min ago
     Docs: man:udev(7)
           man:systemd-udevd.service(8)
  Process: 2162 ExecStart=/usr/bin/udevadm trigger --type=subsystems --action=add (code=exited, status=0/SUCCESS)
  Process: 2554 ExecStart=/usr/bin/udevadm trigger --type=devices --action=add (code=exited, status=1/FAILURE)
  Main PID: 2554 (code=exited, status=1/FAILURE)

  Jan 02 13:16:54 localhost udevadm[2554]: Failed to scan devices: No such file or directory
  Jan 02 13:16:54 localhost systemd[1]: systemd-udev-trigger.service: Main process exited, code=exited, status=1/FAILURE
  Jan 02 13:16:54 localhost systemd[1]: systemd-udev-trigger.service: Failed with result 'exit-code'.
  Jan 02 13:16:54 localhost systemd[1]: Failed to start udev Coldplug all Devices.
*******************************************************************************************************

***** journal log with Environment=SYSTEMD_LOG_LEVEL=debug in systemd-udev-trigger.service  ***********
  Jan 01 21:57:20 localhost udevadm[2039]: sd-device-enumerator: Scanning /sys/bus
  Jan 01 21:57:20 localhost udevadm[2522]: sd-device-enumerator: Scan all dirs
  Jan 01 21:57:20 localhost udevadm[2522]: sd-device-enumerator: Scanning /sys/bus
  Jan 01 21:57:21 localhost udevadm[2522]: sd-device-enumerator: Scanning /sys/class
  Jan 01 21:57:21 localhost udevadm[2522]: sd-device-enumerator: Failed to scan /sys/class: No such file or directory
  Jan 01 21:57:21 localhost udevadm[2522]: Failed to scan devices: No such file or directory
*******************************************************************************************************
2020-11-24 21:38:19 +09:00
Yu Watanabe cd0d230e7b kernel-install: drop redundant "/"
Follow-up for 1cdbff1c84.

After the commit 1cdbff1c84, each entry .conf contains
redundant slash like the following:
```
$ cat xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-5.9.8-200.fc33.x86_64.conf
title      Fedora 33 (Thirty Three)
version    5.9.8-200.fc33.x86_64
machine-id xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
options    root=/dev/nvme0n1p2 ro rootflags=subvol=system/fedora selinux=0 audit=0
linux      //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/5.9.8-200.fc33.x86_64/linux
initrd     //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/5.9.8-200.fc33.x86_64/initrd
```
2020-11-24 11:18:40 +01:00
Yu Watanabe ca91ce3a33 man: bootctl set-default/oneshot accept an empty string 2020-11-24 11:17:37 +01:00
Frantisek Sumsal a2e926a135 Revert "semaphore: temporarily explicitly use the US image mirror"
This reverts commit 9ac47d9261.
2020-11-24 08:56:42 +01:00
Dan Streetman 3965279c67 test/test-functions: copy /usr/lib/pam.d into $initdir
The systemd-user file has been moved from /etc/pam.d into /usr/lib/pam.d,
so test-functions needs to copy it from /usr/lib/pam.d instead.

This will copy it from either location.
2020-11-23 17:17:19 -05:00
Yu Watanabe 6671ff5bad unit: update comment about OOM score
Follow-up for 6b2229c6c6.
2020-11-23 22:21:40 +01:00
Lennart Poettering 4fab57cec5
Merge pull request #17669 from yuwata/coccinelle-update
tree-wide: shorten code a bit suggested by coccinelle
2020-11-23 22:19:52 +01:00
Lennart Poettering e3650d619a
Merge pull request #17676 from yuwata/lgtm-fixes
tree-wide: several fixes prompted by LGTM
2020-11-23 22:18:28 +01:00
Dimitri John Ledkov 499f0f8209 gpt: add RISC-V GPT partition typecode uuid 2020-11-23 22:15:36 +01:00
Etienne Doms 5b639090d0 curl-util: fix callback prototype
CURLMOPT_SOCKETFUNCTION callback is an easy handle, not a multi.
2020-11-23 14:36:28 +01:00
Lennart Poettering 5acd143259
Merge pull request #17685 from yuwata/curl-no-oldies
meson: set CURL_NO_OLDIES in developer mode
2020-11-23 14:36:05 +01:00
Lennart Poettering 37d0d0747f
Merge pull request #17687 from yuwata/use-localtime_or_gmtime_r
use localtime_or_gmtime_r()
2020-11-23 14:35:36 +01:00
Yu Watanabe 8dc1ad04c2 backlight: add several debug logs and adjust log level of non critical error
This may help to investigate issues.
2020-11-23 14:35:14 +01:00
Jörg Thalheim 1d370b2c18 networkd/dhcp6: allow layer3 devices without MAC
Devices with multicast but without mac addresses i.e. tun devices
are not getting setuped correctly:

$ ip tuntap add mode tun dev tun0
$ ip addr show tun0
16: tun0: <NO-CARRIER,POINTOPOINT,MULTICAST,NOARP,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 500
    link/none
$ cat /etc/systemd/network/tun0.network
[Match]
Name = tun0

[Network]
Address=192.168.1.1/32
$ ./systemd-networkd
tun0: DHCP6 CLIENT: Failed to set identifier: Invalid argument
tun0: Failed
2020-11-23 13:56:48 +01:00
vanou 207194c67f man: Fix misspelling of directive and typos in systemd-coredump man page
This commit fixes
 * misspelling of LimitCORE directive of systemd.exec
 * typos
in systemd-coredump man page.
2020-11-23 13:49:53 +01:00
Jérémy Nouhaud 18f3bc96f9
hwdb: set fuzz value for lenovo x240 touchpad to improve cursor precision (#17659) 2020-11-23 09:30:08 +10:00
Yu Watanabe f9c443b7a4 logs-show: use localtime_or_gmtime_r() 2020-11-21 04:38:41 +09:00
Yu Watanabe 56b0ef2fc2 timedate: use localtime_or_gmtime_r() and mktime_or_timegm() 2020-11-21 04:28:45 +09:00
Yu Watanabe 435b5ba8d5 meson: set CURL_NO_OLDIES in developer mode 2020-11-21 01:55:41 +09:00
Yu Watanabe 2d052a0a48 curl-util: fix type CURL -> CURLM 2020-11-21 01:55:31 +09:00
Franck Bui 07ccf434e7 units: restore sysfs conditions in sys-fs-fuse-connections.mount and sys-kernel-config.mount
Commit 42cc2855ba incorrectly removed the condition on sysfs in both
sys-fs-fuse-connections.mount and sys-kernel-config.mount. However there are
still needed in case modprobe of one of these modules is intentionally skipped
(due to lack of privs for example).

This patch restores the 2 conditions which should be safe for the common case,
since all conditions are only checked after all deps ordered before are
complete.

Follow-up for 42cc2855ba.
2020-11-21 01:10:17 +09:00
Yu Watanabe db39a62784 core/mount: mount_start() may be called during the state is MOUNT_MOUNTING_DONE
As, both MOUNT_MOUNTING and MOUNT_MOUNTING_DONE are mapped to
UNIT_ACTIVATING.

Fixes #17570.
2020-11-20 16:41:40 +01:00
Franck Bui 428a9f6f1d core: serialize u->pids until the processes have been moved to the scope cgroup
Otherwise if a daemon-reload happens somewhere between the enqueue of the job
start for the scope unit and scope_start() then u->pids might be lost and none
of the processes specified by "PIDs=" will be moved into the scope cgroup.
2020-11-20 15:57:59 +01:00
Yu Watanabe 6ca4a07077 man: to make MACAddress= take effect, MACAddressPolicy= must be "none" 2020-11-20 23:07:21 +09:00
Yu Watanabe a7a12bf404 link-config: warn when MACAddress= is set with MACAddressPolicy=persistent or random 2020-11-20 22:59:12 +09:00
Yu Watanabe d03cb6b85d link-config: make MACAddressPolicy= accept an empty string 2020-11-20 22:59:12 +09:00
Lennart Poettering eebd1c3ad2
Merge pull request #17649 from yuwata/resolve-dnssd-template-name
resolve: ignore invalid service template name
2020-11-20 14:56:59 +01:00
Lennart Poettering cd580a31ae
Merge pull request #17658 from jwrdegoede/hwdb-accel-work
hwdb accel work
2020-11-20 14:49:41 +01:00
Yu Watanabe e23baae0da systemctl: fix potential pointer overflow 2020-11-20 21:58:47 +09:00
Yu Watanabe 45752a2495 tools: drop unnecessary "else" after for loop 2020-11-20 19:47:11 +09:00
Yu Watanabe 48b11b09ab ask-passwd: drop a condition which is always false 2020-11-20 19:42:38 +09:00
Yu Watanabe 283ec78963 resolvectl: drop a condition which is always true 2020-11-20 19:39:49 +09:00
Yu Watanabe 1058390d20 pstore: use log_oom() 2020-11-20 02:59:02 +09:00
Yu Watanabe 0aa8730edc coccinelle: always use SYNTHETIC_ERRNO() macro 2020-11-20 02:59:00 +09:00
Yu Watanabe fed66db05d tree-wide: use return value of log_xxx_errno() 2020-11-20 02:58:27 +09:00
Yu Watanabe a61c0bdf39 coccinelle: add one more rule to use return value of log_xxx_errno() 2020-11-20 02:57:26 +09:00
Lennart Poettering 5abede3247 seccomp: move brk+mmap+mmap2 into @default syscall filter set
These three syscalls are internally used by libc's memory allocation
logic, i.e. ultimately back malloc(). Allocating a bit of memory is so
basic, it should just be in the default set.

This fixes a couple of issues with asan/msan and the seccomp tests: when
asan/msan is used some additional, large memory allocations take place
in the background, and unless mmap/mmap2/brk are allowlisted these will
fail, aborting the test prematurely.
2020-11-19 16:44:50 +01:00
Zbigniew Jędrzejewski-Szmek bca0618705
Merge pull request #17667 from fbuihuu/fix-module-loading-from-udev-rule
Fix module loading from udev rule
2020-11-19 16:35:32 +01:00
Lennart Poettering bb4cbb25d4 man: suffix settings name with = and enclose in <varname> 2020-11-19 16:16:17 +01:00
Franck Bui 42cc2855ba units: wait until some fs modules are entirely loaded before mounting their corresponding filesystem
udev requests to start the fs mount units when their respective module is
loaded. For that it monitors uevents of type "ADD" for the relevant fs modules.

However the uevent is sent by the kernel too early, ie before the init() of the
module is called hence before directories in /sys/fs/ are created.

This patch workarounds adds "Requires/After=modprobe@<fs-module>.service" to
the mount unit, which means that modprobe(8) will be called once the fs module
is announced to be loaded. This sounds pointless, but given that modprobe only
returns after the initialization of the module is complete, it should
workaround the issue.

As a side effect, the module will be automatically loaded if the mount unit is
started manually.

Fixes #17586.
2020-11-19 11:50:52 +01:00
Franck Bui b3e32582f6 Revert "units: skip modprobe@.service if the unit appears to be already loaded"
This reverts commit 9cbf1e58f9.

The presence of /sys/module/%I directory can't be used to assert that the load
of a given module is complete and therefore the call to modprobe(8) can be
skipped. Indeed this directory is created before the init() function of the
module is called.

Users of modprobe@.service needs to be sure that once this service returns the
module is fully operational.
2020-11-19 09:49:42 +01:00
Hans de Goede 86de5e4239 hwdb: Add accel orientation quirk for Acer Aspire Switch 10 SW3-016 2-in-1
Add a quirk to fix the accelerometer orientation on the
Acer Aspire Switch 10 SW3-016 2-in-1.
2020-11-18 21:23:35 +01:00
Hans de Goede 565849429d hwdb: Add accel orientation quirk for Voyo Winpad A15 tablet
Add a quirk to fix the accelerometer orientation on the
Voyo Winpad A15 tablet.
2020-11-18 21:23:35 +01:00
Hans de Goede 169cd66baa hwdb: Add accel orientation quirk for Lenovo ThinkPad Yoga 11e 4th gen
Add a quirk to fix the accelerometer orientation on the Lenovo
ThinkPad Yoga 11e 4th gen 360 degree hinges 2-in-1.
2020-11-18 21:23:35 +01:00
Hans de Goede 21b58655f3 hwdb: Fix accel orientation quirk Z-axis for Lenovo ThinkPad Yoga 11e 3th gen
The Lenovo ThinkPad Yoga 11e 360 degree hinges style 2-in-1s use 2
accelerometers, 1 in the display and 1 in the base.

Kernel work is under way to also export the second accelerometer in
the base as an iio-device; and userspace work is underway to use
both accelerometers on 360 degree hinges style 2-in-1s (with 2 accels)
to figure out the angle between the 2 halves.

So far most orientation-matrix quirks have not cared much about the
Z-axis being correct, but in these 2 accelerometer setups getting
the Z-axis correct is important too.
2020-11-18 21:23:35 +01:00
Hans de Goede 276ede0740 hwdb: Add base accelerometer orientation quirk for base sensor of Medion Akoya E* series
The KIOX010A and KIOX02A ACPI hw-ids (HIDs) are used in 360 degree hinges
style 2-in-1s which have 2 accelerometers, 1 in the display (as usual) and
a second accelerometer in the base.

So far 60-sensor.hwdb has only defined a mount-matrix for the
sensor with the KIOX010A HID, which is the sensor in the display
half of the device. The reason for this is that sofar userspace has
only cared actually used the sensor in the display (for automatic
display rotation. Work is underway to make userspace use both sensors:
https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/issues/216

Recently an entry was added for the Medion Akoya's E2221T base-sensor,
but that was added to mark it with ACCEL_LOCATION=base and the entry
simply used the identity-matrix for ACCEL_MOUNT_MATRIX since nothing
is using the mount-matrix info for the second accelerometer.
I believe that this entry was added because on some devices the second
accelerometer gets enumerated first and then iio-sensor-proxy will
wrongly use the second sensor for display-rotation, unless it is marked
with ACCEL_LOCATION=base.

Instead of adding info for the second accelerometer on a per device
basis use the same generic dmi matches as used for the first (KIOX010A)
sensor, replacing the special case added for the E2221T and also
update the ACCEL_MOUNT_MATRIX with the actual mount-matrix for the
KIOX020A sensor in the base of these devices.

This was tested on a Medion Akoya E2228T.
2020-11-18 21:23:34 +01:00
Hans de Goede b24e437ab0 hwdb: Document how to properly set the mount-matrix for the base-accelerometer in 360 degree hinges style 2-in-1s with 2 accelerometers
Document how the mount-matrix for the base-accelerometer must be set on
360 degree hinges style 2-in-1s with 2 sensors (one in the display and
1 in the base).

Note the choice to define the lid being fully closed as an angle of
0 degrees is based on the ACPI tables of devices with a BOSC0200
ACPI device-node describing both sensors. In this case the ACPI
tables contain mount-matrix info (and the kernel will soon support
reading this and exporting it to userspace) and the mount-matrices
defined in these ACPI tables are such that the angle of the G-force
vector measured by the sensors is identical for both sensors when
the laptop's lid is fully closed.

This also feels more natural then defining the laptop being fully
open (180 degrees open) as the home / 0 degree angle position.
2020-11-18 21:20:21 +01:00
Yu Watanabe f56a9cbf9c khash: fix structured initializer
Fixes #17646.
2020-11-18 11:15:05 +01:00
igo95862 0e577869f3 man: Fix sd_bus_message_append_array_space function signature 2020-11-18 18:26:14 +09:00