Yu Watanabe
bdb577f545
tree-wide: drop unnecessary inclusion of version.h
2023-07-30 04:56:38 +09:00
Lennart Poettering
f70c90f5ca
analyze: add new "pcrs" verb
...
It shows the PCRs we know about along with their name strings and
current values.
2023-06-28 16:50:50 +02:00
Lennart Poettering
a4b3e94236
dissect-image: port mount_image_privately_interactively() to use /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.
2023-05-16 09:26:17 +02:00
Yu Watanabe
06e78680e3
image-policy: introduce parse_image_policy_argument() helper
...
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 84be0c710d .
2023-04-13 11:17:28 +02:00
Lennart Poettering
a62e12dad1
analyze: add 'image-policy' tool for analyzing image dissection policies
2023-04-05 20:51:31 +02:00
Lennart Poettering
84be0c710d
tree-wide: hook up image dissection policy logic everywhere
2023-04-05 20:45:30 +02:00
Lennart Poettering
5f43c97cd2
analyze: add new fdstore verb
2023-03-29 19:09:10 +02:00
Lennart Poettering
4870133bfa
basic: add RuntimeScope enum
...
In various tools and services we have a per-system and per-user concept.
So far we sometimes used a boolean indicating whether we are in system
mode, or a reversed boolean indicating whether we are in user mode, or
the LookupScope enum used by the lookup path logic.
Let's address that, in introduce a common enum for this, we can use all
across the board.
This is mostly just search/replace, no actual code changes.
2023-03-10 09:47:39 +01:00
Luca Boccassi
f50535afad
analyze: add 'malloc' verb to dump malloc_info()
...
Gets the memory state of the manager:
root@image:~# systemd-analyze malloc
<malloc version=1>
<heap nr=0>
<sizes>
<size from=33 to=33 total=396 count=12/>
<unsorted from=20385 to=20385 total=20385 count=1/>
</sizes>
<total type=fast count=0 size=0/>
<total type=rest count=14 size=36589/>
<system type=current size=1691648/>
<system type=max size=1839104/>
<aspace type=total size=1691648/>
<aspace type=mprotect size=1691648/>
</heap>
<total type=fast count=0 size=0/>
<total type=rest count=14 size=36589/>
<total type=mmap count=0 size=0/>
<system type=current size=1691648/>
<system type=max size=1839104/>
<aspace type=total size=1691648/>
<aspace type=mprotect size=1691648/>
</malloc>
2023-02-23 18:59:06 +00:00
Daan De Meyer
a133d2c366
dissect-image: Return mount point fd if requested
2023-02-17 14:58:55 +01:00
Joshua Zivkovic
ff46b2f97c
systemd-analyze: Add table and JSON output implementation to plot
2023-01-18 14:33:08 +00:00
Zbigniew Jędrzejewski-Szmek
28db6fbff1
Rename def.h to constants.h
...
The name "def.h" originates from before the rule of "no needless abbreviations"
was established. Let's rename the file to clarify that it contains a collection
of various semi-related constants.
2022-11-08 18:21:10 +01:00
Zbigniew Jędrzejewski-Szmek
d6b4d1c7c4
basic: move version() to build.h+c
2022-11-08 13:41:14 +01:00
Lennart Poettering
9f5b68d6b7
analyze: add --image= + --root= to --help text
2022-10-25 17:47:52 +02:00
Franck Bui
d1d8786c5b
analyze: extend the dump command to accept patterns
...
The new function DumpPatterns() can be used to limit (drastically) the size of
the data returned by PID1. Hence the optimization of serializing data into a
file descriptor should be less relevant than having the possibility to limit
the data when communicating with the service manager remotely.
NB: when passing patterns, the dump command omits the version of the manager as
well as the features and the timestamps.
2022-10-13 07:47:42 +09:00
Yu Watanabe
e330f97a89
tree-wide: drop unused reference to DecryptedImage
2022-09-18 23:47:20 +09:00
Zbigniew Jędrzejewski-Szmek
bc012a3e91
analyze: add compare-versions
...
The interface, output, and exit status convention are all taken directly from
rpmdev-vercmp and dpkg --compare-versions. The implementation is different
though. See test-string-util for a list of known cases where we compare
strings incompatibly.
The idea is that this string comparison function will be declared as "the"
method to use for boot entry ordering in the specification and similar
uses. Thus it's nice to allow users to compare strings.
2022-05-19 09:07:34 +02:00
Zbigniew Jędrzejewski-Szmek
fddad5f4a6
analyze: allow verbs to return positive failure
...
No functional change is intended. The verbs where it wasn't immediately
clear if the success exit status is 0 or >= 0 are changed to explicitly
return 0. (I think it's better to be explicit than to rely on some call
stack always returning 0 on success.)
Some other functions are cleaned up to be more idiomatic.
2022-05-19 08:02:29 +02:00
Daan De Meyer
cae7c28272
analyze: Fix verify exit status regression
...
Previously, systemd-analyze verify would return 0 even if warnings
were raised during analysis of the specified units or their
dependencies. With 3cc3dc7 , verify was changed to return 1 when
warnings were raised.
This commit changes the default mode to _RECURSIVE_ERRORS_INVALID
so that verify returns zero again by default when warnings are
raised.
2022-04-06 23:16:02 +09:00
Zbigniew Jędrzejewski-Szmek
b380b64383
Rename UnitFileScope to LookupScope
...
As suggested in
https://github.com/systemd/systemd/pull/22649/commits/8b3ad3983f5440eef812b34e5ed862ca59fdf7f7#r837345892
The define is generalized and moved to path-lookup.h, where it seems to fit
better. This allows a recursive include to be removed and in general makes
things simpler.
2022-03-29 16:17:57 +02:00
Lennart Poettering
ef38bedbf9
analyze: systematically name verb entry point functions verb_xyz()
...
Some of the functions so far were named do_xyz(), others dump_xyz() and
even others test_xyz(). let's instead name them exactly like the verb
exposed in the command line, just prefixed with verb_
2022-02-21 17:22:23 +01:00
Lennart Poettering
e82116e56b
analyze: move "condition" verb into analyze-condition.[ch]
2022-02-21 17:22:23 +01:00
Lennart Poettering
f2562398ea
analyze: split out "verify" verb into own .c/.h file
...
This renames the old analyze-verify.[ch] pair →
analyze-verify-util.[ch], because it's used by the test logic as well,
and by keeping it separate from the verify verb logic we don't have to
import the arg_xyz variables.
2022-02-21 17:22:23 +01:00
Lennart Poettering
2acfc25225
analyze: move inspect-elf verb entrypoint into analyze-elf.[ch], too
...
like for the other verbs, let's move the whole entry point for the verb,
too.
2022-02-21 17:22:23 +01:00
Lennart Poettering
57a22a3f97
analyze: fully move "security" verb to analyze-security.[ch]
...
let's move the verb entropy point too, like for the other verbs now.
2022-02-21 17:22:23 +01:00
Lennart Poettering
f24f8e3789
analyze: split out "time" verb
2022-02-21 17:22:23 +01:00
Lennart Poettering
ef215fa752
analyze: split out critical chain
2022-02-21 17:22:23 +01:00
Lennart Poettering
0c2d69df7f
analyze: split out "unit-files" verb
2022-02-21 17:22:23 +01:00
Lennart Poettering
36258fbe74
analyze: split out "unit-paths" verb
2022-02-21 17:22:23 +01:00
Lennart Poettering
faaa6ea076
analyze: split out log control verb
2022-02-21 17:22:23 +01:00
Lennart Poettering
c649b343b4
analyze: split out cat-config verb
2022-02-21 17:22:23 +01:00
Lennart Poettering
ba474dada8
analyze: split out "plot" verb
2022-02-21 17:22:23 +01:00
Lennart Poettering
113dd9cbc4
analyze: split out "blame" verb + time helpers
2022-02-21 17:22:23 +01:00
Lennart Poettering
6488e8443b
analyze: split out "capability" verb
2022-02-21 17:22:23 +01:00
Lennart Poettering
73cb64c44d
analyze: split out "exit-status" verb
2022-02-21 17:22:23 +01:00
Lennart Poettering
ab86ccbab0
analyze: highlight the range of deprecated verbs in comments a bit better
2022-02-21 17:22:23 +01:00
Lennart Poettering
2b04e72cd1
analyze: split out "service-watchdogs" verb
2022-02-21 17:22:23 +01:00
Lennart Poettering
cccd2af6f5
analyze: split out "dot" verb
2022-02-21 17:22:23 +01:00
Lennart Poettering
25eb70af8b
analyze: split out "dump" verb
2022-02-21 17:22:23 +01:00
Lennart Poettering
389638d395
analyze: split out "syscall-filter" verb
2022-02-21 17:22:23 +01:00
Lennart Poettering
08e36480d4
analyze: split out "filesystems" verb into its own .c/.h file pair
2022-02-21 17:22:23 +01:00
Lennart Poettering
5229b03c10
analyze: split out calendar verb into own .c/.h file
2022-02-21 17:22:23 +01:00
Lennart Poettering
503ccaaa5b
analyze: split out "timestamp" verb into its own .c/.h files
2022-02-21 17:22:23 +01:00
Lennart Poettering
30bddc066a
analyze: split out "timespan" verb into its own .c/.h file
2022-02-21 17:22:23 +01:00
Lennart Poettering
c0f65909cb
analyze: correctly mention that --json= is also understood by inspect-elf
2022-02-02 03:55:51 +09:00
Luca Boccassi and Lucas Werkmeister
741c4c8da9
analyze: do not connect to DBUS with --offline
...
Co-authored-by: Lucas Werkmeister <mail@lucaswerkmeister.de >
2021-12-23 09:44:42 +09:00
Frantisek Sumsal
33b7988d2e
analyze,resolve: suppress a couple of false-positive alerts
2021-12-06 17:45:37 +01:00
Zbigniew Jędrzejewski-Szmek
ec1574cd8e
Merge pull request #21454 from bluca/inspect_elf
...
analyze: add inspect-elf verb to parse package metadata
2021-12-06 12:45:25 +01:00
Frantisek Sumsal
466e63a453
analyze: fix build with -Db_ndebug=true
2021-12-03 16:22:52 +01:00
Luca Boccassi
917e655457
analyze: add inspect-elf verb to parse package metadata
...
Parses and prints package metadata from executables, libraries and core files
$ systemd-analyze inspect-elf /tmp/core ../fsverity-utils/fsverityb /bin/bash --json=off --no-pager
__________________________
path: /tmp/core
elfType: coredump
elfArchitecture: AMD x86-64
module name: /tmp/crash
type: deb
name: hello
version: 1.0
architecture: amd64
os: debian
osVersion: 11
buildId: b33541096a09c29a0ba4ec5c69364a2711b7c269
module name: /usr/lib/x86_64-linux-gnu/libc-2.31.so
type: deb
name: hello
version: 1.0
architecture: amd64
os: debian
osVersion: 11
buildId: 54eef5ce96cf37cb175b0d93186836ca1caf470c
module name: /usr/lib/x86_64-linux-gnu/ld-2.31.so
type: deb
name: hello
version: 1.0
architecture: amd64
os: debian
osVersion: 11
buildId: 32438eb3b034da54caf58c7a65446639f7cfe274
__________________________________________________________________
path: /home/luca/git/systemd/../fsverity-utils/fsverity
elfType: executable
elfArchitecture: AMD x86-64
type: deb
name: fsverity-utils
version: 1.3-1
architecture: amd64
os: debian
debugInfoUrl: https://debuginfod.debian.net
buildId: 05b899e6ee0d3653e20458719b202ed3ca8d566f
_________________________
path: /bin/bash
elfType: executable
elfArchitecture: AMD x86-64
buildId: 4fef260f60e257d2dbd4126bf8add83837aea190
$
$ systemd-analyze inspect-elf /tmp/core ../fsverity-utils/fsverity /bin/bash /tmp/core.test-condition.1000.f9b9a84a9fd1482c9702d6afa6f6934b.37640.1637083078000000 --json=pretty --no-pager
{
"elfType" : "coredump",
"elfArchitecture" : "AMD x86-64",
"/home/bluca/git/fsverity-utils/fsverity" : {
"type" : "deb",
"name" : "fsverity-utils",
"version" : "1.3-1",
"buildId" : "7c895ecd2a271f93e96268f479fdc3c64a2ec4ee"
},
"/home/bluca/git/fsverity-utils/libfsverity.so.0" : {
"type" : "deb",
"name" : "fsverity-utils",
"version" : "1.3-1",
"buildId" : "b5e428254abf14237b0ae70ed85fffbb98a78f88"
}
}
{
"elfType" : "executable",
"elfArchitecture" : "AMD x86-64",
"/home/bluca/git/systemd/../fsverity-utils/fsverity" : {
"type" : "deb",
"name" : "fsverity-utils",
"version" : "1.3-1",
"buildId" : "7c895ecd2a271f93e96268f479fdc3c64a2ec4ee"
}
}
{
"elfType" : "executable",
"elfArchitecture" : "AMD x86-64",
"/bin/bash" : {
"buildId" : "3313b4cb119dcce16927a9b6cc61dcd97dfc4d59"
}
}
{
"elfType" : "coredump",
"elfArchitecture" : "AMD x86-64"
}
2021-11-30 23:14:07 +00:00