| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Fixes: #23783
|
|
|
|
| |
This fixes #20820
|
|\
| |
| | |
Suppress fuzzer timeouts and errors
|
| |
| |
| |
| |
| |
| |
| | |
When the the iterator variable is declared automatically, it "inherits" the
const/non-const status from the argument. We don't need to cast a const
table to non-const. If we had a programming error and tried to modify the
string, the compiler could now catch this.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| | |
The reallocation of memory and counter incrementation is moved from
the only caller to the function. This way the callers can remain oblivious
of the BootConfig internals.
|
| | |
|
|/
|
|
|
| |
I want to use this for fuzzing, but also later to return jsonified
list of entries from logind.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
No actual code changes, just splitting out of some dev_t handling
related calls from stat-util.[ch], they are quite a number already, and
deserve their own module now I think.
Also, try to settle on the name "devnum" as the name for the concept,
instead of "devno" or "dev" or "devid". "devnum" is the name exported in
udev APIs, hence probably best to stick to that. (this just renames a
few symbols to "devum", local variables are left untouched, to make the
patch not too invasive)
No actual code changes.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This normalizes naming of functions operating on BootConfig objects.
Let's always call them boot_config_xyz(), like our usual way to name
stuff.
moreover, move the BootConfig parameter to the beginning, as it's not a
return value (which we typically move to the end of the parameter list),
but simply an object, that even happens to be initialized already.
With these changes the functions are more like our usual way to call
things, and less surprises are good.
|
|
|
|
|
|
| |
the function contains a loop and if expressions and whatnot. Let's
define it as regular function, to make the header easier to read and let
the compiler more freedom on whether to inline this or not.
|
|
|
|
|
|
| |
with entries from loader
Fixes: #22580
|
|
|
|
| |
OOM should usually be fatal, hence make it so here, too.
|
|
|
|
|
|
|
|
| |
This just got too confusing for me. With this change we'll now have
_unified as common suffix for stuff loading unified kernels (i.e. type
1), and _type1 as common suffix for type1 entries.
Just some renaming.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For testing purposes I run one of my system symlinking /boot/loader/ to
/efi/loader/. This triggers annoying behaviour in boot entry
enumeration: the code ends up iterating through the 'entries' subdir of
both, thinking one was actually in the ESP and the other in XBOOTLDR,
and thus distinct. This would result in duplicate entries.
Let's address that, and filter out duplicates via their inode numbers:
never process the same inode twice. This should protect us from any
confusion effectively, regardless which inodes are symlinked (or even
bind mounted).
|
|
|
|
|
| |
This simplifies the parameter lists quite a bit, at zero change in
behaviour.
|
|
|
|
|
|
|
|
|
|
|
|
| |
We can't really use conf_files_list() for finding type #1 entries, since
it is case-sensitive, but type #1 entries are typically placed on VFAT,
i.e. are case-insensitive.
hence, use readdir_all() instead, which is quite similar, but gives us
all files, and allows us to do a case-insensitive check.
While we are at it, use openat() on the open dir to open the file, and
pass that around, to make things a tiny bit more race-free.
|
|\
| |
| | |
Invert order of entries w/o sort-key in sd-boot menu
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
With the changes in 20ec8f534f90c94669ac8f9a50869f22f94fd4c8, we would sort
entries with sort-key as expected (higher versions earlier, i.e. at the top of
the menu), but entries without the sort-key as before, with higher versions
later.
When we have a bunch of boot entries grouped by machine-id (or even in the
typical case of all boot entries having the same machine id), sorting by id
should generally give good results. Entries will be grouped by installation,
and then newer entries should generally be at the top of the menu.
|
| | |
|
| |
| |
| |
| | |
This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
|
|\|
| |
| | |
sd-boot: rework boot entry sorting
|
| | |
|
|/
|
|
|
|
|
|
| |
The code is quite different from the rest of bootspec.c, with different
deps and stuff. There's even a /***/ line to separate the two parts.
Given how large the file already is, let#s just split it into two.
No code changes, just some splitting out.
|
|\
| |
| | |
bootctl: show all discovered entries, but show state + type in details
|
| |
| |
| |
| |
| |
| | |
apparently some checkers don't like that. Let's be entirely safe here,
and use malloc() based allocation, given that the entries are user
controlled.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
On my local system I linked up the ESP and XBOOTLDR partitions, and
ended up with duplicate entries being listed. Try hard to detect that
and only enumerate entries in the ESP if it turns out that both dirs
have the same dev_t.
This should detect both bind mounted and symlinked cases and should make
our list output less confusing.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
find_esp_and_warn()
THis makes sure that find_esp_and_warn() + find_xbootldr_and_warn()
follow our usual coding style that on success all return values are
initialized. We got that right in most successful codepaths out of these
functions, but missed the one where the paths are manually overwritten
via env vars.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Let's improve display of boot entries and show what type they have (i.e.
boot loader spec type 1, or type 2, or auto-discovered or reported by
boot loader), and in particular mark entries the boot loader discovered
but we can't find (i.e. that likely vanished, or possibly couldn't be
found due to a misconfiguration) and that the boot loader didn't find
but we see (which are new, or possibly also the result of
misconfiguraiton).
This is supposed to be a replacement for #22161, but instead of hiding
vanished entries, highlights them, which I think is more appropriate for
a low-level tool such bootctl.
Replaces: #22161 #22398
|
| |
| |
| |
| |
| |
| | |
currently booted)
it's helpful and easy, so let's do it
|
| | |
|
| |
| |
| |
| |
| | |
It has been defined in the boot loader spec, and is the only field we
currently don't parse, hence fix that.
|
| | |
|
| | |
|
|/ |
|
|
|
|
|
|
|
|
| |
Remove the parameter 'only_auto' from the function
boot_entries_augment_from_loader() because each caller set it always to
true.
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
|
|
|
|
| |
As in the previous commit, 'de' is used as the iterator variable name.
|
| |
|
|
|
|
|
|
| |
Let's parse the same fields and use them the same way as in sd-boot.
Fixes: #20093
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Creating those string dynamically at runtime is slow and unnecessary.
Let's use static strings with a bit of macro magic and the let the compiler
coalesce as much as possible.
$ size build/src/shared/libsystemd-shared-248.so{.old,}
text data bss dec hex filename
2813453 94572 4584 2912609 2c7161 build/src/shared/libsystemd-shared-248.so.old
2812309 94564 4584 2911457 2c6ce1 build/src/shared/libsystemd-shared-248.so
A nice side-effect is that the same form is used everywhere, so it's easier to
figure out all variables that are used, and where each specific variable is
used.
C.f. 2b0445262ad9be2a9bf49956ab8e886ea2e48a0a.
Note: 'const char *foo = alloca(…);' seems OK. Our coding style document and
alloca(3) only warn against using alloca() in function invocations. Declaring
both stack variable and alloca at the same time should be fine: no matter in
which order they happen, i.e. if the pointer variable is above the contents,
or the contents are above the pointer, or even if the pointer is elided by the
compiler, everything should be fine.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We recently started making more use of malloc_usable_size() and rely on
it (see the string_erase() story). Given that we don't really support
sytems where malloc_usable_size() cannot be trusted beyond statistics
anyway, let's go fully in and rework GREEDY_REALLOC() on top of it:
instead of passing around and maintaining the currenly allocated size
everywhere, let's just derive it automatically from
malloc_usable_size().
I am mostly after this for the simplicity this brings. It also brings
minor efficiency improvements I guess, but things become so much nicer
to look at if we can avoid these allocation size variables everywhere.
Note that the malloc_usable_size() man page says relying on it wasn't
"good programming practice", but I think it does this for reasons that
don't apply here: the greedy realloc logic specifically doesn't rely on
the returned extra size, beyond the fact that it is equal or larger than
what was requested.
(This commit was supposed to be a quick patch btw, but apparently we use
the greedy realloc stuff quite a bit across the codebase, so this ends
up touching *a*lot* of code.)
|
|
|
|
| |
Fixes: #17746
|
| |
|
| |
|
|
|
|
|
| |
Clarify that the name of the entry failed validation, not the entry
itself.
|
|
|
|
|
|
|
|
| |
an enveloping partition table
If this happens this should just mean: we couldn't find the ESP.
Fixes: #17122
|
|
|
|
|
|
| |
Based-on:
https://github.com/systemd/systemd/issues/14828#issuecomment-634202054
|
|
|
|
| |
Fixes #14657.
|