Commit Graph
62812 Commits
Author SHA1 Message Date
Lennart Poettering 11181f8a5a man: document __SEQNUM=/__SEQNUM_ID= journal pseudo fields 2023-02-08 13:42:30 +01:00
Lennart Poettering 37a40afcfe man: document the new sd_journal_get_seqnum() call 2023-02-08 13:42:30 +01:00
Lennart Poettering e5d60d1b3b journald: maintain entry seqnum counter in mmap()ed file in /run/
Let's ensure that entry seqnums remain stable and monotonic across the
entire runtime of the system, even if local storage is turned off. Let's
do this by maintainer a counter file in /run/ which we mmap() and
wherein we maintain the counter from early-boot on till late shutdown.

This takes inspiration of the kernel-seqnum file we already maintain
like that that tracks which kmsg messages we already processed. In fact,
we reuse the same code for maintaining it.

This should allow the behaviour entry seqnums to be more predictable, in
particular when journal local storage is turned off. Previously, we'd
maintain the seqnum simply by always bumping it to the maximum of the
last written entry seqnum plus one, and the biggest seqnum so far
written to the journal file on disk. If we'd never write a file on disk,
or if no journal file was existing during the initrd→seqnum transition
we'd completely lose the current seqnum position during daemon restarts
(such as the one happening during the switch-root operation).

This also will cause a journal file rotation whenever we try to write to
a journal file with multiple sequence number IDs, so that we know that
from early boot trhough the entire runtime we'll have stable sequence
numbers that do not jump, and thus can be used to determine "lost"
messages.
2023-02-08 13:42:29 +01:00
Lennart Poettering 2bc70e2e9d logs-show: show seqnum info in export+json output mode 2023-02-08 13:42:29 +01:00
Lennart Poettering b1712fabd1 sd-journal: add high-level API for querying seqnum for journal entries, along with seqnum id 2023-02-08 13:42:29 +01:00
Fabian Gurtner 11c0f0659e hwdb: Add HP Envy x360 Convertible 15-cn0xxx to existing entry 2023-02-08 11:01:36 +00:00
Zbigniew Jędrzejewski-Szmek 8eb491f499 test-parse-util: add tests with explicit plus character
I expected this to work, but our tests did not cover this
explicitly.
2023-02-08 12:01:16 +01:00
Zbigniew Jędrzejewski-Szmek 502096b565 core/service: constify ExecCommand* in two functions 2023-02-08 12:01:16 +01:00
Luca Boccassi 398dc7d39b core: imply DeviceAllow=/dev/tpmrm0 with LoadCredentialEncrypted
If the device access policy is restricted, add implicitly access to the TPM
if at least one encrypted credential needs to be loaded.

Fixes https://github.com/systemd/systemd/issues/26042
2023-02-08 10:59:55 +00:00
Luca Boccassi b0fc23fae5 cryptenroll: do not implicitly verify with default tpm policy signature
If it was not requested to use a tpm2 signature file when enrolling, do
not fallback to the default /run/systemd/tpm2-pcr-signature.json as it
likely will be unrelated if it exists.

Fixes https://github.com/systemd/systemd/issues/25435
2023-02-08 10:58:57 +00:00
msizanoen1 500cd2e83b unit: always return 1 in log_kill
This ensures that cg_kill_items returns the correct value to let the
manager know that a process was killed.
2023-02-08 11:33:54 +01:00
Zbigniew Jędrzejewski-Szmek ef9962212a Merge pull request #26328 from yuwata/udev-worker-set-process-name
udev: set worker process name
2023-02-08 08:57:05 +01:00
Lennart Poettering 9eba03c7b1 journal: minor modernizations 2023-02-07 19:36:47 +00:00
Luca Boccassi b4cdd8792e Merge pull request #26337 from poettering/journal-display-ts
logs-show: rename "ts" paramater/variable to "display_ts"
2023-02-07 19:36:27 +00:00
Luca Boccassi 19995b8121 Merge pull request #26336 from poettering/journal-etoomanyrefs
journal: print nicer log message when limit of open journal files during display is hit
2023-02-07 19:35:56 +00:00
Luca Boccassi 2a0e9089cc Merge pull request #26335 from keszybz/dns-not-found
resolve: adjust message for NXDOMAIN lookup result
2023-02-07 19:33:07 +00:00
Daan De Meyer 3743ea3f62 bus-map-properties: Use bus_log_parse_error_debug() 2023-02-07 18:17:04 +01:00
Daan De Meyer a78d1ef596 bus-util: Add bus_log_parse_error_debug() 2023-02-07 18:17:04 +01:00
Daan De Meyer accc26a0e5 chase-symlinks: Always open a dirfd to the root directory
Instead of special casing "/", let's just always open a dirfd to the
root directory.
2023-02-07 16:36:55 +01:00
Daan De Meyer c677e13c35 chase-symlinks: chase_symlinks_at() AT_FDCWD fixes
- Whether we should return an absolute path or not is irrelevant
to whether CHASE_AT_RESOLVE_IN_ROOT is set. We should only return
an absolute path if we are provided one and the directory file
descriptor is AT_FDCWD
- When the directory file descriptor is AT_FDCWD, we should always
resolve symlinks against "/". Currently, if the directory file
descriptor is AT_FDCWD and CHASE_AT_RESOLVE_IN_ROOT is set, we
resolve symlinks against the current working directory which is
almost always not going to be what the caller wants.
- Currently, if we provide an absolute path with a positive directory
file descriptor without CHASE_AT_RESOLVE_IN_ROOT SET, we interpret
the path relative to "/" instead of the given directory file descriptor.
Let's make sure that when we're given a positive directory file
descriptor, we always resolve the given path relative to it.
2023-02-07 16:36:54 +01:00
drosdeck 2f2d948293 Fix Positivo-vaio VJPW12F11X key toggle touchpad 2023-02-07 16:31:50 +01:00
Zbigniew Jędrzejewski-Szmek c820bd413e Merge pull request #26338 from jamacku/fix-labeling
ci: Fix automatic removing of labels when PR is closed
2023-02-07 16:27:06 +01:00
Jan Macku de95bb2a98 ci: remove if: github.event.issue.pull_request from labeler.yml
`github.event.issue.pull_request` is an object, not a boolean.
This is the root cause of why the step that is supposed to remove labels
is always skipped. Having this condition in place is not necessary since
the workflow is run on the `pull_request_target` event.
2023-02-07 16:00:49 +01:00
Lennart Poettering 4e30b87d94 logs-show: rename "ts" paramater/variable to "display_ts"
When displaying log data we deal with two kind of timestamps: the one we
use for display (typically the source timestamp if available), and the
one we use internally (typically the reception timestamp of journald).

The user-facing output modes generally use the display timestamp, the
ones intended for further processing (i.e. json + export outputs) do
not, and directly query the timestamps of the entry, ignoring the
source. This gets a bit confusing, since it's not always clear why we
use which timestamp where. Let's address that by renaming the generic
"ts" parameter/variable to "display_ts" to emphasize that the stored
timestamp are "corrected" timestamps for display only.

No real code change, just some renaming.
2023-02-07 15:52:22 +01:00
Jan Macku d709b92ef1 ci: fix missing quotes in labeler.yml 2023-02-07 15:39:37 +01:00
Lennart Poettering 2fbfdb1edc update TODO 2023-02-07 15:12:07 +01:00
Lennart Poettering 763c46defa journal: print a useful error message if we hit the journal file open limit
See: #20921
2023-02-07 15:12:07 +01:00
Zbigniew Jędrzejewski-Szmek bbb86efa7c resolve: adjust message for NXDOMAIN lookup result
Previously, we reported:
  nx.example.org: resolve call failed: 'nx.example.org' not found
But the call did succeed, and in fact all communication with the upstream
servers was successful, and we got an authoritative negative answer.
So instead of saying that the call fail, just say that the host doesn't exist:
  nx.example.org: Name 'nx.example.org' not found

I wanted to keep the prefix of "<name>: ", to keep the output uniform. But
it'd look a bit strange to say "<name>: <name> not found", so I added "Name "
to make the output more readable. (Another option would be to not display
the error string received from resolved, but that seems risky: even if right
now resolved uses just one message format, it could start doing something else
in the future, so it's better to display the error as received.)

Fixes #26233.
2023-02-07 14:49:58 +01:00
Zbigniew Jędrzejewski-Szmek 03e80572a7 resolve: define normal macros for BUS_ERROR_DNS error codes
This result is identical after cpp is done, so we don't save anything
by not having the usual macros. And with the usual macros it's easier to
grep and code-crossreferencing works better.
2023-02-07 14:49:58 +01:00
Yu Watanabe f3f2d02e97 tree-wide: set FORK_RLIMIT_NOFILE_SAFE flag
No functional changes, just refactoring.
2023-02-07 14:39:49 +09:00
Yu Watanabe e955a7f460 udevd: configure a child process name for worker processes
This effectively reverts commit ff86c92e30,
and re-apply 49f3ee7e74.

The change was dropped due to the process name was not correctly logged,
but the issue was fixed by dd15e4cb57.
Let's set the child process name again.
2023-02-07 14:38:55 +09:00
Yu Watanabe 8586e8ab84 Merge pull request #26324 from yuwata/argv-util-update-short-name
argv-util: also update short invocation name
2023-02-07 12:08:07 +09:00
Yu Watanabe 5746c82968 Merge pull request #26322 from keszybz/log-errno-fix
Log errno fix
2023-02-07 12:07:45 +09:00
Yu Watanabe e7ced42d24 Merge pull request #26321 from keszybz/flex-arrays
Enable new compiler diagnostics for invalid array accesses
2023-02-07 12:07:21 +09:00
Yu Watanabe 14690c230d Merge pull request #26320 from keszybz/operator-whitespace
Drop whitespace after shell redirection operators
2023-02-07 12:06:49 +09:00
Topi Miettinen 8ad6e519d5 NEWS: fix typo 2023-02-07 05:39:30 +09:00
Lennart Poettering 1c904337a2 update TODO 2023-02-06 15:02:59 +01:00
Yu Watanabe dd15e4cb57 argv-util: also update program_invocation_short_name
Our logging uses program_invocation_short_name. Without this patch,
logs from forked client may become broken; spuriously truncated or
the short invocation name is not completely shown in the log.
2023-02-06 22:51:20 +09:00
Yu Watanabe 577a0fd59b test: use notice log level to make easily filter out logs from PID1 2023-02-06 22:50:03 +09:00
Zbigniew Jędrzejewski-Szmek 3156024532 meson: enable -Wzero-length-bounds
This will warn if fake flexible arrays are re-introduced. I'm not using
-Werror=… because we may still get warnings when compiling against old kernel
headers. We can crank this up to error later.
2023-02-06 12:09:55 +01:00
Zbigniew Jędrzejewski-Szmek fc5688375c meson: enable -Warray-bounds and -fstrict-flex-arrays
-fstrict-flex-arrays means that the compiler doesn't have to assume that any
trailing array is a flex array. I.e. unless the array is declared without a
specified size, only indices in the declared range are valid.

-Warray-bounds turns on the warnings about out-of-bounds array accesses.
-Warray-bounds=2 does some more warnings, with higher false positive rate. But
it doesn't seem to yield any false positives in our codebase, so enable it.

clang supports -Warray-bounds, but not -Warray-bounds=2.
gcc supports both.
gcc-13 supports -fstrict-flex-arrays.

See https://people.kernel.org/kees/bounded-flexible-arrays-in-c for a long
discussion of use in the kernel.
2023-02-06 12:09:55 +01:00
Zbigniew Jędrzejewski-Szmek f41e4b82a4 shared/json: avoid use of fake flex array 2023-02-06 12:09:55 +01:00
Zbigniew Jędrzejewski-Szmek da8587b24e sd-journal: avoid use of fake flex arrays
I tried to use DECLARE_FLEX_ARRAY like the kernel does, but it does not work
for anonymous structs (they cannot be declared inline), so an open-coded
version is used.
2023-02-06 12:04:16 +01:00
Zbigniew Jędrzejewski-Szmek 03f5e501b6 repart: silence bogus gcc warning
[2/3] Compiling C object systemd-repart.p/src_partition_repart.c.o
../src/partition/repart.c: In function ‘context_open_copy_block_paths’:
../src/partition/repart.c:5194:41: warning: ‘devno’ may be used uninitialized [-Wmaybe-uninitialized]
 5194 |                         source_fd = r = device_open_from_devnum(S_IFBLK, devno, O_RDONLY|O_CLOEXEC|O_NONBLOCK, &opened);
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/partition/repart.c:5188:31: note: ‘devno’ was declared here
 5188 |                         dev_t devno;
      |                               ^~~~~

This is with gcc-13.0.1-0.2.fc38.x86_64, -O2. I'm pretty sure the code
is correct. I also tried adding some asserts where errno is used for the return
value, but that didn't help. I think resolve_copy_blocks_auto() is just too long
for gcc to understand.
2023-02-06 10:24:57 +01:00
Zbigniew Jędrzejewski-Szmek 375ffdba43 repart: fix invalid errno in log 2023-02-06 10:24:56 +01:00
Zbigniew Jędrzejewski-Szmek c8b960af14 shared/linux: fix fake flexible array in struct autofs_dev_ioctl
The kernel still hasn't fixed this in kernel-headers-6.2.0-0.rc6.git0.1.fc38.x86_64.
2023-02-06 10:19:52 +01:00
Zbigniew Jędrzejewski-Szmek d42add3c17 sd-network: stop using fake flexible array 2023-02-06 10:19:52 +01:00
Zbigniew Jędrzejewski-Szmek 99d4dfd184 shared/linux: update kernel headers
The kernel was updated to not use fake flex arrays with zero size.
Updating should allow -fstrict-flex-arrays to be used.

Headers pulled from kernel-headers-6.2.0-0.rc6.git0.1.fc38.x86_64.

Note that this is not a straighforward copy: our files have local modifications
(listed in README) that need to be preserved.
2023-02-06 10:19:08 +01:00
Zbigniew Jędrzejewski-Szmek 1e8f5f79e1 docs/CODING_STYLE: add sentence about redirection operators 2023-02-06 09:19:04 +01:00
Zbigniew Jędrzejewski-Szmek 397c27097b tools: replace multi-line echo by <<EOF 2023-02-06 09:19:04 +01:00