| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Various fixes and improvements
|
| | |
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
st_dev is not the same as dev_t, and on O32 architectures like
mipsel it's an unsigned long, but dev_t is still unsigned long long,
so they don't match and compilation fails:
../src/journal/cat.c: In function ‘run’:
../src/basic/format-util.h:46:19: error: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘long unsigned int’ [-Werror=format=]
46 | # define DEV_FMT "%" PRIu64
| ^~~
../src/journal/cat.c:168:34: note: in expansion of macro ‘DEV_FMT’
168 | if (asprintf(&s, DEV_FMT ":" INO_FMT, st.st_dev, st.st_ino) < 0)
| ^~~~~~~
In file included from ../src/systemd/sd-journal.h:20,
from ../src/journal/cat.c:11:
/usr/include/inttypes.h:105:41: note: format string is defined here
105 | # define PRIu64 __PRI64_PREFIX "u"
|
|\
| |
| | |
test: append to corrupted journals
|
| |
| |
| |
| |
| |
| |
| | |
Introduce a manual test tool that creates a journal, corrupts it by
flipping bits at given offsets, and then attempts to write to the journal.
In ideal case we should handle this gracefully without any crash or
memory corruption.
|
|/ |
|
|
|
|
|
|
|
| |
files
This makes it a bit easier to test catalog files without installing
systemd.
|
| |
|
|
|
|
| |
As reported by Fossies.org.
|
|
|
|
|
|
|
| |
This is a rework of #24764 by Cristian Rodríguez
<crodriguez@owncloud.com>, which stalled.
Instead of assigning -1 we'll use a macro defined to INT_MAX however.
|
|
|
|
|
|
|
|
|
|
|
| |
Let's move this helper call from journald specific code to src/basic/,
so that we can use it from sd-journal.
While we are at it, slightly extend it to also cover container uids,
which are also routed to the system journal now.
This places the call in uid-alloc-range.[ch] which contains similar
functions that match UID ranges for specific purposes.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
When there is no matching entry stored in journal, then initial call of
`sd_journal_previous()` following `sd_journal_seek_tail()` returns
zero, and does not move the read pointer.
In the main loop, on every journal event, we call `sd_journal_next()`,
even though the current location is tail, and it takes no effect.
In such a case, we need to call `sd_journal_previous()` instead of
`sd_journal_next()`.
|
|
|
|
| |
Fixes #26746.
|
|
|
|
| |
No functional change, just refactoring.
|
|
|
|
| |
No functional changes, just refactoring.
|
|
|
|
| |
No functional change, just refactoring.
|
|
|
|
| |
No functional change, just refactoring.
|
|
|
|
| |
Fixes a bug introduced by 62f21ec91ad8e7e24079962f4df066b0094fe68d.
|
| |
|
|
|
|
|
| |
That's not necessary, as they are initialized with zero, but for safety
and readability.
|
|
|
|
|
|
|
|
|
| |
Previously, get_boots() used for three ways; finding boot entry by
boot ID, finding boot entry by offset, listing up all boot IDs.
Let's split it into three for each usecase.
No functional change, just refactoring.
|
| |
|
|\
| |
| | |
A couple of fixes for potential issues during OOM situations
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When closing the FILE handle attached to a memstream, it may attempt to
do a realloc() that may fail during OOM situations, in which case we are
left with the buffer pointer pointing to NULL and buffer size > 0. For
example:
```
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
void *realloc(void *ptr, size_t size) {
return NULL;
}
int main(int argc, char *argv[])
{
FILE *f;
char *buf;
size_t sz = 0;
f = open_memstream(&buf, &sz);
if (!f)
return -ENOMEM;
fputs("Hello", f);
fflush(f);
printf("buf: 0x%lx, sz: %lu, errno: %d\n",
(unsigned long) buf, sz, errno);
fclose(f);
printf("buf: 0x%lx, sz: %lu, errno: %d\n",
(unsigned long) buf, sz, errno);
return 0;
}
```
```
$ gcc -o main main.c
$ ./main
buf: 0x74d4a0, sz: 5, errno: 0
buf: 0x0, sz: 5, errno: 0
```
This might do unexpected things if the underlying code expects a valid
pointer to the memstream buffer after closing the handle.
Found by Nallocfuzz.
|
|\ \
| |/
|/| |
Use free_and_*() more
|
| | |
|
|/ |
|
|
|
|
|
|
| |
Recent gcc versions have started to trigger false positive
maybe-uninitialized warnings. Let's make sure we initialize
variables annotated with _cleanup_ to avoid these.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 1db6dbb1dcdacfd7d2b4c84562fc6e77bc8c43a5.
The original patch was reverted because of issue #25369. The issue was created
because it wrongly assumed that sd_journal_seek_tail() seeks to 'current' tail.
But in fact, only when a subsequent sd_journal_previous() is called that it's
pointing to the tail at that time. The concept of 'tail' in sd_journal_seek_tail()
only has a logical meaning, and a sd_journal_previous is needed. In fact, if we
look at the codes in journalctl, we can see sd_journal_seek_tail() is followed by
sd_journal_previous(). By contrary, a sd_journal_next() after a 'logical' tail does
not make much sense. So the original patch is correct, and projects that are
using 'sd_journal_next()' right after 'sd_journal_seek_tail()' should do fixes
as in https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2823#note_1637715.
|
|
|
|
|
|
|
|
|
| |
sd_journal_next() or friends
This illustrates bug in sd_journal_next() or friends;
calling sd_jounral_next() followed by sd_journal_seek_tail() makes the
location saved in sd-journal something corrupted, and subsequent
sd_journal_previous() or friends may fail or provides unexpected result.
|
|
|
|
|
|
|
|
| |
Set --boot with --follow only if it's not already set and if --merge is
not used, since it's not compatible with --boot.
Follow-up to 2dd9285bac.
Resolves: #24565
|
|
|
|
|
|
|
|
|
|
| |
/run/systemd/mount-rootfs/ too
Let's use the same common directory as the unit logic uses.
This means we have less to clean up, and opens the door to eventually
allow unprivileged operation of the
mount_image_privately_interactively() logic.
|
|
|
|
|
| |
Let's not only check if the file exists but also check if it contains
a valid machine ID.
|
|
|
|
| |
Follow-up for #27488.
|
|
|
|
|
| |
Especially when using in-memory logging, these are too noisy so
let's drop them back to debug level.
|
|
|
|
|
|
| |
Let's use our nice macros a bit more.
(Not comprehensive)
|
|
|
|
|
|
|
| |
On RISCV32, time_t is 64bit and size_t is 32bit, hence the timestamp
data in message header may not be aligned.
Fixes #27241.
|
|\
| |
| | |
socket-util: tighten CMSG_TYPED_DATA() alignment checks
|
| | |
|
|/
|
|
|
|
|
|
|
| |
Addresses
https://github.com/systemd/systemd/pull/25608/commits/84be0c710d9d562f6d2cf986cc2a8ff4c98a138b#r1060130312,
https://github.com/systemd/systemd/pull/25608/commits/84be0c710d9d562f6d2cf986cc2a8ff4c98a138b#r1067927293, and
https://github.com/systemd/systemd/pull/25608/commits/84be0c710d9d562f6d2cf986cc2a8ff4c98a138b#r1067926416.
Follow-up for 84be0c710d9d562f6d2cf986cc2a8ff4c98a138b.
|
|\
| |
| | |
dissect: add dissection policies
|
| | |
|
|\ \
| | |
| | | |
proc-cmdline: filter PID1 arguments on container
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Otherwise, if getopt() and friends are used before parse_argv(), then
the GNU extensions may be ignored.
This should not change any behavior at least now, as we usually use
getopt_long() only once per invocation. But in the next commit,
getopt_long() will be used for other arrays, hence this change will
become necessary.
|
|/ |
|
|
|
|
|
|
|
|
|
| |
The bit flips during journal verification cause various types of journal
corruptions, so it's useful to go through it even without a sealing key
to see how we handle corrupted stuff.
Also, provide a sealing key if running in "CI mode" (i.e. arguments),
to check the FSS-related codepaths in CIs as well.
|
|
|
|
|
|
|
|
| |
Follow-up for #25147 (db4691961ca52759fe6645d0fddb659ee4299ac2)
--follow sets arg_lines to 10, which breaks
--grep as the latter implies --reverse.
So let's not set --reverse if --follow is used.
|
|
|
|
|
|
|
|
|
| |
Chasing symlinks is a core function that's used in a lot of places
so it deservers a less verbose names so let's rename it to chase()
and chaseat().
We also slightly change the pattern used for the chaseat() helpers
so we get chase_and_openat() and similar.
|