Commit Graph
91582 Commits
Author SHA1 Message Date
Lennart Poettering 92c9f787a7 NEWS: various updates 2026-09-03 17:45:02 +02:00
Luca Boccassi 8cceaab8f5 ukify: generate initrd policy digests for offline signing
When --sign-initrd-pcrs is used with --policy-digest, generate the
extra enter-initrd policy with the "initrd" policy reference. This
matches the policy produced when ukify signs with a private key.

Fixes building UKIs with offline signing (e.g.: on OBS) and using
NVPCRs.

Follow-up for f0f3687700
2026-09-03 12:55:15 +02:00
nl6720 786fcb493f networkd: allow systemd-network user to control ModemManager
systemd-networkd needs authorization for
`org.freedesktop.ModemManager1.Device.Control` to allow establishing a
connection:

    systemd-networkd[1457]: ModemManager: starting simple connect on huawei E3276 interface wwp106s0u4i2
    systemd-networkd[1457]: Could not connect modem huawei E3276: Unauthorized: PolicyKit authorization failed: not authorized for 'org.freedesktop.ModemManager1.Device.Control'
2026-09-03 18:05:17 +09:00
Daan De Meyer 73aa9523d6 Ensure contributors engage with their AI written code
Let's add a canary so that we can distinguish AI written
code that was not looked at in any way or form by its author
easily in pull requests.
2026-09-03 09:37:52 +02:00
Armaan Sandhu 2451b1a9c4 resolve: fix use-after-free of the service browser in mDNS maintenance
mdns_maintenance_query_complete() takes a reference on
query->dnsservice_request and never drops it, so every successful mDNS
maintenance query leaks one reference to the discovered service.

The leak alone would be benign, but the service owns the one-shot event
source that drives its maintenance schedule, and it only borrows a plain
pointer to its service browser. Once the extra reference is outstanding,
dns_service_browser_free() -> dns_remove_service() only drops the list's
reference, so dns_service_free() never runs, the maintenance timer is
never disabled, and the service outlives the browser it points at. The
next time the timer fires, mdns_maintenance_query() dereferences the
freed DnsServiceBrowser to reach the manager's event loop and to issue
the query.

Reaching it only takes a browse subscription whose record lives long
enough for one maintenance query to be answered, followed by the
subscription going away.

Make the reference a _cleanup_ one, the way the sibling
mdns_browse_service_query_complete() below already handles the reference
it takes on the service browser.
2026-09-03 06:37:53 +09:00
Luca Boccassi a019396d2c tools: fix building manpages with lxml 6.1.3
manpages build fails on Arch with new lxml:

Traceback (most recent call last):
  File "/work/src/tools/make-directive-index.py", line 169, in make_page
    _extract_directives(directive_groups, formatting, page)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/src/tools/make-directive-index.py", line 18, in _extract_directives
    t = xml_parse(page)
  File "/work/src/tools/xml_helper.py", line 25, in xml_parse
    doc = tree.parse(page, _parser)
  File "src/lxml/etree.pyx", line 3717, in lxml.etree.parse
  File "src/lxml/parser.pxi", line 2045, in lxml.etree._parseDocument
  File "src/lxml/parser.pxi", line 2071, in lxml.etree._parseDocumentFromURL
  File "src/lxml/parser.pxi", line 1962, in lxml.etree._parseDocFromFile
  File "src/lxml/parser.pxi", line 1231, in lxml.etree._BaseParser._parseDocFromFile
  File "src/lxml/parser.pxi", line 647, in lxml.etree._ParserContext._handleParseResultDoc
  File "src/lxml/parser.pxi", line 765, in lxml.etree._handleParseResult
  File "src/lxml/parser.pxi", line 689, in lxml.etree._raiseParseError
  File "../src/man/hostname.xml", line 5
lxml.etree.XMLSyntaxError: Entity 'entities' not defined, line 5, column 11

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/work/src/tools/make-directive-index.py", line 180, in <module>
    _xml = make_page(_template_path, _xml_files)
  File "/work/src/tools/make-directive-index.py", line 171, in make_page
    raise ValueError('failed to process ' + page) from e
ValueError: failed to process ../src/man/hostname.xml

Relying on XMLParser() defaults leaves the external parameter entity
used to load custom-entities.ent unresolved. Request entity resolution explicitly.

Follow-up for 1a13e31d27
2026-09-03 06:34:04 +09:00
Yu Watanabe 15f7905335 Tweak the hostname-worldlist code (#43599) 2026-09-03 06:29:25 +09:00
Yu Watanabe f559927982 test: fix ConditionCPUFeature= tests with architecture prefix
CPU architecture is determined by uname(), rather than the compile time
macros like __i386__, __x86_64__, __aarch64__.

Let's conditionalize with uname_architecture().

Follow-up for d518675741.
2026-09-03 06:16:05 +09:00
Yu Watanabe 736cb91535 resolved: actually unregister DNS-SD services when the D-Bus client vanishes (#43578)
Since the D-Bus DNS-SD API was introduced in c3036641f0ed (v236),
`RegisterService()` has created an `sd_bus_track` object to destroy the
registered service when the registering client disconnects from the bus.
However, the track object is a `_cleanup_(sd_bus_track_unrefp)` local in
`bus_method_register_service()` that is never stored anywhere, so it is
destroyed again as soon as the method handler returns. The vanish
handler (`dnssd_registered_service_on_bus_track()`) has thus been dead
code for the past ~8 years.

The observable effect: services registered via D-Bus silently persist
after the client disconnects — unowned, advertised until resolved exits,
and impossible to re-register since the identifier stays taken
(`DNSSD_SERVICE_EXISTS`). At the same time, the registration doesn't
survive a resolved restart, so the current behavior is neither reliably
ephemeral nor reliably persistent. Noticed while reviewing a project
that (unknowingly relying on this bug) registers a service with a
one-shot `gdbus call` and expects it to persist.

This PR:
1. splits the goodbye/zone-removal logic out of
`bus_dnssd_method_unregister()` into a helper — the vanish path needs
the full teardown, not just `dnssd_registered_service_free()`, which
would leave the service's RRs published in the per-link mDNS zones;
2. stores the track object in `DnssdRegisteredService`, making client
tracking work as originally intended;
3. documents the lifetime semantics in `org.freedesktop.resolve1(5)`
(matching the equivalent Avahi D-Bus API, whose entry groups are
likewise bound to the client connection) and points to `*.dnssd` files
for registrations independent of a client's lifetime;
4. adds a TEST-75 case covering the connection-bound lifetime.

Note this is a behavioral change for fire-and-forget clients (one-shot
`busctl`/`gdbus` invocations). Arguably those were never working
reliably (registrations silently vanished on any resolved restart, and
stale entries blocked re-registration), but if this is deemed too risky,
the alternative would be to drop the dead tracking code and codify the
persist-until-exit behavior instead — I'd argue tracking as originally
intended is the better contract.

Verification: code compiles; the new integration test is included.
2026-09-03 06:14:31 +09:00
Siteshwar Vashisht 00ca860b2c ndisc: fix an out of memory condition
... and skip the loop when building NDisc option fails.
2026-09-03 05:53:35 +09:00
Luca Boccassi a7ee2a5ea4 mkosi: update opensuse commit reference to 60fbc2d95581a933f9dcdfdb8d7e27d2a7d13e35
* 60fbc2d955 Update systemd to version 261.2 / rev 473 via SR 1368021
* c32d9727e6 Update systemd to version 261.1 / rev 472 via SR 1365923
* 74fd672013 Update systemd to version 260.3 / rev 471 via SR 1362701
* 769e1c4254 Update systemd to version 260.2 / rev 470 via SR 1361320
2026-09-03 05:48:24 +09:00
Franck Bui b5d3e4fa8c test-os-util: test os_release_support_ended() with a date > 2038
SUSE regularly builds packages into the future to track issues like the the
ones that might happen in 2038:
https://www.reddit.com/r/linux/comments/xjtf3q/in_the_year_2038/

Make sure that os_release_support_ended() doesn't fail in this case.

PS: on 32-bit systems time_t cannot represent dates past 2038, so use a safe
date there instead.
2026-09-02 16:52:28 +01:00
Yu Watanabe 26f4d56015 compress: fix unbounded buffer growth on truncated streams, and fuzz the decompressors (#43589) 2026-09-02 19:59:51 +09:00
Stefan Agner 6decadbebf test: silence SC2329 for indirectly invoked cleanup() functions
shellcheck 0.10+ reports SC2329 ("This function is never invoked") for
the per-testcase cleanup() functions in TEST-75-RESOLVED.sh, which are
only invoked indirectly via trap. The existing SC2317 markers don't
cover it, and inserting a new testcase shuffles which definitions the
heuristic fires on, making pre-existing findings show up as new in
differential CI runs. Extend the markers to SC2317,SC2329, matching
what testcase_dot_strict_per_link_verify() in this file and other test
units already do.
2026-09-02 10:41:54 +02:00
Stefan Agner 908c38f300 test: add test for DNS-SD D-Bus registration lifetime
Verify that a DNS-SD service registered via the D-Bus RegisterService()
call is bound to the lifetime of the client's bus connection: since
busctl disconnects right after the call returns, the service must be
unregistered again shortly after. Wait for resolved's vanish handler
log message as proof that the client tracking triggered the
unregistration, check that a subsequent UnregisterService() fails
specifically because the service is not known anymore, and verify that
the identifier can be registered again — previously it stayed taken by
the vanished client's service forever, failing with
DNSSD_SERVICE_EXISTS.

A dummy link with mDNS enabled makes sure the per-scope goodbye/zone
teardown path actually runs, and since resolved would be restarted
automatically if it crashed in it, letting the D-Bus level checks pass
vacuously, verify the InvocationID stayed the same throughout.
2026-09-02 10:41:54 +02:00
Stefan Agner 11e4e35f4c resolved: actually unregister DNS-SD services when the bus client vanishes
Since the D-Bus DNS-SD API was introduced in c3036641f0 ("resolved:
implement D-Bus API for DNS-SD", v236), RegisterService() has set up an
sd_bus_track object so that a registered service is destroyed when the
client that registered it disconnects from the bus — there's even a
handler logging "Client of active request vanished, destroying DNS-SD
service."

However, the track object was never stored anywhere: it is declared as
a _cleanup_(sd_bus_track_unrefp) local in bus_method_register_service()
and hence destroyed again when the method handler returns, taking the
tracking down with it. The vanish handler was thus dead code, and
services registered via D-Bus silently persisted after their client
disconnected — unowned, impossible to re-register (the identifier
stays taken, failing with DNSSD_SERVICE_EXISTS), and advertised until
systemd-resolved itself exited.

Store the track object in DnssdRegisteredService, pinning it for the
lifetime of the service, so that client tracking works as originally
intended. Route the vanish path through the full unregistration logic
(goodbye packets + removal from the per-link mDNS zones), since freeing
the service alone would leave its RRs published in the zones.

Note for fire-and-forget clients (e.g. one-shot busctl/gdbus calls):
these were never reliable — the registration silently vanished on any
resolved restart — and now behave as documented for the corresponding
Avahi API as well: the bus connection must be kept open for as long as
the service is to remain registered. Document that in the man page and
NEWS, and point to *.dnssd files for registrations independent of a
client's lifetime.
2026-09-02 10:40:34 +02:00
Stefan Agner a3a8e82f25 resolved: only send goodbye for the RRs of the service being unregistered
dns_scope_announce(scope, /* goodbye= */ true) is not scoped to a
specific service: it walks the whole per-link mDNS zone and flags every
established RR as goodbye (TTL 0). Unregistering a single DNS-SD
service via the UnregisterService() D-Bus call hence withdrew the
host's own A/AAAA records and every other published service on the
link from remote caches, with nothing re-announcing them afterwards.

Introduce dns_scope_send_goodbye(), which sends an unsolicited response
for a caller-provided RR set, and let the DNS-SD unregistration path
send goodbye only for the RRs of the service actually being removed,
mirroring the flag logic of dns_scope_announce().

The goodbye answer is built per scope, and only includes records
actually established in the respective zone (or under re-verification,
in which case they are still served from it): a per-service goodbye
must take care not to withdraw records that are still being probed for
uniqueness, were withdrawn again after a conflict (in which case the
name belongs to the neighbor), or were never published in the scope in
the first place (e.g. on MulticastDNS=resolve links, which have an mDNS
scope but do not publish DNS-SD services).

This becomes more important with the next commit, which promotes
unregistration from an explicit method call to an automatic consequence
of the registering client disconnecting from the bus.
2026-09-02 10:40:34 +02:00
Luca Boccassi 25c0b10671 mkosi: update debian commit reference to 70dd6c36578ecaa214992f54701eeedaa3b57aed
* 70dd6c3657 Update changelog for 262~rc1-2 release
* 84ccf4ddbf Install 60-tpm2-id.rules on all architectures
* 20cd9d23cf Update changelog for 262~rc1-1 release
* e479c1d28e Update d/copyright
* fac1cd6d40 Update Lintian overrides for new units
* 448fa0e577 Update symbols file for upstream release
* dd467c4e44 Install new files for upstream build
* cbcc96360e d/systemd.links: stop creating cryptdisks{,-early}.service masks (LP: #2153836)
2026-09-02 12:13:42 +09:00
Tobias Heider d2a5296298 boot: Update aa64 hwids
Sync the latest hwid database from Ubuntu stubble

Signed-off-by: Tobias Heider <tobias.heider@canonical.com>
2026-09-01 18:13:50 +01:00
Armaan Sandhu 65c112007a fuzz: add a fuzzer for the qcow2 converter
systemd-importd runs qcow2_detect()/qcow2_convert() over images it has just
downloaded (see pull-raw.c), so the header, the L1/L2 tables and every offset
and cluster descriptor in them are attacker controlled. There is a manual test
for the happy path, but nothing that feeds it a malformed image.

The corpus is two images, a plain data cluster and a zlib-compressed one (i.e.
decompress_zlib_raw()), at the 512 byte minimum cluster size and trimmed to the
last byte the converter reads, so 2K each. A zero cluster and a QCOW3 header are
a flipped descriptor bit and a bumped version field away from these, so they are
left to the fuzzer rather than carried in the tree.
2026-09-01 11:41:19 -04:00
Armaan Sandhu 43cd946f98 fuzz: add a fuzzer for the decompression entrypoints
fuzz-compress only ever feeds the decompressors their own output: it compresses
the fuzzer input and then decompresses the result, so the stream the decoders
see is well formed by construction. The blobs they get in reality come out of
journal files, systemd-journal-remote streams, coredumps and downloaded images,
i.e. from wherever the data was written, which is not necessarily somewhere we
trust.

So hand them the fuzzer input directly instead, across all four entrypoints:
decompress_blob(), decompress_startswith(), decompress_stream(), and the
decompressor_detect()/decompressor_push() pair that systemd-importd feeds from
the network. The latter is pushed in chunks, so that the decoders see the same
fragmentation a real download produces. The decompressed size is capped, as an
unbounded decode of a hostile blob measures the allocator rather than the
decoder.

The corpus carries the two truncated stream headers that used to send
decompress_startswith() allocating until OOM, fixed in the previous commit.
2026-09-01 11:41:19 -04:00
Yu Watanabe 636bd5a0e6 Revert "build(deps): bump meson from 1.11.2 to 1.12.0 in /.github/workflows"
This reverts commit a8ade912ce.
2026-09-02 00:09:25 +09:00
Lucas Adriano Salles 41d4263f50 hwdb: fix Positivo N15WPE-S and N15RPE-S key toggle touchpad and search key (#43602)
Fixes #43601
2026-09-02 00:07:34 +09:00
Armaan Sandhu 87d3c04672 compress: don't grow the output buffer forever on a truncated stream
decompress_startswith() decodes just enough of a blob to compare its leading
bytes against a prefix, and grows the output buffer whenever a round of
decoding came back with less than prefix_len + 1 bytes decoded. That growth is
only the right answer while the decoder actually wants more output room. If it
instead ran out of input, i.e. the stream is truncated, then no amount of extra
room will help, and the gzip and bzip2 paths double their allocation on every
iteration until the process is out of memory.

Neither decoder lets us tell the two cases apart by return code alone:
inflate() reports the stalled stream as Z_BUF_ERROR, which we cannot simply
refuse since that is also how it asks for a bigger output buffer, and
BZ2_bzDecompress() does not distinguish them at all, it just keeps saying
BZ_OK. The output space left over does tell us, though: a decoder that stopped
without filling the buffer we gave it is waiting for input that is not coming,
so report the stream as corrupt instead of growing.

A 10 byte gzip header, or a 4 byte bzip2 header, with nothing behind it was
enough to reach a single 4 GiB allocation this way. The xz and zstd paths
already terminate, the former because liblzma turns a stalled stream into
LZMA_BUF_ERROR.

Note that no caller can reach this today: the only non-test caller is
decompress_startswith_journal(), and compression_supported_journal() admits
only NONE/XZ/LZ4/ZSTD. It is a trap for whoever wires up the other two, so
let's close it now.
2026-09-01 10:02:52 -04:00
Zbigniew Jędrzejewski-Szmek c47a5fa25b hostname-wordlist: fix comment and downgrade warning
The comment was wrong. The average word is about 6 characters, so in
64 iterations, the probability of never landing on a word boundary is
~(1 - 1/7)**64, about 0.01%.
2026-09-01 15:57:58 +02:00
Zbigniew Jędrzejewski-Szmek c737b297a3 hostname-setup: read the whole wordlist into memory when picking words
hostname_pick_word() used to seek around in the wordlist file and read
individual lines with read_line()/read_stripped_line(). Instead, slurp the
whole file into memory use offset arithmetic. The wordlists are small, so
reading them entirely is faster and there is really no reason to do the
complicated thing. The new code is 15% faster (the slow parts are the
hashing and chaseat, they actually dominate over the reading of the data).
The "raced with truncation" case is gone, since the buffer is a consistent
snapshot of the file.

The random offsets derived from the machine ID are unchanged, so the
picked words stay the same.
2026-09-01 15:57:58 +02:00
Zbigniew Jędrzejewski-Szmek 00d512bdce basic/fileio: wrap long comments 2026-09-01 15:57:58 +02:00
Zbigniew Jędrzejewski-Szmek 96de029ad7 basic/path-util: stop ignoring non-absolute paths
112cfb1814 tried to improve handling of
paths when root is specified. It said:
> To avoid answering what a relative path means when called with a root
> prefix path_strv_canonicalize is now path_strv_canonicalize_absolute
> and only considers absolute paths. Fortunately all users of already call
> path_strv_canonicalize with a list of absolute paths.

Of course, other users were added later and for example now
SYSTEMD_HOSTNAME_WORDLIST_PATH=build/hostname-wordlist/ ... doesn't
work as expected. If root is not specified, there is really no reason
to ignore relative paths. They work relative to CWD per the usual convention.
It's up to the user to not use relative paths in a context where they
should not be used. When root is specified, continue to ignore the relative
paths, since there is no clear interpreation what they mean, but emit
a debug message.
2026-09-01 15:57:58 +02:00
Zbigniew Jędrzejewski-Szmek 6ec548c336 shared/fileio: avoid copying strv twice
search_and_fopen called search_and_fopen_internal which made a copy
of the search strv and then called search_and_open which made a copy
too.
2026-09-01 15:57:58 +02:00
Zbigniew Jędrzejewski-Szmek 98dbda7a2c test-hostname-pick-word: add a simple test to check word selection
This is useful to check if how fast the code is (painfully slow) and whether
worlds indeed are selected with a flat distribution probability (they are).

The code is slow because the hashing and because chaseat is exteremely
inefficient :(
2026-09-01 15:55:45 +02:00
dependabot[bot] 050378bb9a build(deps): bump the actions group with 2 updates
Bumps the actions group with 2 updates: [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) and [coverallsapp/github-action](https://github.com/coverallsapp/github-action).


Updates `github/codeql-action/upload-sarif` from 4.37.3 to 4.37.8
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81...db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28)

Updates `coverallsapp/github-action` from 2.3.6 to 2.3.8
- [Release notes](https://github.com/coverallsapp/github-action/releases)
- [Commits](https://github.com/coverallsapp/github-action/compare/648a8eb78e6d50909eff900e4ec85cab4524a45b...8d6379e14d29928660c4ba802d8e85393440b329)

---
updated-dependencies:
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 4.37.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: coverallsapp/github-action
  dependency-version: 2.3.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-09-01 22:35:40 +09:00
dependabot[bot] a8ade912ce build(deps): bump meson from 1.11.2 to 1.12.0 in /.github/workflows
Bumps [meson](https://github.com/mesonbuild/meson) from 1.11.2 to 1.12.0.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/1.11.2...1.12.0)

---
updated-dependencies:
- dependency-name: meson
  dependency-version: 1.12.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-09-01 21:32:17 +09:00
Stefan Agner 27ea9761ac resolved: split out dnssd_registered_service_unregister() helper
Move the logic that sends goodbye messages, removes a registered DNS-SD
service's RRs from all mDNS zones and frees the service out of
bus_dnssd_method_unregister() into a new helper. While at it, add the
nowadays customary parameter comments and ", ignoring" log message
suffix to the moved code. No functional change.

This is preparation for unregistering services when the D-Bus client
that registered them disconnects: that path needs the full teardown as
well, not just dnssd_registered_service_free(), which would leave the
service's RRs published in the per-link mDNS zones.
2026-09-01 14:29:04 +02:00
Luca Boccassi 0896c97321 meson: bump version to v262~rc1 2026-09-01 11:42:23 +02:00
Luca Boccassi fdc59b371c meson: bump library sonames for v262~rc1 2026-09-01 11:42:23 +02:00
Luca Boccassi 9be66f9759 NEWS: finalize time and place 2026-09-01 11:42:23 +02:00
Luca Boccassi a25729eeda NEWS: list contributors 2026-09-01 11:42:23 +02:00
Luca Boccassi 72f3a4a73c NEWS: update up to 9064524e44 2026-09-01 11:42:23 +02:00
Luca Boccassi 7021a61392 hwdb: update autosuspend rules 2026-09-01 11:42:23 +02:00
Luca Boccassi 862b093df2 hwdb: update rules 2026-09-01 11:42:23 +02:00
RamsesandYu Watanabe 3da5c65d87 network: register already enslaved interfaces when their master appears (#43557)
When networkd starts or restarts, links are enumerated in ifindex
order. A slave enumerated before its master cannot register itself in
link_append_to_master(), as the master Link object does not exist yet.
The master then wrongly believes it has no slaves until the next
RTM_NEWLINK message for the slave arrives.

The stale slaves set affects operational state propagation
(degraded-carrier detection) and any code that inspects the slaves of
a master.
For instance, on restart, when networkd thinks that the master has no
slaves yet, we try to set the bond fail-over policy, which the kernel
then refuses because in reality the bond does have slaves.

To fix the issue, this updates the list of slaves after enumeration.

Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
2026-09-01 18:28:43 +09:00
Andres Diaz f396adf4e9 hwdb: do not tag the G502 X Lightspeed macro interface as a keyboard
Its full keyboard descriptor gets it ID_INPUT_KEYBOARD, which makes
UPower show the mouse battery as a keyboard.
2026-09-01 10:02:33 +01:00
Christian Brauner 9b62fd169e Extend W^X memory protection mechanism for RestrictFileSystemAccess (#43511)
Currently `RestrictFileSystemAccess` isn't trying hard enough to enforce
W^X and thus there are still places where an executable and writable
mapping can be created:

* `/proc/<pid>/mem` `FOLL_FORCE` writes
* `PTRACE_POKE{TEXT,DATA}` `FOLL_FORCE` writes
* `MAP_PRIVATE | MAP_EXECUTABLE` memory mappings

Let's block all of these mechanisms. Do note that
`RestrictFileSystemAccess` is still in very active development and also
cannot meaningfully be used on general purpose distros and systems.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-09-01 07:12:13 +02:00
Yu Watanabe d0fcc5a9ec core: Don't racily stop Type=dbus services when the bus broker restarts (#42455) 2026-09-01 09:24:48 +09:00
Christian Brauner 3674263071 test-bpf-restrict-fsaccess: add W^X and ptrace protection tests
Add tests for all new W^X protection mechanisms.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-08-31 23:33:40 +02:00
Christian Brauner e0be975735 man: document RestrictFileSystemAccess= W^X hardening
Describe the system-wide W^X rule and the new proc_mem.force_override=never
and seccomp prerequisites, and drop the advice to block writable and
executable mappings by other means, which the policy now does itself.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-08-31 23:33:40 +02:00
Christian Brauner 62e665cacc core: check that proc_mem.force_override=never is active
The kernel silently ignores command line options it doesn't know. So a
kernel without CONFIG_PROC_MEM_* would pass the command line check while
still allowing FOLL_FORCE memory overwrites. Write one byte through
/proc/self/mem into a private read-only anonymous page. That can only
succeed with FOLL_FORCE writes supported.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-08-31 23:33:40 +02:00
Christian Brauner 0016132c3c core: block /proc/pid/mem FOLL_FORCE writes when RestrictFileSystemAccess= is enabled
In addition to PTRACE_POKE{TEXT,DATA} /proc/<pid>/mem can also be used
to FOLL_FORCE write into a trusted process's executable pages. Require
proc_mem.force_override=never.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-08-31 23:33:40 +02:00
Christian Brauner 4f4502ed23 core: block PTRACE_POKE{TEXT,DATA} when RestrictFileSystemAccess= is enabled
PTRACE_POKETEXT and PTRACE_POKEDATA use FOLL_FORCE to forcibly write
into a tracee's memory. That includes executable read-only pages. If we
restrict execution to trusted binaries PID 1 must enforce that it's
impossible to abuse this to get untrusted code execution. Note, that
usermodehelpers are not subject to PID 1's seccomp filters.

Install a ptrace seccomp filter from PID 1 if RestrictFileSystemAccess=
is requested. Every process it spawns will inherit it.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-08-31 23:33:40 +02:00
Christian Brauner 179781353a test-seccomp: seccomp_restrict_ptrace()
Test seccomp_restrict_ptrace().

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-08-31 23:33:40 +02:00