1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00
Commit Graph

51455 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
a88f9dbae2 systemctl: unset const char* arguments in static destructors
When fuzzing, the following happens:
- we parse 'data' and produce an argv array,
- one of the items in argv is assigned to arg_host,
- the argv array is subsequently freed by strv_freep(), and arg_host has a dangling symlink.

In normal use, argv is static, so arg_host can never become a dangling pointer.
In fuzz-systemctl-parse-argv, if we repeatedly parse the same array, we
have some dangling pointers while we're in the middle of parsing. If we parse
the same array a second time, at the end all the dangling pointers will have been
replaced again. But for a short time, if parsing one of the arguments uses another
argument, we would use a dangling pointer.

Such a case occurs when we have --host=… --boot-loader-entry=help. The latter calls
acquire_bus() which uses arg_host.

I'm not particularly happy with making the code more complicated just for
fuzzing, but I think it's better to resolve this, even if the issue cannot
occur in normal invocations, than to deal with fuzzer reports.

Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31714.
2021-05-31 19:29:07 +02:00
Zbigniew Jędrzejewski-Szmek
6b42227edb systemctl: put static destructor in the order of variables 2021-05-31 12:17:19 +02:00
Zbigniew Jędrzejewski-Szmek
341d883ad6
Merge pull request #19701 from yuwata/network-udev-do-not-manage-loopback-interfaces
udev: do not manage loopback interfaces
2021-05-24 07:26:18 +02:00
Yu Watanabe
113d94c393
Merge pull request #19704 from yuwata/network-small-fixes
network: several tiny cleanups
2021-05-23 23:02:07 +09:00
Yu Watanabe
70f32a260b udev/net: do not manage loopback interfaces
There are nothing we can configure in udevd for loopback interfaces;
no ethertool configs can be applied, MAC address, interface name should
not be touched.
2021-05-23 22:58:47 +09:00
Yu Watanabe
f25e642bca sd-netlink: rename rtnl_get_link_iftype() -> rtnl_get_link_info() and make it optionally return link flags 2021-05-23 22:58:03 +09:00
Yu Watanabe
ce01c07f1c udev/net: rename link_config -> LinkConfig 2021-05-23 22:58:03 +09:00
Yu Watanabe
afca7ac13d udev/net: rename link_config_ctx -> LinkConfigContext 2021-05-23 22:58:03 +09:00
Yu Watanabe
75d5abd298 network: IPv6LinkLocalAddressGenerationMode=none disables IPv6LL addressing 2021-05-23 17:13:06 +09:00
Yu Watanabe
c3b9425130 network: make link_configure() static 2021-05-23 17:12:48 +09:00
Yu Watanabe
fbb1a39866 ordered-set: introduce ordered_set_get() 2021-05-23 17:12:40 +09:00
Yu Watanabe
2a5a844259
Merge pull request #19681 from yuwata/ethtool-util-log
ethtool-util: several cleanups
2021-05-23 15:24:46 +09:00
Yu Watanabe
3ee316bd7b ethtool-util: drop unused function 2021-05-23 11:40:15 +09:00
Yu Watanabe
80662eecbf udev/net: drop unnecessary conditions 2021-05-23 11:40:15 +09:00
Yu Watanabe
a7994dd3ab udev/net: drop fallback logic to set speed
ethtool_set_glinksettings() already fallback to use ETHTOOL_GSET/ETHTOOL_SSET
commands when ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS are not
supported.
2021-05-23 11:40:15 +09:00
Yu Watanabe
ba1030594e ethtool-util: do not touch anything if nothing is requested
And update settings only when it is necessary.
2021-05-23 11:40:15 +09:00
Yu Watanabe
c8e644b116 ethtool-util: disable autonegotiation when speed, duplex, or port is specified
And if autonegotiation is enabled, speed, duplex, and port are ignored.

Fixes #19625.
2021-05-23 11:40:15 +09:00
Yu Watanabe
4323046c5f ethtool-util: move and rebreak comments 2021-05-23 11:40:15 +09:00
Yu Watanabe
4f5040313d ethtool-util: make ethtool_connect() open fd only when it is not opened 2021-05-23 11:39:56 +09:00
Luca Boccassi
986cdba9f8
Merge pull request #19697 from jwrdegoede/hwdb-more-accel-quirks
Hwdb more accel quirks
2021-05-22 23:57:18 +01:00
Luca Boccassi
d1cb55e6e4
Merge pull request #19700 from keszybz/check-os-release-fixups
Fixups for man/check-os-release.*
2021-05-22 23:56:59 +01:00
Hans de Goede
82de3fc6a4 hwdb: keyboard: Ignore duplicate atkbd keypresses on touchpad on/off toggle
The atkbd device on the Lenovo Yoga 300-11IBR 2-in-1 sends unknown
keycodes when the touchpad is toggled on/off:

[ 1918.995562] atkbd serio0: Unknown key pressed (translated set 2, code 0x63 on isa0060/serio0).
[ 1918.995610] atkbd serio0: Use 'setkeycodes 63 <keycode>' to make it known.
[ 1919.032121] atkbd serio0: Unknown key released (translated set 2, code 0x63 on isa0060/serio0).
[ 1919.032135] atkbd serio0: Use 'setkeycodes 63 <keycode>' to make it known.
[ 1926.098414] atkbd serio0: Unknown key pressed (translated set 2, code 0x62 on isa0060/serio0).
[ 1926.098461] atkbd serio0: Use 'setkeycodes 62 <keycode>' to make it known.
[ 1926.146537] atkbd serio0: Unknown key released (translated set 2, code 0x62 on isa0060/serio0).
[ 1926.146583] atkbd serio0: Use 'setkeycodes 62 <keycode>' to make it known.

The "Ideapad extra buttons" driver alreadys sends f22 / f23 key-events
when the touchpad is toggles off, so map the keycodes for the duplicate
atkbd events to unknown to silence these kernel warnings.
2021-05-22 20:50:36 +02:00
Zbigniew Jędrzejewski-Szmek
91da09bd1a man/check-os-release.*: allow ID_LIKE to have multiple values
I missed the fact that it is documented to be a space-separated list.
2021-05-22 20:44:04 +02:00
Zbigniew Jędrzejewski-Szmek
82ca34e6e6 man/check-os-release.py: ignore comment and empty lines
Plus fix off-by-one in error printing.
2021-05-22 20:44:04 +02:00
Hans de Goede
f769f9d095 hwdb: Add accel orientation quirk for the Lenovo Yoga 300-11IBR 2-in-1
Add a quirk for the accelerometer orientation and location for the
2 accelerometers inside the Lenovo Yoga 300-11IBR 2-in-1.
2021-05-22 16:22:36 +02:00
Lennart Poettering
83a04afc06
Merge pull request #19686 from keszybz/os-release-modernization-and-examples
os-release modernization and examples
2021-05-22 14:44:50 +02:00
Lennart Poettering
4c483e2647
Merge pull request #19693 from poettering/sleep-tweaks
sleep code refactoring + automatic fallback from hybrid sleep to suspend
2021-05-22 14:35:26 +02:00
Zbigniew Jędrzejewski-Szmek
412339835e man/check-os-release.py: strip trailing whitespace
The shell parser would do that, so so should we.
2021-05-22 12:20:51 +02:00
Zbigniew Jędrzejewski-Szmek
c0527e1f95 man: say that initrd-release is like os-release 2021-05-22 12:20:51 +02:00
Hans de Goede
eb281f3eff hwdb: Add accel orientation quirk for the KD Kurio Smart C15200 tablet
Add a quirk to fix the accelerometer orientation on the
KD Kurio Smart C15200 tablet.
2021-05-22 12:13:42 +02:00
Lennart Poettering
c3565fe81f sleep: clarify that failure setting env var is not fatal 2021-05-22 11:00:04 +02:00
Lennart Poettering
3d1321117e sleep: if hybrid sleep fails, do regular suspend
Fixes #19550
2021-05-22 11:00:04 +02:00
Lennart Poettering
b0c035e3c8 sleep: remove duplicate logging
execute() logs about all errors, hence only log about what's new, i.e.
what we'll do as consequence, and don't mention the error cause again.
2021-05-22 11:00:04 +02:00
Lennart Poettering
887b2019b6 sleep: don't check for EADV
EADV is not generated anymore since
6d176522f5, let's hence not check for it
anymore.
2021-05-22 11:00:00 +02:00
Lennart Poettering
61dc84817e sleep: can_sleep_state() + can_sleep_disk() don#t return plain booleans 2021-05-22 11:00:00 +02:00
Lennart Poettering
c8cd8ca398 sleep: use SleepOperation enum everywhere and drop sleep_settings()
Instead of comparing strings everywhere, let's use the new enum. This
allows us to drop sleep_settings(), since the operation enum can be
directly used as index into the config settings.

Some minor other refactoring is done, but mostly just shifting thing
around a bit, no actual change in behaviour.
2021-05-22 11:00:00 +02:00
Lennart Poettering
be2a4b0d7e sleep: introduce high-level SleepOperation enum 2021-05-22 10:58:22 +02:00
Lennart Poettering
86204ae145 units: make sure importd has CAP_LINUX_IMMUTABLE flag
Since d8f9686c0f we use the chattr +i flag
for marking containers in directories as reead-only. But to do so we
need the cap for it, hence grant it.

Fixes: #19115
2021-05-22 16:02:02 +09:00
Yu Watanabe
af92e46527
Merge pull request #19594 from yuwata/network-nexthop-group
network: nexthop: add Group= setting to configure multipath route with group nexthop
2021-05-22 16:01:13 +09:00
Yu Watanabe
a6c747a63f
Merge pull request #19691 from poettering/read-virtual-file-tweaks
tweaks to read_virtual_file()
2021-05-22 15:59:17 +09:00
Zbigniew Jędrzejewski-Szmek
fe7f113c13 units: skip some units in the initrd
I'm working on building initramfs images directly from normal packages, and it
doesn't make sense for those units to be started. Pristine system rpms need to
behave correctly as much as possible also in the initrd, and those units are
enabled by the rpms. There usually isn't enough time for the timer to actually
fire, but starting it gives a line on the console and generally looks confusing
and sloppy. Flushing the journal means that its actually lost, since the real
/var is not available yet.

Another approach would be not enable those units, but right now they are
statically enabled, and changing that would be more work, and doesn't really
seem necessary, since the condition checks are very quick.

Checking for /etc/initrd-release is the standard condition that the initrd
units use, so let's do the same here.
2021-05-22 15:58:40 +09:00
Yu Watanabe
9c8f90d0f9 test-network: add a test case for nexthop Group= setting 2021-05-22 04:59:45 +09:00
Yu Watanabe
228c3e21e9 network: nexthop: add Group= setting to configure multipath route with group nexthop 2021-05-22 04:59:40 +09:00
Yu Watanabe
8031e5ca8d network: nexthop: IFF_UP flag is required for nexthops which attached to a link 2021-05-22 04:56:46 +09:00
Yu Watanabe
7b3a7581e3 network: make nexthop_add(), nexthop_configure() and friends return 0 on success
After request queue is introduced, the return value on success is unused.
2021-05-22 04:56:46 +09:00
Lennart Poettering
b2d0b90f54 fileio: read_virtual_file(): on last attempt ignore file size
Apparently the reported file size was misleading on this file, hence
ignore it on our last loop attempt and just pretend it wasn't reported
at all.
2021-05-21 21:54:44 +02:00
Lennart Poettering
eff722c693 test-fileio: run read_virtual_file() for a couple of more interesting sizes 2021-05-21 21:54:44 +02:00
Lennart Poettering
8461d6da35 test-fileio: fix confusing log output
Previously we'd pass all return values of read_virtual_file() to
log_info_errno() as error, but that makes no sense, given that we
sometimes return positive one with means "not truncated" but we'd show
as "Permission denied. Let's fix this, and log differently for sucess
and error.
2021-05-21 21:54:43 +02:00
Lennart Poettering
fd3c6992d9 fileio: read_virtual_file() don't tweak buffer for returning it when we aren't returning it
Let's avoid some redundant work.

Moreover, let' not check for NUL bytes in the buffer if we don't return
the buffer.
2021-05-21 21:54:43 +02:00
Lennart Poettering
259f6de486 fileio: fix typo in comment 2021-05-21 21:54:43 +02:00