Lennart Poettering [Mon, 4 Mar 2019 18:30:23 +0000 (19:30 +0100)]
Merge pull request #11841 from keszybz/dns-packet-speedup
DNS packet speedup
Lennart Poettering [Mon, 4 Mar 2019 18:04:27 +0000 (19:04 +0100)]
Merge pull request #11871 from yuwata/systemctl-show-format-unprintable
systemctl: format many entries in 'show' command
Lennart Poettering [Mon, 4 Mar 2019 18:03:46 +0000 (19:03 +0100)]
Merge pull request #11888 from keszybz/non-atomic
Drop unused atomic operations
Zbigniew Jędrzejewski-Szmek [Wed, 27 Feb 2019 12:09:37 +0000 (13:09 +0100)]
fuzz-dns-packet: add test case with lots of labels
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13422
Zbigniew Jędrzejewski-Szmek [Wed, 27 Feb 2019 09:37:40 +0000 (10:37 +0100)]
resolved: when adding RR to an answer, avoid comparing keys twice
We'd call dns_resource_record_equal(), which calls dns_resource_key_equal()
internally, and then dns_resource_key_equal() a second time. Let's be
a bit smarter, and call dns_resource_key_equal() only once.
(before)
dns_resource_key_hash_func_count=514
dns_resource_key_compare_func_count=275
dns_resource_key_equal_count=62371
4.13s user 0.01s system 99% cpu 4.153 total
(after)
dns_resource_key_hash_func_count=514
dns_resource_key_compare_func_count=276
dns_resource_key_equal_count=31337
2.13s user 0.01s system 99% cpu 2.139 total
Zbigniew Jędrzejewski-Szmek [Wed, 27 Feb 2019 09:27:35 +0000 (10:27 +0100)]
resolve: split the RR comparison function in two
No functional change.
Zbigniew Jędrzejewski-Szmek [Wed, 27 Feb 2019 06:01:50 +0000 (07:01 +0100)]
resolved: use a temporary Set to speed up dns question parsing
This doesn't necessarily make things faster, because we still spend more time
in dns_answer_add(), but it improves the compuational complexity of this part.
If we even make dns_resource_key_equal_faster, this will become worthwhile.
Yu Watanabe [Sat, 2 Mar 2019 17:48:43 +0000 (02:48 +0900)]
systemctl: format LogExtraFields= in 'show' command
Yu Watanabe [Sat, 2 Mar 2019 17:27:04 +0000 (02:27 +0900)]
systemctl: format BindPaths= or TemporaryFileSystems= in 'show' command
Yu Watanabe [Sat, 2 Mar 2019 17:06:18 +0000 (02:06 +0900)]
systemctl: print RestrictAddressFamilies= in 'show' command
Yu Watanabe [Sat, 2 Mar 2019 16:59:58 +0000 (01:59 +0900)]
systemctl: show nothing if no LoadError=
Yu Watanabe [Sat, 2 Mar 2019 16:35:18 +0000 (01:35 +0900)]
systemctl: format IPIngressBytes= or friends nicely
Yu Watanabe [Sat, 2 Mar 2019 16:27:10 +0000 (01:27 +0900)]
systemctl: show IPAddressAllow= and IPAddressDeny= in 'show' command
Yu Watanabe [Mon, 4 Mar 2019 14:07:35 +0000 (23:07 +0900)]
test: add tests for test_in_addr_prefix_to_string()
Yu Watanabe [Mon, 4 Mar 2019 13:47:10 +0000 (22:47 +0900)]
test: move tests for in_addr_prefix_from_string()
Yu Watanabe [Sat, 2 Mar 2019 16:17:32 +0000 (01:17 +0900)]
util: introduce in_addr_prefix_to_string()
Yu Watanabe [Sat, 2 Mar 2019 16:16:50 +0000 (01:16 +0900)]
util: use _cleanup_ attributes
Yu Watanabe [Sat, 2 Mar 2019 15:35:58 +0000 (00:35 +0900)]
core: fix received size of signal or status size
sd_bus_message_read_array() returns size of array in bytes, not number
of elements.
This also convert int to int32_t, as the dbus type 'i' is int32_t.
Zbigniew Jędrzejewski-Szmek [Mon, 4 Mar 2019 14:42:58 +0000 (15:42 +0100)]
sd-hwdb: fix off_t vs. size_t confusion in cast
> on 32bit, size_t is 32bit, but .st_size is off_t hence 64bit
Yu Watanabe [Sat, 2 Mar 2019 15:33:28 +0000 (00:33 +0900)]
systemctl: show SuccessExitStatus= and friends
Yu Watanabe [Sat, 2 Mar 2019 14:50:59 +0000 (23:50 +0900)]
systemctl: use streq() if arguments must be non-NULL
Yu Watanabe [Sat, 2 Mar 2019 14:36:51 +0000 (23:36 +0900)]
systemctl: do not show negative values in {Success,Failure}ActionExitStatus=
Yu Watanabe [Sat, 2 Mar 2019 14:35:26 +0000 (23:35 +0900)]
bus-util: drop unnecessary re-formatting
INSUN PYO [Thu, 17 Jan 2019 06:53:13 +0000 (15:53 +0900)]
systemctl: show SELinuxContext=, AppArmorProfile= and SmackProcessLabel=
Run: systemctl show -a dbus.service | grep -E "SELinuxContext|AppArmorProfile|SmackProcessLabel"
Before patch:
SELinuxContext=[unprintable]
AppArmorProfile=[unprintable]
SmackProcessLabel=[unprintable]
After patch:
SELinuxContext=[""|"value of context"]
AppArmorProfile=[""|"value of context"]
SmackProcessLabel=[""|"value of context"]
Martin Pitt [Sun, 3 Mar 2019 21:19:16 +0000 (22:19 +0100)]
semaphoreci: caching and more robust creation of container image
lxc-create in semaphore sometimes fails with
ERROR: Unable to fetch GPG key from keyserver
Which often happens behind proxies. As the default key server is a load
balancer, retry a few times.
Also, cache the container image between runs, and only recreate it when
it is older than a week.
Davide Cavalca [Tue, 26 Feb 2019 23:11:02 +0000 (18:11 -0500)]
test: do not assume test-chown-rec is running as root
Zbigniew Jędrzejewski-Szmek [Fri, 1 Mar 2019 11:42:31 +0000 (12:42 +0100)]
Remove now-unused refcnt.h
Zbigniew Jędrzejewski-Szmek [Fri, 1 Mar 2019 17:31:45 +0000 (18:31 +0100)]
sd-netlink: do not use atomic reference counters
Same as with the other users, any non-trivial use of the objects requires
use from a single thread only or external locking. Using atomic operations
just for reference counts is not useful.
Zbigniew Jędrzejewski-Szmek [Fri, 1 Mar 2019 17:14:32 +0000 (18:14 +0100)]
sd-hwdb: some minor logging and style updates
Zbigniew Jędrzejewski-Szmek [Fri, 1 Mar 2019 17:04:58 +0000 (18:04 +0100)]
sd-hwdb: use non-atomic reference counters
The sd-hwdb objects cannot be used concurrently from two threads in any
meaningful way, because query and iteration operations modify the object.
Thus atomic reference counts are pointless.
Zbigniew Jędrzejewski-Szmek [Fri, 1 Mar 2019 11:43:12 +0000 (12:43 +0100)]
bus: make reference counting non-atomic
We had atomic counters, but all other operations were non-serialized. This
means that concurrent access to the bus object was only safe if _all_ threads
were doing read-only access. Even sending of messages from threads would not be
possible, because after sending of the message we usually want to remove it
from the send queue in the bus object, which would race. Let's just kill this.
Zbigniew Jędrzejewski-Szmek [Sun, 20 Jan 2019 17:21:09 +0000 (18:21 +0100)]
tests: use the test helpers in more places
This is mostly cosmetic. It makes those test binaries support SYSTEMD_LOG_*
environment variables.
Lennart Poettering [Mon, 4 Mar 2019 12:04:45 +0000 (13:04 +0100)]
Merge pull request #11820 from dm0-/chase
Allow tmpfiles to create files in a root under an unprivileged directory
Lennart Poettering [Mon, 4 Mar 2019 11:11:07 +0000 (12:11 +0100)]
Merge pull request #11770 from yuwata/fix-9955
network: rework address pool
Mike Lothian [Tue, 26 Feb 2019 21:24:43 +0000 (21:24 +0000)]
login: HyperV requires master-of-seat to be set
v2: Update comment provided by Lennart
Fixes: https://github.com/systemd/systemd/issues/11299
Yu Watanabe [Sat, 2 Mar 2019 11:29:07 +0000 (20:29 +0900)]
fuzz-dhcp6-client: avoid assertion failure on samples which dont fit in pipe
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11584.
Lennart Poettering [Mon, 4 Mar 2019 10:03:36 +0000 (11:03 +0100)]
Merge pull request #11882 from yuwata/fix-log-syntax
Fix log_syntax()
Yu Watanabe [Mon, 4 Mar 2019 06:28:32 +0000 (15:28 +0900)]
test: add tests for log_syntax()
Yu Watanabe [Mon, 4 Mar 2019 06:18:06 +0000 (15:18 +0900)]
log: make log_syntax() assign correct errno and show valid error cause
Ben Iofel [Sun, 3 Mar 2019 21:51:22 +0000 (16:51 -0500)]
xbootldr: multiple spaces between keys and values (#11872)
The example below the changed line has multiple spaces between e.g. `title` and `Fedora`
Yu, Li-Yu [Sun, 3 Mar 2019 21:50:22 +0000 (05:50 +0800)]
man: flush-caches and reset-server-features are commands for resolvectl (#11877)
Zbigniew Jędrzejewski-Szmek [Fri, 1 Mar 2019 16:52:57 +0000 (17:52 +0100)]
Merge pull request #11472 from poettering/sd-bus-ref-tweak
try harder to detect when a bus and its queued messages are fully unreffed and free everything then
Zbigniew Jędrzejewski-Szmek [Fri, 1 Mar 2019 15:44:40 +0000 (16:44 +0100)]
Merge pull request #11863 from poettering/subvol-no-submount
nspawn: don't descend into subvols on --ephemeral
Lennart Poettering [Fri, 1 Mar 2019 14:14:36 +0000 (15:14 +0100)]
man: document that --ephemeral and --template= don't cover submounts
We never made this clear, let's fix that.
Lennart Poettering [Fri, 1 Mar 2019 14:13:12 +0000 (15:13 +0100)]
btrfs: when falling back to plain copy when snapshoting exclude submounts
The subvol snapshot logic doesn't cover sub-mounts either, and it really
shouldn't in the general case, hence let's simply stop at submounts in
all cases, both in the main and in the fall-back codepath.
As discussed here:
https://github.com/systemd/systemd/pull/11243#pullrequestreview-
209477230
Zbigniew Jędrzejewski-Szmek [Fri, 1 Mar 2019 15:08:55 +0000 (16:08 +0100)]
Merge pull request #11243 from poettering/nspawn-root-overlay
add systemd-nspawn --volatile=overlay support, as well as the same for host systems
Lennart Poettering [Thu, 17 Jan 2019 18:45:12 +0000 (19:45 +0100)]
test: add test for new sd-bus refcnt logic
Lennart Poettering [Thu, 17 Jan 2019 17:31:59 +0000 (18:31 +0100)]
sd-bus: use "queue" message references for managing r/w message queues in connection objects
Let's make use of the new concept the previous commit added.
See: #4846
Lennart Poettering [Thu, 17 Jan 2019 17:18:54 +0000 (18:18 +0100)]
bus-message: introduce two kinds of references to bus messages
Before this commit bus messages had a single reference count: when it
reached zero the message would be freed. This simple approach meant a
cyclic dependency was typically seen: a message that was enqueued in a
bus connection object would reference the bus connection object but also
itself be referenced by the bus connection object. So far out strategy
to avoid cases like this was: make sure to process the bus connection
regularly so that messages don#t stay queued, and at exit flush/close
the connection so that the message queued would be emptied, and thus the
cyclic dependencies resolved. Im many cases this isn't done properly
however.
With this change, let's address the issue more systematically: let's
break the reference cycle. Specifically, there are now two types of
references to a bus message:
1. A regular one, which keeps both the message and the bus object it is
associated with pinned.
2. A "queue" reference, which is weaker: it pins the message, but not
the bus object it is associated with.
The idea is then that regular user handling uses regular references, but
when a message is enqueued on its connection, then this takes a "queue"
reference instead. This then means that a queued message doesn't imply
the connection itself remains pinned, only regular references to the
connection or a message associated with it do. Thus, if we end up in the
situation where a user allocates a bus and a message and enqueues the
latter in the former and drops all refs to both, then this will detect
this case and free both.
Note that this scheme isn't perfect, it only covers references between
messages and the busses they are associated with. If OTOH a bus message
is enqueued on a different bus than it is associated with cyclic deps
cannot be recognized with this simple algorithm, and thus if you enqueue
a message associated with a bus A on a bus B, and another message
associated with bus B on a bus A, a cyclic ref will be in effect and not
be discovered. However, given that this is an exotic case (though one
that happens, consider systemd-bus-stdio-bridge), it should be OK not to
cover with this, and people have to explicit flush all queues on exit in
that case.
Note that this commit only establishes the separate reference counters
per message. A follow-up commit will start making use of this from the
bus connection object.
Lennart Poettering [Thu, 17 Jan 2019 20:07:42 +0000 (21:07 +0100)]
sd-bus: always go through sd_bus_unref() to free messages
Don't try to be smart, don't bypass the ref counting logic if there's no
real reason to.
This matters if we want to tweak the ref counting logic later.
Lennart Poettering [Thu, 17 Jan 2019 17:18:18 +0000 (18:18 +0100)]
sd-bus: drop two inappropriate empty lines
Lennart Poettering [Thu, 17 Jan 2019 17:15:37 +0000 (18:15 +0100)]
sd-bus: make sure dispatch_rqueue() initializes return parameter on all types of success
Let's make sure our own code follows coding style and initializes all
return values on all types of success (and leaves it uninitialized in
all types of failure).
Lennart Poettering [Thu, 17 Jan 2019 17:14:17 +0000 (18:14 +0100)]
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.
Lennart Poettering [Thu, 17 Jan 2019 17:13:03 +0000 (18:13 +0100)]
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.
Lennart Poettering [Thu, 17 Jan 2019 20:06:30 +0000 (21:06 +0100)]
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.
Lennart Poettering [Thu, 17 Jan 2019 18:42:59 +0000 (19:42 +0100)]
test: fix indenting off by one
Lennart Poettering [Fri, 1 Mar 2019 14:02:09 +0000 (15:02 +0100)]
Merge pull request #11701 from poettering/discover-bls
sd-boot,bootctl,gpt-auto: support Extended Boot Loader Partition
Lennart Poettering [Fri, 21 Dec 2018 23:51:13 +0000 (00:51 +0100)]
man: document new systemd.volatile=overlay kernel command line option
Lennart Poettering [Fri, 21 Dec 2018 20:45:46 +0000 (21:45 +0100)]
man: document nspawn's new --volatile=overlay switch
Lennart Poettering [Thu, 20 Dec 2018 15:01:57 +0000 (16:01 +0100)]
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.
Lennart Poettering [Thu, 20 Dec 2018 14:18:38 +0000 (15:18 +0100)]
gpt-auto-generator: use new /run/systemd/volatile-root symlink as fallback when we otherwise cannot determine root device node
Lennart Poettering [Thu, 20 Dec 2018 14:15:43 +0000 (15:15 +0100)]
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.
Lennart Poettering [Thu, 20 Dec 2018 09:13:35 +0000 (10:13 +0100)]
volatile-root: export original root
Lennart Poettering [Wed, 19 Dec 2018 16:30:13 +0000 (17:30 +0100)]
volatile-root: add overlay mode for host boots, too
Lennart Poettering [Wed, 19 Dec 2018 14:04:08 +0000 (15:04 +0100)]
volatile-root: fail if we can't parse specified parameter
Lennart Poettering [Wed, 19 Dec 2018 14:03:47 +0000 (15:03 +0100)]
volatile-root: add missing logging to volatile-root
Lennart Poettering [Wed, 19 Dec 2018 13:52:26 +0000 (14:52 +0100)]
volatile-util: tweak query_volatile_mode() a bit
Lennart Poettering [Fri, 21 Dec 2018 22:37:00 +0000 (23:37 +0100)]
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.
Lennart Poettering [Fri, 21 Dec 2018 22:33:44 +0000 (23:33 +0100)]
nspawn: refactor how we determine whether it's OK to write to /etc
Lennart Poettering [Wed, 19 Dec 2018 00:03:52 +0000 (01:03 +0100)]
nspawn: no need to make top-level directory a bind mount if we just dissected an image
Lennart Poettering [Wed, 19 Dec 2018 00:02:47 +0000 (01:02 +0100)]
nspawn: slightly reorder mount logic
Let's first setup the volatile logic, and only then mount secondary
partitions of the image in.
Lennart Poettering [Wed, 19 Dec 2018 00:02:06 +0000 (01:02 +0100)]
nspawn: add --volatile=overlay support
Fixes: #11054 #3847
Lennart Poettering [Wed, 19 Dec 2018 00:01:46 +0000 (01:01 +0100)]
nspawn: fix an error path
Lennart Poettering [Tue, 18 Dec 2018 23:09:57 +0000 (00:09 +0100)]
nspawn: add volatile mode multiplexer call setup_volatile_mode()
Just some refactoring, no change in behaviour.
Lennart Poettering [Tue, 18 Dec 2018 23:01:22 +0000 (00:01 +0100)]
nspawn: explicitly refuse mounts over /
Previously this would fail later on, but let's filter this out at the
time of parsing.
Lennart Poettering [Mon, 28 Jan 2019 18:54:09 +0000 (19:54 +0100)]
update TODO
Lennart Poettering [Tue, 12 Feb 2019 15:22:31 +0000 (16:22 +0100)]
man: document XBOOTLDR partition logic in bootctl's man page
Lennart Poettering [Tue, 12 Feb 2019 15:13:57 +0000 (16:13 +0100)]
man: document XBOOTLDR search logic for sd-boot
Lennart Poettering [Tue, 12 Feb 2019 15:06:21 +0000 (16:06 +0100)]
man: extend systemd-gpt-auto-generator with XBOOTLDR info
Lennart Poettering [Tue, 12 Feb 2019 15:05:55 +0000 (16:05 +0100)]
docs: enclose all uuids in ``
Lennart Poettering [Tue, 12 Feb 2019 13:39:34 +0000 (14:39 +0100)]
meson: sort header list again
Lennart Poettering [Fri, 8 Feb 2019 16:19:15 +0000 (17:19 +0100)]
mkosi: let's update the boot loader also in /efi
This is after all where we preferable mount the ESP today.
Lennart Poettering [Fri, 8 Feb 2019 16:18:48 +0000 (17:18 +0100)]
bootspec: stat() on an autofs mount point doesn't trigger it, let's hence do it explicitly
Lennart Poettering [Fri, 8 Feb 2019 15:51:58 +0000 (16:51 +0100)]
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.
Lennart Poettering [Fri, 8 Feb 2019 15:49:09 +0000 (16:49 +0100)]
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.
Lennart Poettering [Fri, 8 Feb 2019 15:46:51 +0000 (16:46 +0100)]
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.
Lennart Poettering [Fri, 8 Feb 2019 15:23:40 +0000 (16:23 +0100)]
efi: beef up efivar_get_xyz() to accept NULL return values
Lennart Poettering [Fri, 8 Feb 2019 12:05:55 +0000 (13:05 +0100)]
sd-boot: don't print error string where there's no error code known
Lennart Poettering [Fri, 8 Feb 2019 12:04:41 +0000 (13:04 +0100)]
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.
Lennart Poettering [Fri, 8 Feb 2019 12:03:26 +0000 (13:03 +0100)]
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.
Lennart Poettering [Wed, 6 Feb 2019 17:07:50 +0000 (18:07 +0100)]
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.
Lennart Poettering [Wed, 6 Feb 2019 16:53:43 +0000 (17:53 +0100)]
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.
Lennart Poettering [Wed, 6 Feb 2019 16:49:37 +0000 (17:49 +0100)]
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
Lennart Poettering [Wed, 6 Feb 2019 16:48:40 +0000 (17:48 +0100)]
bootctl: properly handle readdir() errors
Lennart Poettering [Tue, 5 Feb 2019 18:15:21 +0000 (19:15 +0100)]
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.
Lennart Poettering [Tue, 5 Feb 2019 18:11:31 +0000 (19:11 +0100)]
bootspec: use verify_fsroot_dir() in verify_xbootldr() too
Let's share some code between verify_xbootldr() and verify_esp().
Lennart Poettering [Tue, 5 Feb 2019 18:02:03 +0000 (19:02 +0100)]
bootspec: also optoinally validate XBOOTLDR partition with udev insteado of blkid
Lennart Poettering [Tue, 5 Feb 2019 17:52:24 +0000 (18:52 +0100)]
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.
Lennart Poettering [Tue, 5 Feb 2019 17:45:41 +0000 (18:45 +0100)]
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.
Lennart Poettering [Tue, 5 Feb 2019 17:17:01 +0000 (18:17 +0100)]
bootspec: also split out XBOOTLDR partition blkid code into its own function