summaryrefslogtreecommitdiffstats
path: root/src/journal-remote (follow)
Commit message (Collapse)AuthorAgeFilesLines
* process-util: add new FORK_DEATHSIG_SIGKILL flag, rename FORK_DEATHSIG → ↵Lennart Poettering2023-11-021-1/+1
| | | | | | | | | | | | | | | | | | FORK_DEATHSIG_SIGTERM Sometimes it makes sense to hard kill a client if we die. Let's hence add a third FORK_DEATHSIG flag for this purpose: FORK_DEATHSIG_SIGKILL. To make things less confusing this also renames FORK_DEATHSIG to FORK_DEATHSIG_SIGTERM to make clear it sends SIGTERM. We already had FORK_DEATHSIG_SIGINT, hence this makes things nicely symmetric. A bunch of users are switched over for FORK_DEATHSIG_SIGKILL where we know it's safe to abort things abruptly. This should make some kernel cases more robust, since we cannot get confused by signal masks or such. While we are at it, also fix a bunch of bugs where we didn't take FORK_DEATHSIG_SIGINT into account in safe_fork()
* tree-wide: check if return value of lseek() and friends is negativeYu Watanabe2023-10-191-2/+2
| | | | | | | | | We usually check return value of syscalls or glibc functions by it is negative or not, something like that `if (stat(path, &st) < 0)`. Let's also use the same style for lseek() and friends even the type of their return value is off_t. Note, fseeko() returns int, instead of off_t.
* fuzz: unify logging setupFrantisek Sumsal2023-10-191-2/+1
| | | | | | | | | | Make sure we don't log anything when running in "fuzzing" mode. Also, when at it, unify the setup logic into a helper, pretty similar to the test_setup_logging() one. Addresses: - https://github.com/systemd/systemd/pull/29558#pullrequestreview-1676060607 - https://github.com/systemd/systemd/pull/29558#discussion_r1358940663
* meson: add build option for install path of main config filesFranck Bui2023-10-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows distros to install configuration file templates in /usr/lib/systemd for example. Currently we install "empty" config files in /etc/systemd/. They serve two purposes: - The file contains commented-out values that show the default settings. - It is easier to edit the right file if it is already there, the user doesn't have to type in the path correctly, and the basic file structure is already in place so it's easier to edit. Things that have happened since this approach was put in place: - We started supporting drop-ins for config files, and drop-ins are the recommended way to create local configuration overrides. - We have systemd-analyze cat-config which takes care of iterating over all possible locations (/etc, /run, /usr, /usr/local) and figuring out the right file. - Because of the first two points, systemd-analyze cat-config is much better, because it takes care of finding all the drop-ins and figuring out the precedence. Looking at files manually is still possible of course, but not very convenient. The disadvantages of the current approach with "empty" files in /etc: - We clutter up /etc so it's harder to see what the local configuration actually is. - If a user edits the file, package updates will not override the file (e.g. systemd.rpm uses %config(noreplace). This means that the "documented defaults" will become stale over time, if the user ever edits the main config file. Thus, I think that it's reasonable to: - Install the main config file to /usr/lib so that it serves as reference for syntax and option names and default values and is properly updated on package upgrades. - Recommend to users to always use drop-ins for configuration and systemd-analyze cat-config to view the documentation. This setting makes this change opt-in. Fixes #18420. [zjs: add more text to the description]
* Merge pull request #29242 from fbuihuu/update-main-config-file-headersZbigniew Jędrzejewski-Szmek2023-10-172-6/+10
|\ | | | | config files: update their header to reflect that they can be install…
| * config files: update their header to reflect that they can be installed in /usrFranck Bui2023-09-212-6/+10
| | | | | | | | Follow-up for c76f2fb0e59340222ce21f85c17d384c114db9de.
* | tree-wide: add missing sigbus handlingYu Watanabe2023-10-071-0/+3
| |
* | journal-remote: drop dependencies to journaldYu Watanabe2023-10-023-6/+1
| | | | | | | | Now journal-remote can be built without libjournal_core.
* | journald: move and rename journal/managed-journal-file.[ch] -> ↵Yu Watanabe2023-10-023-2/+3
| | | | | | | | | | | | | | shared/journal-file-util.[ch] The files are used by both journald and journal-remote. Let's move them to src/shared.
* | journald: drop ManagedJournalFileYu Watanabe2023-10-023-14/+14
| | | | | | | | | | The ManagedJournalFile object is a trivial wrapper of JournalFile. Let's drop it, and also drop 'managed_' prefix from the functions.
* | journald: split-out closing journal files from managed_journal_file_open()Yu Watanabe2023-10-021-1/+0
| | | | | | | | | | No functional change, just refactoring and preparation for later commits.
* | meson: do not explicitly specify ownership of /var/log/journal/Zbigniew Jędrzejewski-Szmek2023-09-211-1/+1
|/ | | | | | | | | | | | | | | | | | | | In 9289e093ae6fd5484f9119e1ee07d1dffe37cd10 we started using install_emptydir(). When running unprivileged, 'DESTDIR=… meson install -C build --quiet --no-rebuild' would emit two warnings: '…/var/log/journal': Unable to set owner 'root' and group 'root': Operation not permitted, ignoring... '…/var/log/journal/remote': Unable to set owner 'root' and group 'root': Operation not permitted, ignoring... Those were the only two install_emptydir()s that specified ownership. Let's drop the user/group specification to get rid of the warning. When installing as root, we will create a root-owned directory anyway. When not running as root, we cannot create a root-owned directory. So this specification only makes a difference if we are running as root, and the directory already existed, and was not owned by root. In that case, I think it's actually better to leave the existing modification in place. (E.g. maybe the admin chgrp'ed the ownership for whatever reason. We might just as well leave that in place.)
* config files: more recommendations of `systemd-analyze cat-config`Franck Bui2023-09-192-0/+4
| | | | Follow-up for 3b0754b16c5.
* iovec-util: add iovw_isempty() helperLennart Poettering2023-08-111-2/+1
| | | | Follow-up for: 3746131aac4798cacf67b60cfc4e2e1c80ec4efb
* meson: use install_emptydir() and drop meson-make-symlink.shYu Watanabe2023-08-081-5/+2
| | | | | | The script is mostly equivalent to 'mkdir -p' and 'ln -sfr'. Let's replace it with install_emptydir() builtin function and inline meson call.
* meson: also merge declarations of fuzzers with other executablesYu Watanabe2023-08-031-13/+8
|
* meson: move declarations of journal-remote and friendsYu Watanabe2023-08-011-0/+46
|
* journal-upload: add missing assertionYu Watanabe2023-07-051-0/+2
|
* journal-upload: replace deprecated sd_journal_open_container()Yu Watanabe2023-07-051-7/+4
|
* journal-upload: make --namespace=* workYu Watanabe2023-07-051-5/+3
| | | | | | | Follow-up for 9f6e0bd417fa287dd1e7b541bfe0c60f04cc29e4. Note that sd_journal_open() is a simple wrapper of sd_journal_open_namespace(), hence we can merge the two branch.
* journal-remote: upload journals from namespaceIgor Tsiglyar2023-07-041-1/+26
|
* journal-remote: fix syntax in error messageZbigniew Jędrzejewski-Szmek2023-06-231-1/+1
| | | | Prompted by 2411e990a480affe30bd99a2a33ab6b94a3fe5dd.
* journal-remote: fix typo in an error messageFrantisek Sumsal2023-06-211-1/+1
|
* journal-upload: capitalize all error messagesFrantisek Sumsal2023-06-191-10/+10
| | | | To make them consistent throughout the file.
* journal-remote: capitalize all error messagesFrantisek Sumsal2023-06-191-13/+13
| | | | To make them consistent throughout the file.
* journal-remote: sync TrustedCertificateFile= parsing with journal-uploadFrantisek Sumsal2023-06-193-49/+13
| | | | | So we can use TrustedCertificateFile=- to disable certificate checking for both utilities.
* journal-remote: make MHD_OPTION_EXTERNAL_LOGGER the first optionFrantisek Sumsal2023-06-191-1/+1
| | | | | | | | To suppress a warning on journal-remote startup: systemd-journal-remote[691]: microhttpd: MHD_OPTION_EXTERNAL_LOGGER is not the first option specified for the daemon. Some messages may be printed by the standard MHD logger.
* journal-remote: minor cleanupsFrantisek Sumsal2023-06-191-6/+23
|
* journal-remote: simplify error handling a bitFrantisek Sumsal2023-06-193-55/+37
|
* journal-gatewayd: handle SIGTERMFrantisek Sumsal2023-06-191-0/+6
| | | | To allow gatewayd to exit cleanly.
* journal-gatewayd: make MHD_OPTION_EXTERNAL_LOGGER the first optionFrantisek Sumsal2023-06-161-2/+2
| | | | | | | To get rid of the warning on gatewayd startup: microhttpd: MHD_OPTION_EXTERNAL_LOGGER is not the first option specified for the daemon. Some messages may be printed by the standard MHD logger.
* tree-wide: when in doubt use greek small letter mu rather than micro symbolLennart Poettering2023-06-143-9/+9
| | | | | | | | Doesn't really matter since the two unicode symbols are supposedly equivalent, but let's better follow the unicode recommendations to prefer greek small letter mu, as per: https://www.unicode.org/reports/tr25
* journal-remote: use structured initializationFrantisek Sumsal2023-05-301-5/+6
|
* journal-remote: bump the refcount right after creating the writer objectFrantisek Sumsal2023-05-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise we might hit an assertion during cleanup if the following mmap_cache_new() call fails: Assertion 'p->n_ref > 0' failed at src/journal-remote/journal-remote-write.c:80, function writer_unref(). Aborting. ==2069==ERROR: AddressSanitizer: ABRT on unknown address 0x000000000815 (pc 0x7f39dcd0200b bp 0x7ffe2fe24db0 sp 0x7ffe2fe24b60 T0) SCARINESS: 10 (signal) #0 0x7f39dcd0200b in raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee) #1 0x7f39dcce1858 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x22858) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee) #2 0x7f39dd747e49 in log_assert_failed /work/build/../../src/systemd/src/basic/log.c:940:9 #3 0x4e4431 in writer_unref /work/build/../../src/systemd/src/journal-remote/journal-remote-write.c:80:1 #4 0x4e3fd5 in writer_unrefp /work/build/../../src/systemd/src/journal-remote/journal-remote-write.h:27:1 #5 0x4e3fd5 in writer_new /work/build/../../src/systemd/src/journal-remote/journal-remote-write.c:56:1 #6 0x4e04bc in journal_remote_get_writer /work/build/../../src/systemd/src/journal-remote/journal-remote.c:125:21 #7 0x4e0e0b in get_source_for_fd /work/build/../../src/systemd/src/journal-remote/journal-remote.c:181:13 #8 0x4e0e0b in journal_remote_add_source /work/build/../../src/systemd/src/journal-remote/journal-remote.c:233:13 #9 0x4df99f in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/journal-remote/fuzz-journal-remote.c:54:9 #10 0x4e8f48 in NaloFuzzerTestOneInput (/build/fuzz-journal-remote+0x4e8f48) #11 0x507f53 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15 #12 0x50773a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3 #13 0x508e09 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:757:19 #14 0x509ad5 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:895:5 #15 0x4f8e3f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6 #16 0x4f9708 in LLVMFuzzerRunDriver /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:925:10 #17 0x4e91c5 in main (/build/fuzz-journal-remote+0x4e91c5) #18 0x7f39dcce3082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee) #19 0x420bcd in _start (/build/fuzz-journal-remote+0x420bcd) DEDUP_TOKEN: raise--abort--log_assert_failed AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: ABRT (/lib/x86_64-linux-gnu/libc.so.6+0x4300b) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee) in raise Found by Nallocufzz.
* Merge pull request #27774 from dtardon/free-cleanupYu Watanabe2023-05-241-2/+1
|\ | | | | Use free_and_*() more
| * journal-upload: use mfree()David Tardon2023-05-241-2/+1
| |
* | tree-wide: convert more system1.Manager calls to BusLocatorDavid Tardon2023-05-241-8/+2
|/
* tree-wide: Handle EADDRNOTAVAIL as journal corruptionDaan De Meyer2023-05-021-1/+1
| | | | | Journal corruption is not only indicated by EBADMSG but also by EADDRNOTAVAIL so treat that as corruption in a few more cases.
* Merge pull request #26877 from yuwata/fuzz-journal-remoteLuca Boccassi2023-04-271-9/+14
|\ | | | | fuzz-journal-remote: several cleanups
| * fuzz-journal-remote: fix potential fd-leakYu Watanabe2023-03-181-8/+6
| |
| * fuzz-journal-remote: remove temporary files on exitYu Watanabe2023-03-181-1/+8
| |
* | journal-remote: make specified output file absoluteYu Watanabe2023-03-271-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | After f12b399dd6362a03379cb769954ebfb9972236ed, the output path is also used to determine the directory to be vacuumed. And if a filename only path is specified, `writer_new()` fails since the commit. This makes the specified path is always made absolute. This should not change any behavior before the offending commit, as `journal_open()` opens the specified journal file with `AT_FDCWD`. Fixes #27012.
* | journal-remote: add missing log message for failure in ↵Yu Watanabe2023-03-271-1/+1
| | | | | | | | journal_remote_get_writer()
* | journal-remote: make writer_new() return negative errno on failureYu Watanabe2023-03-273-15/+16
| | | | | | | | | | | | | | | | | | After f12b399dd6362a03379cb769954ebfb9972236ed, writer_new() may fail with non-OOM error. Let's return the error cause, and logs the failure in the caller side. This also drops logs in journal_remote_get_writer(), adds its caller typically logs the failure.
* | tree-wide: simplify x ? x : y to x ?: y where applicableFrantisek Sumsal2023-03-182-2/+2
|/
* conf: replace config_parse_many_nulstr() with config_parse_config_file()Franck Bui2023-03-132-16/+6
| | | | | | | | | | | | | | | | | All daemons use a similar scheme to read their main config files and theirs drop-ins. The main config files are always stored in /etc/systemd directory and it's easy enough to construct the name of the drop-in directories based on the name of the main config file. Hence the new helper does that internally, which allows to reduce and simplify the args passed previously to config_parse_many_nulstr(). Besides the overall code simplification it results: 16 files changed, 87 insertions(+), 159 deletions(-) it allows to identify clearly the locations in the code where configuration files are parsed.
* meson: Introduce userspace depJan Janssen2023-03-101-3/+4
| | | | This will help in a later commit to separate userspace from EFI builds.
* tree-wide: use unlink_and_freep() moreoverLennart Poettering2023-02-231-4/+3
|
* Merge pull request #26203 from medhefgo/mesonYu Watanabe2023-02-221-5/+8
|\ | | | | meson: Use dicts for test/fuzzer definitions
| * meson: Use dicts for fuzzer definitionsJan Janssen2023-02-211-5/+8
| |