Commit Graph

29026 Commits

Author SHA1 Message Date
Evgeny Vereshchagin a53a85b35e
Merge pull request #15914 from poettering/ubsan-float-check
json: disable ubsan float checking
2020-05-26 15:11:16 +03:00
Lennart Poettering ffec8658db
Merge pull request #15862 from hunger/master
repart: Add Uuid option to config files
2020-05-26 09:32:22 +02:00
Lennart Poettering 8e2fa6e223 json: turn off ubsan for json_variant_has_type()
Fixes: #15907
2020-05-26 09:01:26 +02:00
Lennart Poettering 6028d766d1 macro: introduce DISABLE_WARNING_TYPE_LIMITS and make use of it everywhere 2020-05-25 18:25:09 +02:00
Lennart Poettering 56e577c62f tree-wide: use DISABLE_WARNING_FORMAT_NONLITERAL where appropriate 2020-05-25 18:25:05 +02:00
Lennart Poettering 6a5b28def2 json: use our regular way to turn off compiler warnings 2020-05-25 18:23:50 +02:00
Lennart Poettering 1283366a90
Merge pull request #15167 from ssahani/address-gen-mode
networkctl: Add a range to address genmode
2020-05-25 17:32:00 +02:00
Lennart Poettering a177f05a5c
Merge pull request #15872 from keszybz/networkd-types
Type and parsing fixes for networkd
2020-05-25 17:31:00 +02:00
Tobias Hunger 7b5cb4ceb4 Repart: Add simple tests for Label="" and UUID=""
Make sure Labels and UUIDs taken from destination definitions are
taken into account when no Label/UUID is currently set already.
2020-05-25 15:48:59 +02:00
Tobias Hunger 129635333d repart: Add UUID option to config files
Add a option to provide a UUID for the partition that will get
created and document that.
2020-05-25 15:48:59 +02:00
Zbigniew Jędrzejewski-Szmek 10b20e5a93 network: allow empty assignment to PreferredLifetime=
Users might want to use that to unset a previous setting. The docs seem OK as
they are: we don't need to explictly mention the empty value, since it is
almost always allowed.
2020-05-25 14:52:04 +02:00
Zbigniew Jędrzejewski-Szmek d273579667 network: use consistent type when parsing lifetimes
Those fields are both uint32_t, so we should use the same type when parsing.
Having a different type didn't change the result, but let's be consistent.
2020-05-25 14:52:00 +02:00
Frantisek Sumsal 15dd451535 tree-wide: codespell fixes
Another batch of codespell fixes as reported by Fossies.org
2020-05-25 10:29:28 +02:00
Topi Miettinen cc1c85fbc3 login: limit nr_inodes for /run/user/$UID
Limit number of inodes for tmpfs mounts on /run/user/$UID. Default is
RuntimeDirectorySize= divided by 4096.
2020-05-24 22:54:17 +02:00
Tudor Roman 6a220cdb0b home: respect user record mount flags 2020-05-24 22:48:50 +02:00
Susant Sahani 1eb73422f2 network: Fix crash when SendOption= is invalid
```
p11-kit-0.23.20-1.fc32.x86_64 pam-1.3.1-26.fc33.x86_64 xz-libs-5.2.5-1.fc33.x86_64 zlib-1.2.11-21.fc32.x86_64
(gdb) bt
    lvalue=0x560e10 "SendOption", ltype=2, rvalue=0x560e1b "11:string", data=0x561e20, userdata=0x561cd0) at ../src/network/networkd-dhcp-common.c:580
    table=0x4392e0 <network_network_gperf_lookup>, section=0x560ef0 "DHCPv4", section_line=14, lvalue=0x560e10 "SendOption", rvalue=0x560e1b "11:string", flags=CONFIG_PARSE_WARN,
    userdata=0x561cd0) at ../src/shared/conf-parser.c:132
    lookup=0x7ffff7d2f76d <config_item_perf_lookup>, table=0x4392e0 <network_network_gperf_lookup>, flags=CONFIG_PARSE_WARN, section=0x7fffffffc9f8, section_line=0x7fffffffc9a0,
    section_ignored=0x7fffffffc99d, l=0x560e10 "SendOption", userdata=0x561cd0) at ../src/shared/conf-parser.c:270
    lookup=0x7ffff7d2f76d <config_item_perf_lookup>, table=0x4392e0 <network_network_gperf_lookup>, flags=CONFIG_PARSE_WARN, userdata=0x561cd0) at ../src/shared/conf-parser.c:395
    lookup=0x7ffff7d2f76d <config_item_perf_lookup>, table=0x4392e0 <network_network_gperf_lookup>, flags=CONFIG_PARSE_WARN, userdata=0x561cd0) at ../src/shared/conf-parser.c:452
    dropin_dirname=0x7fffffffcbd0 "veth99.network.d", sections=0x4f3a18 "Match", lookup=0x7ffff7d2f76d <config_item_perf_lookup>, table=0x4392e0 <network_network_gperf_lookup>,
    flags=CONFIG_PARSE_WARN, userdata=0x561cd0) at ../src/shared/conf-parser.c:511
(gdb) q
A debugging session is active.

	Inferior 1 [process 118718] will be killed.
```

```
$ printf '[DHCPv4]\nSendOption=1:uint8' >crash

$ ./out/fuzz-network-parser ./crash
INFO: Seed: 1158717610
INFO: Loaded 2 modules   (199728 inline 8-bit counters): 136668 [0x7faf3e91a930, 0x7faf3e93bf0c), 63060 [0xadf190, 0xaee7e4),
INFO: Loaded 2 PC tables (199728 PCs): 136668 [0x7faf3e93bf10,0x7faf3eb51cd0), 63060 [0xaee7e8,0xbe4d28),
./out/fuzz-network-parser: Running 1 inputs 1 time(s) each.
Running: ./crash
Assertion 's' failed at src/basic/parse-util.c:458, function int safe_atou8(const char *, uint8_t *)(). Aborting.
==5588== ERROR: libFuzzer: deadly signal
    #0 0x51811e in __sanitizer_print_stack_trace (/home/vagrant/systemd/out/fuzz-network-parser+0x51811e)
    #1 0x46b921 in fuzzer::PrintStackTrace() (/home/vagrant/systemd/out/fuzz-network-parser+0x46b921)
    #2 0x44ded6 in fuzzer::Fuzzer::CrashCallback() (.part.0) (/home/vagrant/systemd/out/fuzz-network-parser+0x44ded6)
    #3 0x44df9d in fuzzer::Fuzzer::StaticCrashSignalCallback() (/home/vagrant/systemd/out/fuzz-network-parser+0x44df9d)
    #4 0x7faf3d6d7b1f  (/lib64/libpthread.so.0+0x14b1f)
    #5 0x7faf3d3c2624 in raise (/lib64/libc.so.6+0x3c624)
    #6 0x7faf3d3ab8d8 in abort (/lib64/libc.so.6+0x258d8)
    #7 0x7faf3e12593a in log_assert_failed_realm /home/vagrant/systemd/build/../src/basic/log.c:819:9
    #8 0x7faf3e140ce1 in safe_atou8 /home/vagrant/systemd/build/../src/basic/parse-util.c:458:9
    #9 0x68089c in config_parse_dhcp_send_option /home/vagrant/systemd/build/../src/network/networkd-dhcp-common.c:517:21
    #10 0x7faf3debed4e in next_assignment /home/vagrant/systemd/build/../src/shared/conf-parser.c:132:32
    #11 0x7faf3deb7783 in parse_line /home/vagrant/systemd/build/../src/shared/conf-parser.c:270:16
    #12 0x7faf3deb606c in config_parse /home/vagrant/systemd/build/../src/shared/conf-parser.c:395:21
    #13 0x7faf3deb85ee in config_parse_many_files /home/vagrant/systemd/build/../src/shared/conf-parser.c:452:21
    #14 0x7faf3deb8c57 in config_parse_many /home/vagrant/systemd/build/../src/shared/conf-parser.c:511:16
    #15 0x57c2eb in network_load_one /home/vagrant/systemd/build/../src/network/networkd-network.c:470:13
    #16 0x543490 in LLVMFuzzerTestOneInput /home/vagrant/systemd/build/../src/network/fuzz-network-parser.c:26:16
    #17 0x44e3e8 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/home/vagrant/systemd/out/fuzz-network-parser+0x44e3e8)
    #18 0x433505 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/home/vagrant/systemd/out/fuzz-network-parser+0x433505)
    #19 0x43c449 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/home/vagrant/systemd/out/fuzz-network-parser+0x43c449)
    #20 0x42c4a6 in main (/home/vagrant/systemd/out/fuzz-network-parser+0x42c4a6)
    #21 0x7faf3d3ad1a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)
    #22 0x42c4fd in _start (/home/vagrant/systemd/out/fuzz-network-parser+0x42c4fd)

NOTE: libFuzzer has rudimentary signal handlers.
      Combine libFuzzer with AddressSanitizer or similar for better crash reports.
SUMMARY: libFuzzer: deadly signal

```
2020-05-22 11:57:22 +02:00
Lennart Poettering c8f145adbb homed: don't insist on authentication against host-copy user record
homed maintains two or three copies of the user's identity record per
home directory: one on the host, one inside the LUKS header, and one
embedded in the home directory.

Previously we'd insist that if a user logs in they have to authenticate
against all three, as a safety feature. This broke logging into
unfixated records however, since in that case the host version is
synthetic and thus does not carry any authentication data.

Let's hence losen the strictness here: accept authentication against
host records that carry no auth data. This should be safe as we know
after all that the second/third record will catch invalid accesses.

Fixes: #15178
2020-05-21 23:39:30 +02:00
Lennart Poettering 1a53adb3ab homed: include error string when in log message if quota doesn't work 2020-05-21 23:39:30 +02:00
Lennart Poettering 2fcbf417b6 bus-util: actually register the object manager 2020-05-21 23:39:30 +02:00
Lennart Poettering fa3709c5fb homed: also fsync private/public key pair when storing it 2020-05-21 23:39:30 +02:00
Lennart Poettering e8dd54ab3c homed: fix typo 2020-05-21 23:39:30 +02:00
Lennart Poettering b847192699 homed: make sure we log about invalid user records we load 2020-05-21 23:39:30 +02:00
Lennart Poettering 20f4a308bf homed: automatically clean up empty user record files
See: #15178
2020-05-21 23:39:30 +02:00
Lennart Poettering e4005ffe00 homed: when updating local copy of user record, sync to disk
Apparently xfs needs us to sync explicitly, see #15178.
2020-05-21 23:28:49 +02:00
Lennart Poettering 5b3f4a20ea fileio: sync directory after rename, too 2020-05-21 23:28:48 +02:00
Lennart Poettering cbffdcecae homed: return a better error when a home has no authentication information defined
We can't log into home entries that have no password or PKCS#11 token.
Return a proper, useful error in that case.

See: #15178
2020-05-21 23:28:48 +02:00
Susant Sahani a6f1848a23 network: Allow to configure addr_gen_mode
Defines how link-local and autoconf addresses are generated.

	0: generate address based on EUI64 (default)
	1: do no generate a link-local address, use EUI64 for addresses generated
	   from autoconf
	2: generate stable privacy addresses, using the secret from
	   stable_secret (RFC7217)
	3: generate stable privacy addresses, using a random secret if unset
2020-05-21 14:41:04 +02:00
Jeremy Cline efdbf5fe9c shared: treat generator units as vendor units
Units created with "systemctl edit --full" from generator units aren't
removed with "systemctl revert" because units in the generator,
generator_early, and generator_late paths aren't considered vendor
units.

Alter path_is_vendor() to return true if the given path is a
generator unit, which in turn causes "systemctl revert" to remove units
created with "systemctl edit --full" as they now have vendor versions.

Fixes #10053
2020-05-21 10:03:40 +02:00
Lidong Zhong 9b3278d907 udev: rename the persistent link for ATA devices
ATA devices should use the ATA ids like port number and (possibly)
master/slave or multiplier id, not the generic SCSI ID.
Currently only port number is included in the link. With this patch
the link would be able to support more cases, which are a) when the
device is behind a port multiplexer b) the distinction between master
and slave (distinguished by target id).

I tried to verify scenario a) with this patch, but I failed to find a
machine with PMP SATA devices attached. But the link below
https://github.com/systemd/systemd/issues/3943
could show what's the difference. Here is my test for scenario b)

Current version:
linux-ql21:~ # ll /sys/class/block/sd[ab]
lrwxrwxrwx 1 root root 0 May  8 20:46 /sys/class/block/sda ->
../../devices/pci0000:00/0000:00:01.1/ata4/host3/target3:0:0/3:0:0:0/block/sda
lrwxrwxrwx 1 root root 0 May  8 20:46 /sys/class/block/sdb ->
../../devices/pci0000:00/0000:00:01.1/ata4/host3/target3:0:1/3:0:1:0/block/sdb
linux-ql21:~ # ll /dev/disk/by-path/pci-0000\:00\:01.1-ata-1
lrwxrwxrwx 1 root root 9 May  8 20:44
/dev/disk/by-path/pci-0000:00:01.1-ata-1 -> ../../sdb
linux-ql21:~ # udevadm info /sys/class/block/sda |grep by-path
S: disk/by-path/pci-0000:00:01.1-ata-1
E: DEVLINKS=/dev/disk/by-id/ata-VBOX_HARDDISK_VB3649e885-3e0cdd64
/dev/disk/by-id/scsi-0ATA_VBOX_HARDDISK_VB3649e885-3e0cdd64
/dev/disk/by-id/scsi-1ATA_VBOX_HARDDISK_VB3649e885-3e0cdd64
/dev/disk/by-path/pci-0000:00:01.1-ata-1
/dev/disk/by-id/scsi-SATA_VBOX_HARDDISK_VB3649e885-3e0cdd64
linux-ql21:~ # udevadm info /sys/class/block/sdb |grep by-path
S: disk/by-path/pci-0000:00:01.1-ata-1
E: DEVLINKS=/dev/disk/by-id/ata-VBOX_HARDDISK_VBc53b2498-d84ae8de
/dev/disk/by-id/scsi-SATA_VBOX_HARDDISK_VBc53b2498-d84ae8de
/dev/disk/by-id/scsi-1ATA_VBOX_HARDDISK_VBc53b2498-d84ae8de
/dev/disk/by-id/scsi-0ATA_VBOX_HARDDISK_VBc53b2498-d84ae8de
/dev/disk/by-path/pci-0000:00:01.1-ata-1

After patch applied:
linux-ql21:~ # ll /sys/class/block/sd[ab]
lrwxrwxrwx 1 root root 0 May  8 21:07 /sys/class/block/sda ->
../../devices/pci0000:00/0000:00:01.1/ata4/host3/target3:0:0/3:0:0:0/block/sda
lrwxrwxrwx 1 root root 0 May  8 21:07 /sys/class/block/sdb ->
../../devices/pci0000:00/0000:00:01.1/ata4/host3/target3:0:1/3:0:1:0/block/sdb
linux-ql21:~ # ll /dev/disk/by-path/pci-0000\:00\:01.1-ata-*
lrwxrwxrwx 1 root root  9 May  8 21:07
/dev/disk/by-path/pci-0000:00:01.1-ata-1.0 -> ../../sda
lrwxrwxrwx 1 root root  9 May  8 21:07
/dev/disk/by-path/pci-0000:00:01.1-ata-1.1 -> ../../sdb
linux-ql21:~ # udevadm info /sys/class/block/sda |grep by-path
S: disk/by-path/pci-0000:00:01.1-ata-1.0
E: DEVLINKS=/dev/disk/by-id/scsi-1ATA_VBOX_HARDDISK_VB3649e885-3e0cdd64
/dev/disk/by-id/scsi-0ATA_VBOX_HARDDISK_VB3649e885-3e0cdd64
/dev/disk/by-id/ata-VBOX_HARDDISK_VB3649e885-3e0cdd64
/dev/disk/by-path/pci-0000:00:01.1-ata-1.0
/dev/disk/by-id/scsi-SATA_VBOX_HARDDISK_VB3649e885-3e0cdd64
linux-ql21:~ # udevadm info /sys/class/block/sdb |grep by-path
S: disk/by-path/pci-0000:00:01.1-ata-1.1
E: DEVLINKS=/dev/disk/by-id/scsi-0ATA_VBOX_HARDDISK_VBc53b2498-d84ae8de
/dev/disk/by-id/ata-VBOX_HARDDISK_VBc53b2498-d84ae8de
/dev/disk/by-id/scsi-1ATA_VBOX_HARDDISK_VBc53b2498-d84ae8de
/dev/disk/by-id/scsi-SATA_VBOX_HARDDISK_VBc53b2498-d84ae8de
/dev/disk/by-path/pci-0000:00:01.1-ata-1.1

Changelog:
v5: add another parameter compat_link in handle_scsi()
v4: comment for ID_PATH_ATA_COMPAT
    get string length with pointer difference
    (suggested by Franck Bui<fbui@suse.com>)
v3: creating compatible link from env
    variables type change
v2: remove udev rules modification for compatible link
    setup a test scenario of master/slave ATA devices
v1: initial patch
2020-05-21 09:58:06 +02:00
Susant Sahani 7f20a9e5b9 networkctl: Add a range to address genmode 2020-05-21 09:25:16 +02:00
Zbigniew Jędrzejewski-Szmek 7c15a55f8b
Merge pull request #15870 from poettering/proc-cmdline-efi-fix
udev /proc/cmdline handling fixes
2020-05-21 09:07:27 +02:00
Zbigniew Jędrzejewski-Szmek f198303902 sd-path: fix systemd-system-generator-path lookup
CID#1422164.
2020-05-21 08:13:11 +02:00
Zbigniew Jędrzejewski-Szmek 5dc31db7c1 network: reduce scope of variables, etc. 2020-05-21 08:13:11 +02:00
Zbigniew Jędrzejewski-Szmek a27060759b network: fix signed/unsigned confusion
sd_dhcp_lease_get_servers() returns int, which would never be negative when
cast to size_t, so we condition check was wrong.

CID#1425417.
2020-05-21 08:13:11 +02:00
Lennart Poettering a60416f319 homed: fix return value mix-up
We generally return > 1 if any of the actions we are doing is instantly
complete and == 0 when we started doing it asynchronously (by forking
off homework), in our functions that execute operations on homes.

Fix a mix-up where the test for this was reversed in
home_dispatch_release() and home_dispatch_lock_all().

Fixes: #15684
2020-05-21 08:10:13 +02:00
Anita Zhang b10ceb4783
Merge pull request #15557 from poettering/journal-zero-fix
journal: deal better with reading from zeroed out journal mmaps
2020-05-20 18:14:51 -07:00
Anita Zhang 30ed6e2250
Merge pull request #15864 from poettering/pam-sudo-fixes-part3
two more pam_systemd fixes, split out of #15742
2020-05-20 15:01:52 -07:00
Lennart Poettering 09835de3cc proc-cmdline: make checking of EFI options variable optional
And do not use it in the IMPORT{cmdline} udev code. Wherever we expose
direct interfaces to check the kernel cmdline, let's not consult our
systemd-specific EFI variable, but strictly use the actual kernel
variable, because that's what we claim we do. i.e. it's fine to use the
EFI variable for our own settings, but for the generic APIs to the
kernel cmdline we should not use it.

Specifically, this applies to IMPORT{cmdline} and
ConditionKernelCommandLine=. In the latter case we weren#t checking the
EFI variable anyway, hence let's do the same for the udev case, too.

Fixes: #15739
2020-05-20 19:22:09 +02:00
Lennart Poettering 05a7827e87 proc-cmdline: add checking of EFI options variable in proc_cmdline_get_key_many() too 2020-05-20 19:18:45 +02:00
Lennart Poettering 4b5ee5901c proc-cmdline: fix return value clobbering in proc_cmdline_get_key()
Let's make sure proc_cmdline_get_key() follows our coding style: never
clobber return values on failure, and always initialize on success.
2020-05-20 19:17:44 +02:00
Zbigniew Jędrzejewski-Szmek 6b8664cb5b tree-wide: fix bad errno checks 2020-05-20 18:10:58 +02:00
Zbigniew Jędrzejewski-Szmek a0fa268337 basic/efivars: fix errno propagation
Fixup for 484f4e5b2d. Should fix #15730.
2020-05-20 18:08:05 +02:00
Zbigniew Jędrzejewski-Szmek 929d07ddcb
Merge pull request #15274 from ssahani/network-issue-9610
DHCP4: Allow lease time to be set when missing from offer
2020-05-20 16:39:41 +02:00
Lennart Poettering 400530c1e2
Merge pull request #15490 from ssahani/dhcpv6-vendor-class
network: DHCPv6 - Add support to send vendor class information
2020-05-20 16:18:18 +02:00
Zbigniew Jędrzejewski-Szmek a94d11cc66
Merge pull request #15860 from keszybz/bus-message-empty-fields
Fix crash on message with empty fields structure
2020-05-20 15:53:28 +02:00
Zbigniew Jędrzejewski-Szmek bb94ded693
Merge pull request #15661 from hundeboll/mount-read-write-only
Mount read write only
2020-05-20 15:48:04 +02:00
Susant Sahani 579ca0a2b2 sd-network: DHCPv4 - Add user class, extra option and send generic options in request state 2020-05-20 15:43:20 +02:00
Zbigniew Jędrzejewski-Szmek 3d45f6b2d0
Merge pull request #15535 from fbuihuu/update-runtime-watchdog-on-reload
pid1: update RuntimeWatchogSec setting on daemon-reload as well
2020-05-20 15:40:34 +02:00
ExtinctFire 929fed02df load-fragment: fix a typo
Correct the typo of “priority” in log message
2020-05-20 15:22:37 +02:00
Martin Hundebøll f42aa41683 fstab-generator: add x-systemd.rw-only option support
Support enabling the ReadwriteOnly= unit setting from fstab using
'x-systemd.rw-only'
2020-05-20 14:26:04 +02:00