Commit Graph

2099 Commits

Author SHA1 Message Date
Lennart Poettering e4dde4e87d
Merge pull request #17702 from rnhmjoj/master
Extend $SYSTEMD_COLORS to switch colors mode
2020-12-16 19:26:40 +01:00
Zbigniew Jędrzejewski-Szmek 199f75205b
Merge pull request #17799 from yuwata/oss-fuzz-25353
logs-show: skip non-utf8 name entries
2020-12-16 17:52:35 +01:00
Yu Watanabe 24ee0f9d16 tree-wide: fix typo 2020-12-16 17:21:48 +01:00
Lennart Poettering 94b78105c6
Merge pull request #17967 from poettering/connect-user-bus
add support for "systemctl --user --machine=foobar@.host" for connecting to user bus of user "foobar"
2020-12-15 21:14:01 +01:00
Yu Watanabe f2bd032044 journal: refuse data which contain invalid fields
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25353.
2020-12-16 04:56:35 +09:00
Yu Watanabe adce225a10 journal: move journal_field_valid() to journal_file.c 2020-12-16 04:48:44 +09:00
rnhmjoj 25e4608b8b
tree-wide: avoid direct use of color macros 2020-12-15 19:29:42 +01:00
shenyangyang4 b17f651a17 journalctl: don't skip the entries that have the same seqnum
These two judgement can't judge that two entries are repeating fully.
So i think seqnum is needed to make full judgement.
2020-12-15 18:07:11 +01:00
Lennart Poettering 52ef5dd798 hostname-util: flagsify hostname_is_valid(), drop machine_name_is_valid()
Let's clean up hostname_is_valid() a bit: let's turn the second boolean
argument into a more explanatory flags field, and add a flag that
accepts the special name ".host" as valid. This is useful for the
container logic, where the special hostname ".host" refers to the "root
container", i.e. the host system itself, and can be specified at various
places.

let's also get rid of machine_name_is_valid(). It was just an alias,
which is confusing and even more so now that we have the flags param.
2020-12-15 17:59:48 +01:00
Vito Caputo 258190a0d5 mmap-cache: drop ret_size from mmap_cache_get()
The ret_size result is a bit of an awkward optimization that in a
sense enables bypassing the mmap-cache API, while encouraging
duplication of logic it already implements.

It's only utilized in one place; journal_file_move_to_object(),
apparently to avoid the overhead of remapping the whole object
again once its header, and thus its actual size, is known.

With mmap-cache's context cache, the overhead of simply
re-getting the object with the now known size should already be
negligible.  So it's not clear what benefit this brings, unless
avoiding some function calls that do very little in the hot
context-cache hit case is of such a priority.

There's value in having all object-sized gets pass through
mmap_cache_get(), as it provides a single entrypoint for
instrumentation in profiling/statistics gathering.  When
journal_file_move_to_object() bypasses getting the full object
size, you don't capture the full picture on the mmap-cache side
in terms of object sizes explicitly loaded from a journal file.

I'd like to see additional accounting in mmap_cache_get() in a
future commit, taking advantage of this change.
2020-12-13 11:14:43 +00:00
Vito Caputo 104fc4be11 mmap-cache: bind prot(ection) to MMapFileDescriptor
There are no mmap_cache_get() users that actually deviate prot
from the JournalFile's f->prot.

So there's no point in making this a separate parameter to
mmap_cache_get(), nor is there any need to store it in
JournalFile's f->prot.

Instead just pass it to mmap_cache_add_fd() at MMapFileDescriptor
creation, storing it in there for the mmap() callers, which
already receive MMapFileDescriptor *.

For functions receiving both an MMapFileDescriptor * and prot,
the prot argument has been simply removed and call sites updated.

Formalizing this fd:prot binding at the public API also enables
discarding the prot check in window_matches(), which is a hot
function on long window lists, so a minor CPU efficiency gain
should be had there as seen with the past removal of the fd
check.  Unnoticable for uncached journals, but maybe a little
runtime improvement when cached in specific circumstances.

window_matches_fd() has also been simplified to treat the
MMapFileDescrptor * as equivalent to its fd and prot.
2020-12-10 13:03:31 +01:00
Vito Caputo 073f50a099 mmap-cache: separate context and window list cache hit accounting
Account and log these statistics separately since their overheads
are potentially quite different when the window lists are large.

There should probably be a histogram of window list traversal
counts too.
2020-12-10 10:23:01 +01:00
Vito Caputo 3a595c597a mmap-cache: replace stats accessors with log func
In preparation for logging more mmap-cache statistics get rid of this
piecemeal stats accessor api and just have a debug log output function
for producing the stats.

Updates the one call site using these accessors, moving what that site
did into the new log function.  So the output is unchanged for now,
just a trivial refactor.
2020-12-04 12:09:35 +01:00
Lennart Poettering 5517e214c8 tree-wide: make use of new DLSYM_ARG() macro everywhere 2020-12-04 10:41:59 +01:00
Yu Watanabe fed66db05d tree-wide: use return value of log_xxx_errno() 2020-11-20 02:58:27 +09:00
Jörg Thalheim d7aa78c32f meson: add option to skip installing to $sysconfdir
This is useful for development where overwriting files out side
the configured prefix will affect the host as well as stateless
systems such as NixOS that don't let packages install to /etc but handle
configuration on their own.

Alternative to https://github.com/systemd/systemd/pull/17501

tested with:

$ mkdir inst build && cd build
$ meson \
  -Dcreate-log-dirs=false \
  -Dsysvrcnd-path=$(realpath ../inst)/etc/rc.d \
  -Dsysvinit-path=$(realpath ../inst)/etc/init.d \
  -Drootprefix=$(realpath ../inst) \
  -Dinstall-sysconfdir=false \
  --prefix=$(realpath ../inst) ..
$ ninja install
2020-11-12 11:21:46 +01:00
Yu Watanabe 41d544a1c1 journal: refuse skip parameter for sd_journal_next_skip() larger than INT_MAX
Fixes #17502.
2020-11-10 13:14:42 +01:00
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Ronan Pigott ea394d48cc journalctl: show boot id in the reboot context separator 2020-11-06 12:17:03 +01:00
Zbigniew Jędrzejewski-Szmek e61f999755
Merge pull request #17472 from keszybz/spdx-license-headers
More SPDX license headers
2020-10-29 19:05:05 +01:00
Zbigniew Jędrzejewski-Szmek c062cd9dde headers: use custom LicenseRef- spdx tag for various "public domain" files
There is no spdx tag defined for those versions of "public domain", but we can
add a custom tag, see
https://spdx.github.io/spdx-spec/6-other-licensing-information-detected/.

crc32.h is updated to match crc32.c.
2020-10-29 11:41:27 +01:00
Yu Watanabe 7b6c92e6bb journalctl: drop format_journal_url() if gcrypt is not used
Follow-up for f1b823596f.
2020-10-29 00:28:28 -07:00
Zbigniew Jędrzejewski-Szmek a1989bd84b
Merge pull request #17454 from keszybz/journal-dlopen-cleanup
Journal dlopen cleanup and qrcode printing test
2020-10-28 18:20:27 +01:00
Zbigniew Jędrzejewski-Szmek f1b823596f journal,homectl: unify implementations of libqrencode loading and fss key printing
We had two of each: both homectl and journalctl had the whole dlopen()
wrapper, and journalctl had two implementations (slightly different) of the
code to print the fss:// pattern.

print_qrcode() now returns -EOPNOTSUPP when compiled with qrcode support. Both
callers ignore the return value, so this changes nothing.

No functional change.
2020-10-27 18:33:29 +01:00
Lennart Poettering 3b719003c3 journald: remove pointless conditionalization
Let's not have #ifdeffery both in the consumers and the providers of the
selinux glue code. Unless the code is particularly complex, let's do the
ifdeffery only in the provider of the selinux glue code, and let's keep
the consumers simple and just invoke it.
2020-10-27 14:12:26 +01:00
Lennart Poettering 74d6421da0 tree-wide: cast result of get_process_comm() to (void) where we ignore it 2020-10-27 14:06:49 +01:00
Frantisek Sumsal d7a0f1f4f9 tree-wide: assorted coccinelle fixes 2020-10-09 15:02:23 +02:00
Zbigniew Jędrzejewski-Szmek 98dcb8f4c7 Move {uid,gid}_is_*() from basic to shared
Those are functions that express policy, and nothing in basic/ uses
(or should use) them.
2020-09-25 17:18:56 +02:00
Zbigniew Jędrzejewski-Szmek f7bc0c324a Rename find_binary to find_executable
"executable" is more correct than "binary", since scripts are OK too.
2020-09-18 15:28:48 +02:00
Yu Watanabe adb5848706 journal: downgrade log level 2020-09-10 15:20:35 +09:00
Lennart Poettering 12ce0f4173
Merge pull request #16635 from keszybz/do-not-for-each-word
Drop FOREACH_WORD
2020-09-09 17:43:38 +02:00
Zbigniew Jędrzejewski-Szmek da277e90a4 sd-journal: use extract_first_word() 2020-09-09 09:34:54 +02:00
Zbigniew Jędrzejewski-Szmek 90e74a66e6 tree-wide: define iterator inside of the macro 2020-09-08 12:14:05 +02:00
Lennart Poettering b519529104
Merge pull request #16841 from keszybz/acl-util-bitmask
Use a bitmask in fd_add_uid_acl_permission()
2020-08-31 16:45:13 +02:00
Yu Watanabe 89d36ce8f7 journal: fix divide-by-zero warning
Fixes CID#1430209.
2020-08-27 18:20:34 +09:00
Zbigniew Jędrzejewski-Szmek 567aeb5801 shared/acl-util: convert rd,wr,ex to a bitmask
I find this version much more readable.

Add replacement defines so that when acl/libacl.h is not available, the
ACL_{READ,WRITE,EXECUTE} constants are also defined. Those constants were
declared in the kernel headers already in 1da177e4c3f41524e886b7f1b8a0c1f,
so they should be the same pretty much everywhere.
2020-08-27 10:20:12 +02:00
Zbigniew Jędrzejewski-Szmek b6abc2acb4
Merge pull request #16568 from poettering/creds-store
credentials logic to pass privileged data to services
2020-08-26 10:32:30 +02:00
Vito Caputo d4739bc4d3 sd-journal: narrow scope of boot id variable
Something trivial I noticed during some unrelated code spelunking
2020-08-25 22:41:35 +02:00
Lennart Poettering 9db59d9283 acl-util: beef up add_acls_for_user()
Let's add support for controlling r/w/x bits separetely. This is useful
for using it to control access to directories, where r + x shall be
enabled.
2020-08-25 18:39:45 +02:00
Lennart Poettering da3920c3a4 journal: move qrcode printing code to src/shared/
That way we can make use of it in homctl, too.
2020-08-25 17:58:02 +02:00
Luca Boccassi 7b3eb5c97e basic/time-util: add function to format timestamps with different styles
Instead of a multiple fixed format helper functions, add an enum and
a single helper, so that it's easier to extend in the future.
2020-08-19 15:30:13 +01:00
Lennart Poettering b0073a017b
Merge pull request #16640 from keszybz/various-patches
Improve systemd-analyze security a bit and other assorted bits
2020-08-19 10:30:45 +02:00
Zbigniew Jędrzejewski-Szmek b91ae210e6 journal: adjust line about when the journal begins and ends
This comes up occasionally with new users. The phrase "Logs begin ..." is
ambiguous because it can be taken to mean the logs being displayed or all logs
(the intended meaning). Let's rephrase this as "Journal begins ..." to make
this clearer.
2020-08-17 19:48:32 +02:00
Lennart Poettering 721bb6ed08
Merge pull request #16684 from keszybz/assorted-cleanups
Assorted cleanups
2020-08-10 19:28:05 +02:00
Lennart Poettering cc171228d4 journalctl: add --image= switch 2020-08-05 20:34:58 +02:00
Zbigniew Jędrzejewski-Szmek da012db02d journalctl: reshuffle console message about fss keys
We talked about the verification key, then about sealing keys, and then
about the verification key again. Let's shorten things a bit, and divide
the output in three paragraphs: one about the machine, one about the sealing
keys, and one about verification keys and the qr code with them.
2020-08-05 10:49:46 +02:00
Zbigniew Jędrzejewski-Szmek d06bd2e785 Merge pull request #16596 from poettering/event-time-rel
Conflict in src/libsystemd-network/test-ndisc-rs.c fixed manually.
2020-08-04 16:07:03 +02:00
Zbigniew Jędrzejewski-Szmek 1472b58835
Merge pull request #16260 from poettering/pcre2-dlopen
turn pcre2 dependency into dlopen() dependency
2020-08-04 15:37:48 +02:00
Zbigniew Jędrzejewski-Szmek 3a4378cb9e
Merge pull request #16145 from poettering/qrcode-dlopen
journalctl: make libqrencode a weak (dlopen() style) dependency
2020-08-04 15:25:50 +02:00
Lennart Poettering 39cf0351c5 tree-wide: make use of new relative time events in sd-event.h 2020-07-28 11:24:55 +02:00