Systemd/src/network
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
..
generator network-generator: allow empty hostname 2019-12-12 19:01:24 +09:00
netdev Merge pull request #15166 from ssahani/networkctl-ipvlan 2020-05-19 09:29:45 +02:00
tc network: rename type name to ProportionalIntegralControllerEnhanced 2020-03-12 18:18:18 +09:00
wait-online Merge pull request #14536 from DaanDeMeyer/wait-online-max-operstate 2020-02-05 10:16:29 +01:00
fuzz-netdev-parser.c
fuzz-network-parser.c network: add Reload() dbus method 2019-10-24 14:18:09 +09:00
fuzz-network-parser.options
meson.build network: TC - introduce HHF 2020-03-12 15:39:12 +09:00
networkctl.c Merge pull request #15166 from ssahani/networkctl-ipvlan 2020-05-19 09:29:45 +02:00
networkd-address-label.c network: append INTERFACE= attributes for logs corresponds to a netif 2020-01-07 22:20:43 +09:00
networkd-address-label.h
networkd-address-pool.c
networkd-address-pool.h
networkd-address.c network: Introduce method to generate EUI-64 addresses 2020-03-01 00:16:51 +09:00
networkd-address.h network: Introduce method to generate EUI-64 addresses 2020-03-01 00:16:51 +09:00
networkd-brvlan.c networkd: check return value 2019-12-05 18:19:06 +01:00
networkd-brvlan.h
networkd-can.c network: can: add support for CAN-FD related properties 2020-04-01 20:07:20 +02:00
networkd-can.h network: can: introduce a config parser function for bitrates 2020-04-01 20:07:20 +02:00
networkd-conf.c network: Move config_parse_ip_service_type to networkd-dhcp4.c and 2020-03-03 11:53:49 +09:00
networkd-conf.h network: Move config_parse_ip_service_type to networkd-dhcp4.c and 2020-03-03 11:53:49 +09:00
networkd-dhcp-common.c network: Fix crash when SendOption= is invalid 2020-05-22 11:57:22 +02:00
networkd-dhcp-common.h network: DHCPv6 - Add support to send vendor class information 2020-05-20 07:58:03 +02:00
networkd-dhcp-server.c network: fallback on resolved resolv.conf for DHCP server settings 2020-05-08 12:48:39 +02:00
networkd-dhcp-server.h network: Add support send and receive LPR servers 2020-04-22 14:49:27 +02:00
networkd-dhcp4.c network: DHCPv4- Allow to set DHCP lease lifetime 2020-05-20 06:32:26 +02:00
networkd-dhcp4.h network: DHCPv4- Allow to set DHCP lease lifetime 2020-05-20 06:32:26 +02:00
networkd-dhcp6.c network: DHCPv6 - Add support to send vendor class information 2020-05-20 07:58:03 +02:00
networkd-dhcp6.h
networkd-fdb.c network: append INTERFACE= attributes for logs corresponds to a netif 2020-01-07 22:20:43 +09:00
networkd-fdb.h
networkd-gperf.gperf network: Add support to ignore foreign routes 2020-03-07 01:42:52 +09:00
networkd-ipv4ll.c network: do not re-attach sd-event object 2020-03-17 00:32:55 +09:00
networkd-ipv4ll.h
networkd-ipv6-proxy-ndp.c network: append INTERFACE= attributes for logs corresponds to a netif 2020-01-07 22:20:43 +09:00
networkd-ipv6-proxy-ndp.h
networkd-link-bus.c basic/set: let set_put_strdup() create the set with string hash ops 2020-05-06 16:54:06 +02:00
networkd-link-bus.h network: introduce bus method forcerenew for DHCP server 2020-02-19 07:40:42 +01:00
networkd-link.c network: Add support to group links. 2020-05-15 15:27:07 +02:00
networkd-link.h network: introduce TrafficControlKind to prepare for supporting tc class 2020-03-02 15:46:28 +09:00
networkd-lldp-rx.c networkd: don't do lldp rx nor tx on bond devices 2020-04-23 20:01:30 +02:00
networkd-lldp-rx.h
networkd-lldp-tx.c networkd: don't do lldp rx nor tx on bond devices 2020-04-23 20:01:30 +02:00
networkd-lldp-tx.h LLDP: Add support to transmit MUD URL 2020-04-08 00:20:54 +02:00
networkd-manager-bus.c network: introduce bus method forcerenew for DHCP server 2020-02-19 07:40:42 +01:00
networkd-manager-bus.h
networkd-manager.c tree-wide: Mark as _unused_ variables that are only used in assert() 2020-05-06 23:03:25 +02:00
networkd-manager.h network: Add support to ignore foreign routes 2020-03-07 01:42:52 +09:00
networkd-ndisc.c network: Allow DHCPv6 client to be started even if no O or M bit in RA. 2020-04-16 09:32:19 +02:00
networkd-ndisc.h network: Allow DHCPv6 client to be started even if no O or M bit in RA. 2020-04-16 09:32:19 +02:00
networkd-neighbor.c network: append INTERFACE= attributes for logs corresponds to a netif 2020-01-07 22:20:43 +09:00
networkd-neighbor.h
networkd-network-bus.c
networkd-network-bus.h
networkd-network-gperf.gperf Merge pull request #15274 from ssahani/network-issue-9610 2020-05-20 16:39:41 +02:00
networkd-network.c network: DHCPv6 - Add support to send vendor class information 2020-05-20 07:58:03 +02:00
networkd-network.h Merge pull request #15274 from ssahani/network-issue-9610 2020-05-20 16:39:41 +02:00
networkd-nexthop.c network: include NLMSGERR_ATTR_MSG attribute in error message 2019-11-30 16:14:02 +09:00
networkd-nexthop.h network: introduce ip nexthop routing 2019-10-14 21:32:48 +09:00
networkd-radv.c network: introduce IPv6 prefix assign 2020-03-01 00:49:19 +09:00
networkd-radv.h network: introduce IPv6 prefix assign 2020-03-01 00:49:19 +09:00
networkd-route.c network: use VRF's route table if VRF= is set 2020-02-26 15:50:28 +09:00
networkd-route.h network: static routes via DHCP gateway 2020-01-07 19:10:54 +09:00
networkd-routing-policy-rule.c network: add SuppressPrefixLength option to RoutingPolicyRule (#14736) 2020-02-03 08:25:48 +09:00
networkd-routing-policy-rule.h network: add SuppressPrefixLength option to RoutingPolicyRule (#14736) 2020-02-03 08:25:48 +09:00
networkd-speed-meter.c
networkd-speed-meter.h
networkd-util.c condition: add ConditionEnvironment= 2020-05-15 16:05:33 +02:00
networkd-util.h network: define string lookup table for the DHCP info bits 2020-04-10 17:53:10 +02:00
networkd-wifi.c network: support matching based on wifi interfece type 2019-10-25 16:43:18 +09:00
networkd-wifi.h network: also read BSSID 2019-10-15 01:59:13 +09:00
networkd.c resolved, networkd: don't resolve the user if not root 2019-12-07 18:55:54 +02:00
networkd.conf network: Add support to ignore foreign routes 2020-03-07 01:42:52 +09:00
org.freedesktop.network1.conf
org.freedesktop.network1.policy network: Add policy in polkit DHCP server forcenenew 2020-02-19 07:41:36 +01:00
org.freedesktop.network1.service
systemd-networkd.pkla
systemd-networkd.rules
test-network-tables.c network: cleanup header inclusion 2019-10-30 22:23:43 +09:00
test-network.c test: Add return 0 to main() function (even it is not strictly necessary) 2020-05-13 22:56:42 +02:00
test-networkd-conf.c Revert "shared/conf-parser,networkd: EXTRACT_UNQUOTE|EXTRACT_RETAIN_ESCAPE → EXTRACT_UNQUOTE" 2019-08-19 09:54:06 +02:00
test-routing-policy-rule.c