summaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* siphash24: introduce siphash24_compress_typesafe() macroYu Watanabe2023-12-2537-163/+172
| | | | | | | | To prevent copy-and-paste mistake. This also introduce in_addr_hash_func(). No functional change, just refactoring.
* resolve: don't add sockets to the graveyard on shutdownFrantisek Sumsal2023-12-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since in that case the event loop is already finished and we'd hit an assertion: [ 1295.993300] testsuite-75.sh[50]: + systemctl stop systemd-resolved.service [ 1296.005152] systemd-resolved[298]: Assertion 'e->state != SD_EVENT_FINISHED' failed at src/libsystemd/sd-event/sd-event.c:1252, function sd_event_add_io(). Aborting. Thread 1 (Thread 0x7f17d25e2940 (LWP 298)): #0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44 #1 0x00007f17d16ac8a3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78 #2 0x00007f17d165c668 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 #3 0x00007f17d16444b8 in __GI_abort () at abort.c:79 #4 0x00007f17d2402d2d in log_assert_failed (text=<optimized out>, file=<optimized out>, line=<optimized out>, func=<optimized out>) at ../build/src/basic/log.c:968 #5 0x00007f17d240401c in log_assert_failed_return (text=text@entry=0x7f17d2533f13 "e->state != SD_EVENT_FINISHED", file=file@entry=0x7f17d25195d9 "src/libsystemd/sd-event/sd-event.c", line=line@entry=1252, func=func@entry=0x7f17d2567260 <__func__.140> "sd_event_add_io") at ../build/src/basic/log.c:987 #6 0x00007f17d24d011a in sd_event_add_io (e=0x55e5cb497270, ret=0x55e5cb4a5120, fd=fd@entry=26, events=events@entry=1, callback=callback@entry=0x55e5caff5466 <on_io_event>, userdata=0x55e5cb4a5110) at ../build/src/libsystemd/sd-event/sd-event.c:1252 #7 0x000055e5caff571c in manager_add_socket_to_graveyard (m=0x55e5cb43cf00, fd=26) at ../build/src/resolve/resolved-socket-graveyard.c:117 #8 0x000055e5cafd4253 in dns_transaction_close_connection (t=t@entry=0x55e5cb57c7d0, use_graveyard=use_graveyard@entry=true) at ../build/src/resolve/resolved-dns-transaction.c:78 #9 0x000055e5cafd8444 in dns_transaction_complete (t=t@entry=0x55e5cb57c7d0, state=state@entry=DNS_TRANSACTION_ABORTED) at ../build/src/resolve/resolved-dns-transaction.c:427 #10 0x000055e5cafc4969 in dns_scope_abort_transactions (s=s@entry=0x55e5cb4b1a70) at ../build/src/resolve/resolved-dns-scope.c:91 #11 0x000055e5cafc6aee in dns_scope_free (s=0x55e5cb4b1a70) at ../build/src/resolve/resolved-dns-scope.c:106 #12 0x000055e5cafe72d1 in link_free (l=0x55e5cb4a5160) at ../build/src/resolve/resolved-link.c:94 #13 0x000055e5cafedefc in manager_free (m=0x55e5cb43cf00) at ../build/src/resolve/resolved-manager.c:697 #14 0x000055e5caff99b6 in manager_freep (p=p@entry=0x7ffd71fab8f8) at ../build/src/resolve/resolved-manager.h:198 #15 0x000055e5caff9d66 in run (argc=argc@entry=1, argv=argv@entry=0x7ffd71faba78) at ../build/src/resolve/resolved.c:25 #16 0x000055e5caff9fe3 in main (argc=1, argv=0x7ffd71faba78) at ../build/src/resolve/resolved.c:99 Resolves: #30618
* coccinelle: convert hashmap_size() == 0 or friendsYu Watanabe2023-12-241-1/+1
| | | | Addresses https://github.com/systemd/systemd/pull/30567#issuecomment-1866631816.
* sd-device: shorten code a bigYu Watanabe2023-12-241-3/+1
| | | | Suggested by coccinelle.
* busctl: avoid asserting on NULL messageFrantisek Sumsal2023-12-241-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid passing a NULL message to sd_bus_message_is_signal(), to not trip over an assertion: [ 132.869436] H testsuite-82.sh[614]: + systemctl --no-block --check-inhibitors=yes soft-reboot [ 132.967386] H systemd[1]: Created slice system-systemd\x2dcoredump.slice. [ 133.018292] H systemd[1]: Starting inhibit.service... [ 133.122610] H systemd[1]: Started systemd-coredump@0-665-0.service. [ 133.163643] H systemd[1]: Started inhibit.service. [ 133.206836] H testsuite-82.sh[614]: + exec sleep infinity [ 133.236762] H systemd-logind[611]: The system will reboot now! [ 135.891607] H systemd-coredump[667]: [🡕] Process 663 (busctl) of user 0 dumped core. Stack trace of thread 663: #0 0x00007f2ec45e6acf raise (libc.so.6 + 0x4eacf) #1 0x00007f2ec45b9ea5 abort (libc.so.6 + 0x21ea5) #2 0x00007f2ec4b5c9a6 log_assert_failed (libsystemd-shared-255.so + 0x1ff9a6) #3 0x00007f2ec4b5dca5 log_assert_failed_return (libsystemd-shared-255.so + 0x200ca5) #4 0x00007f2ec4bb3df6 sd_bus_message_is_signal (libsystemd-shared-255.so + 0x256df6) #5 0x000000000040e478 monitor (busctl + 0xe478) #6 0x000000000040e82f verb_monitor (busctl + 0xe82f) #7 0x00007f2ec4b202cb dispatch_verb (libsystemd-shared-255.so + 0x1c32cb) #8 0x00000000004074fa busctl_main (busctl + 0x74fa) #9 0x0000000000407525 run (busctl + 0x7525) #10 0x000000000040ff67 main (busctl + 0xff67) #11 0x00007f2ec45d2d85 __libc_start_main (libc.so.6 + 0x3ad85) #12 0x00000000004044be _start (busctl + 0x44be) ELF object binary architecture: AMD x86-64 [ 136.141152] H dbus-daemon[634]: [system] Monitoring connection :1.2 closed. [ 136.152233] H systemd[1]: busctl.service: Main process exited, code=dumped, status=6/ABRT [ 136.153996] H systemd[1]: busctl.service: Failed with result 'core-dump'. The asertion in question: Assertion 'm' failed at src/libsystemd/sd-bus/bus-message.c:1015, function sd_bus_message_is_signal(). Aborting. We can get a NULL message here through sd_bus_process() -> bus_process_internal() -> process_running(), so let's handle this case appropriately.
* Merge pull request #30594 from yuwata/udev-timeout-cleanupsLuca Boccassi2023-12-246-12/+35
|\ | | | | udev: several cleanups for timeout settings
| * udev-spawn: slightly adjust logs about timed out commandsYu Watanabe2023-12-221-4/+3
| | | | | | | | | | - Add full stop to the messages. - Do not kill commands before logging "killing", but do after.
| * udev: refuse too short timeout valueYu Watanabe2023-12-224-1/+27
| | | | | | | | | | | | | | | | Setting zero or too short timeout for each uevent is meaningless, and causes the system fails to boot. Let's refuse such values. Also, delaying execution of RUN= commands too long also makes many uevents enter the failed state. So, let's refuse such misconfiguration.
| * udev: handle event_timeout=infinity correctlyYu Watanabe2023-12-221-0/+3
| | | | | | | | | | This is a paranoia, as even USEC_INFINITY / 3 is finite, it is still so large in general.
| * udev-manager: use ASSERT_PTR()Yu Watanabe2023-12-221-7/+2
| |
* | Merge pull request #30596 from yuwata/sd-device-db-cleanupsLuca Boccassi2023-12-243-55/+90
|\ \ | | | | | | sd-device: several cleanups for udev database related functions
| * | sd-device: introduce device_has_db() helper functionYu Watanabe2023-12-222-0/+14
| | |
| * | sd-device: modernize device_update_db() and friendsYu Watanabe2023-12-223-55/+76
| |/ | | | | | | | | | | | | | | | | - introduce device_should_have_db(), - split out device_get_db_path(), - update log messages, especially clarify which stage is failed, - use _cleanup_(unlink_and_freep) attribute, - clear existing database file also when failed to create database directory and when failed to create temporary file.
* | Merge pull request #30609 from YHNdnzj/analyze-fdstoreYu Watanabe2023-12-231-2/+2
|\ \ | | | | | | analyze-fdstore: minor fixups
| * | analyze-fdstore: don't log duplicate errorMike Yuan2023-12-231-1/+1
| | | | | | | | | | | | table_print_with_pager() logs print error internally.
| * | analyze-fdstore: ignore table header when checking stored fd countMike Yuan2023-12-231-1/+1
| | |
* | | core/executor: use log level specified in LogLevelMax=Yu Watanabe2023-12-233-1/+9
|/ / | | | | | | | | | | Follow-up for cc9f4cad8cd759ab55048dc7a3eaa2c2fb0344da. Otherwise, still unexpected lines may be logged by executor.
* | systemctl: swap cached_id_map and cached_name_map at one more placeYu Watanabe2023-12-231-1/+1
| | | | | | | | | | | | | | | | Follow-up for 2962a508508564ec35f231bd4246846d6d057115. Fortunately, this does not change any behavior. Replaces #30601. Fixes CID#1532831.
* | networkd: support `proxy_arp_pvlan` sysctlRaito Bezarius2023-12-234-0/+19
| | | | | | | | | | The proxy ARP private VLAN sysctl is useful for VLAN aggregation, see https://sysctl-explorer.net/net/ipv4/proxy_arp_pvlan/ for details.
* | Merge pull request #30049 from yuwata/assert-return-criticalYu Watanabe2023-12-2318-85/+148
|\ \ | | | | | | test: make assert_return() critical by default
| * | log: make assert_return() critical when -Dmode=developerYu Watanabe2023-12-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Triggering assert_return() should be a bug in general, and we should really fix that. But, previously, it is hard to notice such bug, as it was not critical. This is for making CI or our testing environment fail if we unexpectedly trigger assert_return(). So, hopefully we can easily find such bugs.
| * | test: make assert_return() critical by default on fuzzer and unit testsYu Watanabe2023-12-2316-85/+132
| | | | | | | | | | | | | | | | | | Several test cases intentionally trigger assert_return(). So, to avoid the entire test fails, this introduces several macros that tentatively make assert_return() not critical.
| * | log: introduce a knob to make assert_return() criticalYu Watanabe2023-12-232-0/+16
| | | | | | | | | | | | | | | | | | | | | These can be used to check if we trigger assert_return() unexpectedly. Co-authored-by: Frantisek Sumsal <frantisek@sumsal.cz>
* | | network: use json_variant_append_arrayb()Yu Watanabe2023-12-231-116/+56
|/ / | | | | | | No functional change, just refactoring and shortening code.
* | Merge pull request #30603 from mrc0mmand/openssl-shenanigansYu Watanabe2023-12-231-1/+1
|\ \ | | | | | | test/ukify: make the tests happy with OpenSSL 3.2.0+
| * | ukify: make the test happy with the latest OpenSSLFrantisek Sumsal2023-12-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Which dropped some whitespaces in the output: $ openssl version OpenSSL 3.2.0 23 Nov 2023 (Library: OpenSSL 3.2.0 23 Nov 2023) $ openssl x509 -in cert.pem -text -noout | grep Issuer Issuer: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd $ openssl version OpenSSL 3.0.9 30 May 2023 (Library: OpenSSL 3.0.9 30 May 2023) $ openssl x509 -in cert.pem -text -noout | grep Issuer Issuer: C = XX, L = Default City, O = Default Company Ltd Making test-ukify unhappy: > assert 'Issuer: CN = SecureBoot signing key on host' in out E AssertionError: assert 'Issuer: CN = SecureBoot signing key on host' in '<...snip...>Issuer: CN=SecureBoot signing key on host archlinux2\n...'
* | | udev: use SD_EVENT_SIGNAL_PROCMASKYu Watanabe2023-12-232-9/+8
| | |
* | | Merge pull request #30590 from yuwata/backlight-cleanupsLuca Boccassi2023-12-221-110/+187
|\ \ \ | |_|/ |/| | backlight: several cleanups and use dispatch_verb()
| * | backlight: split out verb_load() and verb_save(), then use dispatch_verb()Yu Watanabe2023-12-221-57/+75
| | | | | | | | | | | | No functional change, just refactoring.
| * | backlight: use WRITE_STRING_FILE_MKDIR_0755 flag on saveYu Watanabe2023-12-221-6/+1
| | | | | | | | | | | | No functional change, just refactoring.
| * | backlight: split out read_saved_brightness()Yu Watanabe2023-12-221-26/+40
| | | | | | | | | | | | No functional change, just refactoring.
| * | backlight: split out device_new_from_arg()Yu Watanabe2023-12-221-23/+43
| | | | | | | | | | | | | | | | | | | | | While at it, this replaces strndupa_safe() with strndup(), as the input is a user-controlled string. No functional change, just refactoring.
| * | backlight: split out build_save_file_path()Yu Watanabe2023-12-221-18/+44
| | | | | | | | | | | | No functional change, just refactoring.
| * | backlight: move validity check of max_brightness to get_max_brightness()Yu Watanabe2023-12-221-14/+18
| | | | | | | | | | | | | | | Also rename get_max_brightness() -> read_max_brightness() for consistency with read_brightness().
* | | network: use varlink for networkctl check_netns_match()Matt Layher2023-12-221-9/+21
|/ / | | | | | | | | | | | | Use varlink to detect networkd's network namespace when executing networkctl rather than the D-Bus interface. Signed-off-by: Matt Layher <mdlayher@gmail.com>
* | various: clean up isatty() handlingMike Yuan2023-12-2212-29/+26
| | | | | | | | As per https://github.com/systemd/systemd/pull/30547#discussion_r1434371627
* | terminal-util: introduce isatty_safe that rejects EBADFMike Yuan2023-12-222-0/+14
| |
* | terminal-util: use RET_GATHER moreMike Yuan2023-12-221-18/+13
| |
* | test: fix check for device in test-executeLuca Boccassi2023-12-221-1/+1
|/ | | | | | The unit actually uses /dev/kmsg, not /dev/kvm Follow-up for ae7482b994e6a9bc8e
* Merge pull request #30550 from yuwata/network-nexthop-cleanups-3Luca Boccassi2023-12-226-55/+133
|\ | | | | network: several cleanups for nexthop (part3)
| * network/nexthop: check if nexthop is really configured without IDYu Watanabe2023-12-201-0/+10
| |
| * network/nexthop: cache requested nexthop IDsYu Watanabe2023-12-205-20/+49
| |
| * network/nexthop: drop conflicting [NextHop] sectionsYu Watanabe2023-12-204-13/+42
| |
| * network/nexthop: check if on-link is not enabled for group or blackhole nexthopYu Watanabe2023-12-201-5/+19
| |
| * network/nexthop: fix wrong verificationYu Watanabe2023-12-201-1/+1
| | | | | | | | This checks the nexthop is not a blackhole, gateway is unrelated.
| * network/nexthop: add several assertions related to nexthop IDYu Watanabe2023-12-201-6/+12
| |
| * network/nexthop: drop dead codeYu Watanabe2023-12-201-11/+1
| | | | | | | | Follow-up for a533473a48ff05e84e7af3d4049dbf458b6c0f94.
* | systemctl: swap cached_id_map and cached_name_mapYu Watanabe2023-12-221-5/+5
| | | | | | | | | | | | | | | | These are unused or used in the same order. So, this patch does not change any behavior, just for naming consistency with the function prototype. Closes #30570.
* | networkd: add basic Varlink interfaceLennart Poettering2023-12-229-3/+140
| | | | | | | | | | | | | | | | | | | | Let's get networkd onto Varlink. This only adds the most basic of operations. I'd love to see networkd do Varlink for all its basic operations so that networkctl can use that, and work correctly before D-Bus is up. Right now, many of networkctls calls simply don't work before D-Bus, and I'd like to see that improved.
* | service: don't try to determine selinux label for socket activation if ↵Lennart Poettering2023-12-223-33/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RootImage= is used We cannot determine the SELinux label ahead of time if RootImage= is used, since we'd have to mount the image then, hence don't, and handle this cleanly, and gracefully. While we are at it, stop "reaching over" so much from the socket code to the service code, and instead provide function that most of the hard work in service.c that socket.c just calls. While we are at it, add debug logging and stuff. I noticed the issue when also noticing #30560, but that one is harder to fix, hence I avoided it for now.