Commit Graph
58588 Commits
Author SHA1 Message Date
Evgeny Vereshchagin 686a0d387d Merge pull request #23954 from yuwata/resolve-overflow
resolve: fix heap-buffer-overflow
2022-07-08 23:39:31 +03:00
Yu Watanabe 9d9fd4ad0a test: start test user session before idle action setting is changed
Otherwise, idle action may be triggered before starting the test user
session.

This also introduce create_session() and cleanup_session() helper
functions.

Fixes #23952.
2022-07-08 16:14:38 +00:00
Lennart Poettering 03bc11d1c4 mac: rework labelling code to be simpler, and less racy
This merges the various labelling calls into a single label_fix_full(),
which can operate on paths, on inode fds, and in a dirfd/fname style
(i.e. like openat()). It also systematically separates the path to look
up in the db from the path we actually use to reference the inode to
relabel.

This then ports tmpfiles over to labelling by fd. This should make the
code a bit less racy, as we'll try hard to always operate on the very
same inode, pinning it via an fd.

User-visibly the behaviour should not change.
2022-07-08 17:43:49 +02:00
Lennart Poettering 05c4affe04 tmpfiles: take error code from "errno" earlier
This uses RET_NERRNO to more quickly pull the error code we see into
"r" out of "errno".

This does not change anything really. The only reason to do this is
because it is harder to break this accidentally. The thing is that
"errno" is easily set as side-effect of arbitrary functions. Thus, if we
rely on it being set for long code paths, we need to make carefully sure
that no code in between calls any function that might corrupt it as
side-effect. As far as I can see we did get this right. Nonetheless, I
think we should just store the value in "r" instead, to make it easier
to maintain this in the long run, if more code is inserted one day, who
knows.
2022-07-08 16:11:20 +02:00
Lennart Poettering 979055ba73 Merge pull request #23946 from poettering/tmpfiles-extrat-dir-fn
tmpfiles: port from basename()/dirname() → path_extract_direcory()/path_extract_filename()
2022-07-08 16:10:42 +02:00
Lennart Poettering ebbbf44ab9 mkdir-label: don't use mkdirat_errno_wrapper() without reason
mkdirat_errno_wrapper(x,y,z) is identical to RET_NERRNO(mkdirat(x, y,
z)). Let's always use the latter when we can, because easier to read,
shorter.

The only reason to have mkdirat_errno_wrapper() at all is so that we can
pass a function pointer to it around. Otherwise, let's not use it.
2022-07-08 16:10:26 +02:00
Yu Watanabe 9102c625a6 time-util: fix buffer-over-run
Fixes #23928.
2022-07-08 16:09:46 +02:00
Lennart Poettering ef8304de53 smack: catch more types of 'not supported' errors 2022-07-08 16:09:27 +02:00
Lennart Poettering 2f3745dd26 tmpfiles: shorten code a bit 2022-07-08 16:09:06 +02:00
Yu Watanabe 370999c05b resolve: fix possible integer overflow 2022-07-08 22:13:24 +09:00
Yu Watanabe 18f2638f48 test-network: merge DHCP client tests to improve performance 2022-07-08 13:04:02 +00:00
Yu Watanabe beeab352de resolve: fix heap-buffer-overflow reported by ASAN with strict_string_checks=1
Fixes #23942.
2022-07-08 22:01:02 +09:00
Zbigniew Jędrzejewski-Szmek 4707ffa8a3 Merge pull request #23943 from poettering/tmpfiles-errno-fix
two errno variable fixes
2022-07-08 14:50:18 +02:00
Lennart Poettering 4609d3bb07 tmpfiles: port from dirname/basename to path_extract_directory/filename()
let's use our better, newer internal APIs for these purposes. This gets us
two things: safer handling when the root dir is specified, and better
handling of paths with trailing slashes, as we can refuse them whenever
a directory is not acceptable.
2022-07-08 11:35:13 +02:00
Lennart Poettering 70980a39b8 path-util: NULL strings are definitely not valid paths
Let's make this functions that check validity of paths a bit more
friendly towards one specific kind of invalid path: a NULL pointer.

This follows similar logic in path_is_valid(), path_is_normalized() and
so on.
2022-07-08 11:35:00 +02:00
Lennart Poettering b467422bd2 update TODO 2022-07-08 11:19:39 +02:00
Lennart Poettering 149e0ca6c7 tmpfiles: correct error variable to use 2022-07-08 10:41:19 +02:00
Lennart Poettering 1ce268c789 namespace: fix propagated error number 2022-07-08 10:40:40 +02:00
Frantisek Sumsal 8db5bc589a Merge pull request #23941 from yuwata/test-60-improve-performance
test: performance improvement for TEST-60
2022-07-08 07:24:52 +00:00
Yu Watanabe 74af762551 test: use timeout command to improve performance
c.f. #23723.
2022-07-08 07:02:13 +09:00
Yu Watanabe d64c7623ab test: remove /failed and /testok before running test script 2022-07-08 07:00:02 +09:00
Yu Watanabe 0d6217efc1 Merge pull request #23937 from mrc0mmand/test-tweaks
Several ASan-related test suite tweaks
2022-07-08 06:25:57 +09:00
Yu Watanabe cd34a381ba Merge pull request #23939 from mrc0mmand/TEST-70-fix-cleanup
Fix cleanup in TEST-70-TPM2
2022-07-08 05:44:12 +09:00
Frantisek Sumsal 8fec14a7d3 test: use PBKDF2 with capped iterations instead of Argon2
to reduce the amount of resources the test needs (similarly to TEST-24
where we do the same thing).
2022-07-07 20:54:41 +02:00
Frantisek Sumsal 1e42972958 test: make TEST-64 a bit more ASan friendly
Reduce the number of iterations in some of the test cases, since they
generate a huge amount of uevents and basically DoS udev (which can't
keep up while being slowed down by ASan). To avoid this, let's reduce
the number of iterations and bump the timeout when running under ASan,
since we're not interested in performance in such cases.
2022-07-07 20:54:41 +02:00
Frantisek Sumsal 0a62b8f705 test: avoid overriding an already existing EXIT handler
TEST-70 specified its own EXIT handler, which replaced the
`cleanup_loopdev` handler, so the loop device was always hanging around
once this test was run. Let's use the new `add_at_exit_handler()` stuff
to mitigate this.
2022-07-07 20:17:34 +02:00
Frantisek Sumsal b92c3df242 test: allow multiple handlers for the EXIT signal
Bash allows only one handler per signal, so let's overcome this
limitation by having one dedicated EXIT signal which runs all registered
handlers from all over the place.
2022-07-07 20:17:34 +02:00
Frantisek Sumsal 98b27937cb test: bump the data partition size if we don't strip binaries
so we can run TEST-24 under sanitizers as well.

Also, when at it, use the 'named-fields' sfdisk format to make the code
a bit more descriptive without needing a manual.
2022-07-07 19:17:05 +02:00
Frantisek Sumsal fdb70dd922 test: create an ASan wrapper for getent and su
since they "suffer" from the same issue as `login` and other binaries
that load PAM stuff
2022-07-07 19:17:05 +02:00
Frantisek Sumsal db835e5d0e Merge pull request #23931 from yuwata/systemctl-color-log
systemctl: colorize logs
2022-07-07 13:15:59 +00:00
Yu Watanabe 63663a0f0f test: several cleanups for TEST-35-LOGIN
- use test_append_files() to install additional commands
- drop use of expect
- include assert.sh and use assertions at several places
- use timeout command at several places
- always use logind-test-user
- etc
2022-07-07 13:15:00 +00:00
Frank Dana 1f7eed4c35 resolvectl man page: Word correction 2022-07-07 13:02:06 +02:00
Yu Watanabe 4d2b0c7fa5 Merge pull request #23932 from medhefgo/boot-misc
boot: Miscellaneous cleanups
2022-07-07 19:59:05 +09:00
Jan Janssen b30a43dfd7 boot: Use UEFI protocol struct names
These are somewhat pointless gnu-efi typedefs. Using the names from the
UEFI spec makes things clearer.

The one exception left is EFI_FILE as we use it a lot and
EFI_FILE_PROTOCOL is quite a handful.
2022-07-07 10:43:49 +02:00
Jan Janssen 04f316f0ee boot: Use typedef for PE structs 2022-07-07 10:16:26 +02:00
Jan Janssen 6028dd6d8e boot: Constify PE sections type 2022-07-07 10:08:51 +02:00
Jan Janssen 008f47f139 boot: Use void for base pointer 2022-07-07 10:08:18 +02:00
Jan Janssen 3ed785e591 boot: Use open_volume when creating cpio 2022-07-07 10:06:44 +02:00
Yu Watanabe 557218776e systemctl: drop color settings in log message
`log_warning()` colorize the message gracefully.
2022-07-07 16:40:06 +09:00
Yu Watanabe 158fdd5326 systemctl: enable colorized logging by default 2022-07-07 16:40:06 +09:00
Yu Watanabe b5fe371c0e Merge pull request #23569 from msekletar/pam-systemd-no-user-systemd
Don't spawn systemd --user instance for background (i.e. cron) sessions
2022-07-07 10:33:21 +09:00
Michal Sekletar 1611606fd9 NEWS: mention change in default behavior of background sessions 2022-07-07 10:11:45 +09:00
Michal Sekletar bf40417c7c tests: add test for handling of background sessions 2022-07-07 10:11:43 +09:00
Michal Sekletar e73bf3425c logind: don't start user@UID.service instance for background sessions
We have had background session class for a long time (since commit
e2acb67baa), but so far the only difference in handling of background
sessions was logging, i.e. we log some messages with LOG_DEBUG for such
sessions.

Previously there were complains [1] about excessive logging for each
time cron session is started. We used to advise user to enable lingering
for users if they want to avoid these log messages. However, on servers
with a lot of users the extra processes that result from lingering just
adds too much overhead. Hence I think that our current handling of
background sessions is not ideal and we should make better use of this
attribute.

This commit introduces a change in default behavior of logind. Logind is
now not going to start user instance of systemd when background session
is created and that should address excessive logging problem for cron
where background class is used by default. When the same user actually
logs in normally then user instance will be started as previously.

Also note that PAM_TTY variable is now always set to some value for PAM
sessions started via PAMName= option. Otherwise we would categorize such
sessions as "background" and user manager won't be started.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1825942
2022-07-07 10:10:42 +09:00
Yu Watanabe 948fce5118 test: fix typo 2022-07-07 09:33:11 +09:00
Yu Watanabe 47b86590af TODO: fix typo 2022-07-07 09:31:43 +09:00
Yu Watanabe 99080ed3f0 Merge pull request #23396 from msekletar/fix-idle-action-lock
logind: remember our idle state and use it to detect idle level transitions
2022-07-07 07:42:51 +09:00
Zbigniew Jędrzejewski-Szmek 2615c1f17a os-release: define SUPPORT_END=
Fixes #21764.

I think is very simple, but flexible. The date may be set early, for distros
that have a fixed schedule, but it doesn't have to. So for example Debian could
push out an update that sets a few months before the release goes EOL. And
various tools, in particular graphical desktops, can start nagging people to
upgrade a few weeks before the date.

As discussed in the bug, we don't need granularity higher than a day. And this
means that we can use a simple human- and machine-readable format.
I was considering other names, e.g. something with "EOL", but I think that
"SUPPORT_END" is better because it doesn't imply that the machine will somehow
stop working. This is supposed to be an advisory, nothing more.
2022-07-07 07:35:17 +09:00
Luca Boccassi c235945bd5 Merge pull request #23918 from yuwata/dissect
Revert "dissect: ID from os-release should be non-empty, not just non-NULL"
2022-07-06 21:31:04 +01:00
Thomas Haller da519f8c81 fundamental: adjust #if conditional for _fallthrough_ for clang
NetworkManager takes systemd sources. It gets compiler warnings
related to _fallthrough_. They probably can also affect systemd
itself.

A) on RHEL-7, gcc 4.8.5-44.el7 we get:

    ../src/libnm-systemd-shared/src/fundamental/macro-fundamental.h:45:22: error: "__clang__" is not defined [-Werror=undef]
     #if __GNUC__ >= 7 || __clang__
                          ^

   Presumably gcc older than 7 is supported, so fix this.

B) on Ubuntu 18.04, clang 1:6.0-41~exp5~ubuntu1 we get:

    ../src/libnm-systemd-core/src/libsystemd-network/sd-dhcp6-client.c:746:17: error: declaration does not declare anything [-Werror,-Wmissing-declarations]
                    _fallthrough_;
                    ^
    ../src/libnm-systemd-shared/src/fundamental/macro-fundamental.h:46:25: note: expanded from macro '_fallthrough_'
    #  define _fallthrough_ __attribute__((__fallthrough__))
                            ^

   Granted, README comments that clang >= 10 is required. However,
   parts of systemd build just fine with older clang. It seems unnecessary
   to break this and the fix helps NetworkManager.

Fixes: c0f5d58c9a ('meson: Document why -Wimplicit-fallthrough is not used with clang')
2022-07-06 22:10:23 +02:00