1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 20:25:38 +03:00
Commit Graph

38840 Commits

Author SHA1 Message Date
Lennart Poettering
e593b6a87a sd-bus: reorder bus ref and bus message ref handling
Let's always place handling of these references together, so that all
reference counting during allocation is at a single place.
2019-03-01 15:19:45 +01:00
Lennart Poettering
143d4e045a sd-bus: make rqueue/wqueue sizes of type size_t
Let's do this like we usually do and size arrays with size_t.

We already do this for the "allocated" counter correctly, and externally
we expose the queue sizes as uint64_t anyway, hence there's really no
point in usigned "unsigned" internally.
2019-03-01 15:19:45 +01:00
Lennart Poettering
2fe9a10d76 sd-bus: initialize mutex after we allocated the wqueue
That way the mutex doesn't have to be destroyed when we exit early due
to OOM.
2019-03-01 15:19:45 +01:00
Lennart Poettering
8f37636d91 test: fix indenting off by one 2019-03-01 15:19:45 +01:00
Lennart Poettering
d25d289ae2
Merge pull request #11701 from poettering/discover-bls
sd-boot,bootctl,gpt-auto: support Extended Boot Loader Partition
2019-03-01 15:02:09 +01:00
Lennart Poettering
13070a70ef man: document new systemd.volatile=overlay kernel command line option 2019-03-01 14:57:40 +01:00
Lennart Poettering
b23f16283d man: document nspawn's new --volatile=overlay switch 2019-03-01 14:57:40 +01:00
Lennart Poettering
adc6f43b14 copy: don't synthesize a 'user.crtime_usec' xattr on copy unless explicitly requested
Previously, when we'd copy an individual file we'd synthesize a
user.crtime_usec xattr with the source's creation time if we can
determine it. As the creation/birth time was until recently not
queriable form userspace this effectively just propagated the same xattr
on the source to the same xattr on the destination. However, current
kernels now allow to query the birthtime using statx() and we do make
use of that now. Which means that suddenly we started synthesizing these
xattrs much more regularly.

Doing this actually does make sense, but only in very few cases:
not for the typical regular files we copy, but certainly when dealing
with disk images. Hence, let's keep this kind of propagation, but let's
make it a flag and default to off. Then turn it on whenever we deal with
disk images, and leave it off otherwise.

This is particularly relevant as overlayfs combining a real fs, and a
tmpfs on top will result in EOPNOTSUPP when it is attempted to open a
file with xattrs for writing, as tmpfs does not support xattrs, and
hence the copy-up cannot work. Hence, let's avoid synthesizing this
needlessly, to increase compat with overlayfs.
2019-03-01 14:11:07 +01:00
Lennart Poettering
2bef2582a1 gpt-auto-generator: use new /run/systemd/volatile-root symlink as fallback when we otherwise cannot determine root device node 2019-03-01 14:11:07 +01:00
Lennart Poettering
46c82d4956 gpt-auto-generator: rename open_parent() → open_parent_devno() so that we can include fs-util.h later
As that header also defines a function open_parent() which does
something different.
2019-03-01 14:11:07 +01:00
Lennart Poettering
d10b92cb5e volatile-root: export original root 2019-03-01 14:11:07 +01:00
Lennart Poettering
1de7f825d3 volatile-root: add overlay mode for host boots, too 2019-03-01 14:11:07 +01:00
Lennart Poettering
26945d18ac volatile-root: fail if we can't parse specified parameter 2019-03-01 14:11:07 +01:00
Lennart Poettering
85fb5bb2cb volatile-root: add missing logging to volatile-root 2019-03-01 14:11:07 +01:00
Lennart Poettering
68abaa0929 volatile-util: tweak query_volatile_mode() a bit 2019-03-01 14:11:07 +01:00
Lennart Poettering
e5a4bb0d4e nspawn: rework how arg_read_only is initialized in --volatile= mode
Previously, we'd refuse the combination, and claimed we'd imply it, but
actually didn't. Let's allow the combination and imply read-only from
--volatile=, because that's what's documented, what we claim we do, and
what makes sense.
2019-03-01 14:11:07 +01:00
Lennart Poettering
83205269c0 nspawn: refactor how we determine whether it's OK to write to /etc 2019-03-01 14:11:07 +01:00
Lennart Poettering
e50cd82f68 nspawn: no need to make top-level directory a bind mount if we just dissected an image 2019-03-01 14:11:07 +01:00
Lennart Poettering
7d0ecdd62d nspawn: slightly reorder mount logic
Let's first setup the volatile logic, and only then mount secondary
partitions of the image in.
2019-03-01 14:11:07 +01:00
Lennart Poettering
6c610acaaa nspawn: add --volatile=overlay support
Fixes: #11054 #3847
2019-03-01 14:11:06 +01:00
Lennart Poettering
c55d0ae764 nspawn: fix an error path 2019-03-01 14:11:06 +01:00
Lennart Poettering
e5b43a04b6 nspawn: add volatile mode multiplexer call setup_volatile_mode()
Just some refactoring, no change in behaviour.
2019-03-01 14:11:06 +01:00
Lennart Poettering
0646d3c3dd nspawn: explicitly refuse mounts over /
Previously this would fail later on, but let's filter this out at the
time of parsing.
2019-03-01 14:11:06 +01:00
Lennart Poettering
ccc45964a4 update TODO 2019-03-01 12:41:32 +01:00
Lennart Poettering
3da2b703d9 man: document XBOOTLDR partition logic in bootctl's man page 2019-03-01 12:41:32 +01:00
Lennart Poettering
c5fcaed881 man: document XBOOTLDR search logic for sd-boot 2019-03-01 12:41:32 +01:00
Lennart Poettering
aa4c06844d man: extend systemd-gpt-auto-generator with XBOOTLDR info 2019-03-01 12:41:32 +01:00
Lennart Poettering
82dad52818 docs: enclose all uuids in `` 2019-03-01 12:41:32 +01:00
Lennart Poettering
2cb45cdc4d meson: sort header list again 2019-03-01 12:41:32 +01:00
Lennart Poettering
1b14a4b097 mkosi: let's update the boot loader also in /efi
This is after all where we preferable mount the ESP today.
2019-03-01 12:41:32 +01:00
Lennart Poettering
8312d69409 bootspec: stat() on an autofs mount point doesn't trigger it, let's hence do it explicitly 2019-03-01 12:41:32 +01:00
Lennart Poettering
c8b32d06bd stub: don't override LoaderDevicePartUUID EFI var
We document and all our code assumes that LoaderDevicePartUUID is
initialized to the ESP's UUID. Let's hence not override the variable if
it is already set, in order to not confuse userspace if the kernel's EFI
image is run from a different partition than the ESP.

This matches behaviour for all other variables set by the EFI stub, in
particular the closely related LoaderImageIdentifier variable.
2019-03-01 12:41:32 +01:00
Lennart Poettering
8118fb3c83 stub: don't ask for variable data we actually don't care about
Let's take benefit of the fact that efivar_get_xyz() take NULL pointers
for the return data: let's shorten the code a bit.
2019-03-01 12:41:32 +01:00
Lennart Poettering
0d957ef6cf stub: fix GUID to check EFI vars in
Our own variables are in the the "loader" GUID namespace, but our code
so far checked the "global" GUID namespace (i.e. EFI's own), before
setting the variables. Correct that, so that we always check the right
namespace for existing variables before we write them.
2019-03-01 12:41:32 +01:00
Lennart Poettering
b9e452423c efi: beef up efivar_get_xyz() to accept NULL return values 2019-03-01 12:41:32 +01:00
Lennart Poettering
5d87589732 sd-boot: don't print error string where there's no error code known 2019-03-01 12:41:32 +01:00
Lennart Poettering
fa2a3bbdd8 sd-boot: also look for boot loader entries in the XBOOTLDR partition
The specification always said so, let's actually implement this.

Unfortunately UEFI's own APIs don't allow us to search for partition
type GUID, hence we have to implement a minimal GPT parser ourselves.
2019-03-01 12:41:32 +01:00
Lennart Poettering
17ad0f0f4b sd-boot: don't dereference NULL ptr if loaded_image_path is NULL
In a follow-up commit we'd like to invoke config_entry_add_from_file()
on partitions that are not the ESP, let's prepare fpr that and allow
loaded_image_path to be passed as NULL.
2019-03-01 12:41:32 +01:00
Lennart Poettering
c8ad5996b0 sd-boot: pass device handle to config_entry_add_linux()
This makes the code a bit simpler (after all the call is not interested
in the loaded image, just where it is found), and more like
config_load_entries() which takes the same arguments.

This also makes things easier for us later on, when we add support for
discovering images in $XBOOTLDR partitions.
2019-03-01 12:41:32 +01:00
Lennart Poettering
dd2bf34cd0 bootspec: only sort entries list once
Instead of re-sorting entries list each time we loaded enrties from a
specific source, let's just sort them once at the end.
2019-03-01 12:41:32 +01:00
Lennart Poettering
5e146a75b3 bootspec: also look for boot loader spec type 2 entries (i.e. unified kernel images)
sd-boot reads them, and hence we should from our userspace side too
2019-03-01 12:41:32 +01:00
Lennart Poettering
0d73a81611 bootctl: properly handle readdir() errors 2019-03-01 12:41:32 +01:00
Lennart Poettering
882b3bd6c5 bootctl: let's make sure we always add empty line after EFI binary output
Let's make sure we output another "\n", even if we fail this function,
so that the output we started is separated properly from what is
following.
2019-03-01 12:41:32 +01:00
Lennart Poettering
4a4994b68d bootspec: use verify_fsroot_dir() in verify_xbootldr() too
Let's share some code between verify_xbootldr() and verify_esp().
2019-03-01 12:41:32 +01:00
Lennart Poettering
85d021023f bootspec: also optoinally validate XBOOTLDR partition with udev insteado of blkid 2019-03-01 12:41:32 +01:00
Lennart Poettering
18ae9ef1a5 bootspec: split out code that validates whether directory is top-level dir of fs
Let's add a new function that checks whether some directory is the
top-level directory inside an fs, splitting out the code for this from
verify_esp().

While we are at it, let's slightly improve the code, so that we can
correctly work if we have no priviliges but the ESP is mounted
unaccessible: if we can't stat() the path "$ESP/.." then manually remove
the last component of $ESP and check that instead. Which is very similar
in behaviour, and hopefully good enough in the unprivileged case.
2019-03-01 12:41:32 +01:00
Lennart Poettering
cedb9eec76 bootspec: if unprivileged validate partition data with udev rather than blkid directly
udev metadata access works unprivileged, which the blkid stuff doesn't
(as that needs raw device node access). Hence let's use udev if we lack
privs, and raw device access only if root.
2019-03-01 12:41:32 +01:00
Lennart Poettering
ad95aa44d6 bootspec: also split out XBOOTLDR partition blkid code into its own function 2019-03-01 12:41:32 +01:00
Lennart Poettering
575d437032 bootspec: split out ESP blkid validation into function of its own
This makes it easier to add an alternative implementation for this that
uses sd-device instead of blkid directly.
2019-03-01 12:41:32 +01:00
Lennart Poettering
23953a3ef8 bootspec: add comment explaining verify_esp() return codes 2019-03-01 12:41:32 +01:00